From sabre at nondot.org Mon Oct 27 01:05:26 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Oct 2008 06:05:26 -0000 Subject: [llvm-commits] [llvm] r58227 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Message-ID: <200810270605.m9R65QD2022212@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 27 01:05:26 2008 New Revision: 58227 URL: http://llvm.org/viewvc/llvm-project?rev=58227&view=rev Log: Add a new LargeBlockInfo helper, which is just a wrapper around a trivial dense map. Use this in RewriteSingleStoreAlloca to avoid aggressively rescanning blocks over and over again. This fixes PR2925, speeding up mem2reg on the testcase in that bug from 4.56s to 0.02s in a debug build on my machine. Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=58227&r1=58226&r2=58227&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Oct 27 01:05:26 2008 @@ -106,6 +106,58 @@ Values.swap(RHS.Values); } }; + + /// LargeBlockInfo - This assigns and keeps a per-bb relative ordering of + /// load/store instructions in the block that directly load or store an alloca. + /// + /// This functionality is important because it avoids scanning large basic + /// blocks multiple times when promoting many allocas in the same block. + class VISIBILITY_HIDDEN LargeBlockInfo { + /// InstNumbers - For each instruction that we track, keep the index of the + /// instruction. The index starts out as the number of the instruction from + /// the start of the block. + DenseMap InstNumbers; + public: + + /// isInterestingInstruction - This code only looks at accesses to allocas. + static bool isInterestingInstruction(const Instruction *I) { + return (isa(I) && isa(I->getOperand(0))) || + (isa(I) && isa(I->getOperand(1))); + } + + /// getInstructionIndex - Get or calculate the index of the specified + /// instruction. + unsigned getInstructionIndex(const Instruction *I) { + assert(isInterestingInstruction(I) && + "Not a load/store to/from an alloca?"); + + // If we already have this instruction number, return it. + DenseMap::iterator It = InstNumbers.find(I); + if (It != InstNumbers.end()) return It->second; + + // Scan the whole block to get the instruction. This accumulates + // information for every interesting instruction in the block, in order to + // avoid gratuitus rescans. + const BasicBlock *BB = I->getParent(); + unsigned InstNo = 0; + for (BasicBlock::const_iterator BBI = BB->begin(), E = BB->end(); + BBI != E; ++BBI) + if (isInterestingInstruction(BBI)) + InstNumbers[BBI] = InstNo++; + It = InstNumbers.find(I); + + assert(It != InstNumbers.end() && "Didn't insert instruction?"); + return It->second; + } + + void deleteValue(const Instruction *I) { + InstNumbers.erase(I); + } + + void clear() { + InstNumbers.clear(); + } + }; struct VISIBILITY_HIDDEN PromoteMem2Reg { /// Allocas - The alloca instructions being promoted. @@ -189,11 +241,14 @@ const SmallPtrSet &DefBlocks, SmallPtrSet &LiveInBlocks); - void RewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info); + void RewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, + LargeBlockInfo &LBI); - bool PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI); + bool PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI, + LargeBlockInfo &LBI); void PromoteLocallyUsedAllocas(BasicBlock *BB, - const std::vector &AIs); + const std::vector &AIs, + LargeBlockInfo &LBI); void RenamePass(BasicBlock *BB, BasicBlock *Pred, RenamePassData::ValVector &IncVals, @@ -254,7 +309,6 @@ } } }; - } // end of anonymous namespace @@ -271,6 +325,7 @@ if (AST) PointerAllocaValues.resize(Allocas.size()); AllocaInfo Info; + LargeBlockInfo LBI; for (unsigned AllocaNum = 0; AllocaNum != Allocas.size(); ++AllocaNum) { AllocaInst *AI = Allocas[AllocaNum]; @@ -298,14 +353,17 @@ // If there is only a single store to this value, replace any loads of // it that are directly dominated by the definition with the value stored. if (Info.DefiningBlocks.size() == 1) { - RewriteSingleStoreAlloca(AI, Info); + RewriteSingleStoreAlloca(AI, Info, LBI); // Finally, after the scan, check to see if the store is all that is left. if (Info.UsingBlocks.empty()) { // Remove the (now dead) store and alloca. Info.OnlyStore->eraseFromParent(); + LBI.deleteValue(Info.OnlyStore); + if (AST) AST->deleteValue(AI); AI->eraseFromParent(); + LBI.deleteValue(AI); // The alloca has been processed, move on. RemoveFromAllocasList(AllocaNum); @@ -342,7 +400,7 @@ AllocaLookup[Allocas[AllocaNum]] = AllocaNum; // At this point, we're committed to promoting the alloca using IDF's, and - // the standard SSA construction algorithm. Determine which blocks need phi + // the standard SSA construction algorithm. Determine which blocks need PHI // nodes and see if we can optimize out some work by avoiding insertion of // dead phi nodes. DetermineInsertionPoint(AI, AllocaNum, Info); @@ -358,19 +416,22 @@ // efficiently. if (LocAllocas.size() == 1) { // If we can do the quick promotion pass, do so now. - if (PromoteLocallyUsedAlloca(I->first, LocAllocas[0])) + if (PromoteLocallyUsedAlloca(I->first, LocAllocas[0], LBI)) RetryList.push_back(LocAllocas[0]); // Failed, retry later. } else { // Locally promote anything possible. Note that if this is unable to // promote a particular alloca, it puts the alloca onto the Allocas vector // for global processing. - PromoteLocallyUsedAllocas(I->first, LocAllocas); + PromoteLocallyUsedAllocas(I->first, LocAllocas, LBI); } } if (Allocas.empty()) return; // All of the allocas must have been trivial! + LBI.clear(); + + // Set the incoming values for the basic block to be null values for all of // the alloca's. We do this in case there is a load of a value that has not // been stored yet. In this case, it will get this null value. @@ -630,67 +691,63 @@ DFBlocks.clear(); } } - /// RewriteSingleStoreAlloca - If there is only a single store to this value, /// replace any loads of it that are directly dominated by the definition with /// the value stored. void PromoteMem2Reg::RewriteSingleStoreAlloca(AllocaInst *AI, - AllocaInfo &Info) { + AllocaInfo &Info, + LargeBlockInfo &LBI) { StoreInst *OnlyStore = Info.OnlyStore; bool StoringGlobalVal = !isa(OnlyStore->getOperand(0)); + BasicBlock *StoreBB = OnlyStore->getParent(); + int StoreIndex = -1; + + // Clear out UsingBlocks. We will reconstruct it here if needed. + Info.UsingBlocks.clear(); - // Be aware of loads before the store. - SmallPtrSet ProcessedBlocks; - for (unsigned i = 0, e = Info.UsingBlocks.size(); i != e; ++i) { - BasicBlock *UseBlock = Info.UsingBlocks[i]; - - // If we already processed this block, don't reprocess it. - if (!ProcessedBlocks.insert(UseBlock)) { - Info.UsingBlocks[i] = Info.UsingBlocks.back(); - Info.UsingBlocks.pop_back(); - --i; --e; + for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); UI != E; ) { + Instruction *UserInst = cast(*UI++); + if (!isa(UserInst)) { + assert(UserInst == OnlyStore && "Should only have load/stores"); continue; } + LoadInst *LI = cast(UserInst); - // If the store dominates the block and if we haven't processed it yet, - // do so now. We can't handle the case where the store doesn't dominate a - // block because there may be a path between the store and the use, but we - // may need to insert phi nodes to handle dominance properly. - if (!StoringGlobalVal && !dominates(OnlyStore->getParent(), UseBlock)) - continue; - - // If the use and store are in the same block, do a quick scan to - // verify that there are no uses before the store. - if (UseBlock == OnlyStore->getParent()) { - BasicBlock::iterator I = UseBlock->begin(); - for (; &*I != OnlyStore; ++I) { // scan block for store. - if (isa(I) && I->getOperand(0) == AI) - break; - } - if (&*I != OnlyStore) - continue; // Do not promote the uses of this in this block. - } - - // Otherwise, if this is a different block or if all uses happen - // after the store, do a simple linear scan to replace loads with - // the stored value. - for (BasicBlock::iterator I = UseBlock->begin(), E = UseBlock->end(); - I != E; ) { - if (LoadInst *LI = dyn_cast(I++)) { - if (LI->getOperand(0) == AI) { - LI->replaceAllUsesWith(OnlyStore->getOperand(0)); - if (AST && isa(LI->getType())) - AST->deleteValue(LI); - LI->eraseFromParent(); + // Okay, if we have a load from the alloca, we want to replace it with the + // only value stored to the alloca. We can do this if the value is + // dominated by the store. If not, we use the rest of the mem2reg machinery + // to insert the phi nodes as needed. + if (!StoringGlobalVal) { // Non-instructions are always dominated. + if (LI->getParent() == StoreBB) { + // If we have a use that is in the same block as the store, compare the + // indices of the two instructions to see which one came first. If the + // load came before the store, we can't handle it. + if (StoreIndex == -1) + StoreIndex = LBI.getInstructionIndex(OnlyStore); + + if (unsigned(StoreIndex) > LBI.getInstructionIndex(LI)) { + // Can't handle this load, bail out. + Info.UsingBlocks.push_back(StoreBB); + continue; } + + } else if (LI->getParent() != StoreBB && + !dominates(StoreBB, LI->getParent())) { + // If the load and store are in different blocks, use BB dominance to + // check their relationships. If the store doesn't dom the use, bail + // out. + Info.UsingBlocks.push_back(LI->getParent()); + continue; } } - // Finally, remove this block from the UsingBlock set. - Info.UsingBlocks[i] = Info.UsingBlocks.back(); - Info.UsingBlocks.pop_back(); - --i; --e; + // Otherwise, we *can* safely rewrite this load. + LI->replaceAllUsesWith(OnlyStore->getOperand(0)); + if (AST && isa(LI->getType())) + AST->deleteValue(LI); + LI->eraseFromParent(); + LBI.deleteValue(LI); } } @@ -709,7 +766,8 @@ /// /// ... so long as A is not used before undef is set. /// -bool PromoteMem2Reg::PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI) { +bool PromoteMem2Reg::PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI, + LargeBlockInfo &LBI) { assert(!AI->use_empty() && "There are no uses of the alloca!"); // Handle degenerate cases quickly. @@ -724,6 +782,7 @@ // Otherwise it must be a store which is never read. assert(isa(U)); } + LBI.deleteValue(U); BB->getInstList().erase(U); } else { // Uses of the uninitialized memory location shall get undef. @@ -740,12 +799,14 @@ if (AST && isa(LI->getType())) AST->deleteValue(LI); BB->getInstList().erase(LI); + LBI.deleteValue(LI); } } else if (StoreInst *SI = dyn_cast(Inst)) { if (SI->getOperand(1) == AI) { // Store updates the "current value"... CurVal = SI->getOperand(0); BB->getInstList().erase(SI); + LBI.deleteValue(SI); } } } @@ -756,7 +817,8 @@ assert(AI->use_empty() && "Uses of alloca from more than one BB??"); if (AST) AST->deleteValue(AI); AI->eraseFromParent(); - + LBI.deleteValue(AI); + ++NumLocalPromoted; return false; } @@ -767,7 +829,8 @@ /// basic blocks, as we don't want to rescan the entire basic block for each /// alloca which is locally used in it (which might be a lot). void PromoteMem2Reg:: -PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector &AIs) { +PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector &AIs, + LargeBlockInfo &LBI) { DenseMap CurValues; for (unsigned i = 0, e = AIs.size(); i != e; ++i) CurValues[AIs[i]] = 0; // Insert with null value @@ -791,6 +854,7 @@ if (AST && isa(LI->getType())) AST->deleteValue(LI); BB->getInstList().erase(LI); + LBI.deleteValue(LI); } } } @@ -801,6 +865,7 @@ // Store updates the "current value"... AIt->second = SI->getOperand(0); SI->eraseFromParent(); + LBI.deleteValue(SI); } } } @@ -813,6 +878,7 @@ assert(AI->use_empty() && "Uses of alloca from more than one BB??"); if (AST) AST->deleteValue(AI); AI->eraseFromParent(); + LBI.deleteValue(AI); } NumLocalPromoted += CurValues.size(); From evan.cheng at apple.com Mon Oct 27 01:10:33 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 26 Oct 2008 23:10:33 -0700 Subject: [llvm-commits] [llvm] r58225 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp In-Reply-To: <19743F95-2168-4FD4-B261-1E4F8A42553C@apple.com> References: <200810270210.m9R2ANT4030183@zion.cs.uiuc.edu> <19743F95-2168-4FD4-B261-1E4F8A42553C@apple.com> Message-ID: Nevermind. I see your llvmdev email. Thanks. Evan On Oct 26, 2008, at 9:12 PM, Evan Cheng wrote: > Which tests? Was there a PR for this? > > Thanks, > > Evan > > On Oct 26, 2008, at 7:10 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Sun Oct 26 21:10:21 2008 >> New Revision: 58225 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=58225&view=rev >> Log: >> Increase default setting of tail-merge-threshold to >> 150, based on llvm-test measurements. >> >> >> Modified: >> llvm/trunk/lib/CodeGen/BranchFolding.cpp >> >> Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=58225&r1=58224&r2=58225&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) >> +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Sun Oct 26 21:10:21 2008 >> @@ -42,7 +42,7 @@ >> static cl::opt >> TailMergeThreshold("tail-merge-threshold", >> cl::desc("Max number of predecessors to consider tail >> merging"), >> - cl::init(100), cl::Hidden); >> + cl::init(150), cl::Hidden); >> >> namespace { >> struct VISIBILITY_HIDDEN BranchFolder : public MachineFunctionPass { >> >> >> _______________________________________________ >> 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 sabre at nondot.org Mon Oct 27 01:56:35 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Oct 2008 06:56:35 -0000 Subject: [llvm-commits] [llvm] r58228 - /llvm/trunk/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll Message-ID: <200810270656.m9R6uZ9d023869@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 27 01:56:35 2008 New Revision: 58228 URL: http://llvm.org/viewvc/llvm-project?rev=58228&view=rev Log: no need to print output Modified: llvm/trunk/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll Modified: llvm/trunk/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll?rev=58228&r1=58227&r2=58228&view=diff ============================================================================== --- llvm/trunk/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll (original) +++ llvm/trunk/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll Mon Oct 27 01:56:35 2008 @@ -1,6 +1,6 @@ ; Uninitialized values are not handled correctly. ; -; RUN: llvm-as < %s | opt -mem2reg +; RUN: llvm-as < %s | opt -mem2reg -disable-output ; define i32 @test() { From sabre at nondot.org Mon Oct 27 02:05:53 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Oct 2008 07:05:53 -0000 Subject: [llvm-commits] [llvm] r58229 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Message-ID: <200810270705.m9R75r62024212@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 27 02:05:53 2008 New Revision: 58229 URL: http://llvm.org/viewvc/llvm-project?rev=58229&view=rev Log: Rewrite all the 'PromoteLocallyUsedAlloca[s]' logic. With the power of LargeBlockInfo, we can now dramatically simplify their implementation and speed them up at the same time. Now the code has time proportional to the number of uses of the alloca, not the size of the block. This also eliminates code that tried to batch up different allocas which are used in the same blocks, and eliminates the 'retry list' logic which was baroque and no unneccesary. In addition to being a speedup for crazy cases, this is also a nice cleanup: PromoteMemoryToRegister.cpp | 270 +++++++++++++++----------------------------- 1 file changed, 96 insertions(+), 174 deletions(-) Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=58229&r1=58228&r2=58229&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Oct 27 02:05:53 2008 @@ -163,7 +163,6 @@ /// Allocas - The alloca instructions being promoted. /// std::vector Allocas; - SmallVector &RetryList; DominatorTree &DT; DominanceFrontier &DF; @@ -200,10 +199,9 @@ /// BBNumPreds - Lazily compute the number of predecessors a block has. DenseMap BBNumPreds; public: - PromoteMem2Reg(const std::vector &A, - SmallVector &Retry, DominatorTree &dt, + PromoteMem2Reg(const std::vector &A, DominatorTree &dt, DominanceFrontier &df, AliasSetTracker *ast) - : Allocas(A), RetryList(Retry), DT(dt), DF(df), AST(ast) {} + : Allocas(A), DT(dt), DF(df), AST(ast) {} void run(); @@ -243,13 +241,10 @@ void RewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, LargeBlockInfo &LBI); - - bool PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI, + void PromoteSingleBlockAlloca(AllocaInst *AI, AllocaInfo &Info, LargeBlockInfo &LBI); - void PromoteLocallyUsedAllocas(BasicBlock *BB, - const std::vector &AIs, - LargeBlockInfo &LBI); + void RenamePass(BasicBlock *BB, BasicBlock *Pred, RenamePassData::ValVector &IncVals, std::vector &Worklist); @@ -315,13 +310,6 @@ void PromoteMem2Reg::run() { Function &F = *DF.getRoot()->getParent(); - // LocallyUsedAllocas - Keep track of all of the alloca instructions which are - // only used in a single basic block. These instructions can be efficiently - // promoted by performing a single linear scan over that one block. Since - // individual basic blocks are sometimes large, we group together all allocas - // that are live in a single basic block by the basic block they are live in. - std::map > LocallyUsedAllocas; - if (AST) PointerAllocaValues.resize(Allocas.size()); AllocaInfo Info; @@ -376,11 +364,29 @@ // If the alloca is only read and written in one basic block, just perform a // linear sweep over the block to eliminate it. if (Info.OnlyUsedInOneBlock) { - LocallyUsedAllocas[Info.OnlyBlock].push_back(AI); + PromoteSingleBlockAlloca(AI, Info, LBI); - // Remove the alloca from the Allocas list, since it will be processed. - RemoveFromAllocasList(AllocaNum); - continue; + // Finally, after the scan, check to see if the stores are all that is + // left. + if (Info.UsingBlocks.empty()) { + + // Remove the (now dead) stores and alloca. + while (!AI->use_empty()) { + StoreInst *SI = cast(AI->use_back()); + SI->eraseFromParent(); + LBI.deleteValue(SI); + } + + if (AST) AST->deleteValue(AI); + AI->eraseFromParent(); + LBI.deleteValue(AI); + + // The alloca has been processed, move on. + RemoveFromAllocasList(AllocaNum); + + ++NumLocalPromoted; + continue; + } } // If we haven't computed a numbering for the BB's in the function, do so @@ -406,26 +412,6 @@ DetermineInsertionPoint(AI, AllocaNum, Info); } - // Process all allocas which are only used in a single basic block. - for (std::map >::iterator I = - LocallyUsedAllocas.begin(), E = LocallyUsedAllocas.end(); I != E; ++I){ - const std::vector &LocAllocas = I->second; - assert(!LocAllocas.empty() && "empty alloca list??"); - - // It's common for there to only be one alloca in the list. Handle it - // efficiently. - if (LocAllocas.size() == 1) { - // If we can do the quick promotion pass, do so now. - if (PromoteLocallyUsedAlloca(I->first, LocAllocas[0], LBI)) - RetryList.push_back(LocAllocas[0]); // Failed, retry later. - } else { - // Locally promote anything possible. Note that if this is unable to - // promote a particular alloca, it puts the alloca onto the Allocas vector - // for global processing. - PromoteLocallyUsedAllocas(I->first, LocAllocas, LBI); - } - } - if (Allocas.empty()) return; // All of the allocas must have been trivial! @@ -752,7 +738,16 @@ } -/// PromoteLocallyUsedAlloca - Many allocas are only used within a single basic +/// StoreIndexSearchPredicate - This is a helper predicate used to search by the +/// first element of a pair. +struct StoreIndexSearchPredicate { + bool operator()(const std::pair &LHS, + const std::pair &RHS) { + return LHS.first < RHS.first; + } +}; + +/// PromoteSingleBlockAlloca - Many allocas are only used within a single basic /// block. If this is the case, avoid traversing the CFG and inserting a lot of /// potentially useless PHI nodes by just performing a single linear pass over /// the basic block using the Alloca. @@ -766,126 +761,74 @@ /// /// ... so long as A is not used before undef is set. /// -bool PromoteMem2Reg::PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI, +void PromoteMem2Reg::PromoteSingleBlockAlloca(AllocaInst *AI, AllocaInfo &Info, LargeBlockInfo &LBI) { - assert(!AI->use_empty() && "There are no uses of the alloca!"); - - // Handle degenerate cases quickly. - if (AI->hasOneUse()) { - Instruction *U = cast(AI->use_back()); - if (LoadInst *LI = dyn_cast(U)) { - // Must be a load of uninitialized value. - LI->replaceAllUsesWith(UndefValue::get(AI->getAllocatedType())); - if (AST && isa(LI->getType())) - AST->deleteValue(LI); - } else { - // Otherwise it must be a store which is never read. - assert(isa(U)); - } - LBI.deleteValue(U); - BB->getInstList().erase(U); - } else { - // Uses of the uninitialized memory location shall get undef. - Value *CurVal = 0; - - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { - Instruction *Inst = I++; - if (LoadInst *LI = dyn_cast(Inst)) { - if (LI->getOperand(0) == AI) { - if (!CurVal) return true; // Could not locally promote! - - // Loads just returns the "current value"... - LI->replaceAllUsesWith(CurVal); - if (AST && isa(LI->getType())) - AST->deleteValue(LI); - BB->getInstList().erase(LI); - LBI.deleteValue(LI); - } - } else if (StoreInst *SI = dyn_cast(Inst)) { - if (SI->getOperand(1) == AI) { - // Store updates the "current value"... - CurVal = SI->getOperand(0); - BB->getInstList().erase(SI); - LBI.deleteValue(SI); - } - } - } - } - - // After traversing the basic block, there should be no more uses of the - // alloca: remove it now. - assert(AI->use_empty() && "Uses of alloca from more than one BB??"); - if (AST) AST->deleteValue(AI); - AI->eraseFromParent(); - LBI.deleteValue(AI); - - ++NumLocalPromoted; - return false; -} - -/// PromoteLocallyUsedAllocas - This method is just like -/// PromoteLocallyUsedAlloca, except that it processes multiple alloca -/// instructions in parallel. This is important in cases where we have large -/// basic blocks, as we don't want to rescan the entire basic block for each -/// alloca which is locally used in it (which might be a lot). -void PromoteMem2Reg:: -PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector &AIs, - LargeBlockInfo &LBI) { - DenseMap CurValues; - for (unsigned i = 0, e = AIs.size(); i != e; ++i) - CurValues[AIs[i]] = 0; // Insert with null value - - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { - Instruction *Inst = I++; - if (LoadInst *LI = dyn_cast(Inst)) { - // Is this a load of an alloca we are tracking? - if (AllocaInst *AI = dyn_cast(LI->getOperand(0))) { - DenseMap::iterator AIt = CurValues.find(AI); - if (AIt != CurValues.end()) { - // If loading an uninitialized value, allow the inter-block case to - // handle it. Due to control flow, this might actually be ok. - if (AIt->second == 0) { // Use of locally uninitialized value?? - RetryList.push_back(AI); // Retry elsewhere. - CurValues.erase(AIt); // Stop tracking this here. - if (CurValues.empty()) return; - } else { - // Loads just returns the "current value"... - LI->replaceAllUsesWith(AIt->second); - if (AST && isa(LI->getType())) - AST->deleteValue(LI); - BB->getInstList().erase(LI); - LBI.deleteValue(LI); - } - } - } - } else if (StoreInst *SI = dyn_cast(Inst)) { - if (AllocaInst *AI = dyn_cast(SI->getOperand(1))) { - DenseMap::iterator AIt = CurValues.find(AI); - if (AIt != CurValues.end()) { - // Store updates the "current value"... - AIt->second = SI->getOperand(0); - SI->eraseFromParent(); - LBI.deleteValue(SI); - } + // The trickiest case to handle is when we have large blocks. Because of this, + // this code is optimized assuming that large blocks happen. This does not + // significantly pessimize the small block case. This uses LargeBlockInfo to + // make it efficient to get the index of various operations in the block. + + // Clear out UsingBlocks. We will reconstruct it here if needed. + Info.UsingBlocks.clear(); + + // Walk the use-def list of the alloca, getting the locations of all stores. + typedef SmallVector, 64> StoresByIndexTy; + StoresByIndexTy StoresByIndex; + + for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); + UI != E; ++UI) + if (StoreInst *SI = dyn_cast(*UI)) + StoresByIndex.push_back(std::make_pair(LBI.getInstructionIndex(SI), SI)); + + // If there are no stores to the alloca, just replace any loads with undef. + if (StoresByIndex.empty()) { + for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); UI != E;) + if (LoadInst *LI = dyn_cast(*UI++)) { + LI->replaceAllUsesWith(UndefValue::get(LI->getType())); + if (AST && isa(LI->getType())) + AST->deleteValue(LI); + LBI.deleteValue(LI); + LI->eraseFromParent(); } - } + return; } - // At the end of the block scan, all allocas in CurValues are dead. - for (DenseMap::iterator I = CurValues.begin(), - E = CurValues.end(); I != E; ++I) { - AllocaInst *AI = I->first; - assert(AI->use_empty() && "Uses of alloca from more than one BB??"); - if (AST) AST->deleteValue(AI); - AI->eraseFromParent(); - LBI.deleteValue(AI); + // Sort the stores by their index, making it efficient to do a lookup with a + // binary search. + std::sort(StoresByIndex.begin(), StoresByIndex.end()); + + // Walk all of the loads from this alloca, replacing them with the nearest + // store above them, if any. + for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); UI != E;) { + LoadInst *LI = dyn_cast(*UI++); + if (!LI) continue; + + unsigned LoadIdx = LBI.getInstructionIndex(LI); + + // Find the nearest store that has a lower than this load. + StoresByIndexTy::iterator I = + std::lower_bound(StoresByIndex.begin(), StoresByIndex.end(), + std::pair(LoadIdx, 0), + StoreIndexSearchPredicate()); + + // If there is no store before this load, then we can't promote this load. + if (I == StoresByIndex.begin()) { + // Can't handle this load, bail out. + Info.UsingBlocks.push_back(LI->getParent()); + continue; + } + + // Otherwise, there was a store before this load, the load takes its value. + --I; + LI->replaceAllUsesWith(I->second->getOperand(0)); + if (AST && isa(LI->getType())) + AST->deleteValue(LI); + LI->eraseFromParent(); + LBI.deleteValue(LI); } - - NumLocalPromoted += CurValues.size(); } - // QueuePhiNode - queues a phi-node to be added to a basic-block for a specific // Alloca returns true if there wasn't already a phi-node for that variable // @@ -1044,26 +987,5 @@ // If there is nothing to do, bail out... if (Allocas.empty()) return; - SmallVector RetryList; - PromoteMem2Reg(Allocas, RetryList, DT, DF, AST).run(); - - // PromoteMem2Reg may not have been able to promote all of the allocas in one - // pass, run it again if needed. - std::vector NewAllocas; - while (!RetryList.empty()) { - // If we need to retry some allocas, this is due to there being no store - // before a read in a local block. To counteract this, insert a store of - // undef into the alloca right after the alloca itself. - for (unsigned i = 0, e = RetryList.size(); i != e; ++i) { - BasicBlock::iterator BBI = RetryList[i]; - - new StoreInst(UndefValue::get(RetryList[i]->getAllocatedType()), - RetryList[i], ++BBI); - } - - NewAllocas.assign(RetryList.begin(), RetryList.end()); - RetryList.clear(); - PromoteMem2Reg(NewAllocas, RetryList, DT, DF, AST).run(); - NewAllocas.clear(); - } + PromoteMem2Reg(Allocas, DT, DF, AST).run(); } From evan.cheng at apple.com Mon Oct 27 02:14:50 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Oct 2008 07:14:50 -0000 Subject: [llvm-commits] [llvm] r58230 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/PreAllocSplitting.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h lib/Target/X86/X86RegisterInfo.h test/CodeGen/X86/pre-split7.ll Message-ID: <200810270714.m9R7EpwT024528@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 27 02:14:50 2008 New Revision: 58230 URL: http://llvm.org/viewvc/llvm-project?rev=58230&view=rev Log: For now, don't split live intervals around x87 stack register barriers. FpGET_ST0_80 must be right after a call instruction (and ADJCALLSTACKUP) so we need to find a way to prevent reload of x87 registers between them. Added: llvm/trunk/test/CodeGen/X86/pre-split7.ll Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/lib/Target/X86/X86RegisterInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=58230&r1=58229&r2=58230&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Mon Oct 27 02:14:50 2008 @@ -407,6 +407,13 @@ return false; } + /// IgnoreRegisterClassBarriers - Returns true if pre-register allocation + /// live interval splitting pass should ignore barriers of the specified + /// register class. + virtual bool IgnoreRegisterClassBarriers(const TargetRegisterClass *RC) const{ + return true; + } + /// getPointerRegClass - Returns a TargetRegisterClass used for pointer /// values. virtual const TargetRegisterClass *getPointerRegClass() const { @@ -425,7 +432,6 @@ /// GetFunctionSizeInBytes - Returns the size of the specified MachineFunction. /// virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const = 0; - }; /// TargetInstrInfoImpl - This is the default implementation of Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58230&r1=58229&r2=58230&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Mon Oct 27 02:14:50 2008 @@ -659,6 +659,8 @@ // by the current barrier. SmallVector Intervals; for (const TargetRegisterClass **RC = RCs; *RC; ++RC) { + if (TII->IgnoreRegisterClassBarriers(*RC)) + continue; std::vector &VRs = MRI->getRegClassVirtRegs(*RC); for (unsigned i = 0, e = VRs.size(); i != e; ++i) { unsigned Reg = VRs[i]; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=58230&r1=58229&r2=58230&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Oct 27 02:14:50 2008 @@ -2411,6 +2411,14 @@ return false; } +bool X86InstrInfo:: +IgnoreRegisterClassBarriers(const TargetRegisterClass *RC) const { + // FIXME: Ignore bariers of x87 stack registers for now. We can't + // allow any loads of these registers before FpGet_ST0_80. + return RC == &X86::CCRRegClass || RC == &X86::RFP32RegClass || + RC == &X86::RFP64RegClass || RC == &X86::RFP80RegClass; +} + const TargetRegisterClass *X86InstrInfo::getPointerRegClass() const { const X86Subtarget *Subtarget = &TM.getSubtarget(); if (Subtarget->is64Bit()) Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=58230&r1=58229&r2=58230&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Mon Oct 27 02:14:50 2008 @@ -405,6 +405,11 @@ virtual bool ReverseBranchCondition(SmallVectorImpl &Cond) const; + /// IgnoreRegisterClassBarriers - Returns true if pre-register allocation + /// live interval splitting pass should ignore barriers of the specified + /// register class. + bool IgnoreRegisterClassBarriers(const TargetRegisterClass *RC) const; + const TargetRegisterClass *getPointerRegClass() const; // getBaseOpcodeFor - This function returns the "base" X86 opcode for the Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=58230&r1=58229&r2=58230&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Mon Oct 27 02:14:50 2008 @@ -94,6 +94,10 @@ /// Code Generation virtual methods... /// + + /// getCrossCopyRegClass - Returns a legal register class to copy a register + /// in the specified class to or from. Returns NULL if it is possible to copy + /// between a two registers of the specified class. const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const; Added: llvm/trunk/test/CodeGen/X86/pre-split7.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pre-split7.ll?rev=58230&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/pre-split7.ll (added) +++ llvm/trunk/test/CodeGen/X86/pre-split7.ll Mon Oct 27 02:14:50 2008 @@ -0,0 +1,34 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -pre-alloc-split + + at object_distance = external global double, align 8 ; [#uses=1] + at axis_slope_angle = external global double, align 8 ; [#uses=1] + at current_surfaces.b = external global i1 ; [#uses=1] + +declare double @sin(double) nounwind readonly + +declare double @asin(double) nounwind readonly + +declare double @tan(double) nounwind readonly + +define fastcc void @trace_line(i32 %line) nounwind { +entry: + %.b3 = load i1* @current_surfaces.b ; [#uses=1] + br i1 %.b3, label %bb, label %return + +bb: ; preds = %bb, %entry + %0 = tail call double @asin(double 0.000000e+00) nounwind readonly ; [#uses=1] + %1 = add double 0.000000e+00, %0 ; [#uses=2] + %2 = tail call double @asin(double 0.000000e+00) nounwind readonly ; [#uses=1] + %3 = sub double %1, %2 ; [#uses=2] + store double %3, double* @axis_slope_angle, align 8 + %4 = fdiv double %1, 2.000000e+00 ; [#uses=1] + %5 = tail call double @sin(double %4) nounwind readonly ; [#uses=1] + %6 = mul double 0.000000e+00, %5 ; [#uses=1] + %7 = tail call double @tan(double %3) nounwind readonly ; [#uses=0] + %8 = add double 0.000000e+00, %6 ; [#uses=1] + store double %8, double* @object_distance, align 8 + br label %bb + +return: ; preds = %entry + ret void +} From nicholas at mxc.ca Mon Oct 27 02:28:44 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 27 Oct 2008 07:28:44 -0000 Subject: [llvm-commits] [llvm] r58231 - /llvm/trunk/lib/VMCore/Instruction.cpp Message-ID: <200810270728.m9R7SihQ024938@zion.cs.uiuc.edu> Author: nicholas Date: Mon Oct 27 02:28:44 2008 New Revision: 58231 URL: http://llvm.org/viewvc/llvm-project?rev=58231&view=rev Log: Fix an obvious copy/pasto. Modified: llvm/trunk/lib/VMCore/Instruction.cpp Modified: llvm/trunk/lib/VMCore/Instruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=58231&r1=58230&r2=58231&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instruction.cpp (original) +++ llvm/trunk/lib/VMCore/Instruction.cpp Mon Oct 27 02:28:44 2008 @@ -185,9 +185,9 @@ CI->getAttributes().getRawPointer() == cast(I)->getAttributes().getRawPointer(); if (const InvokeInst *CI = dyn_cast(this)) - return CI->getCallingConv() == cast(I)->getCallingConv() && + return CI->getCallingConv() == cast(I)->getCallingConv() && CI->getAttributes().getRawPointer() == - cast(I)->getAttributes().getRawPointer(); + cast(I)->getAttributes().getRawPointer(); if (const InsertValueInst *IVI = dyn_cast(this)) { if (IVI->getNumIndices() != cast(I)->getNumIndices()) return false; @@ -235,9 +235,9 @@ CI->getAttributes().getRawPointer() == cast(I)->getAttributes().getRawPointer(); if (const InvokeInst *CI = dyn_cast(this)) - return CI->getCallingConv() == cast(I)->getCallingConv() && + return CI->getCallingConv() == cast(I)->getCallingConv() && CI->getAttributes().getRawPointer() == - cast(I)->getAttributes().getRawPointer(); + cast(I)->getAttributes().getRawPointer(); if (const InsertValueInst *IVI = dyn_cast(this)) { if (IVI->getNumIndices() != cast(I)->getNumIndices()) return false; From baldrick at free.fr Mon Oct 27 03:42:46 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Oct 2008 08:42:46 -0000 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ Message-ID: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> Author: baldrick Date: Mon Oct 27 03:42:46 2008 New Revision: 58232 URL: http://llvm.org/viewvc/llvm-project?rev=58232&view=rev Log: Turn on LegalizeTypes, the new type legalization codegen infrastructure, by default. Please report any breakage to the mailing lists. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll llvm/trunk/test/CodeGen/Generic/APIntParam.ll llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Oct 27 03:42:46 2008 @@ -54,7 +54,7 @@ static cl::opt EnableValueProp("enable-value-prop", cl::Hidden); static cl::opt -EnableLegalizeTypes("enable-legalize-types", cl::Hidden); +DisableLegalizeTypes("disable-legalize-types", cl::Hidden); static cl::opt EnableFastISelVerbose("fast-isel-verbose", cl::Hidden, cl::desc("Enable verbose messages in the \"fast\" " @@ -572,7 +572,7 @@ // Second step, hack on the DAG until it only uses operations and types that // the target supports. - if (EnableLegalizeTypes) {// Enable this some day. + if (!DisableLegalizeTypes) { if (ViewLegalizeTypesDAGs) CurDAG->viewGraph("legalize-types input for " + BlockName); Modified: llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -o - +; RUN: llvm-as < %s | llc -o - 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-f80:32:32" target triple = "i686-pc-linux-gnu" Modified: llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll (original) +++ llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types +; RUN: llvm-as < %s | llc @i1_l = external global i1 ; [#uses=1] @i1_s = external global i1 ; [#uses=1] @i2_l = external global i2 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/Generic/APIntParam.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntParam.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/APIntParam.ll (original) +++ llvm/trunk/test/CodeGen/Generic/APIntParam.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types +; RUN: llvm-as < %s | llc @i1_s = external global i1 ; [#uses=1] @i2_s = external global i2 ; [#uses=1] @i3_s = external global i3 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll (original) +++ llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types +; RUN: llvm-as < %s | llc @i1_s = external global i1 ; [#uses=1] @i2_s = external global i2 ; [#uses=1] @i3_s = external global i3 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll (original) +++ llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types +; RUN: llvm-as < %s | llc @i1_s = external global i1 ; [#uses=1] @i2_s = external global i2 ; [#uses=1] @i3_s = external global i3 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep subu %t | count 2 ; RUN: grep addu %t | count 4 Modified: llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep {sw.*(\$4)} | count 3 +; RUN: llvm-as < %s | llc -march=mips | grep {sw.*(\$4)} | count 3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep {lw.*(\$4)} | count 2 +; RUN: llvm-as < %s | llc -march=mips | grep {lw.*(\$4)} | count 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:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep __adddf3 +; RUN: llvm-as < %s | llc -march=mips | grep __adddf3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep __extendsfdf2 +; RUN: llvm-as < %s | llc -march=mips | grep __extendsfdf2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep trunc.w.s | count 3 +; RUN: llvm-as < %s | llc -march=mips | grep trunc.w.s | count 3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep __floatsidf %t | count 1 ; RUN: grep __floatunsidf %t | count 1 ; RUN: grep __fixdfsi %t | count 1 Modified: llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep {rodata.str1.4,"aMS", at progbits} %t | count 1 ; RUN: grep {r.data,} %t | count 1 ; RUN: grep {\%hi} %t | count 2 Modified: llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep seh %t | count 1 ; RUN: grep seb %t | count 1 Modified: llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep {CPI\[01\]_\[01\]:} %t | count 2 ; RUN: grep {rodata.cst4,"aM", at progbits} %t | count 1 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" Modified: llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep {c\\..*\\.s} %t | count 3 ; RUN: grep {bc1\[tf\]} %t | count 3 Modified: llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep {b\[ne\]\[eq\]} | count 1 +; RUN: llvm-as < %s | llc -march=mips | grep {b\[ne\]\[eq\]} | count 1 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep abs.s %t | count 1 ; RUN: grep neg.s %t | count 1 Modified: llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep mfhi %t | count 1 ; RUN: grep mflo %t | count 1 ; RUN: grep multu %t | count 1 Modified: llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep {lui.*32767} %t | count 1 ; RUN: grep {ori.*65535} %t | count 1 Modified: llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -f -o %t ; RUN: grep mtc1 %t | count 1 ; RUN: grep mfc1 %t | count 1 Modified: llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep {subu.*sp} | count 2 +; RUN: llvm-as < %s | llc -march=mips | grep {subu.*sp} | count 2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll (original) +++ llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll Mon Oct 27 03:42:46 2008 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ -; RUN: grep __truncdfsf2 | count 1 +; RUN: llvm-as < %s | llc -march=mips | grep __truncdfsf2 | count 1 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" target triple = "mipsallegrexel-psp-elf" Modified: llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -enable-legalize-types +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 ; PR2762 define void @foo(<4 x i32>* %p, <4 x double>* %q) { %n = load <4 x i32>* %p Modified: llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll?rev=58232&r1=58231&r2=58232&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll Mon Oct 27 03:42:46 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -enable-legalize-types -march=x86 -mattr=+sse2 -o - | not grep {ucomiss\[^,\]*esp} +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o - | not grep {ucomiss\[^,\]*esp} define void @f(float %wt) { entry: From isanbard at gmail.com Mon Oct 27 04:06:50 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 02:06:50 -0700 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> Message-ID: <68EAAD50-D1F3-4F48-A60D-97FE8C01111E@gmail.com> Hi Duncan, Here's the failures I get: Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ CodeGen/ARM/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/ build/llvm.src/test/CodeGen/ARM/cse-libcalls.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/Sandbox/Buildbot/llvm/full- llvm/build/llvm.src/test/CodeGen/ARM/cse-libcalls.ll | llc -march=arm | /usr/bin/grep {bl.*__ltdf} | count 1 count: expected 1 lines and got 2. child process exited abnormally Running /Volumes/Sandbox/Buildbot/ llvm/full-llvm/build/llvm.src/test/CodeGen/Alpha/dg.exp ... Running / Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/ CBackend/dg.exp ... Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/ build/llvm.src/test/CodeGen/CPP/dg.exp ... Running /Volumes/Sandbox/ Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/CellSPU/dg.exp ... Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ CodeGen/Generic/GC/dg.exp ... Running /Volumes/Sandbox/Buildbot/llvm/ full-llvm/build/llvm.src/test/CodeGen/Generic/dg.exp ... Running / Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/ IA64/dg.exp ... Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/ llvm.src/test/CodeGen/Mips/dg.exp ... Running /Volumes/Sandbox/ Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/PowerPC/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ CodeGen/PowerPC/vec_spat.ll Failed with exit(1) at line 3 while running: grep vspltw vec_spat.ll.tmp | count 2 count: expected 2 lines and got 3. child process exited abnormally Running /Volumes/Sandbox/ Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/SPARC/dg.exp ... Please investigate them. Thanks! -bw On Oct 27, 2008, at 1:42 AM, Duncan Sands wrote: > Author: baldrick > Date: Mon Oct 27 03:42:46 2008 > New Revision: 58232 > > URL: http://llvm.org/viewvc/llvm-project?rev=58232&view=rev > Log: > Turn on LegalizeTypes, the new type legalization > codegen infrastructure, by default. Please report > any breakage to the mailing lists. > > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll > llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll > llvm/trunk/test/CodeGen/Generic/APIntParam.ll > llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll > llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll > llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll > llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll > llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll > llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll > llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll > llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll > llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll > llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll > llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll > llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll > llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll > llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll > llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll > llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll > llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll > llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll > llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll > llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll > llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll > llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Oct > 27 03:42:46 2008 > @@ -54,7 +54,7 @@ > static cl::opt > EnableValueProp("enable-value-prop", cl::Hidden); > static cl::opt > -EnableLegalizeTypes("enable-legalize-types", cl::Hidden); > +DisableLegalizeTypes("disable-legalize-types", cl::Hidden); > static cl::opt > EnableFastISelVerbose("fast-isel-verbose", cl::Hidden, > cl::desc("Enable verbose messages in the \"fast\" " > @@ -572,7 +572,7 @@ > > // Second step, hack on the DAG until it only uses operations and > types that > // the target supports. > - if (EnableLegalizeTypes) {// Enable this some day. > + if (!DisableLegalizeTypes) { > if (ViewLegalizeTypesDAGs) CurDAG->viewGraph("legalize-types > input for " + > BlockName); > > > Modified: llvm/trunk/test/CodeGen/Generic/2007-11-21- > UndeadIllegalNode.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll > (original) > +++ llvm/trunk/test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll > Mon Oct 27 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -o - > +; RUN: llvm-as < %s | llc -o - > > 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- > f80:32:32" > target triple = "i686-pc-linux-gnu" > > Modified: llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll (original) > +++ llvm/trunk/test/CodeGen/Generic/APIntLoadStore.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types > +; RUN: llvm-as < %s | llc > @i1_l = external global i1 ; [#uses=1] > @i1_s = external global i1 ; [#uses=1] > @i2_l = external global i2 ; [#uses=1] > > Modified: llvm/trunk/test/CodeGen/Generic/APIntParam.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntParam.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Generic/APIntParam.ll (original) > +++ llvm/trunk/test/CodeGen/Generic/APIntParam.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types > +; RUN: llvm-as < %s | llc > @i1_s = external global i1 ; [#uses=1] > @i2_s = external global i2 ; [#uses=1] > @i3_s = external global i3 ; [#uses=1] > > Modified: llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll (original) > +++ llvm/trunk/test/CodeGen/Generic/APIntSextParam.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types > +; RUN: llvm-as < %s | llc > @i1_s = external global i1 ; [#uses=1] > @i2_s = external global i2 ; [#uses=1] > @i3_s = external global i3 ; [#uses=1] > > Modified: llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll (original) > +++ llvm/trunk/test/CodeGen/Generic/APIntZextParam.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types > +; RUN: llvm-as < %s | llc > @i1_s = external global i1 ; [#uses=1] > @i2_s = external global i2 ; [#uses=1] > @i3_s = external global i3 ; [#uses=1] > > Modified: llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-06-05-Carry.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep subu %t | count 2 > ; RUN: grep addu %t | count 4 > > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-03-SRet.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep {sw.*(\$4)} | count 3 > +; RUN: llvm-as < %s | llc -march=mips | grep {sw.*(\$4)} | count 3 > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-05-ByVal.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep {lw.*(\$4)} | count 2 > +; RUN: llvm-as < %s | llc -march=mips | grep {lw.*(\$4)} | count 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:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-06-fadd64.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep __adddf3 > +; RUN: llvm-as < %s | llc -march=mips | grep __adddf3 > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-07-FPExtend.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep __extendsfdf2 > +; RUN: llvm-as < %s | llc -march=mips | grep __extendsfdf2 > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-07-Float2Int.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep trunc.w.s | count 3 > +; RUN: llvm-as < %s | llc -march=mips | grep trunc.w.s | count 3 > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-07- > IntDoubleConvertions.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll > (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll > Mon Oct 27 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep __floatsidf %t | count 1 > ; RUN: grep __floatunsidf %t | count 1 > ; RUN: grep __fixdfsi %t | count 1 > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll > (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll Mon > Oct 27 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep {rodata.str1.4,"aMS", at progbits} %t | count 1 > ; RUN: grep {r.data,} %t | count 1 > ; RUN: grep {\%hi} %t | count 2 > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll Mon Oct > 27 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep seh %t | count 1 > ; RUN: grep seb %t | count 1 > > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep {CPI\[01\]_\[01\]:} %t | count 2 > ; RUN: grep {rodata.cst4,"aM", at progbits} %t | count 1 > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-23-fpcmp.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep {c\\..*\\.s} %t | count 3 > ; RUN: grep {bc1\[tf\]} %t | count 3 > > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-29-icmp.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep {b\[ne\]\[eq\]} | count 1 > +; RUN: llvm-as < %s | llc -march=mips | grep {b\[ne\]\[eq\]} | > count 1 > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-07-31-fcopysign.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep abs.s %t | count 1 > ; RUN: grep neg.s %t | count 1 > > > Modified: llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-08-01-AsmInline.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep mfhi %t | count 1 > ; RUN: grep mflo %t | count 1 > ; RUN: grep multu %t | count 1 > > Modified: llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-08-03-fabs64.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep {lui.*32767} %t | count 1 > ; RUN: grep {ori.*65535} %t | count 1 > > > Modified: llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-08-04-Bitconvert.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips -f -o %t > +; RUN: llvm-as < %s | llc -march=mips -f -o %t > ; RUN: grep mtc1 %t | count 1 > ; RUN: grep mfc1 %t | count 1 > > > Modified: llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-08-06-Alloca.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep {subu.*sp} | count 2 > +; RUN: llvm-as < %s | llc -march=mips | grep {subu.*sp} | count 2 > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll (original) > +++ llvm/trunk/test/CodeGen/Mips/2008-08-07-FPRound.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,5 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=mips | \ > -; RUN: grep __truncdfsf2 | count 1 > +; RUN: llvm-as < %s | llc -march=mips | grep __truncdfsf2 | count 1 > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32- > i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" > target triple = "mipsallegrexel-psp-elf" > > Modified: llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll (original) > +++ llvm/trunk/test/CodeGen/X86/2008-10-16-VecUnaryOp.ll Mon Oct 27 > 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -enable-legalize- > types > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 > ; PR2762 > define void @foo(<4 x i32>* %p, <4 x double>* %q) { > %n = load <4 x i32>* %p > > Modified: llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll?rev=58232&r1=58231&r2=58232&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll > (original) > +++ llvm/trunk/test/CodeGen/X86/2008-10-24-FlippedCompare.ll Mon Oct > 27 03:42:46 2008 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -enable-legalize-types -march=x86 -mattr= > +sse2 -o - | not grep {ucomiss\[^,\]*esp} > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o - | not grep > {ucomiss\[^,\]*esp} > > define void @f(float %wt) { > entry: > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Mon Oct 27 04:19:11 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Oct 2008 10:19:11 +0100 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <68EAAD50-D1F3-4F48-A60D-97FE8C01111E@gmail.com> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <68EAAD50-D1F3-4F48-A60D-97FE8C01111E@gmail.com> Message-ID: <200810271019.12570.baldrick@free.fr> Hi Bill, this is kind of hard to read since it seems to be one long line. Still, here goes. > Here's the failures I get: > > Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ > CodeGen/ARM/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/ > build/llvm.src/test/CodeGen/ARM/cse-libcalls.ll Failed with exit(1) at > line 1 while running: llvm-as < /Volumes/Sandbox/Buildbot/llvm/full- > llvm/build/llvm.src/test/CodeGen/ARM/cse-libcalls.ll | llc -march=arm > | /usr/bin/grep {bl.*__ltdf} | count 1 count: expected 1 lines and got > 2. child process exited abnormally This is a known failure, mentioned in my email. It is due to a bug in UpdateNodeOperands exposed by LegalizeTypes and should be fixed shortly. > Running /Volumes/Sandbox/ > Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/PowerPC/dg.exp ... > FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ > CodeGen/PowerPC/vec_spat.ll Failed with exit(1) at line 3 while > running: grep vspltw vec_spat.ll.tmp | count 2 count: expected 2 lines > and got 3. child process exited abnormally This is also a known failure, also mentioned in my email. I'm still discussing with Chris the best approach to fixing this. I didn't spot any other failures in the list, so it looks like this is as expected. Thanks for testing. Ciao, Duncan. From isanbard at gmail.com Mon Oct 27 04:27:34 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 09:27:34 -0000 Subject: [llvm-commits] [llvm] r58237 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200810270927.m9R9RYM6006175@zion.cs.uiuc.edu> Author: void Date: Mon Oct 27 04:27:33 2008 New Revision: 58237 URL: http://llvm.org/viewvc/llvm-project?rev=58237&view=rev Log: Some grammar fixes, and non-invasive format changes. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=58237&r1=58236&r2=58237&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Mon Oct 27 04:27:33 2008 @@ -98,28 +98,31 @@ yet production quality, it is progressing very nicely. In addition, C++ front-end work has started to make significant progress.

-Clang, in conjunction with the ccc driver, is now usable as a -replacement for gcc for building some small- to medium-sized C applications. +

Clang, in conjunction with the ccc driver, is now usable as a +replacement for gcc for building some small- to medium-sized C applications. Additionally, Clang now has code generation support for Objective-C on Mac OS X -platform. Major highlights include: +platform. Major highlights include:

+
  • Clang/ccc pass almost all of the LLVM test suite on Mac OS X and Linux on the 32-bit x86 architecture. This includes significant C applications such as sqlite3, lua, and -Clam AntiVirus. +Clam AntiVirus.
  • Clang can build the majority of Objective-C examples shipped with the -Mac OS X Developer Tools. +Mac OS X Developer Tools.
-Clang code generation still needs considerable testing and development, however. -Some areas under active development include: +

Clang code generation still needs considerable testing and development, +however. Some areas under active development include:

+
    -
  • Improved support for C and Objective-C features, for example - variable-length arrays, va_arg, exception handling (Obj-C), and garbage - collection (Obj-C). -
  • ABI compatibility, especially for platforms other than 32-bit x86. +
  • Improved support for C and Objective-C features, for example + variable-length arrays, va_arg, exception handling (Obj-C), and garbage + collection (Obj-C).
  • +
  • ABI compatibility, especially for platforms other than 32-bit + x86.
@@ -145,15 +148,14 @@ the tool. While still early in development, the GUI illustrates some of the key features of Clang: accurate source location information, which is used by the GUI to highlight specific code expressions that relate to a bug (including those -that span multiple lines) and built-in knowledge of macros, which is used to +that span multiple lines); and built-in knowledge of macros, which is used to perform inline expansion of macros within the GUI itself.

The set of checks performed by the static analyzer is gradually expanding, -and -future plans for the tool include full source-level inter-procedural analysis -and deeper checks such as buffer overrun detection. There are many opportunities -to extend and enhance the static analyzer, and anyone interested in working on -this project is encouraged to get involved!

+and future plans for the tool include full source-level inter-procedural +analysis and deeper checks such as buffer overrun detection. There are many +opportunities to extend and enhance the static analyzer, and anyone interested +in working on this project is encouraged to get involved!

@@ -174,15 +176,15 @@
    -
  • Support for generics in the .Net virtual machine. -
  • Initial support for the Mono class libraries. +
  • Support for generics in the .Net virtual machine.
  • +
  • Initial support for the Mono class libraries.
  • Support for MacOSX/x86, following LLVM's support for exceptions in -JIT on MacOSX/x86. -
  • A new vmkit driver: a program to run java or .net applications. The -driver supports llvm command line arguments including the new "-fast" option. +JIT on MacOSX/x86.
  • +
  • A new vmkit driver: a program to run java or .net applications. The driver +supports llvm command line arguments including the new "-fast" option.
  • A new memory allocation scheme in the JVM that makes unloading a -class loader very fast. -
  • VMKit now follows the LLVM Makefile machinery. +class loader very fast.
  • +
  • VMKit now follows the LLVM Makefile machinery.
@@ -196,7 +198,7 @@
-

This release includes a huge number of bug fixes, performance tweaks and +

This release includes a huge number of bug fixes, performance tweaks, and minor improvements. Some of the major improvements and new features are listed in this section.

@@ -214,24 +216,24 @@
  • The most visible end-user change in LLVM 2.4 is that it includes many optimizations and changes to make -O0 compile times much faster. You should see -improvements on the order of 30% (or more) faster than LLVM 2.3. There are many -pieces to this change, described in more detail below. The speedups and new -components can also be used for JIT compilers that want fast compilation as -well.

  • +improvements in speed on the order of 30% (or more) than in LLVM 2.3. There are +many pieces to this change described in more detail below. The speedups and new +components can also be used for JIT compilers that want fast +compilation.

  • The biggest change to the LLVM IR is that Multiple Return Values (which were introduced in LLVM 2.3) have been generalized to full support for "First Class Aggregate" values in LLVM 2.4. This means that LLVM IR supports using structs and arrays as values in a function. This capability is mostly useful for front-end authors, who prefer to treat things like complex numbers, simple -tuples, dope vectors, etc as Value*'s instead of as a tuple of Value*'s or as +tuples, dope vectors, etc., as Value*'s instead of as a tuple of Value*'s or as memory values. Bitcode files from LLVM 2.3 will automatically migrate to the general representation.

  • LLVM 2.4 also includes an initial port for the PIC16 microprocessor. This -is the LLVM target that only has support for 8 bit registers, and a number of -other crazy constraints. While the port is still in early development stages, -it shows some interesting things you can do with LLVM.

  • +target only has support for 8 bit registers, and a number of other crazy +constraints. While the port is still in early development stages, it shows some +interesting things you can do with LLVM.

@@ -251,20 +253,20 @@
  • LLVM 2.4 supports the full set of atomic __sync_* builtins. LLVM -2.3 only supported those used by OpenMP, but 2.4 supports them all. While -llvm-gcc supports all of these builtins, note that not all targets do. X86 -support them all in both 32-bit and 64-bit mode and PowerPC supports them all -except for the 64-bit operations when in 32-bit mode.
  • +2.3 only supported those used by OpenMP, but 2.4 supports them all. Note that +while llvm-gcc supports all of these builtins, not all targets do. X86 support +them all in both 32-bit and 64-bit mode and PowerPC supports them all except for +the 64-bit operations when in 32-bit mode.
  • llvm-gcc now supports an -flimited-precision option, which tells -the compiler that it is ok to use low-precision approximations of certain libm -functions (like tan, log, etc). This allows you to get high performance if you -only need (say) 14-bits of precision.
  • +the compiler that it is okay to use low-precision approximations of certain libm +functions (like exp, log, etc). This allows you to get high +performance if you only need (say) 12-bits of precision.
  • llvm-gcc now supports a C language extension known as "Blocks". This feature is similar to nested functions and closures, but does not -require stack trampolines (with most ABIs) and supports returning closures +require stack trampolines (with most ABIs), and supports returning closures from functions that define them. Note that actually using Blocks requires a small runtime that is not included with llvm-gcc.
  • @@ -284,8 +286,7 @@
-

New features include: -

+

New features include:

  • A major change to the Use class landed, which shrank it by 25%. Since @@ -298,14 +299,14 @@
  • LLVM 2.4 includes some changes for better vector support. First, the shift -operations (shl, ashr, lshr) now all support vectors -and do an element-by-element shift (shifts of the whole vector can be -accomplished by bitcasting the vector to <1 x i128> for example). Second, -there is initial support in development for vector comparisons with the -fcmp/icmp +operations (shl, ashr, and lshr) now all support +vectors and do an element-by-element shift (shifts of the whole vector can be +accomplished by bitcasting the vector to <1 x i128>, for example). Second, +there is initial support in development for vector comparisons with the +fcmp/icmp instructions. These instructions compare two vectors and return a vector of -i1's for each result. Note that there is very little codegen support available -for any of these IR features though.
  • +i1's for each result. Note that there is very little codegen support +available for any of these IR features though.
  • A new DebugInfoBuilder class is available, which makes it much easier for front-ends to create debug info descriptors, similar to the way that @@ -317,11 +318,11 @@ useful when learning how LLVM works. The TargetFolder class folds the most, doing target dependent constant folding.
  • -
  • LLVM now supports "function attributes", which allows us to separate return +
  • LLVM now supports "function attributes", which allow us to separate return value attributes from function attributes. LLVM now supports attributes on a function itself, a return value, and its parameters. New supported function -attributes include noinline/alwaysinline and the "opt-size" flag which says the -function should be optimized for code size.
  • +attributes include noinline/alwaysinline and the opt-size flag, +which says the function should be optimized for code size.
  • LLVM IR now directly represents "common" linkage, instead of representing it as a form of weak linkage.
  • From edwintorok at gmail.com Mon Oct 27 05:16:28 2008 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 27 Oct 2008 10:16:28 -0000 Subject: [llvm-commits] [llvm] r58238 - in /llvm/trunk: include/llvm/Transforms/Scalar.h lib/Transforms/Utils/InstructionNamer.cpp Message-ID: <200810271016.m9RAGSxQ007835@zion.cs.uiuc.edu> Author: edwin Date: Mon Oct 27 05:16:27 2008 New Revision: 58238 URL: http://llvm.org/viewvc/llvm-project?rev=58238&view=rev Log: export an ID for the instructionNamer, allowing analysis/transformation passes that need it to require it by ID. Modified: llvm/trunk/include/llvm/Transforms/Scalar.h llvm/trunk/lib/Transforms/Utils/InstructionNamer.cpp Modified: llvm/trunk/include/llvm/Transforms/Scalar.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=58238&r1=58237&r2=58238&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Scalar.h (original) +++ llvm/trunk/include/llvm/Transforms/Scalar.h Mon Oct 27 05:16:27 2008 @@ -329,6 +329,7 @@ // InstructionNamer - Give any unnamed non-void instructions "tmp" names. // FunctionPass *createInstructionNamerPass(); +extern const PassInfo *const InstructionNamerID; } // End llvm namespace Modified: llvm/trunk/lib/Transforms/Utils/InstructionNamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InstructionNamer.cpp?rev=58238&r1=58237&r2=58238&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InstructionNamer.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InstructionNamer.cpp Mon Oct 27 05:16:27 2008 @@ -40,6 +40,7 @@ } +const PassInfo *const llvm::InstructionNamerID = &X; //===----------------------------------------------------------------------===// // // InstructionNamer - Give any unnamed non-void instructions "tmp" names. From ggreif at gmail.com Mon Oct 27 05:17:24 2008 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 27 Oct 2008 10:17:24 -0000 Subject: [llvm-commits] [llvm] r58239 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200810271017.m9RAHOtX007876@zion.cs.uiuc.edu> Author: ggreif Date: Mon Oct 27 05:17:24 2008 New Revision: 58239 URL: http://llvm.org/viewvc/llvm-project?rev=58239&view=rev Log: formatting tweak for intrinsic Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=58239&r1=58238&r2=58239&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Mon Oct 27 05:17:24 2008 @@ -446,7 +446,7 @@
    • Exception handling is supported by default on Linux/x86-64.
    • Position Independent Code (PIC) is now supported on Linux/x86-64.
    • -
    • @llvm.frameaddress now supports getting the frame address of stack frames +
    • @llvm.frameaddress now supports getting the frame address of stack frames > 0 on x86/x86-64.
    • MIPS has improved a lot since last release, the most important changes are: Little endian support, floating point support, allegrex core and From edwintorok at gmail.com Mon Oct 27 05:18:45 2008 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 27 Oct 2008 10:18:45 -0000 Subject: [llvm-commits] [llvm] r58240 - /llvm/trunk/lib/Analysis/LoopVR.cpp Message-ID: <200810271018.m9RAIjfb007922@zion.cs.uiuc.edu> Author: edwin Date: Mon Oct 27 05:18:45 2008 New Revision: 58240 URL: http://llvm.org/viewvc/llvm-project?rev=58240&view=rev Log: Avoid crashing if instruction is not part of a loop. If it is not part of a loop it is obviously invariant wrt to all loops. Modified: llvm/trunk/lib/Analysis/LoopVR.cpp Modified: llvm/trunk/lib/Analysis/LoopVR.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopVR.cpp?rev=58240&r1=58239&r2=58240&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopVR.cpp (original) +++ llvm/trunk/lib/Analysis/LoopVR.cpp Mon Oct 27 05:18:45 2008 @@ -247,12 +247,13 @@ return ConstantRange(cast(V->getType())->getBitWidth(), false); LoopInfo &LI = getAnalysis(); - ScalarEvolution &SE = getAnalysis(); Loop *L = LI.getLoopFor(I->getParent()); - if (L->isLoopInvariant(I)) + if (!L || L->isLoopInvariant(I)) return ConstantRange(cast(V->getType())->getBitWidth(), false); + ScalarEvolution &SE = getAnalysis(); + SCEVHandle S = SE.getSCEV(I); if (isa(S) || isa(S)) return ConstantRange(cast(V->getType())->getBitWidth(), false); From edwintorok at gmail.com Mon Oct 27 06:15:49 2008 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 27 Oct 2008 13:15:49 +0200 Subject: [llvm-commits] [llvm] r58238 - in /llvm/trunk: include/llvm/Transforms/Scalar.h lib/Transforms/Utils/InstructionNamer.cpp In-Reply-To: <200810271016.m9RAGSxQ007835@zion.cs.uiuc.edu> References: <200810271016.m9RAGSxQ007835@zion.cs.uiuc.edu> Message-ID: <4905A2E5.5040601@gmail.com> On 2008-10-27 12:16, Torok Edwin wrote: > Author: edwin > Date: Mon Oct 27 05:16:27 2008 > New Revision: 58238 > > URL: http://llvm.org/viewvc/llvm-project?rev=58238&view=rev > Log: > export an ID for the instructionNamer, allowing analysis/transformation passes > that need it to require it by ID. > I think that this change and the one in 58240 is straight forward enough, so I didn't request approval prior to committing. Best regards, --Edwin From baldrick at free.fr Mon Oct 27 08:18:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Oct 2008 13:18:32 -0000 Subject: [llvm-commits] [llvm] r58246 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Message-ID: <200810271318.m9RDIWEj014127@zion.cs.uiuc.edu> Author: baldrick Date: Mon Oct 27 08:18:32 2008 New Revision: 58246 URL: http://llvm.org/viewvc/llvm-project?rev=58246&view=rev Log: Fix a bug in which a node could be added to the worklist twice: UpdateNodeOperands could morph a new node into a node already on the worklist. We would then recalculate the NodeId for this existing node and add it to the worklist. The testcase is ARM/cse-libcalls.ll, the problem showing up once UpdateNodeOperands is taught to do CSE for calls. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=58246&r1=58245&r2=58246&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Oct 27 08:18:32 2008 @@ -272,9 +272,14 @@ &NewOps[0], NewOps.size()).getNode(); - N->setNodeId(N->getNumOperands()-NumProcessed); - if (N->getNodeId() == ReadyToProcess) - Worklist.push_back(N); + // Calculate the NodeId if we haven't morphed into an existing node for + // which it is already known. + if (N->getNodeId() == NewNode) { + N->setNodeId(N->getNumOperands()-NumProcessed); + if (N->getNodeId() == ReadyToProcess) + Worklist.push_back(N); + } + return N; } From baldrick at free.fr Mon Oct 27 10:30:55 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Oct 2008 15:30:55 -0000 Subject: [llvm-commits] [llvm] r58249 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200810271530.m9RFUt2P018901@zion.cs.uiuc.edu> Author: baldrick Date: Mon Oct 27 10:30:53 2008 New Revision: 58249 URL: http://llvm.org/viewvc/llvm-project?rev=58249&view=rev Log: Fix UpdateNodeOperands so that it does CSE of calls (and a bunch of other node types). While there, I added a doNotCSE predicate and used it to reduce code duplication (some of the duplicated code was wrong...). This fixes ARM/cse-libcalls.ll when using LegalizeTypes. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=58249&r1=58248&r2=58249&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Oct 27 10:30:53 2008 @@ -354,17 +354,9 @@ AddNodeIDOperands(ID, OpList, N); } - -/// AddNodeIDNode - Generic routine for adding a nodes info to the NodeID -/// data. -static void AddNodeIDNode(FoldingSetNodeID &ID, const SDNode *N) { - AddNodeIDOpcode(ID, N->getOpcode()); - // Add the return value info. - AddNodeIDValueTypes(ID, N->getVTList()); - // Add the operand info. - AddNodeIDOperands(ID, N->op_begin(), N->getNumOperands()); - - // Handle SDNode leafs with special info. +/// AddNodeIDCustom - If this is an SDNode with special info, add this info to +/// the NodeID data. +static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N) { switch (N->getOpcode()) { default: break; // Normal nodes don't need extra info. case ISD::ARG_FLAGS: @@ -505,6 +497,19 @@ } // end switch (N->getOpcode()) } +/// AddNodeIDNode - Generic routine for adding a nodes info to the NodeID +/// data. +static void AddNodeIDNode(FoldingSetNodeID &ID, const SDNode *N) { + AddNodeIDOpcode(ID, N->getOpcode()); + // Add the return value info. + AddNodeIDValueTypes(ID, N->getVTList()); + // Add the operand info. + AddNodeIDOperands(ID, N->op_begin(), N->getNumOperands()); + + // Handle SDNode leafs with special info. + AddNodeIDCustom(ID, N); +} + /// encodeMemSDNodeFlags - Generic routine for computing a value for use in /// the CSE map that carries both alignment and volatility information. /// @@ -517,6 +522,29 @@ // SelectionDAG Class //===----------------------------------------------------------------------===// +/// doNotCSE - Return true if CSE should not be performed for this node. +static bool doNotCSE(SDNode *N) { + if (N->getValueType(0) == MVT::Flag) + return true; // Never CSE anything that produces a flag. + + switch (N->getOpcode()) { + default: break; + case ISD::HANDLENODE: + case ISD::DBG_LABEL: + case ISD::DBG_STOPPOINT: + case ISD::EH_LABEL: + case ISD::DECLARE: + return true; // Never CSE these nodes. + } + + // Check that remaining values produced are not flags. + for (unsigned i = 1, e = N->getNumValues(); i != e; ++i) + if (N->getValueType(i) == MVT::Flag) + return true; // Never CSE anything that produces a flag. + + return false; +} + /// RemoveDeadNodes - This method deletes all unreachable nodes in the /// SelectionDAG. void SelectionDAG::RemoveDeadNodes() { @@ -650,11 +678,7 @@ // flag result (which cannot be CSE'd) or is one of the special cases that are // not subject to CSE. if (!Erased && N->getValueType(N->getNumValues()-1) != MVT::Flag && - !N->isMachineOpcode() && - N->getOpcode() != ISD::DBG_LABEL && - N->getOpcode() != ISD::DBG_STOPPOINT && - N->getOpcode() != ISD::EH_LABEL && - N->getOpcode() != ISD::DECLARE) { + !N->isMachineOpcode() && !doNotCSE(N)) { N->dump(this); cerr << "\n"; assert(0 && "Node is not in map!"); @@ -671,24 +695,9 @@ SDNode *SelectionDAG::AddNonLeafNodeToCSEMaps(SDNode *N) { assert(N->getNumOperands() && "This is a leaf node!"); - if (N->getValueType(0) == MVT::Flag) - return 0; // Never CSE anything that produces a flag. + if (doNotCSE(N)) + return 0; - switch (N->getOpcode()) { - default: break; - case ISD::HANDLENODE: - case ISD::DBG_LABEL: - case ISD::DBG_STOPPOINT: - case ISD::EH_LABEL: - case ISD::DECLARE: - return 0; // Never add these nodes. - } - - // Check that remaining values produced are not flags. - for (unsigned i = 1, e = N->getNumValues(); i != e; ++i) - if (N->getValueType(i) == MVT::Flag) - return 0; // Never CSE anything that produces a flag. - SDNode *New = CSEMap.GetOrInsertNode(N); if (New != N) return New; // Node already existed. return 0; @@ -700,26 +709,13 @@ /// node already exists with these operands, the slot will be non-null. SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos) { - if (N->getValueType(0) == MVT::Flag) - return 0; // Never CSE anything that produces a flag. + if (doNotCSE(N)) + return 0; - switch (N->getOpcode()) { - default: break; - case ISD::HANDLENODE: - case ISD::DBG_LABEL: - case ISD::DBG_STOPPOINT: - case ISD::EH_LABEL: - return 0; // Never add these nodes. - } - - // Check that remaining values produced are not flags. - for (unsigned i = 1, e = N->getNumValues(); i != e; ++i) - if (N->getValueType(i) == MVT::Flag) - return 0; // Never CSE anything that produces a flag. - SDValue Ops[] = { Op }; FoldingSetNodeID ID; AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, 1); + AddNodeIDCustom(ID, N); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -730,16 +726,13 @@ SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2, void *&InsertPos) { - if (N->getOpcode() == ISD::HANDLENODE || N->getValueType(0) == MVT::Flag) - - // Check that remaining values produced are not flags. - for (unsigned i = 1, e = N->getNumValues(); i != e; ++i) - if (N->getValueType(i) == MVT::Flag) - return 0; // Never CSE anything that produces a flag. - + if (doNotCSE(N)) + return 0; + SDValue Ops[] = { Op1, Op2 }; FoldingSetNodeID ID; AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, 2); + AddNodeIDCustom(ID, N); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -751,39 +744,12 @@ SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N, const SDValue *Ops,unsigned NumOps, void *&InsertPos) { - if (N->getValueType(0) == MVT::Flag) - return 0; // Never CSE anything that produces a flag. + if (doNotCSE(N)) + return 0; - switch (N->getOpcode()) { - default: break; - case ISD::HANDLENODE: - case ISD::DBG_LABEL: - case ISD::DBG_STOPPOINT: - case ISD::EH_LABEL: - case ISD::DECLARE: - return 0; // Never add these nodes. - } - - // Check that remaining values produced are not flags. - for (unsigned i = 1, e = N->getNumValues(); i != e; ++i) - if (N->getValueType(i) == MVT::Flag) - return 0; // Never CSE anything that produces a flag. - FoldingSetNodeID ID; AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, NumOps); - - if (const LoadSDNode *LD = dyn_cast(N)) { - ID.AddInteger(LD->getAddressingMode()); - ID.AddInteger(LD->getExtensionType()); - ID.AddInteger(LD->getMemoryVT().getRawBits()); - ID.AddInteger(LD->getRawFlags()); - } else if (const StoreSDNode *ST = dyn_cast(N)) { - ID.AddInteger(ST->getAddressingMode()); - ID.AddInteger(ST->isTruncatingStore()); - ID.AddInteger(ST->getMemoryVT().getRawBits()); - ID.AddInteger(ST->getRawFlags()); - } - + AddNodeIDCustom(ID, N); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } From gohman at apple.com Mon Oct 27 10:51:33 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Oct 2008 08:51:33 -0700 (PDT) Subject: [llvm-commits] [llvm] r58185 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: <200810261540.m9QFekk6009665@zion.cs.uiuc.edu> References: <200810261540.m9QFekk6009665@zion.cs.uiuc.edu> Message-ID: <7569311f0c3599a61cad9fedaab7eddc.squirrel@webmail.apple.com> On Sun, October 26, 2008 8:40 am, Cedric Venet wrote: > @@ -45,6 +45,9 @@ > /// an operand, specified with syntax like ${opname:modifier}. > std::string MiModifier; > > + // To make VS STL happy > + AsmWriterOperand():OperandType(isLiteralTextOperand) {} > + > AsmWriterOperand(const std::string &LitStr) > : OperandType(isLiteralTextOperand), Str(LitStr) {} Please don't use tabs. Thanks, Dan From matthijs at stdin.nl Mon Oct 27 10:59:49 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Mon, 27 Oct 2008 15:59:49 -0000 Subject: [llvm-commits] [llvm] r58250 - /llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Message-ID: <200810271559.m9RFxoNS019988@zion.cs.uiuc.edu> Author: matthijs Date: Mon Oct 27 10:59:43 2008 New Revision: 58250 URL: http://llvm.org/viewvc/llvm-project?rev=58250&view=rev Log: Remove redundant word in tblgen error message. Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=58250&r1=58249&r2=58250&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Mon Oct 27 10:59:43 2008 @@ -166,7 +166,7 @@ } else if (!Rec->isSubClassOf("RegisterClass") && Rec->getName() != "ptr_rc" && Rec->getName() != "unknown") throw "Unknown operand class '" + Rec->getName() + - "' in instruction '" + R->getName() + "' instruction!"; + "' in '" + R->getName() + "' instruction!"; // Check that the operand has a name and that it's unique. if (DI->getArgName(i).empty()) From cedric.venet at laposte.net Mon Oct 27 11:06:55 2008 From: cedric.venet at laposte.net (=?ISO-8859-1?Q?C=E9dric_Venet?=) Date: Mon, 27 Oct 2008 17:06:55 +0100 Subject: [llvm-commits] [llvm] r58185 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: <7569311f0c3599a61cad9fedaab7eddc.squirrel@webmail.apple.com> References: <200810261540.m9QFekk6009665@zion.cs.uiuc.edu> <7569311f0c3599a61cad9fedaab7eddc.squirrel@webmail.apple.com> Message-ID: <4905E71F.9080708@laposte.net> Dan Gohman a ?crit : > On Sun, October 26, 2008 8:40 am, Cedric Venet wrote: >> @@ -45,6 +45,9 @@ >> /// an operand, specified with syntax like ${opname:modifier}. >> std::string MiModifier; >> >> + // To make VS STL happy >> + AsmWriterOperand():OperandType(isLiteralTextOperand) {} >> + >> AsmWriterOperand(const std::string &LitStr) >> : OperandType(isLiteralTextOperand), Str(LitStr) {} > > Please don't use tabs. > > Thanks, > > Dan Sorry, I just reinstalled my IDE and forgot to change my tabs settings. Should I change this to space? regards, C?dric From gohman at apple.com Mon Oct 27 12:37:04 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Oct 2008 10:37:04 -0700 Subject: [llvm-commits] [llvm] r58185 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: <4905E71F.9080708@laposte.net> References: <200810261540.m9QFekk6009665@zion.cs.uiuc.edu> <7569311f0c3599a61cad9fedaab7eddc.squirrel@webmail.apple.com> <4905E71F.9080708@laposte.net> Message-ID: <198C81DB-37A8-4A53-89A5-9B166F14686B@apple.com> On Oct 27, 2008, at 9:06 AM, C?dric Venet wrote: > Dan Gohman a ?crit : >> On Sun, October 26, 2008 8:40 am, Cedric Venet wrote: >>> @@ -45,6 +45,9 @@ >>> /// an operand, specified with syntax like ${opname:modifier}. >>> std::string MiModifier; >>> >>> + // To make VS STL happy >>> + AsmWriterOperand():OperandType(isLiteralTextOperand) {} >>> + >>> AsmWriterOperand(const std::string &LitStr) >>> : OperandType(isLiteralTextOperand), Str(LitStr) {} >> >> Please don't use tabs. >> >> Thanks, >> >> Dan > > Sorry, I just reinstalled my IDE and forgot to change my tabs > settings. > Should I change this to space? Yes, thanks. Dan From greened at obbligato.org Mon Oct 27 12:39:00 2008 From: greened at obbligato.org (David Greene) Date: Mon, 27 Oct 2008 17:39:00 -0000 Subject: [llvm-commits] [llvm] r58255 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200810271739.m9RHd0op024272@zion.cs.uiuc.edu> Author: greened Date: Mon Oct 27 12:38:59 2008 New Revision: 58255 URL: http://llvm.org/viewvc/llvm-project?rev=58255&view=rev Log: Fix PR2634. Create new virtual registers from spills early so that we can give it the same stack slot as the spilled interval if it is folded. This prevents the fold/unfold code from pointing to the wrong register. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=58255&r1=58254&r2=58255&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Oct 27 12:38:59 2008 @@ -1231,6 +1231,17 @@ if (!TrySplit) SSWeight += Weight; + // Create a new virtual register for the spill interval. + // Create the new register now so we can map the fold instruction + // to the new register so when it is unfolded we get the correct + // answer. + bool CreatedNewVReg = false; + if (NewVReg == 0) { + NewVReg = mri_->createVirtualRegister(rc); + vrm.grow(); + CreatedNewVReg = true; + } + if (!TryFold) CanFold = false; else { @@ -1238,9 +1249,16 @@ // optimal point to insert a load / store later. if (!TrySplit) { if (tryFoldMemoryOperand(MI, vrm, ReMatDefMI, index, - Ops, FoldSS, FoldSlot, Reg)) { + Ops, FoldSS, FoldSlot, NewVReg)) { // Folding the load/store can completely change the instruction in // unpredictable ways, rescan it from the beginning. + + if (FoldSS) { + // We need to give the new vreg the same stack slot as the + // spilled interval. + vrm.assignVirt2StackSlot(NewVReg, FoldSlot); + } + HasUse = false; HasDef = false; CanFold = false; @@ -1256,13 +1274,6 @@ } } - // Create a new virtual register for the spill interval. - bool CreatedNewVReg = false; - if (NewVReg == 0) { - NewVReg = mri_->createVirtualRegister(rc); - vrm.grow(); - CreatedNewVReg = true; - } mop.setReg(NewVReg); if (mop.isImplicit()) rewriteImplicitOps(li, MI, NewVReg, vrm); From isanbard at gmail.com Mon Oct 27 12:50:37 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 10:50:37 -0700 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <200810271019.12570.baldrick@free.fr> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <68EAAD50-D1F3-4F48-A60D-97FE8C01111E@gmail.com> <200810271019.12570.baldrick@free.fr> Message-ID: <16e5fdf90810271050v24cf0108r3aa0bc68577e3817@mail.gmail.com> On Mon, Oct 27, 2008 at 2:19 AM, Duncan Sands wrote: > Hi Bill, this is kind of hard to read since it seems to be one long > line. Still, here goes. > >> Here's the failures I get: >> >> Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ >> CodeGen/ARM/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/ >> build/llvm.src/test/CodeGen/ARM/cse-libcalls.ll Failed with exit(1) at >> line 1 while running: llvm-as < /Volumes/Sandbox/Buildbot/llvm/full- >> llvm/build/llvm.src/test/CodeGen/ARM/cse-libcalls.ll | llc -march=arm >> | /usr/bin/grep {bl.*__ltdf} | count 1 count: expected 1 lines and got >> 2. child process exited abnormally > > This is a known failure, mentioned in my email. It is due to a bug > in UpdateNodeOperands exposed by LegalizeTypes and should be fixed shortly. > >> Running /Volumes/Sandbox/ >> Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/PowerPC/dg.exp ... >> FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ >> CodeGen/PowerPC/vec_spat.ll Failed with exit(1) at line 3 while >> running: grep vspltw vec_spat.ll.tmp | count 2 count: expected 2 lines >> and got 3. child process exited abnormally > > This is also a known failure, also mentioned in my email. I'm still > discussing with Chris the best approach to fixing this. > > I didn't spot any other failures in the list, so it looks like this > is as expected. Thanks for testing. > If you're working on a fix, could you XFAIL this for now? Thanks! -bw From baldrick at free.fr Mon Oct 27 13:00:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Oct 2008 19:00:32 +0100 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <16e5fdf90810271050v24cf0108r3aa0bc68577e3817@mail.gmail.com> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810271019.12570.baldrick@free.fr> <16e5fdf90810271050v24cf0108r3aa0bc68577e3817@mail.gmail.com> Message-ID: <200810271900.33073.baldrick@free.fr> Hi Bill, > If you're working on a fix, could you XFAIL this for now? the cse-libcalls is fixed. I will xfail the vec_splat one tomorrow. The reason for not doing that now is that as nightly tester results come in I can see if they have LegalizeTypes turned on or not by looking at whether vec_spat.ll fails! I hope this is acceptable. Ciao, Duncan. From clattner at apple.com Mon Oct 27 13:14:38 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 27 Oct 2008 11:14:38 -0700 Subject: [llvm-commits] [llvm] r58230 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/PreAllocSplitting.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h lib/Target/X86/X86RegisterInfo.h test/CodeGen/X86/pre-split7.ll In-Reply-To: <200810270714.m9R7EpwT024528@zion.cs.uiuc.edu> References: <200810270714.m9R7EpwT024528@zion.cs.uiuc.edu> Message-ID: <2FE23620-131F-49FB-935F-530AB43C95BE@apple.com> On Oct 27, 2008, at 12:14 AM, Evan Cheng wrote: > Author: evancheng > Date: Mon Oct 27 02:14:50 2008 > New Revision: 58230 > > URL: http://llvm.org/viewvc/llvm-project?rev=58230&view=rev > Log: > For now, don't split live intervals around x87 stack register > barriers. FpGET_ST0_80 must be right after a call instruction (and > ADJCALLSTACKUP) so we need to find a way to prevent reload of x87 > registers between them. Eww... This seems exactly like the "copy instruction that clobbers flags" problem, -Chris From greened at obbligato.org Mon Oct 27 13:15:25 2008 From: greened at obbligato.org (David Greene) Date: Mon, 27 Oct 2008 18:15:25 -0000 Subject: [llvm-commits] [llvm] r58256 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200810271815.m9RIFPSx025538@zion.cs.uiuc.edu> Author: greened Date: Mon Oct 27 13:15:15 2008 New Revision: 58256 URL: http://llvm.org/viewvc/llvm-project?rev=58256&view=rev Log: Add STL-style typedefs and default constructors to make it possible to use DenseMap in more contexts. Modified: llvm/trunk/include/llvm/ADT/DenseMap.h Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=58256&r1=58255&r2=58256&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Mon Oct 27 13:15:15 2008 @@ -105,6 +105,8 @@ unsigned NumEntries; unsigned NumTombstones; public: + typedef KeyT key_type; + typedef ValueT mapped_type; typedef BucketT value_type; DenseMap(const DenseMap& other) { @@ -452,6 +454,8 @@ protected: const BucketT *Ptr, *End; public: + DenseMapIterator(void) : Ptr(0), End(0) {} + DenseMapIterator(const BucketT *Pos, const BucketT *E) : Ptr(Pos), End(E) { AdvancePastEmptyBuckets(); } @@ -494,6 +498,7 @@ template class DenseMapConstIterator : public DenseMapIterator { public: + DenseMapConstIterator(void) : DenseMapIterator() {} DenseMapConstIterator(const std::pair *Pos, const std::pair *E) : DenseMapIterator(Pos, E) { From greened at obbligato.org Mon Oct 27 13:17:03 2008 From: greened at obbligato.org (David Greene) Date: Mon, 27 Oct 2008 18:17:03 -0000 Subject: [llvm-commits] [llvm] r58257 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200810271817.m9RIH4tA025597@zion.cs.uiuc.edu> Author: greened Date: Mon Oct 27 13:17:03 2008 New Revision: 58257 URL: http://llvm.org/viewvc/llvm-project?rev=58257&view=rev Log: Add setSubgraphColor to color an entire portion of a SelectionDAG. This will be used to support debug features in TableGen. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=58257&r1=58256&r2=58257&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Oct 27 13:17:03 2008 @@ -16,6 +16,7 @@ #define LLVM_CODEGEN_SELECTIONDAG_H #include "llvm/ADT/ilist.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/StringMap.h" #include "llvm/CodeGen/SelectionDAGNodes.h" @@ -102,6 +103,12 @@ /// VerifyNode - Sanity check the given node. Aborts if it is invalid. void VerifyNode(SDNode *N); + /// setGraphColorHelper - Implementation of setSubgraphColor. + /// Return whether we had to truncate the search. + /// + bool setSubgraphColorHelper(SDNode *N, const char *Color, DenseSet &visited, + int level, bool &printed); + public: SelectionDAG(TargetLowering &tli, FunctionLoweringInfo &fli); ~SelectionDAG(); @@ -147,6 +154,10 @@ /// void setGraphColor(const SDNode *N, const char *Color); + /// setGraphColor - Convenience for setting subgraph color attribute. + /// + void setSubgraphColor(SDNode *N, const char *Color); + typedef ilist::const_iterator allnodes_const_iterator; allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); } allnodes_const_iterator allnodes_end() const { return AllNodes.end(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=58257&r1=58256&r2=58257&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Oct 27 13:17:03 2008 @@ -22,8 +22,10 @@ #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/GraphWriter.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Config/config.h" #include @@ -326,6 +328,61 @@ #endif } +/// setSubgraphColorHelper - Implement setSubgraphColor. Return +/// whether we truncated the search. +/// +bool SelectionDAG::setSubgraphColorHelper(SDNode *N, const char *Color, DenseSet &visited, + int level, bool &printed) { + bool hit_limit = false; + +#ifndef NDEBUG + if (level >= 20) { + if (!printed) { + printed = true; + DOUT << "setSubgraphColor hit max level\n"; + } + return true; + } + + unsigned oldSize = visited.size(); + visited.insert(N); + if (visited.size() != oldSize) { + setGraphColor(N, Color); + for(SDNodeIterator i = SDNodeIterator::begin(N), iend = SDNodeIterator::end(N); + i != iend; + ++i) { + hit_limit = setSubgraphColorHelper(*i, Color, visited, level+1, printed) || hit_limit; + } + } +#else + cerr << "SelectionDAG::setSubgraphColor is only available in debug builds" + << " on systems with Graphviz or gv!\n"; +#endif + return hit_limit; +} + +/// setSubgraphColor - Convenience for setting subgraph color attribute. +/// +void SelectionDAG::setSubgraphColor(SDNode *N, const char *Color) { +#ifndef NDEBUG + DenseSet visited; + bool printed = false; + if (setSubgraphColorHelper(N, Color, visited, 0, printed)) { + // Visually mark that we hit the limit + if (Color == "red" ) { + setSubgraphColorHelper(N, "blue", visited, 0, printed); + } + else if (Color == "yellow" ) { + setSubgraphColorHelper(N, "green", visited, 0, printed); + } + } + +#else + cerr << "SelectionDAG::setSubgraphColor is only available in debug builds" + << " on systems with Graphviz or gv!\n"; +#endif +} + namespace llvm { template<> struct DOTGraphTraits : public DefaultDOTGraphTraits { From evan.cheng at apple.com Mon Oct 27 13:24:03 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Oct 2008 18:24:03 -0000 Subject: [llvm-commits] [test-suite] r58258 - /test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c Message-ID: <200810271824.m9RIO3Lu025883@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 27 13:24:02 2008 New Revision: 58258 URL: http://llvm.org/viewvc/llvm-project?rev=58258&view=rev Log: Don't assume file name is shorter than 100 characters. Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c?rev=58258&r1=58257&r2=58258&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c Mon Oct 27 13:24:02 2008 @@ -62,7 +62,7 @@ size_t size; int outsize,time; unsigned char *inbuf, *outbuf, *temp; - char outfilename[100]; + char *outfilename; char postfix[] = ".c"; struct timeval pre,post; @@ -77,12 +77,15 @@ perror(argv[1]); exit(1); } + outfilename = malloc(strlen(argv[1]) + strlen(postfix) + 1); strcpy(outfilename,argv[1]); strcat(outfilename,postfix); if ((out = fopen(outfilename, "w")) == NULL) { perror(outfilename); + free(outfilename); exit(1); } + free(outfilename); argv++; argc--; } else From evan.cheng at apple.com Mon Oct 27 13:26:07 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Oct 2008 18:26:07 -0000 Subject: [llvm-commits] [test-suite] r58259 - /test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c Message-ID: <200810271826.m9RIQ7gw025981@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 27 13:26:06 2008 New Revision: 58259 URL: http://llvm.org/viewvc/llvm-project?rev=58259&view=rev Log: Fix test. Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c?rev=58259&r1=58258&r2=58259&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/BitBench/uuencode/uuencode.c Mon Oct 27 13:26:06 2008 @@ -155,8 +155,6 @@ size_t size; int outsize,time; unsigned char *inbuf, *outbuf, *temp; - char outfilename[100]; - char postfix[] = ".c"; struct timeval pre,post; /* optional input arg */ @@ -169,8 +167,6 @@ perror(argv[1]); exit(1); } - strcpy(outfilename,argv[1]); - strcat(outfilename,postfix); argc--; } From sabre at nondot.org Mon Oct 27 13:28:25 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Oct 2008 18:28:25 -0000 Subject: [llvm-commits] [llvm] r58260 - in /llvm/trunk/test/CodeGen/PowerPC: vec_spat.ll vec_splat.ll Message-ID: <200810271828.m9RISP9a026084@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 27 13:28:24 2008 New Revision: 58260 URL: http://llvm.org/viewvc/llvm-project?rev=58260&view=rev Log: rename vec_spat -> vec_splat, pointed out by duncan Added: llvm/trunk/test/CodeGen/PowerPC/vec_splat.ll - copied unchanged from r58257, llvm/trunk/test/CodeGen/PowerPC/vec_spat.ll Removed: llvm/trunk/test/CodeGen/PowerPC/vec_spat.ll Removed: llvm/trunk/test/CodeGen/PowerPC/vec_spat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/vec_spat.ll?rev=58259&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/vec_spat.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/vec_spat.ll (removed) @@ -1,71 +0,0 @@ -; Test that vectors are scalarized/lowered correctly. -; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g3 | \ -; RUN: grep stfs | count 4 -; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t -f -; RUN: grep vspltw %t | count 2 -; RUN: grep vsplti %t | count 3 -; RUN: grep vsplth %t | count 1 - - %f4 = type <4 x float> - %i4 = type <4 x i32> - -define void @splat(%f4* %P, %f4* %Q, float %X) nounwind { - %tmp = insertelement %f4 undef, float %X, i32 0 ; <%f4> [#uses=1] - %tmp2 = insertelement %f4 %tmp, float %X, i32 1 ; <%f4> [#uses=1] - %tmp4 = insertelement %f4 %tmp2, float %X, i32 2 ; <%f4> [#uses=1] - %tmp6 = insertelement %f4 %tmp4, float %X, i32 3 ; <%f4> [#uses=1] - %q = load %f4* %Q ; <%f4> [#uses=1] - %R = add %f4 %q, %tmp6 ; <%f4> [#uses=1] - store %f4 %R, %f4* %P - ret void -} - -define void @splat_i4(%i4* %P, %i4* %Q, i32 %X) nounwind { - %tmp = insertelement %i4 undef, i32 %X, i32 0 ; <%i4> [#uses=1] - %tmp2 = insertelement %i4 %tmp, i32 %X, i32 1 ; <%i4> [#uses=1] - %tmp4 = insertelement %i4 %tmp2, i32 %X, i32 2 ; <%i4> [#uses=1] - %tmp6 = insertelement %i4 %tmp4, i32 %X, i32 3 ; <%i4> [#uses=1] - %q = load %i4* %Q ; <%i4> [#uses=1] - %R = add %i4 %q, %tmp6 ; <%i4> [#uses=1] - store %i4 %R, %i4* %P - ret void -} - -define void @splat_imm_i32(%i4* %P, %i4* %Q, i32 %X) nounwind { - %q = load %i4* %Q ; <%i4> [#uses=1] - %R = add %i4 %q, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <%i4> [#uses=1] - store %i4 %R, %i4* %P - ret void -} - -define void @splat_imm_i16(%i4* %P, %i4* %Q, i32 %X) nounwind { - %q = load %i4* %Q ; <%i4> [#uses=1] - %R = add %i4 %q, < i32 65537, i32 65537, i32 65537, i32 65537 > ; <%i4> [#uses=1] - store %i4 %R, %i4* %P - ret void -} - -define void @splat_h(i16 %tmp, <16 x i8>* %dst) nounwind { - %tmp.upgrd.1 = insertelement <8 x i16> undef, i16 %tmp, i32 0 - %tmp72 = insertelement <8 x i16> %tmp.upgrd.1, i16 %tmp, i32 1 - %tmp73 = insertelement <8 x i16> %tmp72, i16 %tmp, i32 2 - %tmp74 = insertelement <8 x i16> %tmp73, i16 %tmp, i32 3 - %tmp75 = insertelement <8 x i16> %tmp74, i16 %tmp, i32 4 - %tmp76 = insertelement <8 x i16> %tmp75, i16 %tmp, i32 5 - %tmp77 = insertelement <8 x i16> %tmp76, i16 %tmp, i32 6 - %tmp78 = insertelement <8 x i16> %tmp77, i16 %tmp, i32 7 - %tmp78.upgrd.2 = bitcast <8 x i16> %tmp78 to <16 x i8> - store <16 x i8> %tmp78.upgrd.2, <16 x i8>* %dst - ret void -} - -define void @spltish(<16 x i8>* %A, <16 x i8>* %B) nounwind { - %tmp = load <16 x i8>* %B ; <<16 x i8>> [#uses=1] - %tmp.s = bitcast <16 x i8> %tmp to <16 x i8> ; <<16 x i8>> [#uses=1] - %tmp4 = sub <16 x i8> %tmp.s, bitcast (<8 x i16> < i16 15, i16 15, i16 15, i16 15, i16 15, i16 - 15, i16 15, i16 15 > to <16 x i8>) ; <<16 x i8>> [#uses=1] - %tmp4.u = bitcast <16 x i8> %tmp4 to <16 x i8> ; <<16 x i8>> [#uses=1] - store <16 x i8> %tmp4.u, <16 x i8>* %A - ret void -} - From isanbard at gmail.com Mon Oct 27 13:28:31 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 11:28:31 -0700 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <200810271900.33073.baldrick@free.fr> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810271019.12570.baldrick@free.fr> <16e5fdf90810271050v24cf0108r3aa0bc68577e3817@mail.gmail.com> <200810271900.33073.baldrick@free.fr> Message-ID: <16e5fdf90810271128q7561854fo25234c6fc40e7172@mail.gmail.com> On Mon, Oct 27, 2008 at 11:00 AM, Duncan Sands wrote: > Hi Bill, > >> If you're working on a fix, could you XFAIL this for now? > > the cse-libcalls is fixed. I will xfail the vec_splat one tomorrow. > The reason for not doing that now is that as nightly tester results > come in I can see if they have LegalizeTypes turned on or not by > looking at whether vec_spat.ll fails! I hope this is acceptable. > It's not ideal, but I suppose it's okay for now. I did see this failure now happening on my PPC box: $ llvm-dis -o - bug.bc ; ModuleID = 'bugpoint-reduced-simplified.bc' target datalayout = "E-p:64:64:64-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-f128:64:128" target triple = "powerpc64-apple-darwin9.5" define void @__divtc3({ ppc_fp128, ppc_fp128 }* noalias sret %agg.result, ppc_fp128 %a, ppc_fp128 %b, ppc_fp128 %c, ppc_fp128 %d) nounwind { entry: %imag59 = load ppc_fp128* null, align 8 ; [#uses=1] %0 = mul ppc_fp128 0xM00000000000000000000000000000000, %imag59 ; [#uses=1] %1 = mul ppc_fp128 0xM00000000000000000000000000000000, 0xM00000000000000000000000000000000 ; [#uses=1] %2 = add ppc_fp128 %0, %1 ; [#uses=1] store ppc_fp128 %2, ppc_fp128* null, align 16 unreachable } $ llc -o - bug.bc Assertion failed: (NodeID != ReadyToProcess && NodeID != Processed && "Invalid node id for user of unprocessed node!"), function run, file /Volumes/Gir/devel/llvm/llvm.src/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp, line 145. 0 llc 0x0080de25 _ZN4llvm3sys20SetInterruptFunctionEPFvvE + 87 1 llc 0x0080df91 _ZN4llvm3sys20SetInterruptFunctionEPFvvE + 451 2 libSystem.B.dylib 0x92f0109b _sigtramp + 43 3 ??? 0xffffffff 0x0 + 4294967295 4 libSystem.B.dylib 0x92f79ec2 raise + 26 Does this look related to your stuff? -bw From gohman at apple.com Mon Oct 27 13:32:16 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Oct 2008 11:32:16 -0700 Subject: [llvm-commits] [test-suite] r58258 - /test-suite/trunk/MultiSource/Benchmarks/BitBench/drop3/drop3.c In-Reply-To: <200810271824.m9RIO3Lu025883@zion.cs.uiuc.edu> References: <200810271824.m9RIO3Lu025883@zion.cs.uiuc.edu> Message-ID: <0B0F56DC-77E2-4719-97DC-6308B3810FBC@apple.com> On Oct 27, 2008, at 11:24 AM, Evan Cheng wrote: > Author: evancheng > Date: Mon Oct 27 13:24:02 2008 > New Revision: 58258 > > URL: http://llvm.org/viewvc/llvm-project?rev=58258&view=rev > Log: > Don't assume file name is shorter than 100 characters. Thanks for finding this! This explains why those tests weren't failing for me -- I guess my directories don't have long enough names ;-). Dan From evan.cheng at apple.com Mon Oct 27 13:47:10 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Oct 2008 11:47:10 -0700 Subject: [llvm-commits] [llvm] r58230 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/PreAllocSplitting.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h lib/Target/X86/X86RegisterInfo.h test/CodeGen/X86/pre-split7.ll In-Reply-To: <2FE23620-131F-49FB-935F-530AB43C95BE@apple.com> References: <200810270714.m9R7EpwT024528@zion.cs.uiuc.edu> <2FE23620-131F-49FB-935F-530AB43C95BE@apple.com> Message-ID: <6E99516D-AC07-403B-9A31-65AE58023836@apple.com> On Oct 27, 2008, at 11:14 AM, Chris Lattner wrote: > > On Oct 27, 2008, at 12:14 AM, Evan Cheng wrote: > >> Author: evancheng >> Date: Mon Oct 27 02:14:50 2008 >> New Revision: 58230 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=58230&view=rev >> Log: >> For now, don't split live intervals around x87 stack register >> barriers. FpGET_ST0_80 must be right after a call instruction (and >> ADJCALLSTACKUP) so we need to find a way to prevent reload of x87 >> registers between them. > > Eww... This seems exactly like the "copy instruction that clobbers > flags" problem, Yep. Except this is not modeled in the machine instruction level at all. Once we figure out a way to deal with it, this patch can go away. Evan > > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From cedric.venet at laposte.net Mon Oct 27 14:21:37 2008 From: cedric.venet at laposte.net (Cedric Venet) Date: Mon, 27 Oct 2008 19:21:37 -0000 Subject: [llvm-commits] [llvm] r58263 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200810271921.m9RJLbZm028041@zion.cs.uiuc.edu> Author: venet Date: Mon Oct 27 14:21:35 2008 New Revision: 58263 URL: http://llvm.org/viewvc/llvm-project?rev=58263&view=rev Log: Remove tabs from my previous commit. Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=58263&r1=58262&r2=58263&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Mon Oct 27 14:21:35 2008 @@ -45,8 +45,8 @@ /// an operand, specified with syntax like ${opname:modifier}. std::string MiModifier; - // To make VS STL happy - AsmWriterOperand():OperandType(isLiteralTextOperand) {} + // To make VS STL happy + AsmWriterOperand():OperandType(isLiteralTextOperand) {} AsmWriterOperand(const std::string &LitStr) : OperandType(isLiteralTextOperand), Str(LitStr) {} From baldrick at free.fr Mon Oct 27 14:59:01 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Oct 2008 20:59:01 +0100 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <16e5fdf90810271128q7561854fo25234c6fc40e7172@mail.gmail.com> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810271900.33073.baldrick@free.fr> <16e5fdf90810271128q7561854fo25234c6fc40e7172@mail.gmail.com> Message-ID: <200810272059.01601.baldrick@free.fr> Hi Bill, > It's not ideal, but I suppose it's okay for now. I did see this > failure now happening on my PPC box: > > $ llvm-dis -o - bug.bc > ; ModuleID = 'bugpoint-reduced-simplified.bc' > target datalayout = > "E-p:64:64:64-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-f128:64:128" > target triple = "powerpc64-apple-darwin9.5" ... > Does this look related to your stuff? yup, thanks for the testcase! Investigating... Ciao, Duncan. From tonic at nondot.org Mon Oct 27 15:40:33 2008 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 27 Oct 2008 15:40:33 -0500 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200810272040.m9RKeX2d031000@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.163 -> 1.164 --- Log message: Update release schedule. --- Diffs of the changes: (+3 -3) www-index.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.163 llvm-www/www-index.html:1.164 --- llvm-www/www-index.html:1.163 Fri Oct 3 12:14:35 2008 +++ llvm-www/www-index.html Mon Oct 27 15:39:48 2008 @@ -110,9 +110,9 @@
    • Oct 6, 2008: Branch creation/Code Freeze (9PM PDT).
    • Oct 9, 2008: First round of pre-release testing begins.
    • Oct 19, 2008: Pre-release testing ends.
    • -
    • Oct 21, 2008: Second round of pre-release testing begins.
    • -
    • Oct 28, 2008: Pre-release testing ends.
    • -
    • Oct 30, 2008: 2.4 Released.
    • +
    • Oct 29, 2008: Second round of pre-release testing begins.
    • +
    • Nov 3, 2008: Pre-release testing ends.
    • +
    • Nov 5, 2008: 2.4 Released.
From gohman at apple.com Mon Oct 27 15:46:33 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Oct 2008 20:46:33 -0000 Subject: [llvm-commits] [test-suite] r58267 - in /test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac: pdefs.h precision.h Message-ID: <200810272046.m9RKkXS5031215@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 27 15:46:33 2008 New Revision: 58267 URL: http://llvm.org/viewvc/llvm-project?rev=58267&view=rev Log: Fix cfrac on LP64 platforms. Some prototypes for functions that return pointer values where mistakenly missing, and the typedef for u32 was broken. Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/pdefs.h test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/precision.h Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/pdefs.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/pdefs.h?rev=58267&r1=58266&r2=58267&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/pdefs.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/pdefs.h Mon Oct 27 15:46:33 2008 @@ -43,9 +43,10 @@ /* * These next four types are used only used in this include file */ -typedef unsigned char u8; /* 8 bits */ -typedef unsigned short u16; /* 16 bits */ -typedef unsigned long u32; /* 32 bits */ +#include +typedef uint8_t u8; /* 8 bits */ +typedef uint16_t u16; /* 16 bits */ +typedef uint32_t u32; /* 32 bits */ typedef u8 boolean; /* 1 bit */ #define BASE 65536 /* Base * (Base-1) <= MAXINT */ Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/precision.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/precision.h?rev=58267&r1=58266&r2=58267&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/precision.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/cfrac/precision.h Mon Oct 27 15:46:33 2008 @@ -118,11 +118,18 @@ #endif #ifdef __STDC__ /* if ANSI compiler */ +/* LLVM - Disable all of the inlining */ +#if 0 #ifndef __GNUC__ extern precision pnew(precision); /* initialization */ extern precision presult(precision); /* function result */ extern precision psetq(precision *, precision); /* quick assignment */ #endif +#else +extern precision pnew(precision); /* initialization */ +extern precision presult(precision); /* function result */ +extern precision psetq(precision *, precision); /* quick assignment */ +#endif extern precision psetv(precision *, precision); /* checked assignment */ extern precision pparmv(precision); /* checked parameter */ extern precision pparmf(precision); /* unchecked parameter (fn) */ @@ -225,11 +232,18 @@ * Function versions of above if you still want side effects */ +/* LLVM - Disable all of the inlining */ +#if 0 #ifndef __GNUC__ extern precision pnew(); /* initialization */ extern precision presult(); /* function result */ extern precision psetq(); /* quick assignment */ #endif +#else +extern precision pnew(); /* initialization */ +extern precision presult(); /* function result */ +extern precision psetq(); /* quick assignment */ +#endif extern precision psetv(); /* checked assignment */ extern precision pparmv(); /* checked parameter */ extern precision pparmf(); /* unchecked parameter (fn) */ From daniel at zuster.org Mon Oct 27 15:50:02 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 27 Oct 2008 20:50:02 -0000 Subject: [llvm-commits] [llvm] r58268 - /llvm/trunk/include/llvm/ADT/StringSet.h Message-ID: <200810272050.m9RKo20b031332@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Oct 27 15:50:02 2008 New Revision: 58268 URL: http://llvm.org/viewvc/llvm-project?rev=58268&view=rev Log: Return bool (inserted) from StringSet::insert as for StringMap::insert. Modified: llvm/trunk/include/llvm/ADT/StringSet.h Modified: llvm/trunk/include/llvm/ADT/StringSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringSet.h?rev=58268&r1=58267&r2=58268&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringSet.h (original) +++ llvm/trunk/include/llvm/ADT/StringSet.h Mon Oct 27 15:50:02 2008 @@ -27,12 +27,12 @@ class StringSet : public llvm::StringMap { typedef llvm::StringMap base; public: - void insert (const std::string& InLang) { + bool insert (const std::string& InLang) { assert(!InLang.empty()); const char* KeyStart = &InLang[0]; const char* KeyEnd = KeyStart + InLang.size(); - base::insert(llvm::StringMapEntry:: - Create(KeyStart, KeyEnd, base::getAllocator(), '+')); + return base::insert(llvm::StringMapEntry:: + Create(KeyStart, KeyEnd, base::getAllocator(), '+')); } }; } From dalej at apple.com Mon Oct 27 16:00:31 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Oct 2008 21:00:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58271 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/_Pragma3.c Message-ID: <200810272100.m9RL0VBM031701@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 27 16:00:31 2008 New Revision: 58271 URL: http://llvm.org/viewvc/llvm-project?rev=58271&view=rev Log: attempt to store with a later timestamp Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/_Pragma3.c Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/_Pragma3.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/_Pragma3.c?rev=58271&r1=58270&r2=58271&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/_Pragma3.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/_Pragma3.c Mon Oct 27 16:00:31 2008 @@ -3,7 +3,7 @@ /* { dg-do preprocess } */ /* Pragma buffers have a NULL "inc" member, which we would dereference - when getting a file's date and time. + when getting a file's date and time. Based on PR 7526. 14 Aug 2002. */ From dalej at apple.com Mon Oct 27 16:09:35 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Oct 2008 21:09:35 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp Message-ID: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 27 16:09:34 2008 New Revision: 58273 URL: http://llvm.org/viewvc/llvm-project?rev=58273&view=rev Log: Hack the relative timestamps of _Pragma3.c and its included file. Not sure how portable 'touch' is, if it doesn't work for you please substitute whatever your equivalent functionality is... Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp?rev=58273&r1=58272&r2=58273&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp Mon Oct 27 16:09:34 2008 @@ -28,6 +28,10 @@ foreach header { A.h bA.h c.h d/d.h } { remote_download host $srcdir/$subdir/inc/$header $header } +# LLVM LOCAL the timestamp of this file must be newer than that of +# a file it includes, or the test fails. +exec touch $srcdir/$subdir/_Pragma3.c + # APPLE LOCAL end headermaps # Load support procs. From greened at obbligato.org Mon Oct 27 16:56:29 2008 From: greened at obbligato.org (David Greene) Date: Mon, 27 Oct 2008 21:56:29 -0000 Subject: [llvm-commits] [llvm] r58278 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/Alpha/AlphaISelDAGToDAG.cpp lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/IA64/IA64ISelDAGToDAG.cpp lib/Target/Mips/MipsISelDAGToDAG.cpp lib/Target/PIC16/PIC16ISelDAGToDAG.cpp lib/Target/PowerPC/PPCISelDAGToDAG.cpp lib/Target/Sparc/SparcISelDAGToDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp utils/TableGen/DAGISelEmitter.cpp Message-ID: <200810272156.m9RLuT7v001548@zion.cs.uiuc.edu> Author: greened Date: Mon Oct 27 16:56:29 2008 New Revision: 58278 URL: http://llvm.org/viewvc/llvm-project?rev=58278&view=rev Log: Have TableGen emit setSubgraphColor calls under control of a -gen-debug flag. Then in a debugger developers can set breakpoints at these calls to see waht is about to be selected and what the resulting subgraph looks like. This really helps when debugging instruction selection. Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Mon Oct 27 16:56:29 2008 @@ -153,7 +153,7 @@ /// SelectRoot - Top level entry to DAG instruction selector. /// Selects instructions starting at the root of the current DAG. -void SelectRoot() { +void SelectRoot(SelectionDAG &DAG) { SelectRootInit(); unsigned NumBytes = (DAGSize + 7) / 8; ISelQueued = new unsigned char[NumBytes]; @@ -176,14 +176,18 @@ // Skip already selected nodes. if (isSelected(Node->getNodeId())) continue; + DAG.setSubgraphColor(Node, "red"); SDNode *ResNode = Select(SDValue(Node, 0)); // If node should not be replaced, // continue with the next one. if (ResNode == Node) continue; // Replace node. - if (ResNode) + if (ResNode) { + DAG.setSubgraphColor(ResNode, "yellow"); + DAG.setSubgraphColor(ResNode, "black"); ReplaceUses(Node, ResNode); + } // If after the replacement this node is not used any more, // remove this dead node. if (Node->use_empty()) { // Don't delete EntryToken, etc. @@ -191,6 +195,7 @@ CurDAG->RemoveDeadNode(Node, &ISQU); UpdateQueue(ISQU); } + //DAG.setSubgraphColor(Node, "black"); } delete[] ISelQueued; Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -94,7 +94,7 @@ void ARMDAGToDAGISel::InstructionSelect() { DEBUG(BB->dump()); - SelectRoot(); + SelectRoot(*CurDAG); CurDAG->RemoveDeadNodes(); } Modified: llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -230,7 +230,7 @@ DEBUG(BB->dump()); // Select target instructions for the DAG. - SelectRoot(); + SelectRoot(*CurDAG); CurDAG->RemoveDeadNodes(); } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -344,7 +344,7 @@ DEBUG(BB->dump()); // Select target instructions for the DAG. - SelectRoot(); + SelectRoot(*CurDAG); CurDAG->RemoveDeadNodes(); } Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -97,7 +97,7 @@ DEBUG(BB->dump()); // Select target instructions for the DAG. - SelectRoot(); + SelectRoot(*CurDAG); CurDAG->RemoveDeadNodes(); } Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -105,7 +105,7 @@ #endif // Select target instructions for the DAG. - SelectRoot(); + SelectRoot(*CurDAG); #ifndef NDEBUG DOUT << "===== Instruction selection ends:\n"; Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -102,7 +102,7 @@ #endif // Select target instructions for the DAG. - SelectRoot(); + SelectRoot(*CurDAG); DOUT << "===== Instruction selection ends:\n"; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -204,7 +204,7 @@ DEBUG(BB->dump()); // Select target instructions for the DAG. - SelectRoot(); + SelectRoot(*CurDAG); CurDAG->RemoveDeadNodes(); } Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -70,7 +70,7 @@ DEBUG(BB->dump()); // Select target instructions for the DAG. - SelectRoot(); + SelectRoot(*CurDAG); CurDAG->RemoveDeadNodes(); } Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Oct 27 16:56:29 2008 @@ -655,7 +655,7 @@ DOUT << "===== Instruction selection begins:\n"; Indent = 0; #endif - SelectRoot(); + SelectRoot(*CurDAG); #ifndef NDEBUG DOUT << "===== Instruction selection ends:\n"; #endif Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=58278&r1=58277&r2=58278&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Oct 27 16:56:29 2008 @@ -14,13 +14,21 @@ #include "DAGISelEmitter.h" #include "Record.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/Streams.h" #include #include using namespace llvm; +namespace { + cl::opt + GenDebug("gen-debug", cl::desc("Generate debug code"), + cl::init(false)); +} + //===----------------------------------------------------------------------===// // DAGISelEmitter Helper methods // @@ -969,6 +977,10 @@ emitCode("InChains.push_back(" + ChainName + ");"); emitCode(ChainName + " = CurDAG->getNode(ISD::TokenFactor, MVT::Other, " "&InChains[0], InChains.size());"); + if (GenDebug) { + emitCode("CurDAG->setSubgraphColor(" + ChainName +".getNode(), \"yellow\");"); + emitCode("CurDAG->setSubgraphColor(" + ChainName +".getNode(), \"black\");"); + } } // Loop over all of the operands of the instruction pattern, emitting code @@ -1096,13 +1108,18 @@ if (II.isSimpleLoad | II.mayLoad | II.mayStore) { std::vector::const_iterator mi, mie; for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) { - emitCode("SDValue LSI_" + *mi + " = " + std::string LSIName = "LSI_" + *mi; + emitCode("SDValue " + LSIName + " = " "CurDAG->getMemOperand(cast(" + *mi + ")->getMemOperand());"); + if (GenDebug) { + emitCode("CurDAG->setSubgraphColor(" + LSIName +".getNode(), \"yellow\");"); + emitCode("CurDAG->setSubgraphColor(" + LSIName +".getNode(), \"black\");"); + } if (IsVariadic) - emitCode("Ops" + utostr(OpsNo) + ".push_back(LSI_" + *mi + ");"); + emitCode("Ops" + utostr(OpsNo) + ".push_back(" + LSIName + ");"); else - AllOps.push_back("LSI_" + *mi); + AllOps.push_back(LSIName); } } @@ -1269,6 +1286,18 @@ } emitCode(CodePrefix + Code + ");"); + + if (GenDebug) { + if (!isRoot) { + emitCode("CurDAG->setSubgraphColor(" + NodeName +".getNode(), \"yellow\");"); + emitCode("CurDAG->setSubgraphColor(" + NodeName +".getNode(), \"black\");"); + } + else { + emitCode("CurDAG->setSubgraphColor(" + NodeName +", \"yellow\");"); + emitCode("CurDAG->setSubgraphColor(" + NodeName +", \"black\");"); + } + } + for (unsigned i = 0, e = After.size(); i != e; ++i) emitCode(After[i]); @@ -1766,8 +1795,19 @@ // Replace the emission code within selection routines with calls to the // emission functions. - CallerCode = "return Emit_" + utostr(EmitFuncNum) + CallerCode; - GeneratedCode.push_back(std::make_pair(false, CallerCode)); + if (GenDebug) { + GeneratedCode.push_back(std::make_pair(0, "CurDAG->setSubgraphColor(N.getNode(), \"red\");")); + } + CallerCode = "SDNode *Result = Emit_" + utostr(EmitFuncNum) + CallerCode; + GeneratedCode.push_back(std::make_pair(3, CallerCode)); + if (GenDebug) { + GeneratedCode.push_back(std::make_pair(0, "if(Result) {")); + GeneratedCode.push_back(std::make_pair(0, " CurDAG->setSubgraphColor(Result, \"yellow\");")); + GeneratedCode.push_back(std::make_pair(0, " CurDAG->setSubgraphColor(Result, \"black\");")); + GeneratedCode.push_back(std::make_pair(0, "}")); + //GeneratedCode.push_back(std::make_pair(0, "CurDAG->setSubgraphColor(N.getNode(), \"black\");")); + } + GeneratedCode.push_back(std::make_pair(0, "return Result;")); } // Print function. From kremenek at apple.com Mon Oct 27 17:05:57 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 27 Oct 2008 22:05:57 -0000 Subject: [llvm-commits] [llvm] r58283 - /llvm/tags/checker/checker-118/ Message-ID: <200810272205.m9RM5vlg001947@zion.cs.uiuc.edu> Author: kremenek Date: Mon Oct 27 17:05:57 2008 New Revision: 58283 URL: http://llvm.org/viewvc/llvm-project?rev=58283&view=rev Log: Tagging checker-118. Added: llvm/tags/checker/checker-118/ - copied from r58282, llvm/trunk/ From evan.cheng at apple.com Mon Oct 27 17:22:03 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Oct 2008 15:22:03 -0700 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <200810272059.01601.baldrick@free.fr> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810271900.33073.baldrick@free.fr> <16e5fdf90810271128q7561854fo25234c6fc40e7172@mail.gmail.com> <200810272059.01601.baldrick@free.fr> Message-ID: <62BE7F59-47B9-40C5-ADEC-185E066BBAC3@apple.com> Hi Duncan, Apple style llvm-gcc is not building now due to this: Undefined symbols: "___fixunstfsi", referenced from: ___fixunstfdi in _fixunstfdi_s.o ___fixunstfdi in _fixunstfdi_s.o ___fixunstfdi in _fixunstfdi_s.o ld: symbol(s) not found collect2: ld returned 1 exit status Looks like ppc backend is generating __fixunstfsi now. I'll send you a bc file. Thanks, Evan On Oct 27, 2008, at 12:59 PM, Duncan Sands wrote: > Hi Bill, > >> It's not ideal, but I suppose it's okay for now. I did see this >> failure now happening on my PPC box: >> >> $ llvm-dis -o - bug.bc >> ; ModuleID = 'bugpoint-reduced-simplified.bc' >> target datalayout = >> "E-p:64:64:64-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-f128:64:128" >> target triple = "powerpc64-apple-darwin9.5" > ... >> Does this look related to your stuff? > > yup, thanks for the testcase! Investigating... > > Ciao, > > Duncan. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From kremenek at apple.com Mon Oct 27 17:43:07 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 27 Oct 2008 22:43:07 -0000 Subject: [llvm-commits] [llvm] r58290 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200810272243.m9RMh7JJ003252@zion.cs.uiuc.edu> Author: kremenek Date: Mon Oct 27 17:43:07 2008 New Revision: 58290 URL: http://llvm.org/viewvc/llvm-project?rev=58290&view=rev Log: Fix bogus comparison of "const char *" with c-string literal. Use strcmp instead. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=58290&r1=58289&r2=58290&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Oct 27 17:43:07 2008 @@ -369,10 +369,10 @@ bool printed = false; if (setSubgraphColorHelper(N, Color, visited, 0, printed)) { // Visually mark that we hit the limit - if (Color == "red" ) { + if (strcmp(Color, "red") == 0) { setSubgraphColorHelper(N, "blue", visited, 0, printed); } - else if (Color == "yellow" ) { + else if (strcmp(Color, "yellow") == 0) { setSubgraphColorHelper(N, "green", visited, 0, printed); } } From echristo at apple.com Mon Oct 27 18:02:57 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Oct 2008 16:02:57 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58271 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/_Pragma3.c In-Reply-To: <200810272100.m9RL0VBM031701@zion.cs.uiuc.edu> References: <200810272100.m9RL0VBM031701@zion.cs.uiuc.edu> Message-ID: <9528AF5B-AB4F-46EB-8DC1-115BD2E24EE3@apple.com> On Oct 27, 2008, at 2:00 PM, Dale Johannesen wrote: > Author: johannes > Date: Mon Oct 27 16:00:31 2008 > New Revision: 58271 > > URL: http://llvm.org/viewvc/llvm-project?rev=58271&view=rev > Log: > attempt to store with a later timestamp The gcc_update script should handle this. -eric From echristo at apple.com Mon Oct 27 18:03:33 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Oct 2008 16:03:33 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp In-Reply-To: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> References: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> Message-ID: <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> On Oct 27, 2008, at 2:09 PM, Dale Johannesen wrote: > Author: johannes > Date: Mon Oct 27 16:09:34 2008 > New Revision: 58273 > > URL: http://llvm.org/viewvc/llvm-project?rev=58273&view=rev > Log: > Hack the relative timestamps of _Pragma3.c and its included file. > > Not sure how portable 'touch' is, if it doesn't work for you please > substitute whatever your equivalent functionality is... > This is what gcc_update does - probably be best to just have things use gcc_update instead. -eric From dalej at apple.com Mon Oct 27 18:12:34 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Oct 2008 16:12:34 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp In-Reply-To: <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> References: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> Message-ID: <4098B227-F7EB-4EAC-84AE-6B80697DBF44@apple.com> You may be right, but that appears to affect only generated files? That is not the problem here. On Oct 27, 2008, at 4:03 PMPDT, Eric Christopher wrote: > On Oct 27, 2008, at 2:09 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Mon Oct 27 16:09:34 2008 >> New Revision: 58273 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=58273&view=rev >> Log: >> Hack the relative timestamps of _Pragma3.c and its included file. >> >> Not sure how portable 'touch' is, if it doesn't work for you please >> substitute whatever your equivalent functionality is... >> > > This is what gcc_update does - probably be best to just have things > use gcc_update instead. > > -eric > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Mon Oct 27 18:19:33 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 23:19:33 -0000 Subject: [llvm-commits] [llvm] r58293 - in /llvm/tags/Apple/llvmCore-2077.3: ./ utils/buildit/build_llvm Message-ID: <200810272319.m9RNJXYu004442@zion.cs.uiuc.edu> Author: void Date: Mon Oct 27 18:19:33 2008 New Revision: 58293 URL: http://llvm.org/viewvc/llvm-project?rev=58293&view=rev Log: Pass in the LLVM_SUBMIT_VERSION flags when doing a 'make install'. The libLTO install process uses this flag. Added: llvm/tags/Apple/llvmCore-2077.3/ - copied from r58209, llvm/tags/Apple/llvmCore-2077.2/ Modified: llvm/tags/Apple/llvmCore-2077.3/utils/buildit/build_llvm Modified: llvm/tags/Apple/llvmCore-2077.3/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2077.3/utils/buildit/build_llvm?rev=58293&r1=58209&r2=58293&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2077.3/utils/buildit/build_llvm (original) +++ llvm/tags/Apple/llvmCore-2077.3/utils/buildit/build_llvm Mon Oct 27 18:19:33 2008 @@ -89,7 +89,7 @@ || exit 1 fi -SUBVERSION=`echo $RC_ProjectSourceVersion | sed -e 's/.*\.//'` +SUBVERSION=`echo $RC_ProjectSourceVersion | sed -e 's/[^.]*\.\([0-9]*\).*/\1/'` if [ "x$SUBVERSION" != "x$RC_ProjectSourceVersion" ]; then LLVM_SUBMIT_SUBVERSION=`printf "%02d" $SUBVERSION` @@ -138,7 +138,8 @@ make $JOBS_FLAG $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$TARGETS" \ LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \ LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \ - CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" + CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" \ + VERBOSE=1 if ! test $? == 0 ; then echo "error: LLVM 'make' failed!" @@ -158,7 +159,10 @@ # Install the tree into the destination directory. make $LOCAL_MAKEFLAGS $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$TARGETS" \ - OPTIMIZE_OPTION='-O2' install + OPTIMIZE_OPTION='-O2' \ + LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \ + LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \ + VERBOSE=1 install if ! test $? == 0 ; then echo "error: LLVM 'make install' failed!" From evan.cheng at apple.com Mon Oct 27 18:21:02 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Oct 2008 23:21:02 -0000 Subject: [llvm-commits] [llvm] r58294 - in /llvm/trunk: lib/CodeGen/PreAllocSplitting.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/X86/2008-10-27-CoalescerBug.ll Message-ID: <200810272321.m9RNL2cP004514@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 27 18:21:01 2008 New Revision: 58294 URL: http://llvm.org/viewvc/llvm-project?rev=58294&view=rev Log: Remove val# defined by a remat'ed def that is now dead. Added: llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58294&r1=58293&r2=58294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Mon Oct 27 18:21:01 2008 @@ -561,6 +561,9 @@ SpillMI = prior(SpillPt); LIs->InsertMachineInstrInMaps(SpillMI, SpillIndex); } else if (!PrevSpilled) { + if (!DefMI) + // Def is dead. Do nothing. + return false; // If it's already split, just restore the value. There is no need to spill // the def again. // Check if it's possible to insert a spill after the def MI. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=58294&r1=58293&r2=58294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Oct 27 18:21:01 2008 @@ -707,6 +707,18 @@ return false; } +/// RemoveDeadDef - If a def of a live interval is now determined dead, remove +/// the val# it defines. If the live interval becomes empty, remove it as well. +bool SimpleRegisterCoalescing::RemoveDeadDef(LiveInterval &li, + MachineInstr *DefMI) { + unsigned DefIdx = li_->getDefIndex(li_->getInstructionIndex(DefMI)); + LiveInterval::iterator MLR = li.FindLiveRangeContaining(DefIdx); + if (DefIdx != MLR->valno->def) + return false; + li.removeValNo(MLR->valno); + return removeIntervalIfEmpty(li, li_, tri_); +} + /// PropagateDeadness - Propagate the dead marker to the instruction which /// defines the val#. static void PropagateDeadness(LiveInterval &li, MachineInstr *CopyMI, @@ -2280,6 +2292,7 @@ // Perform a final pass over the instructions and compute spill weights // and remove identity moves. + SmallVector DeadDefs; for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end(); mbbi != mbbe; ++mbbi) { MachineBasicBlock* mbb = mbbi; @@ -2313,9 +2326,13 @@ bool isDead = true; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || MO.isDead()) + if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); + if (TargetRegisterInfo::isVirtualRegister(Reg)) + DeadDefs.push_back(Reg); + if (MO.isDead()) + continue; if (TargetRegisterInfo::isPhysicalRegister(Reg) || !mri_->use_empty(Reg)) { isDead = false; @@ -2323,10 +2340,16 @@ } } if (isDead) { + while (!DeadDefs.empty()) { + unsigned DeadDef = DeadDefs.back(); + DeadDefs.pop_back(); + RemoveDeadDef(li_->getInterval(DeadDef), MI); + } li_->RemoveMachineInstrFromMaps(mii); mii = mbbi->erase(mii); continue; - } + } else + DeadDefs.clear(); } // If the move will be an identity move delete it Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h?rev=58294&r1=58293&r2=58294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h Mon Oct 27 18:21:01 2008 @@ -269,6 +269,11 @@ /// live range is dead. Return true if live interval is removed. bool ShortenDeadCopySrcLiveRange(LiveInterval &li, MachineInstr *CopyMI); + /// RemoveDeadDef - If a def of a live interval is now determined dead, + /// remove the val# it defines. If the live interval becomes empty, remove + /// it as well. + bool RemoveDeadDef(LiveInterval &li, MachineInstr *DefMI); + /// lastRegisterUse - Returns the last use of the specific register between /// cycles Start and End or NULL if there are no uses. MachineOperand *lastRegisterUse(unsigned Start, unsigned End, unsigned Reg, Added: llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll?rev=58294&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll Mon Oct 27 18:21:01 2008 @@ -0,0 +1,44 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |& not grep {Number of register spills} + +define fastcc void @fourn(double* %data, i32 %isign) nounwind { +entry: + br label %bb + +bb: ; preds = %bb, %entry + %indvar93 = phi i32 [ 0, %entry ], [ %idim.030, %bb ] ; [#uses=2] + %idim.030 = add i32 %indvar93, 1 ; [#uses=1] + %0 = add i32 %indvar93, 2 ; [#uses=1] + %1 = icmp sgt i32 %0, 2 ; [#uses=1] + br i1 %1, label %bb30.loopexit, label %bb + +bb3: ; preds = %bb30.loopexit, %bb25, %bb3 + %2 = load i32* null, align 4 ; [#uses=1] + %3 = mul i32 %2, 0 ; [#uses=1] + %4 = icmp slt i32 0, %3 ; [#uses=1] + br i1 %4, label %bb18, label %bb3 + +bb18: ; preds = %bb3 + %5 = fdiv double %11, 0.000000e+00 ; [#uses=1] + %6 = tail call double @sin(double %5) nounwind readonly ; [#uses=1] + br label %bb24.preheader + +bb22.preheader: ; preds = %bb24.preheader, %bb22.preheader + br label %bb22.preheader + +bb25: ; preds = %bb24.preheader + %7 = mul double 0.000000e+00, %6 ; [#uses=0] + %8 = add i32 %i3.122100, 0 ; [#uses=1] + %9 = icmp sgt i32 %8, 0 ; [#uses=1] + br i1 %9, label %bb3, label %bb24.preheader + +bb24.preheader: ; preds = %bb25, %bb18 + %i3.122100 = or i32 0, 1 ; [#uses=2] + %10 = icmp slt i32 0, %i3.122100 ; [#uses=1] + br i1 %10, label %bb25, label %bb22.preheader + +bb30.loopexit: ; preds = %bb + %11 = mul double 0.000000e+00, 0x401921FB54442D1C ; [#uses=1] + br label %bb3 +} + +declare double @sin(double) nounwind readonly From isanbard at gmail.com Mon Oct 27 18:22:50 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 23:22:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58295 - /llvm-gcc-4.2/tags/llvmgcc42-2077.3/ Message-ID: <200810272322.m9RNMofa004593@zion.cs.uiuc.edu> Author: void Date: Mon Oct 27 18:22:50 2008 New Revision: 58295 URL: http://llvm.org/viewvc/llvm-project?rev=58295&view=rev Log: Copy from llvmgcc42-2077.2 to keep version numbers in sync with llvmCore. Added: llvm-gcc-4.2/tags/llvmgcc42-2077.3/ - copied from r58294, llvm-gcc-4.2/tags/llvmgcc42-2077.2/ From greened at obbligato.org Mon Oct 27 18:24:04 2008 From: greened at obbligato.org (David Greene) Date: Mon, 27 Oct 2008 23:24:04 -0000 Subject: [llvm-commits] [llvm] r58296 - /llvm/trunk/lib/Analysis/ValueTracking.cpp Message-ID: <200810272324.m9RNO4SD004642@zion.cs.uiuc.edu> Author: greened Date: Mon Oct 27 18:24:03 2008 New Revision: 58296 URL: http://llvm.org/viewvc/llvm-project?rev=58296&view=rev Log: Re-apply 55137 with fixes. Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=58296&r1=58295&r2=58296&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Oct 27 18:24:03 2008 @@ -509,12 +509,15 @@ ComputeMaskedBits(R, Mask2, KnownZero2, KnownOne2, TD, Depth+1); Mask2 = APInt::getLowBitsSet(BitWidth, KnownZero2.countTrailingOnes()); - KnownOne2.clear(); - KnownZero2.clear(); - ComputeMaskedBits(L, Mask2, KnownZero2, KnownOne2, TD, Depth+1); + + // We need to take the minimum number of known bits + APInt KnownZero3(KnownZero), KnownOne3(KnownOne); + ComputeMaskedBits(L, Mask2, KnownZero3, KnownOne3, TD, Depth+1); + KnownZero = Mask & APInt::getLowBitsSet(BitWidth, - KnownZero2.countTrailingOnes()); + std::min(KnownZero2.countTrailingOnes(), + KnownZero3.countTrailingOnes())); break; } } From evan.cheng at apple.com Mon Oct 27 18:29:28 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Oct 2008 23:29:28 -0000 Subject: [llvm-commits] [llvm] r58297 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Message-ID: <200810272329.m9RNTSLO004863@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 27 18:29:28 2008 New Revision: 58297 URL: http://llvm.org/viewvc/llvm-project?rev=58297&view=rev Log: Silence a bogus compile time warning. Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58297&r1=58296&r2=58297&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Mon Oct 27 18:29:28 2008 @@ -543,9 +543,9 @@ // Add a spill either before the barrier or after the definition. MachineBasicBlock *DefMBB = DefMI ? DefMI->getParent() : NULL; const TargetRegisterClass *RC = MRI->getRegClass(CurrLI->reg); - int SS; unsigned SpillIndex = 0; MachineInstr *SpillMI = NULL; + int SS = -1; bool PrevSpilled = isAlreadySplit(CurrLI->reg, ValNo->id, SS); if (ValNo->def == ~0U) { // If it's defined by a phi, we must split just before the barrier. From isanbard at gmail.com Mon Oct 27 18:31:24 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 23:31:24 -0000 Subject: [llvm-commits] [llvm] r58298 - /llvm/trunk/utils/buildit/build_llvm Message-ID: <200810272331.m9RNVOSl004936@zion.cs.uiuc.edu> Author: void Date: Mon Oct 27 18:31:24 2008 New Revision: 58298 URL: http://llvm.org/viewvc/llvm-project?rev=58298&view=rev Log: - Fix SUBVERSION string to handle x.x.x version number formats. - Add VERBOSE=1 flag. - Specify the LLVM_SUBMIT_VERSION when doing the "make install". The libLTO.dylib relies upon this flag during that time. Modified: llvm/trunk/utils/buildit/build_llvm Modified: llvm/trunk/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=58298&r1=58297&r2=58298&view=diff ============================================================================== --- llvm/trunk/utils/buildit/build_llvm (original) +++ llvm/trunk/utils/buildit/build_llvm Mon Oct 27 18:31:24 2008 @@ -89,7 +89,7 @@ || exit 1 fi -SUBVERSION=`echo $RC_ProjectSourceVersion | sed -e 's/.*\.//'` +SUBVERSION=`echo $RC_ProjectSourceVersion | sed -e 's/[^.]*\.\([0-9]*\).*/\1/'` if [ "x$SUBVERSION" != "x$RC_ProjectSourceVersion" ]; then LLVM_SUBMIT_SUBVERSION=`printf "%02d" $SUBVERSION` @@ -138,7 +138,8 @@ make $JOBS_FLAG $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$TARGETS" \ LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \ LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \ - CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" + CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" \ + VERBOSE=1 if ! test $? == 0 ; then echo "error: LLVM 'make' failed!" @@ -158,7 +159,9 @@ # Install the tree into the destination directory. make $LOCAL_MAKEFLAGS $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$TARGETS" \ - OPTIMIZE_OPTION='-O2' install + LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \ + LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \ + OPTIMIZE_OPTION='-O2' VERBOSE=1 install if ! test $? == 0 ; then echo "error: LLVM 'make install' failed!" From isanbard at gmail.com Mon Oct 27 18:32:46 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 23:32:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58299 - in /llvm-gcc-4.2/tags: Apple/llvmgcc42-2077.2/ llvmgcc42-2077.2/ Message-ID: <200810272332.m9RNWkiJ004981@zion.cs.uiuc.edu> Author: void Date: Mon Oct 27 18:32:46 2008 New Revision: 58299 URL: http://llvm.org/viewvc/llvm-project?rev=58299&view=rev Log: Move Apple tag into the Apple subdirectory. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2077.2/ - copied from r58298, llvm-gcc-4.2/tags/llvmgcc42-2077.2/ Removed: llvm-gcc-4.2/tags/llvmgcc42-2077.2/ From echristo at apple.com Mon Oct 27 18:39:02 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Oct 2008 16:39:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp In-Reply-To: <4098B227-F7EB-4EAC-84AE-6B80697DBF44@apple.com> References: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> <4098B227-F7EB-4EAC-84AE-6B80697DBF44@apple.com> Message-ID: On Oct 27, 2008, at 4:12 PM, Dale Johannesen wrote: > You may be right, but that appears to affect only generated files? > That is not the problem here. Hmm.. it used to, doesn't appear to anymore - it is part of the script though (grep for Pragma) and probably affects the Makefiles used to make sure that the time stamp is reasonable. -eric From isanbard at gmail.com Mon Oct 27 18:53:13 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Oct 2008 23:53:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58301 - in /llvm-gcc-4.2/tags: Apple/llvmgcc42-2077.3/ llvmgcc42-2077.3/ Message-ID: <200810272353.m9RNrDLD005631@zion.cs.uiuc.edu> Author: void Date: Mon Oct 27 18:53:12 2008 New Revision: 58301 URL: http://llvm.org/viewvc/llvm-project?rev=58301&view=rev Log: Move llvmgcc42-2077.3 into Apple directory. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2077.3/ - copied from r58300, llvm-gcc-4.2/tags/llvmgcc42-2077.3/ Removed: llvm-gcc-4.2/tags/llvmgcc42-2077.3/ From dalej at apple.com Mon Oct 27 19:36:37 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Oct 2008 17:36:37 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp In-Reply-To: References: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> <4098B227-F7EB-4EAC-84AE-6B80697DBF44@apple.com> Message-ID: <7FE8A066-5C78-4553-969D-271A9F1CFCCE@apple.com> That does look like it's trying to solve the same problem. OTOH, it is not invoked automatically, at least not by the build+test procedure we use here; I consider a solution contained within the testsuite much cleaner; and that script looks like serious overkill for the problem. So I'm inclined to leave it alone. On Oct 27, 2008, at 4:39 PMPDT, Eric Christopher wrote: > On Oct 27, 2008, at 4:12 PM, Dale Johannesen wrote: > >> You may be right, but that appears to affect only generated files? >> That is not the problem here. > > Hmm.. it used to, doesn't appear to anymore - it is part of the script > though (grep for Pragma) and probably affects the Makefiles used to > make sure that the time stamp is reasonable. > > -eric > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Mon Oct 27 19:47:50 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Oct 2008 00:47:50 -0000 Subject: [llvm-commits] [llvm] r58309 - in /llvm/trunk: lib/CodeGen/PreAllocSplitting.cpp test/CodeGen/X86/pre-split8.ll test/CodeGen/X86/pre-split9.ll Message-ID: <200810280047.m9S0loPr008149@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 27 19:47:49 2008 New Revision: 58309 URL: http://llvm.org/viewvc/llvm-project?rev=58309&view=rev Log: Avoid putting a split past the end of the live range; always shrink wrap live interval in the barrier mbb. Added: llvm/trunk/test/CodeGen/X86/pre-split8.ll llvm/trunk/test/CodeGen/X86/pre-split9.ll Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58309&r1=58308&r2=58309&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Mon Oct 27 19:47:49 2008 @@ -109,7 +109,7 @@ SmallPtrSet&, unsigned&); MachineBasicBlock::iterator - findRestorePoint(MachineBasicBlock*, MachineInstr*, + findRestorePoint(MachineBasicBlock*, MachineInstr*, unsigned, SmallPtrSet&, unsigned&); void RecordSplit(unsigned, unsigned, unsigned, int); @@ -203,12 +203,15 @@ /// found. MachineBasicBlock::iterator PreAllocSplitting::findRestorePoint(MachineBasicBlock *MBB, MachineInstr *MI, + unsigned LastIdx, SmallPtrSet &RefsInMBB, unsigned &RestoreIndex) { MachineBasicBlock::iterator Pt = MBB->end(); + unsigned EndIdx = LIs->getMBBEndIdx(MBB); - // Go bottom up if RefsInMBB is empty. - if (RefsInMBB.empty()) { + // Go bottom up if RefsInMBB is empty and the end of the mbb isn't beyond + // the last index in the live range. + if (RefsInMBB.empty() && LastIdx >= EndIdx) { MachineBasicBlock::iterator MII = MBB->end(); MachineBasicBlock::iterator EndPt = MI; do { @@ -224,8 +227,12 @@ } else { MachineBasicBlock::iterator MII = MI; MII = ++MII; + // FIXME: Limit the number of instructions to examine to reduce + // compile time? while (MII != MBB->end()) { unsigned Index = LIs->getInstructionIndex(MII); + if (Index > LastIdx) + break; unsigned Gap = LIs->findGapBeforeInstr(Index); if (Gap) { Pt = MII; @@ -438,13 +445,15 @@ // If live interval is live in another successor path, then we can't process // this block. But we may able to do so after all the successors have been // processed. - for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), - SE = MBB->succ_end(); SI != SE; ++SI) { - MachineBasicBlock *SMBB = *SI; - if (SMBB == SuccMBB) - continue; - if (CurrLI->liveAt(LIs->getMBBStartIdx(SMBB))) - return; + if (MBB != BarrierMBB) { + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), + SE = MBB->succ_end(); SI != SE; ++SI) { + MachineBasicBlock *SMBB = *SI; + if (SMBB == SuccMBB) + continue; + if (CurrLI->liveAt(LIs->getMBBStartIdx(SMBB))) + return; + } } Visited.insert(MBB); @@ -536,7 +545,7 @@ // Find a point to restore the value after the barrier. unsigned RestoreIndex; MachineBasicBlock::iterator RestorePt = - findRestorePoint(BarrierMBB, Barrier, RefsInMBB, RestoreIndex); + findRestorePoint(BarrierMBB, Barrier, LR->end, RefsInMBB, RestoreIndex); if (RestorePt == BarrierMBB->end()) return false; Added: llvm/trunk/test/CodeGen/X86/pre-split8.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pre-split8.ll?rev=58309&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/pre-split8.ll (added) +++ llvm/trunk/test/CodeGen/X86/pre-split8.ll Mon Oct 27 19:47:49 2008 @@ -0,0 +1,35 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& \ +; RUN: grep {pre-alloc-split} | grep {Number of intervals split} | grep 1 + + at current_surfaces.b = external global i1 ; [#uses=1] + +declare double @asin(double) nounwind readonly + +declare double @tan(double) nounwind readonly + +define fastcc void @trace_line(i32 %line) nounwind { +entry: + %.b3 = load i1* @current_surfaces.b ; [#uses=1] + br i1 %.b3, label %bb, label %return + +bb: ; preds = %bb9.i, %entry + %.rle4 = phi double [ %7, %bb9.i ], [ 0.000000e+00, %entry ] ; [#uses=1] + %0 = load double* null, align 8 ; [#uses=3] + %1 = fcmp une double %0, 0.000000e+00 ; [#uses=1] + br i1 %1, label %bb9.i, label %bb13.i + +bb9.i: ; preds = %bb + %2 = sub double %.rle4, %0 ; [#uses=0] + %3 = tail call double @asin(double 0.000000e+00) nounwind readonly ; [#uses=0] + %4 = mul double 0.000000e+00, %0 ; [#uses=1] + %5 = tail call double @tan(double 0.000000e+00) nounwind readonly ; [#uses=0] + %6 = mul double %4, 0.000000e+00 ; [#uses=1] + %7 = add double %6, 0.000000e+00 ; [#uses=1] + br i1 false, label %return, label %bb + +bb13.i: ; preds = %bb + unreachable + +return: ; preds = %bb9.i, %entry + ret void +} Added: llvm/trunk/test/CodeGen/X86/pre-split9.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pre-split9.ll?rev=58309&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/pre-split9.ll (added) +++ llvm/trunk/test/CodeGen/X86/pre-split9.ll Mon Oct 27 19:47:49 2008 @@ -0,0 +1,38 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& \ +; RUN: grep {pre-alloc-split} | grep {Number of intervals split} | grep 1 + + at current_surfaces.b = external global i1 ; [#uses=1] + +declare double @sin(double) nounwind readonly + +declare double @asin(double) nounwind readonly + +declare double @tan(double) nounwind readonly + +define fastcc void @trace_line(i32 %line) nounwind { +entry: + %.b3 = load i1* @current_surfaces.b ; [#uses=1] + br i1 %.b3, label %bb, label %return + +bb: ; preds = %bb9.i, %entry + %.rle4 = phi double [ %8, %bb9.i ], [ 0.000000e+00, %entry ] ; [#uses=1] + %0 = load double* null, align 8 ; [#uses=3] + %1 = fcmp une double %0, 0.000000e+00 ; [#uses=1] + br i1 %1, label %bb9.i, label %bb13.i + +bb9.i: ; preds = %bb + %2 = sub double %.rle4, %0 ; [#uses=0] + %3 = tail call double @asin(double 0.000000e+00) nounwind readonly ; [#uses=0] + %4 = tail call double @sin(double 0.000000e+00) nounwind readonly ; [#uses=1] + %5 = mul double %4, %0 ; [#uses=1] + %6 = tail call double @tan(double 0.000000e+00) nounwind readonly ; [#uses=0] + %7 = mul double %5, 0.000000e+00 ; [#uses=1] + %8 = add double %7, 0.000000e+00 ; [#uses=1] + br i1 false, label %return, label %bb + +bb13.i: ; preds = %bb + unreachable + +return: ; preds = %bb9.i, %entry + ret void +} From gohman at apple.com Mon Oct 27 19:52:46 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Oct 2008 00:52:46 -0000 Subject: [llvm-commits] [llvm] r58310 - /llvm/trunk/include/llvm/Support/NoFolder.h Message-ID: <200810280052.m9S0qkqn008297@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 27 19:52:46 2008 New Revision: 58310 URL: http://llvm.org/viewvc/llvm-project?rev=58310&view=rev Log: Fix the name of the include guard to match the filename. Modified: llvm/trunk/include/llvm/Support/NoFolder.h Modified: llvm/trunk/include/llvm/Support/NoFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=58310&r1=58309&r2=58310&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/NoFolder.h (original) +++ llvm/trunk/include/llvm/Support/NoFolder.h Mon Oct 27 19:52:46 2008 @@ -20,8 +20,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_SUPPORT_NULLFOLDER_H -#define LLVM_SUPPORT_NULLFOLDER_H +#ifndef LLVM_SUPPORT_NOFOLDER_H +#define LLVM_SUPPORT_NOFOLDER_H #include "llvm/Constants.h" #include "llvm/Instructions.h" From gohman at apple.com Mon Oct 27 20:00:31 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Oct 2008 18:00:31 -0700 Subject: [llvm-commits] [llvm] r58278 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/Alpha/AlphaISelDAGToDAG.cpp lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/IA64/IA64ISelDAGToDAG.cpp lib/Target/Mips/MipsISelDAGToDAG.cpp lib/Target/PIC16/PIC16ISelDAGToDAG.cpp lib/Target/PowerPC/PPCISelDAGToDAG.cpp lib/Target/Sparc/SparcISelDAGToDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp utils/TableGen/DAGISelEmitter.cpp In-Reply-To: <200810272156.m9RLuT7v001548@zion.cs.uiuc.edu> References: <200810272156.m9RLuT7v001548@zion.cs.uiuc.edu> Message-ID: <4F0BF11F-0920-4FC4-977D-7E12E5AA2A86@apple.com> On Oct 27, 2008, at 2:56 PM, David Greene wrote: > Author: greened > Date: Mon Oct 27 16:56:29 2008 > New Revision: 58278 > > URL: http://llvm.org/viewvc/llvm-project?rev=58278&view=rev > Log: > > Have TableGen emit setSubgraphColor calls under control of a -gen- > debug > flag. Then in a debugger developers can set breakpoints at these > calls > to see waht is about to be selected and what the resulting subgraph > looks like. This really helps when debugging instruction selection. Cool! Comments below. > > > Modified: > llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h > llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp > llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp > llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp > llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp > llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp > llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp > llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp > llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp > llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp > llvm/trunk/utils/TableGen/DAGISelEmitter.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58278&r1=58277&r2=58278&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) > +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Mon Oct 27 > 16:56:29 2008 > @@ -153,7 +153,7 @@ > > /// SelectRoot - Top level entry to DAG instruction selector. > /// Selects instructions starting at the root of the current DAG. > -void SelectRoot() { > +void SelectRoot(SelectionDAG &DAG) { This DAG parameter shouldn't be necessary. SelectRoot is a member of SelectionDAGISel, where it can access the CurDAG member. > > SelectRootInit(); > unsigned NumBytes = (DAGSize + 7) / 8; > ISelQueued = new unsigned char[NumBytes]; > @@ -176,14 +176,18 @@ > // Skip already selected nodes. > if (isSelected(Node->getNodeId())) > continue; > + DAG.setSubgraphColor(Node, "red"); I think this line should be guarded by #ifndef NDEBUG, so that it doesn't slow down release mode. Either that, or perhaps setSubgraphColor itself should be an empty inline function in the NDEBUG case. > > SDNode *ResNode = Select(SDValue(Node, 0)); > // If node should not be replaced, > // continue with the next one. > if (ResNode == Node) > continue; > // Replace node. > - if (ResNode) > + if (ResNode) { > + DAG.setSubgraphColor(ResNode, "yellow"); > + DAG.setSubgraphColor(ResNode, "black"); Setting the node to yellow and then immediately to black? > > ReplaceUses(Node, ResNode); > + } > // If after the replacement this node is not used any more, > // remove this dead node. > if (Node->use_empty()) { // Don't delete EntryToken, etc. > @@ -191,6 +195,7 @@ > CurDAG->RemoveDeadNode(Node, &ISQU); > UpdateQueue(ISQU); > } > + //DAG.setSubgraphColor(Node, "black"); Please decide what to do this code, instead of just leaving it here commented out. > > } > > delete[] ISelQueued; > > Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=58278&r1=58277&r2=58278&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Oct 27 16:56:29 > 2008 > @@ -14,13 +14,21 @@ > #include "DAGISelEmitter.h" > #include "Record.h" > #include "llvm/ADT/StringExtras.h" > +#include "llvm/Support/CommandLine.h" > #include "llvm/Support/Debug.h" > #include "llvm/Support/MathExtras.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/Streams.h" > #include > #include > using namespace llvm; > > +namespace { > + cl::opt > + GenDebug("gen-debug", cl::desc("Generate debug code"), > + cl::init(false)); > +} As a tablegen option, this cool functionality is somewhat out of common view. Would it make sense to turn this functionality on by default, with the code guarded by #ifndef NDEBUG? > > + > // > = > = > = > ----------------------------------------------------------------------= > ==// > // DAGISelEmitter Helper methods > // > @@ -969,6 +977,10 @@ > emitCode("InChains.push_back(" + ChainName + ");"); > emitCode(ChainName + " = CurDAG->getNode(ISD::TokenFactor, > MVT::Other, " > "&InChains[0], InChains.size());"); > + if (GenDebug) { > + emitCode("CurDAG->setSubgraphColor(" + ChainName > +".getNode(), \"yellow\");"); > + emitCode("CurDAG->setSubgraphColor(" + ChainName > +".getNode(), \"black\");"); > + } Again, yellow and then immediately black? > > } > > // Loop over all of the operands of the instruction pattern, > emitting code > @@ -1096,13 +1108,18 @@ > if (II.isSimpleLoad | II.mayLoad | II.mayStore) { > std::vector::const_iterator mi, mie; > for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) { > - emitCode("SDValue LSI_" + *mi + " = " > + std::string LSIName = "LSI_" + *mi; > + emitCode("SDValue " + LSIName + " = " > "CurDAG->getMemOperand(cast(" + > *mi + ")->getMemOperand());"); > + if (GenDebug) { > + emitCode("CurDAG->setSubgraphColor(" + LSIName > +".getNode(), \"yellow\");"); > + emitCode("CurDAG->setSubgraphColor(" + LSIName > +".getNode(), \"black\");"); > + } > if (IsVariadic) > - emitCode("Ops" + utostr(OpsNo) + ".push_back(LSI_" + > *mi + ");"); > + emitCode("Ops" + utostr(OpsNo) + ".push_back(" + > LSIName + ");"); > else > - AllOps.push_back("LSI_" + *mi); > + AllOps.push_back(LSIName); > } > } > > @@ -1269,6 +1286,18 @@ > } > > emitCode(CodePrefix + Code + ");"); > + > + if (GenDebug) { > + if (!isRoot) { > + emitCode("CurDAG->setSubgraphColor(" + NodeName > +".getNode(), \"yellow\");"); > + emitCode("CurDAG->setSubgraphColor(" + NodeName > +".getNode(), \"black\");"); > + } > + else { > + emitCode("CurDAG->setSubgraphColor(" + NodeName +", > \"yellow\");"); > + emitCode("CurDAG->setSubgraphColor(" + NodeName +", > \"black\");"); > + } > + } > + > for (unsigned i = 0, e = After.size(); i != e; ++i) > emitCode(After[i]); > > @@ -1766,8 +1795,19 @@ > > // Replace the emission code within selection routines with > calls to the > // emission functions. > - CallerCode = "return Emit_" + utostr(EmitFuncNum) + > CallerCode; > - GeneratedCode.push_back(std::make_pair(false, CallerCode)); > + if (GenDebug) { > + GeneratedCode.push_back(std::make_pair(0, "CurDAG- > >setSubgraphColor(N.getNode(), \"red\");")); > + } > + CallerCode = "SDNode *Result = Emit_" + utostr(EmitFuncNum) > + CallerCode; > + GeneratedCode.push_back(std::make_pair(3, CallerCode)); > + if (GenDebug) { > + GeneratedCode.push_back(std::make_pair(0, "if(Result) {")); > + GeneratedCode.push_back(std::make_pair(0, " CurDAG- > >setSubgraphColor(Result, \"yellow\");")); > + GeneratedCode.push_back(std::make_pair(0, " CurDAG- > >setSubgraphColor(Result, \"black\");")); > + GeneratedCode.push_back(std::make_pair(0, "}")); > + //GeneratedCode.push_back(std::make_pair(0, "CurDAG- > >setSubgraphColor(N.getNode(), \"black\");")); > + } > + GeneratedCode.push_back(std::make_pair(0, "return Result;")); > } > > // Print function. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Mon Oct 27 20:11:26 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Oct 2008 18:11:26 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp In-Reply-To: <7FE8A066-5C78-4553-969D-271A9F1CFCCE@apple.com> References: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> <4098B227-F7EB-4EAC-84AE-6B80697DBF44@apple.com> <7FE8A066-5C78-4553-969D-271A9F1CFCCE@apple.com> Message-ID: <3C6576B7-7366-4528-BD5A-19B6F4C137B8@apple.com> On Oct 27, 2008, at 5:36 PM, Dale Johannesen wrote: > That does look like it's trying to solve the same problem. OTOH, > it is not invoked automatically, at least not by the build+test > procedure we use here; I consider a solution contained within the > testsuite much cleaner; and that script looks like serious overkill > for > the problem. So I'm inclined to leave it alone. The script solves the problem for more than just that test. -eric From dalej at apple.com Mon Oct 27 20:15:28 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Oct 2008 18:15:28 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp In-Reply-To: <3C6576B7-7366-4528-BD5A-19B6F4C137B8@apple.com> References: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> <4098B227-F7EB-4EAC-84AE-6B80697DBF44@apple.com> <7FE8A066-5C78-4553-969D-271A9F1CFCCE@apple.com> <3C6576B7-7366-4528-BD5A-19B6F4C137B8@apple.com> Message-ID: <9906EE7E-773D-4AB1-A5B2-80956C79A728@apple.com> On Oct 27, 2008, at 6:11 PMPDT, Eric Christopher wrote: > > On Oct 27, 2008, at 5:36 PM, Dale Johannesen wrote: > >> That does look like it's trying to solve the same problem. OTOH, >> it is not invoked automatically, at least not by the build+test >> procedure we use here; I consider a solution contained within the >> testsuite much cleaner; and that script looks like serious overkill >> for >> the problem. So I'm inclined to leave it alone. > > The script solves the problem for more than just that test. That would certainly be a reason to use it, but AFAIK nobody has run into a similar problem anywhere else. From echristo at apple.com Mon Oct 27 20:16:20 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Oct 2008 18:16:20 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r58273 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp In-Reply-To: <9906EE7E-773D-4AB1-A5B2-80956C79A728@apple.com> References: <200810272109.m9RL9ZeY032289@zion.cs.uiuc.edu> <7C97B4A8-5154-4BEF-BFA9-5153002CCE67@apple.com> <4098B227-F7EB-4EAC-84AE-6B80697DBF44@apple.com> <7FE8A066-5C78-4553-969D-271A9F1CFCCE@apple.com> <3C6576B7-7366-4528-BD5A-19B6F4C137B8@apple.com> <9906EE7E-773D-4AB1-A5B2-80956C79A728@apple.com> Message-ID: <3EA6E2DB-13A3-4398-81FA-C8DF2CD96DBB@apple.com> On Oct 27, 2008, at 6:15 PM, Dale Johannesen wrote: > > On Oct 27, 2008, at 6:11 PMPDT, Eric Christopher wrote: > >> >> On Oct 27, 2008, at 5:36 PM, Dale Johannesen wrote: >> >>> That does look like it's trying to solve the same problem. OTOH, >>> it is not invoked automatically, at least not by the build+test >>> procedure we use here; I consider a solution contained within the >>> testsuite much cleaner; and that script looks like serious overkill >>> for >>> the problem. So I'm inclined to leave it alone. >> >> The script solves the problem for more than just that test. > > That would certainly be a reason to use it, but AFAIK nobody has run > into a similar problem anywhere else. "Yet" and that's because we don't get far enough in some other languages. -eric From evan.cheng at apple.com Mon Oct 27 20:48:25 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Oct 2008 01:48:25 -0000 Subject: [llvm-commits] [llvm] r58312 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Message-ID: <200810280148.m9S1mPJL010024@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 27 20:48:24 2008 New Revision: 58312 URL: http://llvm.org/viewvc/llvm-project?rev=58312&view=rev Log: Add command line option to limit the number splits to help debugging. Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58312&r1=58311&r2=58312&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Mon Oct 27 20:48:24 2008 @@ -33,7 +33,9 @@ #include using namespace llvm; -STATISTIC(NumSplit , "Number of intervals split"); +static cl::opt PreSplitLimit("pre-split-limit", cl::init(-1), cl::Hidden); + +STATISTIC(NumSplits, "Number of intervals split"); namespace { class VISIBILITY_HIDDEN PreAllocSplitting : public MachineFunctionPass { @@ -607,7 +609,7 @@ // Record val# values are in the specific spill slot. RecordSplit(CurrLI->reg, SpillIndex, RestoreIndex, SS); - ++NumSplit; + ++NumSplits; return true; } @@ -659,7 +661,7 @@ // Record val# values are in the specific spill slot. RecordSplit(CurrLI->reg, SpillIndex, RestoreIndex, SS); - ++NumSplit; + ++NumSplits; return true; } @@ -689,6 +691,8 @@ // Process the affected live intervals. bool Change = false; while (!Intervals.empty()) { + if (PreSplitLimit != -1 && (int)NumSplits == PreSplitLimit) + break; LiveInterval *LI = Intervals.back(); Intervals.pop_back(); Change |= SplitRegLiveInterval(LI); From baldrick at free.fr Mon Oct 27 22:34:41 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 28 Oct 2008 04:34:41 +0100 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r58232_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_lib/CodeGen/SelectionDAG/_test/CodeGen/Generic/=09test?= =?iso-8859-1?q?/CodeGen/Mips/_test/CodeGen/X86/?= In-Reply-To: <62BE7F59-47B9-40C5-ADEC-185E066BBAC3@apple.com> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810272059.01601.baldrick@free.fr> <62BE7F59-47B9-40C5-ADEC-185E066BBAC3@apple.com> Message-ID: <200810280434.41473.baldrick@free.fr> Hi Evan, > Apple style llvm-gcc is not building now due to this: > > Undefined symbols: > "___fixunstfsi", referenced from: > ___fixunstfdi in _fixunstfdi_s.o > ___fixunstfdi in _fixunstfdi_s.o > ___fixunstfdi in _fixunstfdi_s.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > > Looks like ppc backend is generating __fixunstfsi now. I'll send you a > bc file. I'm not sure what to think about this. After all, the bc file has: %2 = fptoui ppc_fp128 %1 to i32 ; [#uses=1] and we have a FPTOUINT_PPCF128_I32 libcall (this is ___fixunstfsi). So it seems natural to use it! I guess the problem is that this machine does not support ppc_fp128 (not a legal type) so doesn't provide this libcall. Presumably it's only available on machines where ppc_fp128 is a legal type - does that sound right? Ciao, Duncan. From clattner at apple.com Tue Oct 28 00:03:05 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 27 Oct 2008 22:03:05 -0700 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <200810280434.41473.baldrick@free.fr> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810272059.01601.baldrick@free.fr> <62BE7F59-47B9-40C5-ADEC-185E066BBAC3@apple.com> <200810280434.41473.baldrick@free.fr> Message-ID: <62F9A41F-9D23-4A61-986C-2CB36947D353@apple.com> On Oct 27, 2008, at 8:34 PM, Duncan Sands wrote: > Hi Evan, > >> Apple style llvm-gcc is not building now due to this: >> >> Undefined symbols: >> "___fixunstfsi", referenced from: >> ___fixunstfdi in _fixunstfdi_s.o >> ___fixunstfdi in _fixunstfdi_s.o >> ___fixunstfdi in _fixunstfdi_s.o >> ld: symbol(s) not found >> collect2: ld returned 1 exit status >> >> Looks like ppc backend is generating __fixunstfsi now. I'll send >> you a >> bc file. > > I'm not sure what to think about this. After all, the bc file has: > > %2 = fptoui ppc_fp128 %1 to i32 ; [#uses=1] > > and we have a FPTOUINT_PPCF128_I32 libcall (this is ___fixunstfsi). > So it seems natural to use it! I guess the problem is that this > machine does not support ppc_fp128 (not a legal type) so doesn't > provide this libcall. Presumably it's only available on machines > where ppc_fp128 is a legal type - does that sound right? What does llc with legalize-types disabled produce? -Chris From evan.cheng at apple.com Tue Oct 28 00:28:22 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Oct 2008 05:28:22 -0000 Subject: [llvm-commits] [llvm] r58314 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Message-ID: <200810280528.m9S5SMmb017155@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 28 00:28:21 2008 New Revision: 58314 URL: http://llvm.org/viewvc/llvm-project?rev=58314&view=rev Log: If def is in the same mbb as the barrier, spilt the value after the last use before the barrier. Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58314&r1=58313&r2=58314&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Tue Oct 28 00:28:21 2008 @@ -107,7 +107,7 @@ unsigned&); MachineBasicBlock::iterator - findSpillPoint(MachineBasicBlock*, MachineInstr*, + findSpillPoint(MachineBasicBlock*, MachineInstr*, MachineInstr*, SmallPtrSet&, unsigned&); MachineBasicBlock::iterator @@ -166,12 +166,13 @@ /// none is found. MachineBasicBlock::iterator PreAllocSplitting::findSpillPoint(MachineBasicBlock *MBB, MachineInstr *MI, + MachineInstr *DefMI, SmallPtrSet &RefsInMBB, unsigned &SpillIndex) { MachineBasicBlock::iterator Pt = MBB->begin(); // Go top down if RefsInMBB is empty. - if (RefsInMBB.empty()) { + if (RefsInMBB.empty() && !DefMI) { MachineBasicBlock::iterator MII = MBB->begin(); MachineBasicBlock::iterator EndPt = MI; do { @@ -186,7 +187,9 @@ } while (MII != EndPt); } else { MachineBasicBlock::iterator MII = MI; - while (MII != MBB->begin() && !RefsInMBB.count(MII)) { + MachineBasicBlock::iterator EndPt = DefMI + ? MachineBasicBlock::iterator(DefMI) : MBB->begin(); + while (MII != EndPt && !RefsInMBB.count(MII)) { unsigned Index = LIs->getInstructionIndex(MII); if (LIs->hasGapBeforeInstr(Index)) { Pt = MII; @@ -561,7 +564,7 @@ if (ValNo->def == ~0U) { // If it's defined by a phi, we must split just before the barrier. MachineBasicBlock::iterator SpillPt = - findSpillPoint(BarrierMBB, Barrier, RefsInMBB, SpillIndex); + findSpillPoint(BarrierMBB, Barrier, NULL, RefsInMBB, SpillIndex); if (SpillPt == BarrierMBB->begin()) return false; // No gap to insert spill. // Add spill. @@ -578,10 +581,17 @@ // If it's already split, just restore the value. There is no need to spill // the def again. // Check if it's possible to insert a spill after the def MI. - MachineBasicBlock::iterator SpillPt = - findNextEmptySlot(DefMBB, DefMI, SpillIndex); - if (SpillPt == DefMBB->end()) - return false; // No gap to insert spill. + MachineBasicBlock::iterator SpillPt; + if (DefMBB == BarrierMBB) { + // Add spill after the def and the last use before the barrier. + SpillPt = findSpillPoint(BarrierMBB, Barrier, DefMI, RefsInMBB, SpillIndex); + if (SpillPt == DefMBB->begin()) + return false; // No gap to insert spill. + } else { + SpillPt = findNextEmptySlot(DefMBB, DefMI, SpillIndex); + if (SpillPt == DefMBB->end()) + return false; // No gap to insert spill. + } SS = MFI->CreateStackObject(RC->getSize(), RC->getAlignment()); // Add spill. The store instruction kills the register if def is before From sabre at nondot.org Tue Oct 28 00:31:31 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Oct 2008 05:31:31 -0000 Subject: [llvm-commits] [llvm] r58315 - /llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Message-ID: <200810280531.m9S5VVtA017269@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 28 00:31:31 2008 New Revision: 58315 URL: http://llvm.org/viewvc/llvm-project?rev=58315&view=rev Log: comment cleanups. Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=58315&r1=58314&r2=58315&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Tue Oct 28 00:31:31 2008 @@ -224,21 +224,21 @@ return Objects[ObjectIdx+NumFixedObjects].Size; } - // setObjectSize - Change the size of the specified stack object... + /// setObjectSize - Change the size of the specified stack object. void setObjectSize(int ObjectIdx, int64_t Size) { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); Objects[ObjectIdx+NumFixedObjects].Size = Size; } - /// getObjectAlignment - Return the alignment of the specified stack object... + /// getObjectAlignment - Return the alignment of the specified stack object. unsigned getObjectAlignment(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); return Objects[ObjectIdx+NumFixedObjects].Alignment; } - /// setObjectAlignment - Change the alignment of the specified stack object... + /// setObjectAlignment - Change the alignment of the specified stack object. void setObjectAlignment(int ObjectIdx, unsigned Align) { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); From sabre at nondot.org Tue Oct 28 00:32:08 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Oct 2008 05:32:08 -0000 Subject: [llvm-commits] [llvm] r58316 - /llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Message-ID: <200810280532.m9S5W8x5017297@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 28 00:32:08 2008 New Revision: 58316 URL: http://llvm.org/viewvc/llvm-project?rev=58316&view=rev Log: more comment cleanups. Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=58316&r1=58315&r2=58316&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Tue Oct 28 00:32:08 2008 @@ -201,11 +201,11 @@ bool isFrameAddressTaken() const { return FrameAddressTaken; } void setFrameAddressIsTaken(bool T) { FrameAddressTaken = T; } - /// getObjectIndexBegin - Return the minimum frame object index... + /// getObjectIndexBegin - Return the minimum frame object index. /// int getObjectIndexBegin() const { return -NumFixedObjects; } - /// getObjectIndexEnd - Return one past the maximum frame object index... + /// getObjectIndexEnd - Return one past the maximum frame object index. /// int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; } @@ -216,7 +216,7 @@ /// unsigned getNumObjects() const { return Objects.size(); } - /// getObjectSize - Return the size of the specified object + /// getObjectSize - Return the size of the specified object. /// int64_t getObjectSize(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && From sabre at nondot.org Tue Oct 28 00:49:35 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Oct 2008 05:49:35 -0000 Subject: [llvm-commits] [llvm] r58317 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-10-27-StackRealignment.ll Message-ID: <200810280549.m9S5nZ9c017937@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 28 00:49:35 2008 New Revision: 58317 URL: http://llvm.org/viewvc/llvm-project?rev=58317&view=rev Log: Fix a nasty miscompilation of 176.gcc on linux/x86 where we synthesized a memset using 16-byte XMM stores, but where the stack realignment code didn't work. Until it does (PR2962) disable use of xmm regs in memcpy and memset formation for linux and other targets with insufficiently aligned stacks. This is part of PR2888 Added: llvm/trunk/test/CodeGen/X86/2008-10-27-StackRealignment.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=58317&r1=58316&r2=58317&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 28 00:49:35 2008 @@ -850,10 +850,15 @@ MVT X86TargetLowering::getOptimalMemOpType(uint64_t Size, unsigned Align, bool isSrcConst, bool isSrcStr) const { - if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16) - return MVT::v4i32; - if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16) - return MVT::v4f32; + // FIXME: This turns off use of xmm stores for memset/memcpy on targets like + // linux. This is because the stack realignment code can't handle certain + // cases like PR2962. This should be removed when PR2962 is fixed. + if (Subtarget->getStackAlignment() >= 16) { + if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16) + return MVT::v4i32; + if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16) + return MVT::v4f32; + } if (Subtarget->is64Bit() && Size >= 8) return MVT::i64; return MVT::i32; Added: llvm/trunk/test/CodeGen/X86/2008-10-27-StackRealignment.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-27-StackRealignment.ll?rev=58317&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-10-27-StackRealignment.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-10-27-StackRealignment.ll Tue Oct 28 00:49:35 2008 @@ -0,0 +1,22 @@ +; Linux doesn't support stack realignment for functions with allocas (PR2888). +; Until it does, we shouldn't use movaps to access the stack. On targets with +; sufficiently aligned stack (e.g. darwin) we should. + +; RUN: llvm-as < %s | llc -mtriple=i386-pc-linux-gnu -mcpu=yonah | not grep movaps +; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin9 -mcpu=yonah | grep movaps | count 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-f80:32:32" +target triple = "i386-pc-linux-gnu" + +define void @foo(i32 %t) nounwind { + %tmp1210 = alloca i8, i32 32, align 4 + call void @llvm.memset.i64(i8* %tmp1210, i8 0, i64 32, i32 4) + + %x = alloca i8, i32 %t + call void @dummy(i8* %x) + ret void +} + +declare void @dummy(i8* %x) +declare void @llvm.memset.i64(i8*, i8, i64, i32) nounwind From sabre at nondot.org Tue Oct 28 01:20:18 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Oct 2008 06:20:18 -0000 Subject: [llvm-commits] [llvm] r58318 - /llvm/trunk/include/llvm/Value.h Message-ID: <200810280620.m9S6KJNh029658@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 28 01:20:17 2008 New Revision: 58318 URL: http://llvm.org/viewvc/llvm-project?rev=58318&view=rev Log: fit in 80 cols Modified: llvm/trunk/include/llvm/Value.h Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=58318&r1=58317&r2=58318&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Tue Oct 28 01:20:17 2008 @@ -289,7 +289,8 @@ return Val.getValueID() == Value::GlobalAliasVal; } template <> inline bool isa_impl(const Value &Val) { - return isa(Val) || isa(Val) || isa(Val); + return isa(Val) || isa(Val) || + isa(Val); } } // End llvm namespace From sabre at nondot.org Tue Oct 28 02:10:52 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Oct 2008 07:10:52 -0000 Subject: [llvm-commits] [llvm] r58319 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200810280710.m9S7AqS5031273@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 28 02:10:51 2008 New Revision: 58319 URL: http://llvm.org/viewvc/llvm-project?rev=58319&view=rev Log: fix some whitespace stuff Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=58319&r1=58318&r2=58319&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 28 02:10:51 2008 @@ -2834,7 +2834,7 @@ isSrcStr = isMemSrcFromString(Src, Str); bool isSrcConst = isa(Src); bool AllowUnalign = TLI.allowsUnalignedMemoryAccesses(); - MVT VT= TLI.getOptimalMemOpType(Size, Align, isSrcConst, isSrcStr); + MVT VT = TLI.getOptimalMemOpType(Size, Align, isSrcConst, isSrcStr); if (VT != MVT::iAny) { unsigned NewAlign = (unsigned) TLI.getTargetData()->getABITypeAlignment(VT.getTypeForMVT()); @@ -3048,8 +3048,8 @@ unsigned VTSize = VT.getSizeInBits() / 8; SDValue Value = getMemsetValue(Src, VT, DAG); SDValue Store = DAG.getStore(Chain, Value, - getMemBasePlusOffset(Dst, DstOff, DAG), - DstSV, DstSVOff + DstOff); + getMemBasePlusOffset(Dst, DstOff, DAG), + DstSV, DstSVOff + DstOff); OutChains.push_back(Store); DstOff += VTSize; } From sabre at nondot.org Tue Oct 28 02:11:07 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Oct 2008 07:11:07 -0000 Subject: [llvm-commits] [llvm] r58320 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200810280711.m9S7B7ig031294@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 28 02:11:07 2008 New Revision: 58320 URL: http://llvm.org/viewvc/llvm-project?rev=58320&view=rev Log: Don't produce invalid comparisons after legalize. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=58320&r1=58319&r2=58320&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Oct 28 02:11:07 2008 @@ -1720,7 +1720,8 @@ if (LL == RL && LR == RR) { bool isInteger = LL.getValueType().isInteger(); ISD::CondCode Result = ISD::getSetCCAndOperation(Op0, Op1, isInteger); - if (Result != ISD::SETCC_INVALID) + if (Result != ISD::SETCC_INVALID && + (!AfterLegalize || TLI.isCondCodeLegal(Result, LL.getValueType()))) return DAG.getSetCC(N0.getValueType(), LL, LR, Result); } } @@ -1904,7 +1905,8 @@ if (LL == RL && LR == RR) { bool isInteger = LL.getValueType().isInteger(); ISD::CondCode Result = ISD::getSetCCOrOperation(Op0, Op1, isInteger); - if (Result != ISD::SETCC_INVALID) + if (Result != ISD::SETCC_INVALID && + (!AfterLegalize || TLI.isCondCodeLegal(Result, LL.getValueType()))) return DAG.getSetCC(N0.getValueType(), LL, LR, Result); } } From baldrick at free.fr Tue Oct 28 04:34:56 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 28 Oct 2008 10:34:56 +0100 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r58232_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_lib/CodeGen/SelectionDAG/_test/CodeGen/Generic/=09test?= =?iso-8859-1?q?/CodeGen/Mips/_test/CodeGen/X86/?= In-Reply-To: <62F9A41F-9D23-4A61-986C-2CB36947D353@apple.com> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810280434.41473.baldrick@free.fr> <62F9A41F-9D23-4A61-986C-2CB36947D353@apple.com> Message-ID: <200810281034.57298.baldrick@free.fr> > >> Looks like ppc backend is generating __fixunstfsi now. I'll send > >> you a > >> bc file. ... >> What does llc with legalize-types disabled produce? Interestingly enough, LegalizeDAG also produces a libcall for ppcf128 to s/uint, except for one special case that it intercepts in LegalizeOp (see LegalizeDAG line 3767): ppcf128 to i32. It expands this into an inline code sequence. Why just this one and no others? My guess is that this is a workaround for __fixunstfsi somehow not being available during llvm-gcc bootstrap. But maybe it simply isn't ever available on the target platform (but the other libcalls are?). If it isn't ever available maybe the right solution is to set the libcall Name to NULL in the libcall Names array, in order to indicate that. Then LegalizeTypes (and LegalizeDAG) can generate an inline code sequence when they see that the libcall name is NULL. Ciao, Duncan. From baldrick at free.fr Tue Oct 28 04:38:36 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 28 Oct 2008 09:38:36 -0000 Subject: [llvm-commits] [llvm] r58323 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h test/CodeGen/PowerPC/2008-10-28-UnprocessedNode.ll Message-ID: <200810280938.m9S9cbjm013341@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 28 04:38:36 2008 New Revision: 58323 URL: http://llvm.org/viewvc/llvm-project?rev=58323&view=rev Log: Fix a testcase provided by Bill in which the node id could end up being wrong mostly because of forgetting to remap new nodes that morphed into processed nodes through CSE. Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-28-UnprocessedNode.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=58323&r1=58322&r2=58323&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Tue Oct 28 04:38:36 2008 @@ -222,10 +222,12 @@ /// new nodes. Correct any processed operands (this may change the node) and /// calculate the NodeId. /// Returns the potentially changed node. -SDNode *DAGTypeLegalizer::AnalyzeNewNode(SDNode *N) { +void DAGTypeLegalizer::AnalyzeNewNode(SDValue &Val) { + SDNode *N = Val.getNode(); + // If this was an existing node that is already done, we're done. if (N->getNodeId() != NewNode) - return N; + return; // Remove any stale map entries. ExpungeNode(N); @@ -249,10 +251,10 @@ if (Op.getNode()->getNodeId() == Processed) RemapNode(Op); - - if (Op.getNode()->getNodeId() == NewNode) + else if (Op.getNode()->getNodeId() == NewNode) AnalyzeNewNode(Op); - else if (Op.getNode()->getNodeId() == Processed) + + if (Op.getNode()->getNodeId() == Processed) ++NumProcessed; if (!NewOps.empty()) { @@ -267,29 +269,30 @@ } // Some operands changed - update the node. - if (!NewOps.empty()) - N = DAG.UpdateNodeOperands(SDValue(N, 0), - &NewOps[0], - NewOps.size()).getNode(); - - // Calculate the NodeId if we haven't morphed into an existing node for - // which it is already known. - if (N->getNodeId() == NewNode) { - N->setNodeId(N->getNumOperands()-NumProcessed); - if (N->getNodeId() == ReadyToProcess) - Worklist.push_back(N); + if (!NewOps.empty()) { + Val = DAG.UpdateNodeOperands(Val, &NewOps[0], NewOps.size()); + if (Val.getNode() != N) { + // The node morphed, work with the new node. + N = Val.getNode(); + + // Maybe it morphed into a previously analyzed node? + if (N->getNodeId() != NewNode) { + if (N->getNodeId() == Processed) + // An already processed node may need to be remapped. + RemapNode(Val); + return; + } + + // It morphed into a different new node. Do the equivalent of passing + // it to AnalyzeNewNode: expunge it and calculate the NodeId. + ExpungeNode(N); + } } - return N; -} - -/// AnalyzeNewNode - call AnalyzeNewNode(SDNode *N) -/// and update the node in SDValue if necessary. -void DAGTypeLegalizer::AnalyzeNewNode(SDValue &Val) { - SDNode *N(Val.getNode()); - SDNode *M(AnalyzeNewNode(N)); - if (N != M) - Val.setNode(M); + // Calculate the NodeId. + N->setNodeId(N->getNumOperands()-NumProcessed); + if (N->getNodeId() == ReadyToProcess) + Worklist.push_back(N); } @@ -353,7 +356,9 @@ // If expansion produced new nodes, make sure they are properly marked. ExpungeNode(From); - To = AnalyzeNewNode(To); // Expunges To. + SDValue Val(To, 0); + AnalyzeNewNode(Val); // Expunges To. FIXME: All results mapped the same? + To = Val.getNode(); assert(From->getNumValues() == To->getNumValues() && "Node results don't match"); @@ -382,6 +387,7 @@ RemapNode(I->second); N = I->second; } + assert(N.getNode()->getNodeId() != NewNode && "Mapped to unanalyzed node!"); } /// ExpungeNode - If N has a bogus mapping in ReplacedNodes, eliminate it. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=58323&r1=58322&r2=58323&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Tue Oct 28 04:38:36 2008 @@ -155,9 +155,11 @@ /// ReanalyzeNode - Recompute the NodeID and correct processed operands /// for the specified node, adding it to the worklist if ready. - SDNode *ReanalyzeNode(SDNode *N) { + void ReanalyzeNode(SDNode *N) { N->setNodeId(NewNode); - return AnalyzeNewNode(N); + SDValue Val(N, 0); + AnalyzeNewNode(Val); + // The node may have changed but we don't care. } void NoteDeletion(SDNode *Old, SDNode *New) { @@ -169,7 +171,6 @@ private: void AnalyzeNewNode(SDValue &Val); - SDNode *AnalyzeNewNode(SDNode *N); void ReplaceValueWith(SDValue From, SDValue To); void ReplaceNodeWith(SDNode *From, SDNode *To); Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-28-UnprocessedNode.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-10-28-UnprocessedNode.ll?rev=58323&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2008-10-28-UnprocessedNode.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2008-10-28-UnprocessedNode.ll Tue Oct 28 04:38:36 2008 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -march=ppc64 + +define void @__divtc3({ ppc_fp128, ppc_fp128 }* noalias sret %agg.result, ppc_fp128 %a, ppc_fp128 %b, ppc_fp128 %c, ppc_fp128 %d) nounwind { +entry: + %imag59 = load ppc_fp128* null, align 8 ; [#uses=1] + %0 = mul ppc_fp128 0xM00000000000000000000000000000000, %imag59 ; [#uses=1] + %1 = mul ppc_fp128 0xM00000000000000000000000000000000, 0xM00000000000000000000000000000000 ; [#uses=1] + %2 = add ppc_fp128 %0, %1 ; [#uses=1] + store ppc_fp128 %2, ppc_fp128* null, align 16 + unreachable +} From baldrick at free.fr Tue Oct 28 04:55:05 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 28 Oct 2008 09:55:05 -0000 Subject: [llvm-commits] [llvm] r58324 - /llvm/trunk/test/CodeGen/PowerPC/vec_splat.ll Message-ID: <200810280955.m9S9t5kD013882@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 28 04:55:04 2008 New Revision: 58324 URL: http://llvm.org/viewvc/llvm-project?rev=58324&view=rev Log: Turn off LegalizeTypes for this test for the moment, while waiting for a proper solution. Modified: llvm/trunk/test/CodeGen/PowerPC/vec_splat.ll Modified: llvm/trunk/test/CodeGen/PowerPC/vec_splat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/vec_splat.ll?rev=58324&r1=58323&r2=58324&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/vec_splat.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/vec_splat.ll Tue Oct 28 04:55:04 2008 @@ -1,7 +1,7 @@ ; Test that vectors are scalarized/lowered correctly. ; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g3 | \ ; RUN: grep stfs | count 4 -; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t -f -disable-legalize-types ; RUN: grep vspltw %t | count 2 ; RUN: grep vsplti %t | count 3 ; RUN: grep vsplth %t | count 1 From baldrick at free.fr Tue Oct 28 04:57:01 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 28 Oct 2008 10:57:01 +0100 Subject: [llvm-commits] [llvm] r58232 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ test/CodeGen/Generic/ test/CodeGen/Mips/ test/CodeGen/X86/ In-Reply-To: <16e5fdf90810271128q7561854fo25234c6fc40e7172@mail.gmail.com> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810271900.33073.baldrick@free.fr> <16e5fdf90810271128q7561854fo25234c6fc40e7172@mail.gmail.com> Message-ID: <200810281057.01811.baldrick@free.fr> Hi Bill, > >> If you're working on a fix, could you XFAIL this for now? I added -disable-legalize-types to the command line, which does the trick for now. > It's not ideal, but I suppose it's okay for now. I did see this > failure now happening on my PPC box: This should be fixed. Thanks for the nice testcase :) Ciao, Duncan. From ggreif at gmail.com Tue Oct 28 06:57:54 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 28 Oct 2008 11:57:54 -0000 Subject: [llvm-commits] [llvm] r58326 - /llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Message-ID: <200810281157.m9SBvsDs018291@zion.cs.uiuc.edu> Author: ggreif Date: Tue Oct 28 06:57:54 2008 New Revision: 58326 URL: http://llvm.org/viewvc/llvm-project?rev=58326&view=rev Log: move checks for exit conditions to a better place eliminate tabs Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=58326&r1=58325&r2=58326&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Tue Oct 28 06:57:54 2008 @@ -99,7 +99,7 @@ case Use::fullStopTagN: return reinterpret_cast(Next); case Use::stopTagN: { - goto efficiency; + goto efficiency; } default: Acc = (Acc << 1) | (Tag & 1); @@ -122,17 +122,10 @@ // try to pick up exactly requiredSteps digits int digits = requiredSteps; Acc = 0; - Use* Tagspace = 0; + Use* Tagspace = 0; Use* Orig(Next); while (1) { - if (!digits) { - if (Tagspace && Cushion <= -requiredSteps) { - punchAwayDigits(Orig->Prev); - repaintByCopying(Tagspace, Orig); - } - return reinterpret_cast(Acc << spareBits); - } Next = Next->Next; __builtin_prefetch(Next); --Cushion; @@ -152,21 +145,28 @@ goto efficiency; } default: - if (!Tagspace) { - Tagspace = Orig; - // Exploit the fact that a pointer to Use::Next - // is identical to the pointer to the previous Use. - // This is a mild hack assuming Use::Next being the - // first member. At this point we can be certain - // that U->Prev points into a Use, because we have - // already seen a stop tag (precondition). - Orig = (Use*)stripTag(U->Prev); - } + if (!Tagspace) { + Tagspace = Orig; + // Exploit the fact that a pointer to Use::Next + // is identical to the pointer to the previous Use. + // This is a mild hack assuming Use::Next being the + // first member. At this point we can be certain + // that U->Prev points into a Use, because we have + // already seen a stop tag (precondition). + Orig = (Use*)stripTag(U->Prev); + } --digits; Acc = (Acc << 1) | (Tag & 1); if (Cushion <= 0) { U = stripTag(U->Next); } + if (!digits) { + if (Tagspace && Cushion <= -requiredSteps) { + punchAwayDigits(Orig->Prev); + repaintByCopying(Tagspace, Orig); + } + return reinterpret_cast(Acc << spareBits); + } continue; } break; @@ -200,12 +200,6 @@ Use *Tagspace(Next); while (1) { - if (!digits) { - punchAwayDigits(U->Prev); - repaintByCopying(Tagspace, U); - return reinterpret_cast(Acc << spareBits); - } - Next = Next->Next; __builtin_prefetch(Next); U = stripTag(U->Next); @@ -223,6 +217,11 @@ default: --digits; Acc = (Acc << 1) | (Tag & 1); + if (!digits) { + punchAwayDigits(U->Prev); + repaintByCopying(Tagspace, U); + return reinterpret_cast(Acc << spareBits); + } continue; } break; From baldrick at free.fr Tue Oct 28 10:00:39 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 28 Oct 2008 15:00:39 -0000 Subject: [llvm-commits] [llvm] r58329 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp lib/Target/PowerPC/PPCISelLowering.cpp test/CodeGen/PowerPC/2008-10-28-f128-i32.ll Message-ID: <200810281500.m9SF0e7S024424@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 28 10:00:32 2008 New Revision: 58329 URL: http://llvm.org/viewvc/llvm-project?rev=58329&view=rev Log: Fix darwin ppc llvm-gcc build breakage: intercept ppcf128 to i32 conversion and expand it into a code sequence like in LegalizeDAG. This needs custom ppc lowering of FP_ROUND_INREG, so turn that on and make it work with LegalizeTypes. Probably PPC should simply custom lower the original conversion. Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-28-f128-i32.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=58329&r1=58328&r2=58329&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Tue Oct 28 10:00:32 2008 @@ -902,6 +902,18 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_SINT(SDNode *N) { MVT RVT = N->getValueType(0); + + // Expand ppcf128 to i32 by hand for the benefit of llvm-gcc bootstrap on + // PPC (the libcall is not available). FIXME: Do this in a less hacky way. + if (RVT == MVT::i32) { + assert(N->getOperand(0).getValueType() == MVT::ppcf128 && + "Logic only correct for ppcf128!"); + SDValue Res = DAG.getNode(ISD::FP_ROUND_INREG, MVT::ppcf128, + N->getOperand(0), DAG.getValueType(MVT::f64)); + Res = DAG.getNode(ISD::FP_ROUND, MVT::f64, Res, DAG.getIntPtrConstant(1)); + return DAG.getNode(ISD::FP_TO_SINT, MVT::i32, Res); + } + RTLIB::Libcall LC = RTLIB::getFPTOSINT(N->getOperand(0).getValueType(), RVT); assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported FP_TO_SINT!"); return MakeLibCall(LC, RVT, &N->getOperand(0), 1, false); @@ -909,6 +921,29 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_UINT(SDNode *N) { MVT RVT = N->getValueType(0); + + // Expand ppcf128 to i32 by hand for the benefit of llvm-gcc bootstrap on + // PPC (the libcall is not available). FIXME: Do this in a less hacky way. + if (RVT == MVT::i32) { + assert(N->getOperand(0).getValueType() == MVT::ppcf128 && + "Logic only correct for ppcf128!"); + const uint64_t TwoE31[] = {0x41e0000000000000LL, 0}; + APFloat APF = APFloat(APInt(128, 2, TwoE31)); + SDValue Tmp = DAG.getConstantFP(APF, MVT::ppcf128); + // X>=2^31 ? (int)(X-2^31)+0x80000000 : (int)X + // FIXME: generated code sucks. + return DAG.getNode(ISD::SELECT_CC, MVT::i32, N->getOperand(0), Tmp, + DAG.getNode(ISD::ADD, MVT::i32, + DAG.getNode(ISD::FP_TO_SINT, MVT::i32, + DAG.getNode(ISD::FSUB, + MVT::ppcf128, + N->getOperand(0), + Tmp)), + DAG.getConstant(0x80000000, MVT::i32)), + DAG.getNode(ISD::FP_TO_SINT, MVT::i32, N->getOperand(0)), + DAG.getCondCode(ISD::SETGE)); + } + RTLIB::Libcall LC = RTLIB::getFPTOUINT(N->getOperand(0).getValueType(), RVT); assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported FP_TO_UINT!"); return MakeLibCall(LC, N->getValueType(0), &N->getOperand(0), 1, false); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=58329&r1=58328&r2=58329&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Oct 28 10:00:32 2008 @@ -2865,9 +2865,10 @@ assert(Op.getValueType() == MVT::ppcf128); SDNode *Node = Op.getNode(); assert(Node->getOperand(0).getValueType() == MVT::ppcf128); - assert(Node->getOperand(0).getNode()->getOpcode() == ISD::BUILD_PAIR); - SDValue Lo = Node->getOperand(0).getNode()->getOperand(0); - SDValue Hi = Node->getOperand(0).getNode()->getOperand(1); + SDValue Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::f64, Node->getOperand(0), + DAG.getIntPtrConstant(0)); + SDValue Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::f64, Node->getOperand(0), + DAG.getIntPtrConstant(1)); // This sequence changes FPSCR to do round-to-zero, adds the two halves // of the long double, and puts FPSCR back the way it was. We do not @@ -2916,7 +2917,7 @@ // We know the low half is about to be thrown away, so just use something // convenient. - return DAG.getNode(ISD::BUILD_PAIR, Lo.getValueType(), FPreg, FPreg); + return DAG.getNode(ISD::BUILD_PAIR, MVT::ppcf128, FPreg, FPreg); } SDValue PPCTargetLowering::LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) { @@ -3883,7 +3884,8 @@ SDNode *PPCTargetLowering::ReplaceNodeResults(SDNode *N, SelectionDAG &DAG) { switch (N->getOpcode()) { - default: assert(0 && "Wasn't expecting to be able to lower this!"); + default: + return PPCTargetLowering::LowerOperation(SDValue (N, 0), DAG).getNode(); case ISD::FP_TO_SINT: { SDValue Res = LowerFP_TO_SINT(SDValue(N, 0), DAG); // Use MERGE_VALUES to drop the chain result value and get a node with one Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-28-f128-i32.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-10-28-f128-i32.ll?rev=58329&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2008-10-28-f128-i32.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2008-10-28-f128-i32.ll Tue Oct 28 10:00:32 2008 @@ -0,0 +1,33 @@ +; RUN: llvm-as < %s | llc -march=ppc32 -o - | not grep fixunstfsi + +define i64 @__fixunstfdi(ppc_fp128 %a) nounwind readnone { +entry: + %0 = fcmp olt ppc_fp128 %a, 0xM00000000000000000000000000000000 ; [#uses=1] + br i1 %0, label %bb5, label %bb1 + +bb1: ; preds = %entry + %1 = mul ppc_fp128 %a, 0xM3DF00000000000000000000000000000 ; [#uses=1] + %2 = fptoui ppc_fp128 %1 to i32 ; [#uses=1] + %3 = zext i32 %2 to i64 ; [#uses=1] + %4 = shl i64 %3, 32 ; [#uses=3] + %5 = uitofp i64 %4 to ppc_fp128 ; [#uses=1] + %6 = sub ppc_fp128 %a, %5 ; [#uses=3] + %7 = fcmp olt ppc_fp128 %6, 0xM00000000000000000000000000000000 ; [#uses=1] + br i1 %7, label %bb2, label %bb3 + +bb2: ; preds = %bb1 + %8 = sub ppc_fp128 0xM80000000000000000000000000000000, %6 ; [#uses=1] + %9 = fptoui ppc_fp128 %8 to i32 ; [#uses=1] + %10 = zext i32 %9 to i64 ; [#uses=1] + %11 = sub i64 %4, %10 ; [#uses=1] + ret i64 %11 + +bb3: ; preds = %bb1 + %12 = fptoui ppc_fp128 %6 to i32 ; [#uses=1] + %13 = zext i32 %12 to i64 ; [#uses=1] + %14 = or i64 %13, %4 ; [#uses=1] + ret i64 %14 + +bb5: ; preds = %entry + ret i64 0 +} From baldrick at free.fr Tue Oct 28 10:05:15 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 28 Oct 2008 16:05:15 +0100 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r58232_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_lib/CodeGen/SelectionDAG/_test/CodeGen/Generic/=09test?= =?iso-8859-1?q?/CodeGen/Mips/_test/CodeGen/X86/?= In-Reply-To: <62BE7F59-47B9-40C5-ADEC-185E066BBAC3@apple.com> References: <200810270842.m9R8gl1t004026@zion.cs.uiuc.edu> <200810272059.01601.baldrick@free.fr> <62BE7F59-47B9-40C5-ADEC-185E066BBAC3@apple.com> Message-ID: <200810281605.15281.baldrick@free.fr> Hi Evan, > Apple style llvm-gcc is not building now due to this: > > Undefined symbols: > "___fixunstfsi", referenced from: I've fixed this by duplicating the LegalizeDAG code. However it would be nice to have a cleaner solution than just intercepting the ppcf128->i32 case. How about moving this to PPC custom lowering instead? Ciao, Duncan. From dag at cray.com Tue Oct 28 11:11:46 2008 From: dag at cray.com (David Greene) Date: Tue, 28 Oct 2008 11:11:46 -0500 Subject: [llvm-commits] [llvm] r58278 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/Alpha/AlphaISelDAGToDAG.cpp lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/IA64/IA64ISelDAGToDAG.cpp lib/Target/Mips/MipsISelDAGToDAG.cpp lib/Target/PIC16/PIC16ISelDAGToDAG.cpp lib/Target/PowerPC/PPCISelDAGToDAG.cpp lib/Target/Sparc/SparcISelDAGToDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp utils/TableGen/DAGISelEmitter.cpp In-Reply-To: <4F0BF11F-0920-4FC4-977D-7E12E5AA2A86@apple.com> References: <200810272156.m9RLuT7v001548@zion.cs.uiuc.edu> <4F0BF11F-0920-4FC4-977D-7E12E5AA2A86@apple.com> Message-ID: <200810281111.46825.dag@cray.com> On Monday 27 October 2008 20:00, Dan Gohman wrote: > > /// SelectRoot - Top level entry to DAG instruction selector. > > /// Selects instructions starting at the root of the current DAG. > > -void SelectRoot() { > > +void SelectRoot(SelectionDAG &DAG) { > > This DAG parameter shouldn't be necessary. SelectRoot is a member > of SelectionDAGISel, where it can access the CurDAG member. It is? Then why isn't it qualified by a scoping operator? > > SelectRootInit(); > > unsigned NumBytes = (DAGSize + 7) / 8; > > ISelQueued = new unsigned char[NumBytes]; > > @@ -176,14 +176,18 @@ > > // Skip already selected nodes. > > if (isSelected(Node->getNodeId())) > > continue; > > + DAG.setSubgraphColor(Node, "red"); > > I think this line should be guarded by #ifndef NDEBUG, so that > it doesn't slow down release mode. Either that, or perhaps > setSubgraphColor itself should be an empty inline function in > the NDEBUG case. setSubgraphColor is so guarded. This actually worked better when this was part of DAGISelEmitter because it could be controlled by the new -gen-debug flag. > > SDNode *ResNode = Select(SDValue(Node, 0)); > > // If node should not be replaced, > > // continue with the next one. > > if (ResNode == Node) > > continue; > > // Replace node. > > - if (ResNode) > > + if (ResNode) { > > + DAG.setSubgraphColor(ResNode, "yellow"); > > + DAG.setSubgraphColor(ResNode, "black"); > > Setting the node to yellow and then immediately to black? Yep. The idea is that when running codegen in a debugger one can set breakpoints here. You don't want to keep it yellow because then your whole graph becomes yellow once all instructions are selected. You want to see what is happening _now_. > > ReplaceUses(Node, ResNode); > > + } > > // If after the replacement this node is not used any more, > > // remove this dead node. > > if (Node->use_empty()) { // Don't delete EntryToken, etc. > > @@ -191,6 +195,7 @@ > > CurDAG->RemoveDeadNode(Node, &ISQU); > > UpdateQueue(ISQU); > > } > > + //DAG.setSubgraphColor(Node, "black"); > > Please decide what to do this code, instead of just > leaving it here commented out. Yep, my mistake. > > +namespace { > > + cl::opt > > + GenDebug("gen-debug", cl::desc("Generate debug code"), > > + cl::init(false)); > > +} > > As a tablegen option, this cool functionality is somewhat > out of common view. Would it make sense to turn this functionality > on by default, with the code guarded by #ifndef NDEBUG? Either that or alter the Makefiles to pass -gen-debug. I kind of like having a separate flag. There's other stuff we do here in our local copy which I hope to send upstream eventually. -Dave From edwintorok at gmail.com Tue Oct 28 11:54:36 2008 From: edwintorok at gmail.com (Torok Edwin) Date: Tue, 28 Oct 2008 16:54:36 -0000 Subject: [llvm-commits] [llvm] r58332 - /llvm/trunk/docs/Lexicon.html Message-ID: <200810281654.m9SGsbZH029560@zion.cs.uiuc.edu> Author: edwin Date: Tue Oct 28 11:54:34 2008 New Revision: 58332 URL: http://llvm.org/viewvc/llvm-project?rev=58332&view=rev Log: fix duplicate anchor names, and broken anchor links from the TOC Modified: llvm/trunk/docs/Lexicon.html Modified: llvm/trunk/docs/Lexicon.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Lexicon.html?rev=58332&r1=58331&r2=58332&view=diff ============================================================================== --- llvm/trunk/docs/Lexicon.html (original) +++ llvm/trunk/docs/Lexicon.html Tue Oct 28 11:54:34 2008 @@ -157,7 +157,7 @@
Inter-Procedural Optimization. Refers to any variety of code optimization that occurs between procedures, functions or compilation units (modules).
-
ISel
+
ISel
Instruction Selection.
@@ -175,7 +175,7 @@ - +
Object Pointer
@@ -214,7 +214,7 @@
-
Safe Point
+
Safe Point
In garbage collection, it is necessary to identify stack roots so that reachability analysis may proceed. It may be infeasible to provide this information for every instruction, so instead the information From tonic at nondot.org Tue Oct 28 12:22:40 2008 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 28 Oct 2008 17:22:40 -0000 Subject: [llvm-commits] [llvm] r58335 - /llvm/trunk/include/llvm/User.h Message-ID: <200810281722.m9SHMeU1030804@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Oct 28 12:22:40 2008 New Revision: 58335 URL: http://llvm.org/viewvc/llvm-project?rev=58335&view=rev Log: Do not allow a user to set the operand for a constant. Modified: llvm/trunk/include/llvm/User.h Modified: llvm/trunk/include/llvm/User.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/User.h?rev=58335&r1=58334&r2=58335&view=diff ============================================================================== --- llvm/trunk/include/llvm/User.h (original) +++ llvm/trunk/include/llvm/User.h Tue Oct 28 12:22:40 2008 @@ -95,6 +95,9 @@ } void setOperand(unsigned i, Value *Val) { assert(i < NumOperands && "setOperand() out of range!"); + assert((!isa((const Value*)this) || + isa((const Value*)this)) && + "Cannot mutate a constant with setOperand!"); OperandList[i] = Val; } unsigned getNumOperands() const { return NumOperands; } From evan.cheng at apple.com Tue Oct 28 12:23:13 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Oct 2008 17:23:13 -0000 Subject: [llvm-commits] [llvm] r58336 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Message-ID: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 28 12:23:13 2008 New Revision: 58336 URL: http://llvm.org/viewvc/llvm-project?rev=58336&view=rev Log: Avoid calls to setSubgraphColor in release mode. They generate lots of error messages and slow down compilation. Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58336&r1=58335&r2=58336&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Tue Oct 28 12:23:13 2008 @@ -176,7 +176,9 @@ // Skip already selected nodes. if (isSelected(Node->getNodeId())) continue; +#ifndef NDEBUG DAG.setSubgraphColor(Node, "red"); +#endif SDNode *ResNode = Select(SDValue(Node, 0)); // If node should not be replaced, // continue with the next one. @@ -184,8 +186,10 @@ continue; // Replace node. if (ResNode) { +#ifndef NDEBUG DAG.setSubgraphColor(ResNode, "yellow"); DAG.setSubgraphColor(ResNode, "black"); +#endif ReplaceUses(Node, ResNode); } // If after the replacement this node is not used any more, @@ -195,7 +199,6 @@ CurDAG->RemoveDeadNode(Node, &ISQU); UpdateQueue(ISQU); } - //DAG.setSubgraphColor(Node, "black"); } delete[] ISelQueued; From edwintorok at gmail.com Tue Oct 28 12:29:24 2008 From: edwintorok at gmail.com (Torok Edwin) Date: Tue, 28 Oct 2008 17:29:24 -0000 Subject: [llvm-commits] [llvm] r58337 - /llvm/trunk/docs/WritingAnLLVMPass.html Message-ID: <200810281729.m9SHTOFf031220@zion.cs.uiuc.edu> Author: edwin Date: Tue Oct 28 12:29:23 2008 New Revision: 58337 URL: http://llvm.org/viewvc/llvm-project?rev=58337&view=rev Log: fix prototype of print, it is (llvm/Pass.h): virtual void print(std::ostream &O, const Module *M) const; instead of virtual void print(llvm::OStream &O, const Module *M) const; as the docs say Modified: llvm/trunk/docs/WritingAnLLVMPass.html Modified: llvm/trunk/docs/WritingAnLLVMPass.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMPass.html?rev=58337&r1=58336&r2=58337&view=diff ============================================================================== --- llvm/trunk/docs/WritingAnLLVMPass.html (original) +++ llvm/trunk/docs/WritingAnLLVMPass.html Tue Oct 28 12:29:23 2008 @@ -977,7 +977,7 @@
-  virtual void print(llvm::OStream &O, const Module *M) const;
+  virtual void print(std::ostream &O, const Module *M) const;
 

The print method must be implemented by "analyses" in order to print From clattner at apple.com Tue Oct 28 13:02:55 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Oct 2008 11:02:55 -0700 Subject: [llvm-commits] [llvm] r58336 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> References: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> Message-ID: On Oct 28, 2008, at 10:23 AM, Evan Cheng wrote: > Author: evancheng > Date: Tue Oct 28 12:23:13 2008 > New Revision: 58336 > > URL: http://llvm.org/viewvc/llvm-project?rev=58336&view=rev > Log: > Avoid calls to setSubgraphColor in release mode. They generate lots > of error messages and slow down compilation. Do we even want this in debug mode? Why not make this predicated on whether -view-isel-dags is set? -Chris > > > Modified: > llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h > > Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58336&r1=58335&r2=58336&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) > +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Tue Oct 28 > 12:23:13 2008 > @@ -176,7 +176,9 @@ > // Skip already selected nodes. > if (isSelected(Node->getNodeId())) > continue; > +#ifndef NDEBUG > DAG.setSubgraphColor(Node, "red"); > +#endif > SDNode *ResNode = Select(SDValue(Node, 0)); > // If node should not be replaced, > // continue with the next one. > @@ -184,8 +186,10 @@ > continue; > // Replace node. > if (ResNode) { > +#ifndef NDEBUG > DAG.setSubgraphColor(ResNode, "yellow"); > DAG.setSubgraphColor(ResNode, "black"); > +#endif > ReplaceUses(Node, ResNode); > } > // If after the replacement this node is not used any more, > @@ -195,7 +199,6 @@ > CurDAG->RemoveDeadNode(Node, &ISQU); > UpdateQueue(ISQU); > } > - //DAG.setSubgraphColor(Node, "black"); > } > > delete[] ISelQueued; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dag at cray.com Tue Oct 28 13:05:57 2008 From: dag at cray.com (David Greene) Date: Tue, 28 Oct 2008 13:05:57 -0500 Subject: [llvm-commits] [llvm] r58336 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> References: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> Message-ID: <200810281305.57876.dag@cray.com> On Tuesday 28 October 2008 12:23, Evan Cheng wrote: > Author: evancheng > Date: Tue Oct 28 12:23:13 2008 > New Revision: 58336 > > URL: http://llvm.org/viewvc/llvm-project?rev=58336&view=rev > Log: > Avoid calls to setSubgraphColor in release mode. They generate lots of > error messages and slow down compilation. Error messages? What do they say? -Dave From dag at cray.com Tue Oct 28 13:06:43 2008 From: dag at cray.com (David Greene) Date: Tue, 28 Oct 2008 13:06:43 -0500 Subject: [llvm-commits] [llvm] r58336 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: References: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> Message-ID: <200810281306.43666.dag@cray.com> On Tuesday 28 October 2008 13:02, Chris Lattner wrote: > On Oct 28, 2008, at 10:23 AM, Evan Cheng wrote: > > Author: evancheng > > Date: Tue Oct 28 12:23:13 2008 > > New Revision: 58336 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=58336&view=rev > > Log: > > Avoid calls to setSubgraphColor in release mode. They generate lots > > of error messages and slow down compilation. > > Do we even want this in debug mode? Why not make this predicated on > whether -view-isel-dags is set? It's not used with -view-isel-dags. It's only meaningful in the debugger. We definitely want it in debug mode. -Dave From evan.cheng at apple.com Tue Oct 28 13:23:44 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Oct 2008 11:23:44 -0700 Subject: [llvm-commits] [llvm] r58336 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: <200810281305.57876.dag@cray.com> References: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> <200810281305.57876.dag@cray.com> Message-ID: cerr << "SelectionDAG::setSubgraphColor is only available in debug builds" << " on systems with Graphviz or gv!\n"; The nightly tests last night generated enough of them to fill up my hard drives. Evan On Oct 28, 2008, at 11:05 AM, David Greene wrote: > On Tuesday 28 October 2008 12:23, Evan Cheng wrote: >> Author: evancheng >> Date: Tue Oct 28 12:23:13 2008 >> New Revision: 58336 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=58336&view=rev >> Log: >> Avoid calls to setSubgraphColor in release mode. They generate lots >> of >> error messages and slow down compilation. > > Error messages? What do they say? > > -Dave > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From grosbach at apple.com Tue Oct 28 13:25:50 2008 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 28 Oct 2008 18:25:50 -0000 Subject: [llvm-commits] [llvm] r58338 - in /llvm/trunk: include/llvm/Target/TargetJITInfo.h lib/ExecutionEngine/JIT/JITEmitter.cpp lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMJITInfo.h Message-ID: <200810281825.m9SIPoPU000856@zion.cs.uiuc.edu> Author: grosbach Date: Tue Oct 28 13:25:49 2008 New Revision: 58338 URL: http://llvm.org/viewvc/llvm-project?rev=58338&view=rev Log: Support for constant islands in the ARM JIT. Since the ARM constant pool handling supercedes the standard LLVM constant pool entirely, the JIT emitter does not allocate space for the constants, nor initialize the memory. The constant pool is considered part of the instruction stream. Likewise, when resolving relocations into the constant pool, a hook into the target back end is used to resolve from the constant ID# to the address where the constant is stored. For now, the support in the ARM emitter is limited to 32-bit integer. Future patches will expand this to the full range of constants necessary. Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMJITInfo.h Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=58338&r1=58337&r2=58338&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Tue Oct 28 13:25:49 2008 @@ -107,6 +107,15 @@ // JIT to manage a GOT for it. bool needsGOT() const { return useGOT; } + /// hasCustomConstantPool - Allows a target to specify that constant + /// pool address resolution is handled by the target. + virtual bool hasCustomConstantPool() const { return false; } + + /// getCustomConstantPoolEntryAddress - When using a custom constant + /// pool, resolve a constant pool index to the address of where the + /// entry is stored. + virtual intptr_t getCustomConstantPoolEntryAddress(unsigned CPI) const + {return 0;} protected: bool useGOT; }; Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58338&r1=58337&r2=58338&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Oct 28 13:25:49 2008 @@ -1011,6 +1011,11 @@ } void JITEmitter::emitConstantPool(MachineConstantPool *MCP) { + if (TheJIT->getJITInfo().hasCustomConstantPool()) { + DOUT << "JIT: Target has custom constant pool handling. Omitting standard " + "constant pool\n"; + return; + } const std::vector &Constants = MCP->getConstants(); if (Constants.empty()) return; @@ -1124,6 +1129,10 @@ // method. // intptr_t JITEmitter::getConstantPoolEntryAddress(unsigned ConstantNum) const { + if (TheJIT->getJITInfo().hasCustomConstantPool()) { + return TheJIT->getJITInfo().getCustomConstantPoolEntryAddress(ConstantNum); + } + assert(ConstantNum < ConstantPool->getConstants().size() && "Invalid ConstantPoolIndex!"); return (intptr_t)ConstantPoolBase + Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=58338&r1=58337&r2=58338&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Tue Oct 28 13:25:49 2008 @@ -19,6 +19,8 @@ #include "ARMRelocations.h" #include "ARMSubtarget.h" #include "ARMTargetMachine.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/Function.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/MachineCodeEmitter.h" @@ -358,7 +360,29 @@ } void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) { - // FIXME + unsigned CPID = MI.getOperand(0).getImm(); + unsigned CPIndex = MI.getOperand(1).getIndex(); + const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPIndex]; + + //FIXME: Can we get these here? + assert (!MCPE.isMachineConstantPoolEntry()); + + const Constant *CV = MCPE.Val.ConstVal; + // FIXME: We can get other types here. Need to handle them. + // According to the constant island pass, everything is multiples, + // of 4-bytes in size, though, so that helps. + assert (CV->getType()->isInteger()); + assert (cast(CV->getType())->getBitWidth() == 32); + + const ConstantInt *CI = dyn_cast(CV); + uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); + + DOUT << "Constant pool #" << CPID << ", value '" << Val << "' @ " << + (void*)MCE.getCurrentPCValue() << "\n"; + + if (JTI) + JTI->mapCPIDtoAddress(CPID, MCE.getCurrentPCValue()); + MCE.emitWordLE(Val); } void ARMCodeEmitter::emitPseudoInstruction(const MachineInstr &MI) { Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.h?rev=58338&r1=58337&r2=58338&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.h Tue Oct 28 13:25:49 2008 @@ -15,14 +15,16 @@ #define ARMJITINFO_H #include "llvm/Target/TargetJITInfo.h" +#include namespace llvm { class ARMTargetMachine; class ARMJITInfo : public TargetJITInfo { ARMTargetMachine &TM; + std::map CPIDtoAddressMap; public: - explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) {useGOT = 0;} + explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) { useGOT = false; } /// replaceMachineCodeForFunction - Make it so that calling the function /// whose machine code is at OLD turns into a call to NEW, perhaps by @@ -45,6 +47,27 @@ /// referenced global symbols. virtual void relocate(void *Function, MachineRelocation *MR, unsigned NumRelocs, unsigned char* GOTBase); + + /// hasCustomConstantPool - Allows a target to specify that constant + /// pool address resolution is handled by the target. + virtual bool hasCustomConstantPool() const { return true; } + + /// getCustomConstantPoolEntryAddress - The ARM target puts all constant + /// pool entries into constant islands. Resolve the constant pool index + /// into the address where the constant is stored. + virtual intptr_t getCustomConstantPoolEntryAddress(unsigned CPID) const + { + std::map::const_iterator elem; + elem = CPIDtoAddressMap.find(CPID); + assert (elem != CPIDtoAddressMap.end()); + return elem->second; + } + + /// mapCPIDtoAddress - Map a Constant Pool Index (CPID) to the address + /// where its associated value is stored. When relocations are processed, + /// this value will be used to resolve references to the constant. + void mapCPIDtoAddress(unsigned CPID, intptr_t address) + { CPIDtoAddressMap[CPID] = address; } }; } From gohman at apple.com Tue Oct 28 13:42:34 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Oct 2008 11:42:34 -0700 Subject: [llvm-commits] [llvm] r58278 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/Alpha/AlphaISelDAGToDAG.cpp lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/IA64/IA64ISelDAGToDAG.cpp lib/Target/Mips/MipsISelDAGToDAG.cpp lib/Target/PIC16/PIC16ISelDAGToDAG.cpp lib/Target/PowerPC/PPCISelDAGToDAG.cpp lib/Target/Sparc/SparcISelDAGToDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp utils/TableGen/DAGISelEmitter.cpp In-Reply-To: <200810281111.46825.dag@cray.com> References: <200810272156.m9RLuT7v001548@zion.cs.uiuc.edu> <4F0BF11F-0920-4FC4-977D-7E12E5AA2A86@apple.com> <200810281111.46825.dag@cray.com> Message-ID: <9C9979FA-97A2-4AD8-91AB-866F183CC217@apple.com> On Oct 28, 2008, at 9:11 AM, David Greene wrote: > On Monday 27 October 2008 20:00, Dan Gohman wrote: > >>> /// SelectRoot - Top level entry to DAG instruction selector. >>> /// Selects instructions starting at the root of the current DAG. >>> -void SelectRoot() { >>> +void SelectRoot(SelectionDAG &DAG) { >> >> This DAG parameter shouldn't be necessary. SelectRoot is a member >> of SelectionDAGISel, where it can access the CurDAG member. > > It is? Then why isn't it qualified by a scoping operator? It's actually #included inside of the target-specific SelectionDAGISel subclasses, so syntactically it's an inline function. This is a little unusual, but it allows targets to share this code while avoiding the need for a virtual function call to get back into target-specific code. I suppose the same effect could be had using templates, but the current approach is at least an improvement over the prior approach, where all this code was spit out as a fixed block for each target by tablegen. > > >>> SelectRootInit(); >>> unsigned NumBytes = (DAGSize + 7) / 8; >>> ISelQueued = new unsigned char[NumBytes]; >>> @@ -176,14 +176,18 @@ >>> // Skip already selected nodes. >>> if (isSelected(Node->getNodeId())) >>> continue; >>> + DAG.setSubgraphColor(Node, "red"); >> >> I think this line should be guarded by #ifndef NDEBUG, so that >> it doesn't slow down release mode. Either that, or perhaps >> setSubgraphColor itself should be an empty inline function in >> the NDEBUG case. > > setSubgraphColor is so guarded. This actually worked better when > this was > part of DAGISelEmitter because it could be controlled by the new - > gen-debug > flag. The cerr usage in the else case caused major slowdowns. But even with that fixed, it might be nice for setSubgraphColor to have the #ifndef NDEBUG be in an inline function, possibly a wrapper around a call to the real code, so that there's no overhead in Release builds. > > >>> SDNode *ResNode = Select(SDValue(Node, 0)); >>> // If node should not be replaced, >>> // continue with the next one. >>> if (ResNode == Node) >>> continue; >>> // Replace node. >>> - if (ResNode) >>> + if (ResNode) { >>> + DAG.setSubgraphColor(ResNode, "yellow"); >>> + DAG.setSubgraphColor(ResNode, "black"); >> >> Setting the node to yellow and then immediately to black? > > Yep. The idea is that when running codegen in a debugger one can set > breakpoints here. You don't want to keep it yellow because then > your whole > graph becomes yellow once all instructions are selected. You want > to see what > is happening _now_. Ok. Please add a comment explaining this :-). > >>> +namespace { >>> + cl::opt >>> + GenDebug("gen-debug", cl::desc("Generate debug code"), >>> + cl::init(false)); >>> +} >> >> As a tablegen option, this cool functionality is somewhat >> out of common view. Would it make sense to turn this functionality >> on by default, with the code guarded by #ifndef NDEBUG? > > Either that or alter the Makefiles to pass -gen-debug. I kind of > like having > a separate flag. There's other stuff we do here in our local copy > which I > hope to send upstream eventually. I really like having debug tools that are informative and pretty by default :-). What kinds of things are happening here that would not be appropriate for Debug builds? Thanks, Dan From dag at cray.com Tue Oct 28 13:45:50 2008 From: dag at cray.com (David Greene) Date: Tue, 28 Oct 2008 13:45:50 -0500 Subject: [llvm-commits] [llvm] r58336 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: References: <200810281723.m9SHNDaH030832@zion.cs.uiuc.edu> <200810281305.57876.dag@cray.com> Message-ID: <200810281345.50294.dag@cray.com> On Tuesday 28 October 2008 13:23, Evan Cheng wrote: > cerr << "SelectionDAG::setSubgraphColor is only available in debug > builds" > << " on systems with Graphviz or gv!\n"; > > The nightly tests last night generated enough of them to fill up my > hard drives. Ugh. Yeah, that's bad. -Dave From gohman at apple.com Tue Oct 28 13:47:37 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Oct 2008 18:47:37 -0000 Subject: [llvm-commits] [llvm] r58339 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Message-ID: <200810281847.m9SIlb6Q001579@zion.cs.uiuc.edu> Author: djg Date: Tue Oct 28 13:47:37 2008 New Revision: 58339 URL: http://llvm.org/viewvc/llvm-project?rev=58339&view=rev Log: Add some more information to the top-level comment for this file. Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58339&r1=58338&r2=58339&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Tue Oct 28 13:47:37 2008 @@ -11,7 +11,11 @@ // data, which is used by SelectionDAG-based instruction selectors. // // *** NOTE: This file is #included into the middle of the target -// *** instruction selector class. These functions are really methods. +// instruction selector class. These functions are really methods. +// This is a little awkward, but it allows this code to be shared +// by all the targets while still being able to call into +// target-specific code without using a virtual function call. +// //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_DAGISEL_HEADER_H From dag at cray.com Tue Oct 28 13:49:20 2008 From: dag at cray.com (David Greene) Date: Tue, 28 Oct 2008 13:49:20 -0500 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r58278_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_include/llvm/CodeGen/DAGISelHeader=2Eh=09lib/Target/AR?= =?iso-8859-1?q?M/ARMISelDAGToDAG=2Ecpp_lib/Target/Alpha/AlphaISelDAGToDAG?= =?iso-8859-1?q?=2Ecpp=09lib/Target/CellSPU/SPUISelDAGToDAG=2Ecpp_lib/Targ?= =?iso-8859-1?q?et/IA64/IA64ISelDAGToDAG=2Ecpp=09lib/Target/Mips/MipsISelD?= =?iso-8859-1?q?AGToDAG=2Ecpp_lib/Target/PIC16/PIC16ISelDAGToDAG=2Ecpp=09l?= =?iso-8859-1?q?ib/Target/PowerPC/PPCISelDAGToDAG=2Ecpp_lib/Target/Sparc/S?= =?iso-8859-1?q?parcISelDAGToDAG=2Ecpp=09lib/Target/X86/X86ISelDAGToDAG=2E?= =?iso-8859-1?q?cpp_utils/TableGen/DAGISelEmitter=2Ecpp?= In-Reply-To: <9C9979FA-97A2-4AD8-91AB-866F183CC217@apple.com> References: <200810272156.m9RLuT7v001548@zion.cs.uiuc.edu> <200810281111.46825.dag@cray.com> <9C9979FA-97A2-4AD8-91AB-866F183CC217@apple.com> Message-ID: <200810281349.20559.dag@cray.com> On Tuesday 28 October 2008 13:42, Dan Gohman wrote: > > It is? Then why isn't it qualified by a scoping operator? > > It's actually #included inside of the target-specific SelectionDAGISel > subclasses, so syntactically it's an inline function. This is a little > unusual, but it allows targets to share this code while avoiding the > need for a virtual function call to get back into target-specific code. > I suppose the same effect could be had using templates, but the > current approach is at least an improvement over the prior approach, > where all this code was spit out as a fixed block for each target > by tablegen. Yeah, I realized what is going on. I'll look at fixing this in a bit. I have a couple of Standard Library violation fixes to commit first. > > setSubgraphColor is so guarded. This actually worked better when > > this was > > part of DAGISelEmitter because it could be controlled by the new - > > gen-debug > > flag. > > The cerr usage in the else case caused major slowdowns. But even > with that fixed, it might be nice for setSubgraphColor to have > the #ifndef NDEBUG be in an inline function, possibly a wrapper > around a call to the real code, so that there's no overhead in > Release builds. Yep, will fix. > >> Setting the node to yellow and then immediately to black? > > > > Yep. The idea is that when running codegen in a debugger one can set > > breakpoints here. You don't want to keep it yellow because then > > your whole > > graph becomes yellow once all instructions are selected. You want > > to see what > > is happening _now_. > > Ok. Please add a comment explaining this :-). Ok. > >>> +namespace { > >>> + cl::opt > >>> + GenDebug("gen-debug", cl::desc("Generate debug code"), > >>> + cl::init(false)); > >>> +} > >> > >> As a tablegen option, this cool functionality is somewhat > >> out of common view. Would it make sense to turn this functionality > >> on by default, with the code guarded by #ifndef NDEBUG? > > > > Either that or alter the Makefiles to pass -gen-debug. I kind of > > like having > > a separate flag. There's other stuff we do here in our local copy > > which I > > hope to send upstream eventually. > > I really like having debug tools that are informative and pretty > by default :-). What kinds of things are happening here that would > not be appropriate for Debug builds? With a Makefile change things will be pretty by default. The other major thing we have here is some code to add comments to SDNodes and MachineInstrs. There's a flag to annotate instructions with comments that show which pattern generated them. I'm not sure we always want that on, even in debug builds. I'm not wedded to the TableGen flag, though. -Dave From dag at cray.com Tue Oct 28 13:56:47 2008 From: dag at cray.com (David Greene) Date: Tue, 28 Oct 2008 13:56:47 -0500 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r58278_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_include/llvm/CodeGen/DAGISelHeader=2Eh=09lib/Target/AR?= =?iso-8859-1?q?M/ARMISelDAGToDAG=2Ecpp_lib/Target/Alpha/AlphaISelDAGToDAG?= =?iso-8859-1?q?=2Ecpp=09lib/Target/CellSPU/SPUISelDAGToDAG=2Ecpp_lib/Targ?= =?iso-8859-1?q?et/IA64/IA64ISelDAGToDAG=2Ecpp=09lib/Target/Mips/MipsISelD?= =?iso-8859-1?q?AGToDAG=2Ecpp_lib/Target/PIC16/PIC16ISelDAGToDAG=2Ecpp=09l?= =?iso-8859-1?q?ib/Target/PowerPC/PPCISelDAGToDAG=2Ecpp_lib/Target/Sparc/S?= =?iso-8859-1?q?parcISelDAGToDAG=2Ecpp=09lib/Target/X86/X86ISelDAGToDAG=2E?= =?iso-8859-1?q?cpp_utils/TableGen/DAGISelEmitter=2Ecpp?= In-Reply-To: <9C9979FA-97A2-4AD8-91AB-866F183CC217@apple.com> References: <200810272156.m9RLuT7v001548@zion.cs.uiuc.edu> <200810281111.46825.dag@cray.com> <9C9979FA-97A2-4AD8-91AB-866F183CC217@apple.com> Message-ID: <200810281356.47340.dag@cray.com> On Tuesday 28 October 2008 13:42, Dan Gohman wrote: > >> This DAG parameter shouldn't be necessary. SelectRoot is a member > >> of SelectionDAGISel, where it can access the CurDAG member. > > > > It is? Then why isn't it qualified by a scoping operator? > > It's actually #included inside of the target-specific SelectionDAGISel > subclasses, so syntactically it's an inline function. This is a little > unusual, but it allows targets to share this code while avoiding the > need for a virtual function call to get back into target-specific code. > I suppose the same effect could be had using templates, but the CRTP is perfect for this kind of thing. But things work now so I wouldn't disturb it unless we have a cleanup goal later on. -Dave From gohman at apple.com Tue Oct 28 14:08:47 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Oct 2008 19:08:47 -0000 Subject: [llvm-commits] [llvm] r58340 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200810281908.m9SJ8lli002220@zion.cs.uiuc.edu> Author: djg Date: Tue Oct 28 14:08:46 2008 New Revision: 58340 URL: http://llvm.org/viewvc/llvm-project?rev=58340&view=rev Log: Protect the code for fast-isel debugging with #ifndef NDEBUG. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=58340&r1=58339&r2=58340&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Oct 28 14:08:46 2008 @@ -55,6 +55,7 @@ EnableValueProp("enable-value-prop", cl::Hidden); static cl::opt DisableLegalizeTypes("disable-legalize-types", cl::Hidden); +#ifndef NDEBUG static cl::opt EnableFastISelVerbose("fast-isel-verbose", cl::Hidden, cl::desc("Enable verbose messages in the \"fast\" " @@ -62,6 +63,7 @@ static cl::opt EnableFastISelAbort("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction fails")); +#endif static cl::opt SchedLiveInCopies("schedule-livein-copies", cl::desc("Schedule copies of livein registers"), @@ -701,8 +703,10 @@ for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I, ++j) if (Fn.paramHasAttr(j, Attribute::ByVal)) { +#ifndef NDEBUG if (EnableFastISelVerbose || EnableFastISelAbort) cerr << "FastISel skips entry block due to byval argument\n"; +#endif SuppressFastISel = true; break; } @@ -766,12 +770,14 @@ // feed PHI nodes in successor blocks. if (isa(BI)) if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, FastIS)) { +#ifndef NDEBUG if (EnableFastISelVerbose || EnableFastISelAbort) { cerr << "FastISel miss: "; BI->dump(); } if (EnableFastISelAbort) assert(0 && "FastISel didn't handle a PHI in a successor"); +#endif break; } @@ -785,10 +791,12 @@ // Then handle certain instructions as single-LLVM-Instruction blocks. if (isa(BI)) { +#ifndef NDEBUG if (EnableFastISelVerbose || EnableFastISelAbort) { cerr << "FastISel missed call: "; BI->dump(); } +#endif if (BI->getType() != Type::VoidTy) { unsigned &R = FuncInfo->ValueMap[BI]; @@ -803,6 +811,7 @@ continue; } +#ifndef NDEBUG // Otherwise, give up on FastISel for the rest of the block. // For now, be a little lenient about non-branch terminators. if (!isa(BI) || isa(BI)) { @@ -815,6 +824,7 @@ // For the purpose of debugging, just abort. assert(0 && "FastISel didn't select the entire block"); } +#endif break; } } From daniel at zuster.org Tue Oct 28 14:33:03 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Oct 2008 19:33:03 -0000 Subject: [llvm-commits] [llvm] r58343 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200810281933.m9SJX3Z5003175@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Oct 28 14:33:02 2008 New Revision: 58343 URL: http://llvm.org/viewvc/llvm-project?rev=58343&view=rev Log: Reuse PrintEscapedString for printing names in .ll - One functionality change, '\\' in a name is now printed as a hex escape instead of "\\\\". This is consistent with other users of PrintEscapedString. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=58343&r1=58342&r2=58343&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Oct 28 14:33:02 2008 @@ -60,6 +60,25 @@ return 0; } +// PrintEscapedString - Print each character of the specified string, escaping +// it if it is not printable or if it is an escape char. +static void PrintEscapedString(const char *Str, unsigned Length, + raw_ostream &Out) { + for (unsigned i = 0; i != Length; ++i) { + unsigned char C = Str[i]; + if (isprint(C) && C != '\\' && C != '"' && isprint(C)) + Out << C; + else + Out << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F); + } +} + +// PrintEscapedString - Print each character of the specified string, escaping +// it if it is not printable or if it is an escape char. +static void PrintEscapedString(const std::string &Str, raw_ostream &Out) { + PrintEscapedString(Str.c_str(), Str.size(), Out); +} + enum PrefixType { GlobalPrefix, LabelPrefix, @@ -82,7 +101,7 @@ } // Scan the name to see if it needs quotes first. - bool NeedsQuotes = NameStr[0] >= '0' && NameStr[0] <= '9'; + bool NeedsQuotes = isdigit(NameStr[0]); if (!NeedsQuotes) { for (unsigned i = 0; i != NameLen; ++i) { char C = NameStr[i]; @@ -102,18 +121,7 @@ // Okay, we need quotes. Output the quotes and escape any scary characters as // needed. OS << '"'; - for (unsigned i = 0; i != NameLen; ++i) { - char C = NameStr[i]; - if (C == '\\') { - OS << "\\\\"; - } else if (C != '"' && isprint(C)) { - OS << C; - } else { - OS << '\\'; - OS << hexdigit((C >> 4) & 0x0F); - OS << hexdigit((C >> 0) & 0x0F); - } - } + PrintEscapedString(NameStr, NameLen, OS); OS << '"'; } @@ -579,21 +587,6 @@ } } -// PrintEscapedString - Print each character of the specified string, escaping -// it if it is not printable or if it is an escape char. -static void PrintEscapedString(const std::string &Str, raw_ostream &Out) { - for (unsigned i = 0, e = Str.size(); i != e; ++i) { - unsigned char C = Str[i]; - if (isprint(C) && C != '"' && C != '\\') { - Out << C; - } else { - Out << '\\' - << (char) ((C/16 < 10) ? ( C/16 +'0') : ( C/16 -10+'A')) - << (char)(((C&15) < 10) ? ((C&15)+'0') : ((C&15)-10+'A')); - } - } -} - static const char *getPredicateText(unsigned predicate) { const char * pred = "unknown"; switch (predicate) { From clattner at apple.com Tue Oct 28 14:40:08 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Oct 2008 12:40:08 -0700 Subject: [llvm-commits] [llvm] r58340 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <200810281908.m9SJ8lli002220@zion.cs.uiuc.edu> References: <200810281908.m9SJ8lli002220@zion.cs.uiuc.edu> Message-ID: On Oct 28, 2008, at 12:08 PM, Dan Gohman wrote: > Author: djg > Date: Tue Oct 28 14:08:46 2008 > New Revision: 58340 > > URL: http://llvm.org/viewvc/llvm-project?rev=58340&view=rev > Log: > Protect the code for fast-isel debugging with #ifndef NDEBUG. Thanks, > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Oct > 28 14:08:46 2008 > @@ -55,6 +55,7 @@ > EnableValueProp("enable-value-prop", cl::Hidden); > static cl::opt > DisableLegalizeTypes("disable-legalize-types", cl::Hidden); > +#ifndef NDEBUG > static cl::opt > EnableFastISelVerbose("fast-isel-verbose", cl::Hidden, > cl::desc("Enable verbose messages in the \"fast\" " How about: #else enum { EnableFastISelVerbose = 0; } and let the compiler strip the code that uses EnableFastISelVerbose, instead of #ifdef'ing around each use? -Chris > > @@ -62,6 +63,7 @@ > static cl::opt > EnableFastISelAbort("fast-isel-abort", cl::Hidden, > cl::desc("Enable abort calls when \"fast\" instruction > fails")); > +#endif > static cl::opt > SchedLiveInCopies("schedule-livein-copies", > cl::desc("Schedule copies of livein registers"), > @@ -701,8 +703,10 @@ > for (Function::arg_iterator I = Fn.arg_begin(), E = > Fn.arg_end(); > I != E; ++I, ++j) > if (Fn.paramHasAttr(j, Attribute::ByVal)) { > +#ifndef NDEBUG > if (EnableFastISelVerbose || EnableFastISelAbort) > cerr << "FastISel skips entry block due to byval > argument\n"; > +#endif > SuppressFastISel = true; > break; > } > @@ -766,12 +770,14 @@ > // feed PHI nodes in successor blocks. > if (isa(BI)) > if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, FastIS)) { > +#ifndef NDEBUG > if (EnableFastISelVerbose || EnableFastISelAbort) { > cerr << "FastISel miss: "; > BI->dump(); > } > if (EnableFastISelAbort) > assert(0 && "FastISel didn't handle a PHI in a > successor"); > +#endif > break; > } > > @@ -785,10 +791,12 @@ > > // Then handle certain instructions as single-LLVM- > Instruction blocks. > if (isa(BI)) { > +#ifndef NDEBUG > if (EnableFastISelVerbose || EnableFastISelAbort) { > cerr << "FastISel missed call: "; > BI->dump(); > } > +#endif > > if (BI->getType() != Type::VoidTy) { > unsigned &R = FuncInfo->ValueMap[BI]; > @@ -803,6 +811,7 @@ > continue; > } > > +#ifndef NDEBUG > // Otherwise, give up on FastISel for the rest of the block. > // For now, be a little lenient about non-branch terminators. > if (!isa(BI) || isa(BI)) { > @@ -815,6 +824,7 @@ > // For the purpose of debugging, just abort. > assert(0 && "FastISel didn't select the entire block"); > } > +#endif > break; > } > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Tue Oct 28 15:05:06 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Oct 2008 20:05:06 -0000 Subject: [llvm-commits] [llvm] r58345 - /llvm/trunk/docs/CommandGuide/llvm-ld.pod Message-ID: <200810282005.m9SK56vp004272@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 28 15:05:06 2008 New Revision: 58345 URL: http://llvm.org/viewvc/llvm-project?rev=58345&view=rev Log: llvm-ld doesn't have a -march option. This fixes PR2961 Modified: llvm/trunk/docs/CommandGuide/llvm-ld.pod Modified: llvm/trunk/docs/CommandGuide/llvm-ld.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-ld.pod?rev=58345&r1=58344&r2=58345&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/llvm-ld.pod (original) +++ llvm/trunk/docs/CommandGuide/llvm-ld.pod Tue Oct 28 15:05:06 2008 @@ -128,10 +128,6 @@ An alias for -link-as-library. -=item B<-march=>C - -Specifies the kind of machine for which code or assembly should be generated. - =item B<-native> Generate a native machine code executable. From dalej at apple.com Tue Oct 28 15:23:16 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 28 Oct 2008 20:23:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58347 - in /llvm-gcc-4.2/trunk/gcc: cp/name-lookup.c testsuite/g++.apple/lookup-1.C Message-ID: <200810282023.m9SKNG8N004938@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 28 15:23:11 2008 New Revision: 58347 URL: http://llvm.org/viewvc/llvm-project?rev=58347&view=rev Log: Bring fix for PR 2867 over from Apple gcc-4.2. Fix by Mike Stump. His comment: This is one of the corner cases in C++ that just makes the head hurt. We don't want to find hidden friends from local classes during name lookup at this point. Previously we would just crash. Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/lookup-1.C Modified: llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c Modified: llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c?rev=58347&r1=58346&r2=58347&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c Tue Oct 28 15:23:11 2008 @@ -4039,8 +4039,13 @@ if (binding) { - /* Only namespace-scope bindings can be hidden. */ - gcc_assert (!hidden_name_p (binding)); + /* APPLE LOCAL begin 6322334 */ + /* Ick, we don't want to find a hidden friend inside a + local class! */ + if (hidden_name_p (binding)) + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE); + /* APPLE LOCAL end 6322334 */ + val = binding; break; } Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/lookup-1.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/lookup-1.C?rev=58347&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/lookup-1.C (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/lookup-1.C Tue Oct 28 15:23:11 2008 @@ -0,0 +1,13 @@ +/* APPLE LOCAL file 6322334 */ +/* Radar 6322334 */ + +class A { + void foo(const char* basename); +}; +void A::foo(const char* basename) { + class B { + friend class C; + static void WaitForSinks(C:: /* { dg-error "has not been declared" } */ + D* data); /* { dg-error "expected" } */ + }; +} From gohman at apple.com Tue Oct 28 15:35:32 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Oct 2008 20:35:32 -0000 Subject: [llvm-commits] [llvm] r58350 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200810282035.m9SKZWq6005456@zion.cs.uiuc.edu> Author: djg Date: Tue Oct 28 15:35:31 2008 New Revision: 58350 URL: http://llvm.org/viewvc/llvm-project?rev=58350&view=rev Log: Take Chris' suggestion and define EnableFastISelVerbose and EnableFastISelAbort variables for Release mode instead of using ifdefs in the code. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=58350&r1=58349&r2=58350&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Oct 28 15:35:31 2008 @@ -63,6 +63,9 @@ static cl::opt EnableFastISelAbort("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction fails")); +#else +static const bool EnableFastISelVerbose = false, + EnableFastISelAbort = false; #endif static cl::opt SchedLiveInCopies("schedule-livein-copies", @@ -703,10 +706,8 @@ for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I, ++j) if (Fn.paramHasAttr(j, Attribute::ByVal)) { -#ifndef NDEBUG if (EnableFastISelVerbose || EnableFastISelAbort) cerr << "FastISel skips entry block due to byval argument\n"; -#endif SuppressFastISel = true; break; } @@ -770,14 +771,12 @@ // feed PHI nodes in successor blocks. if (isa(BI)) if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, FastIS)) { -#ifndef NDEBUG if (EnableFastISelVerbose || EnableFastISelAbort) { cerr << "FastISel miss: "; BI->dump(); } if (EnableFastISelAbort) assert(0 && "FastISel didn't handle a PHI in a successor"); -#endif break; } @@ -791,12 +790,10 @@ // Then handle certain instructions as single-LLVM-Instruction blocks. if (isa(BI)) { -#ifndef NDEBUG if (EnableFastISelVerbose || EnableFastISelAbort) { cerr << "FastISel missed call: "; BI->dump(); } -#endif if (BI->getType() != Type::VoidTy) { unsigned &R = FuncInfo->ValueMap[BI]; @@ -811,7 +808,6 @@ continue; } -#ifndef NDEBUG // Otherwise, give up on FastISel for the rest of the block. // For now, be a little lenient about non-branch terminators. if (!isa(BI) || isa(BI)) { @@ -824,7 +820,6 @@ // For the purpose of debugging, just abort. assert(0 && "FastISel didn't select the entire block"); } -#endif break; } } From criswell at cs.uiuc.edu Tue Oct 28 16:23:04 2008 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 28 Oct 2008 16:23:04 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200810282123.m9SLN4Yo026698@maute.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.39 -> 1.40 --- Log message: Added LLVM D compiler. --- Diffs of the changes: (+8 -1) Users.html | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.39 llvm-www/Users.html:1.40 --- llvm-www/Users.html:1.39 Thu Oct 9 15:21:03 2008 +++ llvm-www/Users.html Tue Oct 28 16:22:14 2008 @@ -370,6 +370,13 @@ Python bindings for LLVM. + + + + LLVM D Compiler + D compiler with LLVM backend. + +

@@ -384,6 +391,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2008/10/09 20:21:03 $ + Last modified: $Date: 2008/10/28 21:22:14 $ From gohman at apple.com Tue Oct 28 17:39:03 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Oct 2008 22:39:03 -0000 Subject: [llvm-commits] [llvm] r58351 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll Message-ID: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> Author: djg Date: Tue Oct 28 17:38:57 2008 New Revision: 58351 URL: http://llvm.org/viewvc/llvm-project?rev=58351&view=rev Log: (A & sext(C)) | (B & ~sext(C) -> C ? A : B Added: llvm/trunk/test/Transforms/InstCombine/logical-select.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=58351&r1=58350&r2=58351&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 28 17:38:57 2008 @@ -4337,6 +4337,25 @@ return BinaryOperator::CreateAnd(V1, Or); } } + + // (A & sext(C0)) | (B & ~sext(C0) -> C0 ? A : B + if (isa(C) && + cast(C)->getOperand(0)->getType() == Type::Int1Ty) { + if (match(D, m_Not(m_Value(C)))) + return SelectInst::Create(cast(C)->getOperand(0), A, B); + // And commutes, try both ways. + if (match(B, m_Not(m_Value(C)))) + return SelectInst::Create(cast(C)->getOperand(0), A, D); + } + // Or commutes, try both ways. + if (isa(D) && + cast(D)->getOperand(0)->getType() == Type::Int1Ty) { + if (match(C, m_Not(m_Value(D)))) + return SelectInst::Create(cast(D)->getOperand(0), A, B); + // And commutes, try both ways. + if (match(A, m_Not(m_Value(D)))) + return SelectInst::Create(cast(D)->getOperand(0), C, B); + } } // (X >> Z) | (Y >> Z) -> (X|Y) >> Z for all shifts. Added: llvm/trunk/test/Transforms/InstCombine/logical-select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/logical-select.ll?rev=58351&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/logical-select.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/logical-select.ll Tue Oct 28 17:38:57 2008 @@ -0,0 +1,20 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select | count 2 + +define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { + %e = icmp slt i32 %a, %b + %f = sext i1 %e to i32 + %g = and i32 %c, %f + %h = xor i32 %f, -1 + %i = and i32 %d, %h + %j = or i32 %g, %i + ret i32 %j +} +define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { + %e = icmp slt i32 %a, %b + %f = sext i1 %e to i32 + %g = and i32 %c, %f + %h = xor i32 %f, -1 + %i = and i32 %d, %h + %j = or i32 %i, %g + ret i32 %j +} From clattner at apple.com Tue Oct 28 18:13:25 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Oct 2008 16:13:25 -0700 Subject: [llvm-commits] [llvm] r58351 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll In-Reply-To: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> References: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> Message-ID: <31FD8611-77F8-4739-A8F4-1167E3CC63EF@apple.com> On Oct 28, 2008, at 3:39 PM, Dan Gohman wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=58351&view=rev > Log: > (A & sext(C)) | (B & ~sext(C) -> C ? A : B Is sext from i1 really the canonical form or is select c, -1, 0? If so, do we turn "c ? -1 : 0" into sext(c)? If not, do we already do this xform for the ?: form? -Chris From daniel at zuster.org Tue Oct 28 18:24:26 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Oct 2008 23:24:26 -0000 Subject: [llvm-commits] [llvm] r58352 - in /llvm/trunk: include/llvm/Transforms/Utils/InlineCost.h lib/Transforms/IPO/InlineAlways.cpp lib/Transforms/Utils/BasicInliner.cpp Message-ID: <200810282324.m9SNOR3J011182@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Oct 28 18:24:26 2008 New Revision: 58352 URL: http://llvm.org/viewvc/llvm-project?rev=58352&view=rev Log: Assorted comment/naming fixes, 80-col violations, and reindentation. - No functionality change. Modified: llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Modified: llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h?rev=58352&r1=58351&r2=58352&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h Tue Oct 28 18:24:26 2008 @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef INLINECOST_H -#define INLINECOST_H +#ifndef LLVM_TRANSFORMS_UTILS_INLINECOST_H +#define LLVM_TRANSFORMS_UTILS_INLINECOST_H #include "llvm/ADT/SmallPtrSet.h" #include @@ -46,7 +46,7 @@ /// is used to estimate the code size cost of inlining it. unsigned NumInsts, NumBlocks; - /// NumVectorInsts - Keep track how many instrctions produce vector + /// NumVectorInsts - Keep track of how many instructions produce vector /// values. The inliner is being more aggressive with inlining vector /// kernels. unsigned NumVectorInsts; Modified: llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp?rev=58352&r1=58351&r2=58352&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp Tue Oct 28 18:24:26 2008 @@ -51,14 +51,13 @@ char AlwaysInliner::ID = 0; static RegisterPass -X("always-inline", "Inliner that handles always_inline functions"); +X("always-inline", "Inliner for always_inline functions"); Pass *llvm::createAlwaysInlinerPass() { return new AlwaysInliner(); } // doInitialization - Initializes the vector of functions that have not // been annotated with the "always inline" attribute. bool AlwaysInliner::doInitialization(CallGraph &CG) { - Module &M = CG.getModule(); for (Module::iterator I = M.begin(), E = M.end(); @@ -68,4 +67,3 @@ return false; } - Modified: llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp?rev=58352&r1=58351&r2=58352&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Tue Oct 28 18:24:26 2008 @@ -28,7 +28,7 @@ static cl::opt BasicInlineThreshold("inline-threshold", cl::Hidden, cl::init(200), - cl::desc("Control the amount of basic inlining to perform (default = 200)")); + cl::desc("Control the amount of basic inlining to perform (default = 200)")); namespace llvm { @@ -95,22 +95,23 @@ bool Changed = false; do { Changed = false; - for (unsigned index = 0; index != CallSites.size() && !CallSites.empty(); ++index) { + for (unsigned index = 0; index != CallSites.size() && !CallSites.empty(); + ++index) { CallSite CS = CallSites[index]; if (Function *Callee = CS.getCalledFunction()) { - // Eliminate calls taht are never inlinable. + // Eliminate calls that are never inlinable. if (Callee->isDeclaration() || CS.getInstruction()->getParent()->getParent() == Callee) { CallSites.erase(CallSites.begin() + index); - --index; - continue; + --index; + continue; } int InlineCost = CA.getInlineCost(CS, NeverInline); if (InlineCost >= (int) BasicInlineThreshold) { - DOUT << " NOT Inlining: cost = " << InlineCost - << ", call: " << *CS.getInstruction(); - continue; + DOUT << " NOT Inlining: cost = " << InlineCost + << ", call: " << *CS.getInstruction(); + continue; } DOUT << " Inlining: cost=" << InlineCost @@ -119,7 +120,7 @@ // Inline if (InlineFunction(CS, NULL, TD)) { if (Callee->use_empty() && Callee->hasInternalLinkage()) - DeadFunctions.insert(Callee); + DeadFunctions.insert(Callee); Changed = true; CallSites.erase(CallSites.begin() + index); --index; From greened at obbligato.org Tue Oct 28 19:30:54 2008 From: greened at obbligato.org (David Greene) Date: Wed, 29 Oct 2008 00:30:54 -0000 Subject: [llvm-commits] [llvm] r58354 - /llvm/trunk/include/llvm/Instructions.h Message-ID: <200810290030.m9T0Utxw014113@zion.cs.uiuc.edu> Author: greened Date: Tue Oct 28 19:30:54 2008 New Revision: 58354 URL: http://llvm.org/viewvc/llvm-project?rev=58354&view=rev Log: Don't force things to be Value * when they're not. Modified: llvm/trunk/include/llvm/Instructions.h Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=58354&r1=58353&r2=58354&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Tue Oct 28 19:30:54 2008 @@ -420,7 +420,7 @@ if (NumIdx > 0) // This requires that the iterator points to contiguous memory. - return getIndexedType(Ptr, (Value *const *)&*IdxBegin, NumIdx); + return getIndexedType(Ptr, &*IdxBegin, NumIdx); else return getIndexedType(Ptr, (Value *const*)0, NumIdx); } From daniel at zuster.org Tue Oct 28 20:02:03 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Oct 2008 01:02:03 -0000 Subject: [llvm-commits] [llvm] r58355 - in /llvm/trunk: include/llvm/Transforms/IPO/InlinerPass.h lib/Transforms/IPO/Inliner.cpp Message-ID: <200810290102.m9T124x8015393@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Oct 28 20:02:02 2008 New Revision: 58355 URL: http://llvm.org/viewvc/llvm-project?rev=58355&view=rev Log: Factor shouldInline method out of Inliner. - No functionality change. Modified: llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h llvm/trunk/lib/Transforms/IPO/Inliner.cpp Modified: llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h?rev=58355&r1=58354&r2=58355&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h Tue Oct 28 20:02:02 2008 @@ -23,7 +23,7 @@ class CallSite; /// Inliner - This class contains all of the helper code which is used to -/// perform the inlining operations that does not depend on the policy. +/// perform the inlining operations that do not depend on the policy. /// struct Inliner : public CallGraphSCCPass { explicit Inliner(void *ID); @@ -63,6 +63,10 @@ private: // InlineThreshold - Cache the value here for easy access. unsigned InlineThreshold; + + /// shouldInline - Return true if the inliner should attempt to + /// inline at the given CallSite. + bool shouldInline(CallSite CS); }; } // End llvm namespace Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=58355&r1=58354&r2=58355&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Tue Oct 28 20:02:02 2008 @@ -72,6 +72,31 @@ } return true; } + +/// shouldInline - Return true if the inliner should attempt to inline +/// at the given CallSite. +bool Inliner::shouldInline(CallSite CS) { + int Cost = getInlineCost(CS); + float FudgeFactor = getInlineFudgeFactor(CS); + + int CurrentThreshold = InlineThreshold; + Function *Fn = CS.getCaller(); + if (Fn && !Fn->isDeclaration() + && Fn->hasFnAttr(Attribute::OptimizeForSize) + && InlineThreshold != 50) { + CurrentThreshold = 50; + } + + if (Cost >= (int)(CurrentThreshold * FudgeFactor)) { + DOUT << " NOT Inlining: cost=" << Cost + << ", Call: " << *CS.getInstruction(); + return false; + } else { + DOUT << " Inlining: cost=" << Cost + << ", Call: " << *CS.getInstruction(); + return true; + } +} bool Inliner::runOnSCC(const std::vector &SCC) { CallGraph &CG = getAnalysis(); @@ -136,24 +161,7 @@ // If the policy determines that we should inline this function, // try to do so. CallSite CS = CallSites[CSi]; - int InlineCost = getInlineCost(CS); - float FudgeFactor = getInlineFudgeFactor(CS); - - int CurrentThreshold = InlineThreshold; - Function *Fn = CS.getCaller(); - if (Fn && !Fn->isDeclaration() - && Fn->hasFnAttr(Attribute::OptimizeForSize) - && InlineThreshold != 50) { - CurrentThreshold = 50; - } - - if (InlineCost >= (int)(CurrentThreshold * FudgeFactor)) { - DOUT << " NOT Inlining: cost=" << InlineCost - << ", Call: " << *CS.getInstruction(); - } else { - DOUT << " Inlining: cost=" << InlineCost - << ", Call: " << *CS.getInstruction(); - + if (shouldInline(CS)) { // Attempt to inline the function... if (InlineCallIfPossible(CS, CG, SCCFunctions, getAnalysis())) { From ofv at wanadoo.es Tue Oct 28 21:33:15 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Wed, 29 Oct 2008 02:33:15 -0000 Subject: [llvm-commits] [llvm] r58358 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake cmake/modules/TableGen.cmake tools/llvmc2/driver/CMakeLists.txt Message-ID: <200810290233.m9T2XFNm018645@zion.cs.uiuc.edu> Author: ofv Date: Tue Oct 28 21:33:15 2008 New Revision: 58358 URL: http://llvm.org/viewvc/llvm-project?rev=58358&view=rev Log: CMake: Removed some cruft. Modified: llvm/trunk/CMakeLists.txt llvm/trunk/cmake/config-ix.cmake llvm/trunk/cmake/modules/TableGen.cmake llvm/trunk/tools/llvmc2/driver/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=58358&r1=58357&r2=58358&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Tue Oct 28 21:33:15 2008 @@ -7,7 +7,7 @@ include(FindPerl) set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include/llvm) +set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include) set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin) set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) @@ -21,14 +21,6 @@ CACHE STRING "Semicolon-separated list of targets to build") endif( MSVC ) -if( NOT MSVC ) - set(CMAKE_CXX_LINK_EXECUTABLE "sh -c \"${CMAKE_CXX_LINK_EXECUTABLE}\"") -endif( NOT MSVC ) - -# TODO: Eliminate? -get_filename_component(llvm_include_path ${LLVM_MAIN_SRC_DIR}/include ABSOLUTE) - -#get_filename_component(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm ABSOLUTE) set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm) # Add path for custom modules @@ -83,7 +75,7 @@ add_definitions( -wd4355 -wd4715 ) endif( MSVC ) -include_directories( ${LLVM_BINARY_DIR}/include ${llvm_include_path}) +include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR}) #link_directories( d:/dev/lib ) #add_subdirectory(lib) @@ -101,7 +93,7 @@ add_subdirectory(utils/TableGen) add_custom_command(OUTPUT ${llvm_builded_incs_dir}/Intrinsics.gen - COMMAND tblgen -gen-intrinsic -I ${llvm_include_path} ${llvm_include_path}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen + COMMAND tblgen -gen-intrinsic -I ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen DEPENDS tblgen COMMENT "Building intrinsics.gen...") Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=58358&r1=58357&r2=58358&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Tue Oct 28 21:33:15 2008 @@ -57,9 +57,9 @@ message(STATUS "LLVM_HOSTTRIPLE: ${LLVM_HOSTTRIPLE}") if( MINGW ) - # tbi: Comprobar que existen las librerias: set(HAVE_LIBIMAGEHLP 1) set(HAVE_LIBPSAPI 1) + # TODO: Check existence of libraries. # include(CheckLibraryExists) # CHECK_LIBRARY_EXISTS(imagehlp ??? . HAVE_LIBIMAGEHLP) endif( MINGW ) @@ -97,26 +97,26 @@ set(ENABLE_THREADS 0) configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/Config/config.h.cmake + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake ${LLVM_BINARY_DIR}/include/llvm/Config/config.h ) configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/ADT/iterator.cmake + ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/iterator.cmake ${LLVM_BINARY_DIR}/include/llvm/ADT/iterator.h ) configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/Support/DataTypes.h.cmake + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h ) configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_map.cmake + ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/hash_map.cmake ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_map.h ) configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_set.cmake + ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/hash_set.cmake ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_set.h ) Modified: llvm/trunk/cmake/modules/TableGen.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=58358&r1=58357&r2=58358&view=diff ============================================================================== --- llvm/trunk/cmake/modules/TableGen.cmake (original) +++ llvm/trunk/cmake/modules/TableGen.cmake Tue Oct 28 21:33:15 2008 @@ -4,7 +4,7 @@ macro(tablegen ofn) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} - COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${llvm_include_path} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn} + COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn} DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} COMMENT "Building ${ofn}..." ) Modified: llvm/trunk/tools/llvmc2/driver/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/driver/CMakeLists.txt?rev=58358&r1=58357&r2=58358&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/driver/CMakeLists.txt (original) +++ llvm/trunk/tools/llvmc2/driver/CMakeLists.txt Tue Oct 28 21:33:15 2008 @@ -3,11 +3,11 @@ macro(tgen ofn) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} - COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${llvm_include_path} ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td -o ${ofn} + COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td -o ${ofn} DEPENDS tblgen - ${llvm_include_path}/llvm/CompilerDriver/Common.td - ${llvm_include_path}/llvm/CompilerDriver/Tools.td + ${LLVM_MAIN_INCLUDE_DIR}/llvm/CompilerDriver/Common.td + ${LLVM_MAIN_INCLUDE_DIR}/llvm/CompilerDriver/Tools.td COMMENT "Building ${ofn}..." ) endmacro(tgen ofn) From daniel at zuster.org Tue Oct 28 22:05:28 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Oct 2008 20:05:28 -0700 Subject: [llvm-commits] PATCH: Add InlineCost class Message-ID: <6a8523d60810282005t3a2aa087re6b419e15be1b628@mail.gmail.com> The attached patch adds an InlineCost value class to wrap the costs returned by Inliner::getInlineCost. The motivation is that it encodes whether the cost equates to "always" inline or "never" inline, instead of returning the magic constants -2000000000 and 2000000000 respectively. Previously there were cases where always functions were not inlined (in fact, it looked to me like the always inliner would almost never work). Additionally, I am worried about cases where the fudge factor computation overflows when using the large magic constants. With this change the inliner is guaranteed to respect the "always" and "never" requests. - Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081028/91aed14e/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: InlineCost.patch Type: application/octet-stream Size: 8740 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081028/91aed14e/attachment.obj From gohman at apple.com Tue Oct 28 22:07:44 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Oct 2008 20:07:44 -0700 Subject: [llvm-commits] [llvm] r58351 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll In-Reply-To: <31FD8611-77F8-4739-A8F4-1167E3CC63EF@apple.com> References: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> <31FD8611-77F8-4739-A8F4-1167E3CC63EF@apple.com> Message-ID: On Oct 28, 2008, at 4:13 PM, Chris Lattner wrote: > On Oct 28, 2008, at 3:39 PM, Dan Gohman wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=58351&view=rev >> Log: >> (A & sext(C)) | (B & ~sext(C) -> C ? A : B > > Is sext from i1 really the canonical form or is select c, -1, 0? If > so, do we turn "c ? -1 : 0" into sext(c)? If not, do we already do > this xform for the ?: form? There doesn't appear to be a canonical form yet. sext i1 to i32 is not converted to select, and select x, -1, 0 is not converted to sext. Also, we don't do the above xform for the ?: form. Do you have a preference for which to make canonical? Dan From daniel at zuster.org Tue Oct 28 22:34:25 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Oct 2008 20:34:25 -0700 Subject: [llvm-commits] PATCH: Add Version.h and macros Message-ID: <6a8523d60810282034x52d5954dua0e0b13c93d77a20@mail.gmail.com> The attached patch adds llvm/Version.h, which provides the following defines: LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR - The major and minor LLVM version *numbers*. LLVM_VERSION_BRANCH - The LLVM branch. The intent is for this to be blank for released versions or "svn". LLVM_API_VERSION - An arbitrary number identifying the API version. The purpose of these macros is to support clients who wish to be able to compile with different versions of LLVM. We currently have no defines to support this. The macros are defined in the configure script and need to be manually updated. They are adjacent to the other code which needs to be manually updated; my autoconf foo is not sophisticated enough to derive them from the version string. The API_VERSION is designed to support this behavior at a finer grained level than releases. Its success depends on a cooperative policy where API changes imply a bump of this value. I believe Tanya has encourage developers to clearly mark what are API changes, with limited success. Making LLVM_API_VERSION successful requires people (or reviewers) to actively (a) recognize when they make an API change, and (b) bump the value. Although this requires a bit more care, this has the following benefits: (1) API changes are clearly marked; they are commits which update LLVM_API_VERSION. (2) Reviewing API changes between releases is simplified, the revision log for Version.h can be consulted. (3) Clients gain additional flexibility in tracking TOT. This has been important for me in the past on the klee project, where I would like to run with a known good LLVM version, but occasionally will test TOT in order to roll that known good version forward. This has historically been a pain since I need to update my code to work with TOT, test it, then roll back my changes if there are issues. The LLVM_VERSION_* macros are necessary in my opinion. The LLVM_API_VERSION macro can be argued separately if it has opponents. - Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081028/4752e738/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: Version.patch Type: application/octet-stream Size: 1610 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081028/4752e738/attachment.obj From nicholas at mxc.ca Tue Oct 28 23:01:22 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 28 Oct 2008 21:01:22 -0700 Subject: [llvm-commits] [llvm] r58351 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll In-Reply-To: References: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> <31FD8611-77F8-4739-A8F4-1167E3CC63EF@apple.com> Message-ID: <4907E012.8080803@mxc.ca> Dan Gohman wrote: > On Oct 28, 2008, at 4:13 PM, Chris Lattner wrote: > >> On Oct 28, 2008, at 3:39 PM, Dan Gohman wrote: >>> URL: http://llvm.org/viewvc/llvm-project?rev=58351&view=rev >>> Log: >>> (A & sext(C)) | (B & ~sext(C) -> C ? A : B >> Is sext from i1 really the canonical form or is select c, -1, 0? If >> so, do we turn "c ? -1 : 0" into sext(c)? If not, do we already do >> this xform for the ?: form? > > > There doesn't appear to be a canonical form yet. sext i1 to i32 is > not converted to select, and select x, -1, 0 is not converted to sext. > > Also, we don't do the above xform for the ?: form. > > Do you have a preference for which to make canonical? Some day, select from i1 should be canonical. It would allow us to eliminate any long chain of computations that started with an i1. However, I don't think the backends can currently handle that efficiently. Nick > Dan > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From kremenek at apple.com Tue Oct 28 23:30:42 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 29 Oct 2008 04:30:42 -0000 Subject: [llvm-commits] [llvm] r58364 - /llvm/tags/checker/checker-119/ Message-ID: <200810290430.m9T4UgOO022510@zion.cs.uiuc.edu> Author: kremenek Date: Tue Oct 28 23:30:42 2008 New Revision: 58364 URL: http://llvm.org/viewvc/llvm-project?rev=58364&view=rev Log: Tagging checker-119. Added: llvm/tags/checker/checker-119/ - copied from r58363, llvm/trunk/ From isanbard at gmail.com Tue Oct 28 23:56:27 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Oct 2008 21:56:27 -0700 Subject: [llvm-commits] PATCH: Add Version.h and macros In-Reply-To: <6a8523d60810282034x52d5954dua0e0b13c93d77a20@mail.gmail.com> References: <6a8523d60810282034x52d5954dua0e0b13c93d77a20@mail.gmail.com> Message-ID: <75170A90-E08B-4BA2-BE87-AF678E3C1E86@gmail.com> Hi Daniel, This will require a bit more thought. Right now, we generate Version.h when doing an Apple-style build. It looks like: #define LLVM_VERSION 1234 #define LLVM_MINOR_VERSION 3 This patch would conflict. I would like to get Devang's input on this. It's possible that a scheme can be developed that will kill two birds with one stone. :-) -bw On Oct 28, 2008, at 8:34 PM, Daniel Dunbar wrote: > The attached patch adds llvm/Version.h, which provides the following > defines: > > LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR - The major and minor LLVM > version *numbers*. > LLVM_VERSION_BRANCH - The LLVM branch. The intent is for this to be > blank for released versions or "svn". > LLVM_API_VERSION - An arbitrary number identifying the API version. > > The purpose of these macros is to support clients who wish to be > able to compile with different versions of LLVM. We currently have > no defines to support this. > > The macros are defined in the configure script and need to be > manually updated. They are adjacent to the other code which needs to > be manually updated; my autoconf foo is not sophisticated enough to > derive them from the version string. > > The API_VERSION is designed to support this behavior at a finer > grained level than releases. Its success depends on a cooperative > policy where API changes imply a bump of this value. I believe > Tanya has encourage developers to clearly mark what are API changes, > with limited success. Making LLVM_API_VERSION successful requires > people (or reviewers) to actively (a) recognize when they make an > API change, and (b) bump the value. > > Although this requires a bit more care, this has the following > benefits: > (1) API changes are clearly marked; they are commits which update > LLVM_API_VERSION. > > (2) Reviewing API changes between releases is simplified, the > revision log for Version.h can be consulted. > > (3) Clients gain additional flexibility in tracking TOT. This has > been important for me in the past on the klee project, where I would > like to run with a known good LLVM version, but occasionally will > test TOT in order to roll that known good version forward. This has > historically been a pain since I need to update my code to work with > TOT, test it, then roll back my changes if there are issues. > > The LLVM_VERSION_* macros are necessary in my opinion. The > LLVM_API_VERSION macro can be argued separately if it has opponents. > > - Daniel > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Oct 29 00:06:14 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Oct 2008 05:06:14 -0000 Subject: [llvm-commits] [llvm] r58367 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h include/llvm/CodeGen/LiveStackAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/PreAllocSplitting.cpp lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200810290506.m9T56Ehk023621@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 29 00:06:14 2008 New Revision: 58367 URL: http://llvm.org/viewvc/llvm-project?rev=58367&view=rev Log: - Rewrite code that update register live interval that's split. - Create and update spill slot live intervals. - Lots of bug fixes. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/include/llvm/CodeGen/LiveStackAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=58367&r1=58366&r2=58367&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Oct 29 00:06:14 2008 @@ -260,7 +260,12 @@ /// findLiveInMBBs - Given a live range, if the value of the range /// is live in any MBB returns true as well as the list of basic blocks /// in which the value is live. - bool findLiveInMBBs(const LiveRange &LR, + bool findLiveInMBBs(unsigned Start, unsigned End, + SmallVectorImpl &MBBs) const; + + /// findReachableMBBs - Return a list MBB that can be reached via any + /// branch or fallthroughs. Return true if the list is not empty. + bool findReachableMBBs(unsigned Start, unsigned End, SmallVectorImpl &MBBs) const; // Interval creation Modified: llvm/trunk/include/llvm/CodeGen/LiveStackAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveStackAnalysis.h?rev=58367&r1=58366&r2=58367&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveStackAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveStackAnalysis.h Wed Oct 29 00:06:14 2008 @@ -52,6 +52,22 @@ return I->second; } + LiveInterval &getInterval(int Slot) { + SS2IntervalMap::iterator I = s2iMap.find(Slot); + assert(I != s2iMap.end() && "Interval does not exist for stack slot"); + return I->second; + } + + const LiveInterval &getInterval(int Slot) const { + SS2IntervalMap::const_iterator I = s2iMap.find(Slot); + assert(I != s2iMap.end() && "Interval does not exist for stack slot"); + return I->second; + } + + bool hasInterval(unsigned reg) const { + return s2iMap.count(reg); + } + BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; } virtual void getAnalysisUsage(AnalysisUsage &AU) const; Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=58367&r1=58366&r2=58367&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Oct 29 00:06:14 2008 @@ -751,14 +751,14 @@ } } -bool LiveIntervals::findLiveInMBBs(const LiveRange &LR, +bool LiveIntervals::findLiveInMBBs(unsigned Start, unsigned End, SmallVectorImpl &MBBs) const { std::vector::const_iterator I = - std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), LR.start); + std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), Start); bool ResVal = false; while (I != Idx2MBBMap.end()) { - if (LR.end <= I->first) + if (I->first > End) break; MBBs.push_back(I->second); ResVal = true; @@ -767,6 +767,27 @@ return ResVal; } +bool LiveIntervals::findReachableMBBs(unsigned Start, unsigned End, + SmallVectorImpl &MBBs) const { + std::vector::const_iterator I = + std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), Start); + + bool ResVal = false; + while (I != Idx2MBBMap.end()) { + if (I->first > End) + break; + MachineBasicBlock *MBB = I->second; + if (getMBBEndIdx(MBB) > End) + break; + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), + SE = MBB->succ_end(); SI != SE; ++SI) + MBBs.push_back(*SI); + ResVal = true; + ++I; + } + return ResVal; +} + LiveInterval* LiveIntervals::createInterval(unsigned reg) { float Weight = TargetRegisterInfo::isPhysicalRegister(reg) ? HUGE_VALF : 0.0F; Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58367&r1=58366&r2=58367&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Wed Oct 29 00:06:14 2008 @@ -16,6 +16,7 @@ #define DEBUG_TYPE "pre-alloc-split" #include "llvm/CodeGen/LiveIntervalAnalysis.h" +#include "llvm/CodeGen/LiveStackAnalysis.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineLoopInfo.h" @@ -28,9 +29,9 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" -#include using namespace llvm; static cl::opt PreSplitLimit("pre-split-limit", cl::init(-1), cl::Hidden); @@ -39,12 +40,13 @@ namespace { class VISIBILITY_HIDDEN PreAllocSplitting : public MachineFunctionPass { - MachineFunction *CurMF; + MachineFunction *CurrMF; const TargetMachine *TM; const TargetInstrInfo *TII; MachineFrameInfo *MFI; MachineRegisterInfo *MRI; LiveIntervals *LIs; + LiveStacks *LSs; // Barrier - Current barrier being processed. MachineInstr *Barrier; @@ -58,10 +60,14 @@ // CurrLI - Current live interval being split. LiveInterval *CurrLI; - // LIValNoSSMap - A map from live interval and val# pairs to spill slots. - // This records what live interval's val# has been split and what spill - // slot was used. - std::map, int> LIValNoSSMap; + // CurrSLI - Current stack slot live interval. + LiveInterval *CurrSLI; + + // CurrSValNo - Current val# for the stack slot live interval. + VNInfo *CurrSValNo; + + // IntervalSSMap - A map from live interval to spill slots. + DenseMap IntervalSSMap; // RestoreMIs - All the restores inserted due to live interval splitting. SmallPtrSet RestoreMIs; @@ -75,6 +81,8 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.addPreserved(); + AU.addRequired(); + AU.addPreserved(); AU.addPreserved(); if (StrongPHIElim) AU.addPreservedID(StrongPHIEliminationID); @@ -84,7 +92,7 @@ } virtual void releaseMemory() { - LIValNoSSMap.clear(); + IntervalSSMap.clear(); RestoreMIs.clear(); } @@ -114,13 +122,15 @@ findRestorePoint(MachineBasicBlock*, MachineInstr*, unsigned, SmallPtrSet&, unsigned&); - void RecordSplit(unsigned, unsigned, unsigned, int); + int CreateSpillStackSlot(unsigned, const TargetRegisterClass *); + + bool IsAvailableInStack(unsigned, unsigned, int&) const; - bool isAlreadySplit(unsigned, unsigned, int&); + void UpdateSpillSlotInterval(VNInfo*, unsigned, unsigned); - void UpdateIntervalForSplit(VNInfo*, unsigned, unsigned); + void UpdateRegisterInterval(VNInfo*, unsigned, unsigned); - bool ShrinkWrapToLastUse(MachineBasicBlock*, + bool ShrinkWrapToLastUse(MachineBasicBlock*, VNInfo*, SmallVector&, SmallPtrSet&); @@ -252,38 +262,101 @@ return Pt; } -/// RecordSplit - Given a register live interval is split, remember the spill -/// slot where the val#s are in. -void PreAllocSplitting::RecordSplit(unsigned Reg, unsigned SpillIndex, - unsigned RestoreIndex, int SS) { - const LiveRange *LR = NULL; - if (SpillIndex) { - LR = CurrLI->getLiveRangeContaining(LIs->getUseIndex(SpillIndex)); - LIValNoSSMap.insert(std::make_pair(std::make_pair(CurrLI->reg, - LR->valno->id), SS)); - } - LR = CurrLI->getLiveRangeContaining(LIs->getDefIndex(RestoreIndex)); - LIValNoSSMap.insert(std::make_pair(std::make_pair(CurrLI->reg, - LR->valno->id), SS)); -} - -/// isAlreadySplit - Return if a given val# of a register live interval is already -/// split. Also return by reference the spill stock where the value is. -bool PreAllocSplitting::isAlreadySplit(unsigned Reg, unsigned ValNoId, int &SS){ - std::map, int>::iterator I = - LIValNoSSMap.find(std::make_pair(Reg, ValNoId)); - if (I == LIValNoSSMap.end()) +/// CreateSpillStackSlot - Create a stack slot for the live interval being +/// split. If the live interval was previously split, just reuse the same +/// slot. +int PreAllocSplitting::CreateSpillStackSlot(unsigned Reg, + const TargetRegisterClass *RC) { + int SS; + DenseMap::iterator I = IntervalSSMap.find(Reg); + if (I != IntervalSSMap.end()) { + SS = I->second; + } else { + SS = MFI->CreateStackObject(RC->getSize(), RC->getAlignment()); + IntervalSSMap[Reg] = SS; + } + + // Create live interval for stack slot. + CurrSLI = &LSs->getOrCreateInterval(SS); + if (CurrSLI->getNumValNums()) + CurrSValNo = CurrSLI->getValNumInfo(0); + else + CurrSValNo = CurrSLI->getNextValue(~0U, 0, LSs->getVNInfoAllocator()); + return SS; +} + +/// IsAvailableInStack - Return true if register is available in a split stack +/// slot at the specified index. +bool +PreAllocSplitting::IsAvailableInStack(unsigned Reg, unsigned Index, int &SS) const { + DenseMap::iterator I = IntervalSSMap.find(Reg); + if (I == IntervalSSMap.end()) return false; - SS = I->second; - return true; + if (LSs->getInterval(I->second).liveAt(Index)) { + SS = I->second; + return true; + } + return false; } -/// UpdateIntervalForSplit - Given the specified val# of the current live -/// interval is being split, and the split and rejoin indices, update the live +/// UpdateSpillSlotInterval - Given the specified val# of the register live +/// interval being split, and the spill and restore indicies, update the live +/// interval of the spill stack slot. +void +PreAllocSplitting::UpdateSpillSlotInterval(VNInfo *ValNo, unsigned SpillIndex, + unsigned RestoreIndex) { + const LiveRange *LR = CurrLI->getLiveRangeContaining(SpillIndex); + if (LR->contains(RestoreIndex)) { + LiveRange SLR(SpillIndex, RestoreIndex, CurrSValNo); + CurrSLI->addRange(SLR); + return; + } + + SmallPtrSet Processed; + LiveRange SLR(SpillIndex, LR->end, CurrSValNo); + CurrSLI->addRange(SLR); + Processed.insert(LR); + + // Start from the spill mbb, figure out the extend of the spill slot's + // live interval. + SmallVector WorkList; + MachineBasicBlock *MBB = LIs->getMBBFromIndex(SpillIndex); + if (LR->end > LIs->getMBBEndIdx(MBB)) + // If live range extend beyond end of mbb, add successors to work list. + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), + SE = MBB->succ_end(); SI != SE; ++SI) + WorkList.push_back(*SI); + // Live range may cross multiple basic blocks, add all reachable mbbs to + // the work list. + LIs->findReachableMBBs(LR->start, LR->end, WorkList); + + while (!WorkList.empty()) { + MachineBasicBlock *MBB = WorkList.back(); + WorkList.pop_back(); + unsigned Idx = LIs->getMBBStartIdx(MBB); + LR = CurrLI->getLiveRangeContaining(Idx); + if (LR && LR->valno == ValNo && !Processed.count(LR)) { + if (LR->contains(RestoreIndex)) { + // Spill slot live interval stops at the restore. + LiveRange SLR(LR->start, RestoreIndex, CurrSValNo); + CurrSLI->addRange(SLR); + LIs->findReachableMBBs(LR->start, RestoreIndex, WorkList); + } else { + LiveRange SLR(LR->start, LR->end, CurrSValNo); + CurrSLI->addRange(SLR); + LIs->findReachableMBBs(LR->start, LR->end, WorkList); + } + Processed.insert(LR); + } + } +} + +/// UpdateRegisterInterval - Given the specified val# of the current live +/// interval is being split, and the spill and restore indices, update the live /// interval accordingly. void -PreAllocSplitting::UpdateIntervalForSplit(VNInfo *ValNo, unsigned SplitIndex, - unsigned JoinIndex) { +PreAllocSplitting::UpdateRegisterInterval(VNInfo *ValNo, unsigned SpillIndex, + unsigned RestoreIndex) { SmallVector, 4> Before; SmallVector, 4> After; SmallVector BeforeKills; @@ -292,20 +365,22 @@ // First, let's figure out which parts of the live interval is now defined // by the restore, which are defined by the original definition. - const LiveRange *LR = CurrLI->getLiveRangeContaining(JoinIndex); - After.push_back(std::make_pair(JoinIndex, LR->end)); + const LiveRange *LR = CurrLI->getLiveRangeContaining(RestoreIndex); + After.push_back(std::make_pair(RestoreIndex, LR->end)); if (CurrLI->isKill(ValNo, LR->end)) AfterKills.push_back(LR->end); - assert(LR->contains(SplitIndex)); - if (SplitIndex > LR->start) { - Before.push_back(std::make_pair(LR->start, SplitIndex)); - BeforeKills.push_back(SplitIndex); + assert(LR->contains(SpillIndex)); + if (SpillIndex > LR->start) { + Before.push_back(std::make_pair(LR->start, SpillIndex)); + BeforeKills.push_back(SpillIndex); } Processed.insert(LR); + // Start from the restore mbb, figure out what part of the live interval + // are defined by the restore. SmallVector WorkList; - MachineBasicBlock *MBB = LIs->getMBBFromIndex(LR->end-1); + MachineBasicBlock *MBB = LIs->getMBBFromIndex(RestoreIndex); for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI) WorkList.push_back(*SI); @@ -321,15 +396,9 @@ AfterKills.push_back(LR->end); Idx = LIs->getMBBEndIdx(MBB); if (LR->end > Idx) { - for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), - SE = MBB->succ_end(); SI != SE; ++SI) - WorkList.push_back(*SI); - if (LR->end > Idx+1) { - MBB = LIs->getMBBFromIndex(LR->end-1); - for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), - SE = MBB->succ_end(); SI != SE; ++SI) - WorkList.push_back(*SI); - } + // Live range extend beyond at least one mbb. Let's see what other + // mbbs it reaches. + LIs->findReachableMBBs(LR->start, LR->end, WorkList); } Processed.insert(LR); } @@ -359,7 +428,7 @@ VNInfo *AValNo = (After.empty()) ? NULL - : CurrLI->getNextValue(JoinIndex,0, LIs->getVNInfoAllocator()); + : CurrLI->getNextValue(RestoreIndex, 0, LIs->getVNInfoAllocator()); if (AValNo) { AValNo->hasPHIKill = HasPHIKill; CurrLI->addKills(AValNo, AfterKills); @@ -382,7 +451,7 @@ /// from last use to the end of the mbb). In case mbb is the where the barrier /// is, remove from the last use to the barrier. bool -PreAllocSplitting::ShrinkWrapToLastUse(MachineBasicBlock *MBB, +PreAllocSplitting::ShrinkWrapToLastUse(MachineBasicBlock *MBB, VNInfo *ValNo, SmallVector &Uses, SmallPtrSet &UseMIs) { MachineOperand *LastMO = 0; @@ -399,7 +468,8 @@ MII = Barrier; else MII = MBB->end(); - while (--MII != MEE) { + while (MII != MEE) { + --MII; MachineInstr *UseMI = &*MII; if (!UseMIs.count(UseMI)) continue; @@ -429,6 +499,8 @@ if (MBB == BarrierMBB) RangeEnd = LIs->getUseIndex(BarrierIdx)+1; CurrLI->removeRange(RangeStart, RangeEnd); + if (LastMI) + CurrLI->addKill(ValNo, RangeStart); // Return true if the last use becomes a new kill. return LastMI; @@ -469,12 +541,10 @@ // At least one use in this mbb, lets look for the kill. DenseMap >::iterator UMII2 = UseMIs.find(MBB); - if (ShrinkWrapToLastUse(MBB, UMII->second, UMII2->second)) + if (ShrinkWrapToLastUse(MBB, ValNo, UMII->second, UMII2->second)) // Found a kill, shrink wrapping of this path ends here. return; } else if (MBB == DefMBB) { - assert(LIValNoSSMap.find(std::make_pair(CurrLI->reg, ValNo->id)) != - LIValNoSSMap.end() && "Why wasn't def spilled?"); // There are no uses after the def. MachineInstr *DefMI = LIs->getInstructionFromIndex(ValNo->def); assert(RestoreMIs.count(DefMI) && "Not defined by a join?"); @@ -560,7 +630,6 @@ unsigned SpillIndex = 0; MachineInstr *SpillMI = NULL; int SS = -1; - bool PrevSpilled = isAlreadySplit(CurrLI->reg, ValNo->id, SS); if (ValNo->def == ~0U) { // If it's defined by a phi, we must split just before the barrier. MachineBasicBlock::iterator SpillPt = @@ -568,18 +637,15 @@ if (SpillPt == BarrierMBB->begin()) return false; // No gap to insert spill. // Add spill. - if (!PrevSpilled) - // If previously split, reuse the spill slot. - SS = MFI->CreateStackObject(RC->getSize(), RC->getAlignment()); + SS = CreateSpillStackSlot(CurrLI->reg, RC); TII->storeRegToStackSlot(*BarrierMBB, SpillPt, CurrLI->reg, true, SS, RC); SpillMI = prior(SpillPt); LIs->InsertMachineInstrInMaps(SpillMI, SpillIndex); - } else if (!PrevSpilled) { - if (!DefMI) - // Def is dead. Do nothing. - return false; + } else if (!IsAvailableInStack(CurrLI->reg, RestoreIndex, SS)) { // If it's already split, just restore the value. There is no need to spill // the def again. + if (!DefMI) + return false; // Def is dead. Do nothing. // Check if it's possible to insert a spill after the def MI. MachineBasicBlock::iterator SpillPt; if (DefMBB == BarrierMBB) { @@ -592,10 +658,9 @@ if (SpillPt == DefMBB->end()) return false; // No gap to insert spill. } - SS = MFI->CreateStackObject(RC->getSize(), RC->getAlignment()); - // Add spill. The store instruction kills the register if def is before // the barrier in the barrier block. + SS = CreateSpillStackSlot(CurrLI->reg, RC); TII->storeRegToStackSlot(*DefMBB, SpillPt, CurrLI->reg, DefMBB == BarrierMBB, SS, RC); SpillMI = prior(SpillPt); @@ -603,7 +668,6 @@ } // Add restore. - // FIXME: Create live interval for stack slot. TII->loadRegFromStackSlot(*BarrierMBB, RestorePt, CurrLI->reg, SS, RC); MachineInstr *LoadMI = prior(RestorePt); LIs->InsertMachineInstrInMaps(LoadMI, RestoreIndex); @@ -613,16 +677,24 @@ // create a hole in the interval. if (!DefMBB || (SpillMI && SpillMI->getParent() == BarrierMBB)) { - UpdateIntervalForSplit(ValNo, LIs->getUseIndex(SpillIndex)+1, - LIs->getDefIndex(RestoreIndex)); + // Update spill stack slot live interval. + UpdateSpillSlotInterval(ValNo, LIs->getUseIndex(SpillIndex)+1, + LIs->getDefIndex(RestoreIndex)); - // Record val# values are in the specific spill slot. - RecordSplit(CurrLI->reg, SpillIndex, RestoreIndex, SS); + UpdateRegisterInterval(ValNo, LIs->getUseIndex(SpillIndex)+1, + LIs->getDefIndex(RestoreIndex)); ++NumSplits; return true; } + // Update spill stack slot live interval. + if (SpillIndex) + // If value is already in stack at the restore point, there is + // no need to update the live interval. + UpdateSpillSlotInterval(ValNo, LIs->getUseIndex(SpillIndex)+1, + LIs->getDefIndex(RestoreIndex)); + // Shrink wrap the live interval by walking up the CFG and find the // new kills. // Now let's find all the uses of the val#. @@ -666,10 +738,8 @@ // Remove live range from barrier to the restore. FIXME: Find a better // point to re-start the live interval. - UpdateIntervalForSplit(ValNo, LIs->getUseIndex(BarrierIdx)+1, + UpdateRegisterInterval(ValNo, LIs->getUseIndex(BarrierIdx)+1, LIs->getDefIndex(RestoreIndex)); - // Record val# values are in the specific spill slot. - RecordSplit(CurrLI->reg, SpillIndex, RestoreIndex, SS); ++NumSplits; return true; @@ -712,12 +782,13 @@ } bool PreAllocSplitting::runOnMachineFunction(MachineFunction &MF) { - CurMF = &MF; - TM = &MF.getTarget(); - TII = TM->getInstrInfo(); - MFI = MF.getFrameInfo(); - MRI = &MF.getRegInfo(); - LIs = &getAnalysis(); + CurrMF = &MF; + TM = &MF.getTarget(); + TII = TM->getInstrInfo(); + MFI = MF.getFrameInfo(); + MRI = &MF.getRegInfo(); + LIs = &getAnalysis(); + LSs = &getAnalysis(); bool MadeChange = false; Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=58367&r1=58366&r2=58367&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Oct 29 00:06:14 2008 @@ -410,7 +410,7 @@ for (LiveInterval::Ranges::const_iterator I = cur.begin(), E = cur.end(); I != E; ++I) { const LiveRange &LR = *I; - if (li_->findLiveInMBBs(LR, LiveInMBBs)) { + if (li_->findLiveInMBBs(LR.start, LR.end, LiveInMBBs)) { for (unsigned i = 0, e = LiveInMBBs.size(); i != e; ++i) if (LiveInMBBs[i] != EntryMBB) LiveInMBBs[i]->addLiveIn(Reg); From clattner at apple.com Wed Oct 29 00:10:20 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Oct 2008 22:10:20 -0700 Subject: [llvm-commits] [llvm] r58351 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll In-Reply-To: References: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> <31FD8611-77F8-4739-A8F4-1167E3CC63EF@apple.com> Message-ID: <4B511224-5EB9-49E5-954E-01306D3DA8D2@apple.com> On Oct 28, 2008, at 8:07 PM, Dan Gohman wrote: > > On Oct 28, 2008, at 4:13 PM, Chris Lattner wrote: > >> On Oct 28, 2008, at 3:39 PM, Dan Gohman wrote: >>> URL: http://llvm.org/viewvc/llvm-project?rev=58351&view=rev >>> Log: >>> (A & sext(C)) | (B & ~sext(C) -> C ? A : B >> >> Is sext from i1 really the canonical form or is select c, -1, 0? If >> so, do we turn "c ? -1 : 0" into sext(c)? If not, do we already do >> this xform for the ?: form? > > > There doesn't appear to be a canonical form yet. sext i1 to i32 is > not converted to select, and select x, -1, 0 is not converted to sext. > > Also, we don't do the above xform for the ?: form. > > Do you have a preference for which to make canonical? I have a slight preference for select over sext. I think it would interact best with the existing optimizers. -Chris From clattner at apple.com Wed Oct 29 00:26:04 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Oct 2008 22:26:04 -0700 Subject: [llvm-commits] PATCH: Add Version.h and macros In-Reply-To: <75170A90-E08B-4BA2-BE87-AF678E3C1E86@gmail.com> References: <6a8523d60810282034x52d5954dua0e0b13c93d77a20@mail.gmail.com> <75170A90-E08B-4BA2-BE87-AF678E3C1E86@gmail.com> Message-ID: On Oct 28, 2008, at 9:56 PM, Bill Wendling wrote: > Hi Daniel, > > This will require a bit more thought. Right now, we generate Version.h > when doing an Apple-style build. It looks like: > > #define LLVM_VERSION 1234 > #define LLVM_MINOR_VERSION 3 > > This patch would conflict. I would like to get Devang's input on this. > It's possible that a scheme can be developed that will kill two birds > with one stone. :-) Yeah, Bill's right, it would be good to unify these. Also, it seems that it would be reasonable to use make something like: #define LLVM_RELEASE_VERSION 24 For LLVM 2.4 etc? Is there any specific reason to track branches? -Chris From duncan.sands at math.u-psud.fr Wed Oct 29 00:30:55 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Wed, 29 Oct 2008 06:30:55 +0100 Subject: [llvm-commits] [llvm] r58351 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll In-Reply-To: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> References: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> Message-ID: <200810290630.55670.duncan.sands@math.u-psud.fr> Hi Dan, > + // (A & sext(C0)) | (B & ~sext(C0) -> C0 ? A : B missing closing parenthesis after ~sext(C0). Also, why use C0 and not C? Ciao, Duncan. From clattner at apple.com Wed Oct 29 00:54:39 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Oct 2008 22:54:39 -0700 Subject: [llvm-commits] PATCH: Add InlineCost class In-Reply-To: <6a8523d60810282005t3a2aa087re6b419e15be1b628@mail.gmail.com> References: <6a8523d60810282005t3a2aa087re6b419e15be1b628@mail.gmail.com> Message-ID: <69649F87-2D6D-4017-AE77-9832906ECBBD@apple.com> On Oct 28, 2008, at 8:05 PM, Daniel Dunbar wrote: > The attached patch adds an InlineCost value class to wrap the costs > returned by Inliner::getInlineCost. The motivation is that it > encodes whether the cost equates to "always" inline or "never" > inline, instead of returning the magic constants -2000000000 and > 2000000000 respectively. > > Previously there were cases where always functions were not inlined > (in fact, it looked to me like the always inliner would almost never > work). Additionally, I am worried about cases where the fudge factor > computation overflows when using the large magic constants. With > this change the inliner is guaranteed to respect the "always" and > "never" requests. Looks great to me! -Chris From daniel at zuster.org Wed Oct 29 01:09:00 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Oct 2008 23:09:00 -0700 Subject: [llvm-commits] PATCH: Add Version.h and macros In-Reply-To: References: <6a8523d60810282034x52d5954dua0e0b13c93d77a20@mail.gmail.com> <75170A90-E08B-4BA2-BE87-AF678E3C1E86@gmail.com> Message-ID: <6a8523d60810282309y205f595gb319fe3ce12ea377@mail.gmail.com> On Tue, Oct 28, 2008 at 10:26 PM, Chris Lattner wrote: > > On Oct 28, 2008, at 9:56 PM, Bill Wendling wrote: > > > Hi Daniel, > > > > This will require a bit more thought. Right now, we generate Version.h > > when doing an Apple-style build. It looks like: > > > > #define LLVM_VERSION 1234 > > #define LLVM_MINOR_VERSION 3 > > > > This patch would conflict. I would like to get Devang's input on this. > > It's possible that a scheme can be developed that will kill two birds > > with one stone. :-) > > Yeah, Bill's right, it would be good to unify these. Ok. > > Also, it seems that it would be reasonable to use make something like: > > #define LLVM_RELEASE_VERSION 24 > > For LLVM 2.4 etc? Is there any specific reason to track branches? No, there is no particular reason to track branches (especially if LLVM_API_VERSION is adopted). I thought it might make sense to provide the full information given by the PACKAGE_VERSION define autoconf generates. I don't see any particular reason not to provide it. As far as LLVM_RELEASE_VERSION, I prefer to encode major and minor. What is LLVM_RELEASE_VERSION 210? - Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081028/c25c7bcd/attachment.html From clattner at apple.com Wed Oct 29 01:16:44 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Oct 2008 23:16:44 -0700 Subject: [llvm-commits] PATCH: Add Version.h and macros In-Reply-To: <6a8523d60810282309y205f595gb319fe3ce12ea377@mail.gmail.com> References: <6a8523d60810282034x52d5954dua0e0b13c93d77a20@mail.gmail.com> <75170A90-E08B-4BA2-BE87-AF678E3C1E86@gmail.com> <6a8523d60810282309y205f595gb319fe3ce12ea377@mail.gmail.com> Message-ID: On Oct 28, 2008, at 11:09 PM, Daniel Dunbar wrote: > #define LLVM_RELEASE_VERSION 24 > > For LLVM 2.4 etc? Is there any specific reason to track branches? > > No, there is no particular reason to track branches (especially if > LLVM_API_VERSION is adopted). I thought it might make sense to > provide the full information given by the PACKAGE_VERSION define > autoconf generates. I don't see any particular reason not to provide > it. > > As far as LLVM_RELEASE_VERSION, I prefer to encode major and minor. I agree, I just don't see a need to do it separately. > What is LLVM_RELEASE_VERSION 210? LLVM 21.0? -Chris From baldrick at free.fr Wed Oct 29 01:31:04 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 06:31:04 -0000 Subject: [llvm-commits] [llvm] r58370 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Message-ID: <200810290631.m9T6V4W3026293@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 01:31:03 2008 New Revision: 58370 URL: http://llvm.org/viewvc/llvm-project?rev=58370&view=rev Log: Fix 80 column violations. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=58370&r1=58369&r2=58370&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Oct 29 01:31:03 2008 @@ -616,7 +616,8 @@ RTLIB::ADD_PPCF128), N->getValueType(0), Ops, 2, false); - assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); Lo = Call.getOperand(0); Hi = Call.getOperand(1); } @@ -643,7 +644,8 @@ RTLIB::DIV_PPCF128), N->getValueType(0), Ops, 2, false); - assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); Lo = Call.getOperand(0); Hi = Call.getOperand(1); } @@ -657,7 +659,8 @@ RTLIB::MUL_PPCF128), N->getValueType(0), Ops, 2, false); - assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); Lo = Call.getOperand(0); Hi = Call.getOperand(1); } @@ -685,7 +688,8 @@ RTLIB::SUB_PPCF128), N->getValueType(0), Ops, 2, false); - assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); Lo = Call.getOperand(0); Hi = Call.getOperand(1); } @@ -747,7 +751,8 @@ assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported XINT_TO_FP!"); Hi = MakeLibCall(LC, VT, &Src, 1, true); - assert(Hi.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + assert(Hi.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); Lo = Hi.getOperand(0); Hi = Hi.getOperand(1); } From baldrick at free.fr Wed Oct 29 01:33:00 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 06:33:00 -0000 Subject: [llvm-commits] [llvm] r58371 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Message-ID: <200810290633.m9T6X0cU026355@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 01:33:00 2008 New Revision: 58371 URL: http://llvm.org/viewvc/llvm-project?rev=58371&view=rev Log: Fix 80 column violations. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=58371&r1=58370&r2=58371&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Wed Oct 29 01:33:00 2008 @@ -1708,7 +1708,7 @@ MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDValue Op = N->getOperand(0); if (Op.getValueType().bitsLE(NVT)) { - // The low part is sign extension of the input (which degenerates to a copy). + // The low part is sign extension of the input (degenerates to a copy). Lo = DAG.getNode(ISD::SIGN_EXTEND, NVT, N->getOperand(0)); // The high part is obtained by SRA'ing all but one of the bits of low part. unsigned LoSize = NVT.getSizeInBits(); @@ -1822,7 +1822,7 @@ MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDValue Op = N->getOperand(0); if (Op.getValueType().bitsLE(NVT)) { - // The low part is zero extension of the input (which degenerates to a copy). + // The low part is zero extension of the input (degenerates to a copy). Lo = DAG.getNode(ISD::ZERO_EXTEND, NVT, N->getOperand(0)); Hi = DAG.getConstant(0, NVT); // The high part is just a zero. } else { From baldrick at free.fr Wed Oct 29 01:42:19 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 06:42:19 -0000 Subject: [llvm-commits] [llvm] r58372 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.cpp LegalizeTypes.h Message-ID: <200810290642.m9T6gJlC026646@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 01:42:19 2008 New Revision: 58372 URL: http://llvm.org/viewvc/llvm-project?rev=58372&view=rev Log: Fix a FIXME: in ReplaceNodeWith, if the new node is morphed by AnalyzeNewNode into a previously processed node, and different result values of that node are remapped to values with different nodes, then we could end up using wrong values here [we were assuming that all results remap to values with the same underlying node]. This seems theoretically possible, but I don't have a testcase. The meat of the patch is in the changes to AnalyzeNewNode/AnalyzeNewValue and ReplaceNodeWith. While there, I changed names like RemapNode to RemapValue, since it really remaps values. To tell the truth, I would be much happier if we were only remapping nodes (it would simplify a bunch of logic, and allow for some cute speedups) but I haven't yet worked out how to do that. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=58372&r1=58371&r2=58372&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Wed Oct 29 01:42:19 2008 @@ -220,14 +220,13 @@ /// AnalyzeNewNode - The specified node is the root of a subtree of potentially /// new nodes. Correct any processed operands (this may change the node) and -/// calculate the NodeId. +/// calculate the NodeId. If the node itself changes to a processed node, it +/// is not remapped - the caller needs to take care of this. /// Returns the potentially changed node. -void DAGTypeLegalizer::AnalyzeNewNode(SDValue &Val) { - SDNode *N = Val.getNode(); - +SDNode *DAGTypeLegalizer::AnalyzeNewNode(SDNode *N) { // If this was an existing node that is already done, we're done. if (N->getNodeId() != NewNode) - return; + return N; // Remove any stale map entries. ExpungeNode(N); @@ -250,9 +249,9 @@ SDValue Op = OrigOp; if (Op.getNode()->getNodeId() == Processed) - RemapNode(Op); + RemapValue(Op); else if (Op.getNode()->getNodeId() == NewNode) - AnalyzeNewNode(Op); + AnalyzeNewValue(Op); if (Op.getNode()->getNodeId() == Processed) ++NumProcessed; @@ -270,21 +269,16 @@ // Some operands changed - update the node. if (!NewOps.empty()) { - Val = DAG.UpdateNodeOperands(Val, &NewOps[0], NewOps.size()); - if (Val.getNode() != N) { - // The node morphed, work with the new node. - N = Val.getNode(); - - // Maybe it morphed into a previously analyzed node? - if (N->getNodeId() != NewNode) { - if (N->getNodeId() == Processed) - // An already processed node may need to be remapped. - RemapNode(Val); - return; - } + SDNode *M = DAG.UpdateNodeOperands(SDValue(N, 0), &NewOps[0], + NewOps.size()).getNode(); + if (M != N) { + if (M->getNodeId() != NewNode) + // It morphed into a previously analyzed node - nothing more to do. + return M; // It morphed into a different new node. Do the equivalent of passing // it to AnalyzeNewNode: expunge it and calculate the NodeId. + N = M; ExpungeNode(N); } } @@ -293,6 +287,23 @@ N->setNodeId(N->getNumOperands()-NumProcessed); if (N->getNodeId() == ReadyToProcess) Worklist.push_back(N); + + return N; +} + +/// AnalyzeNewValue - Call AnalyzeNewNode, updating the node in Val if needed. +/// If the node changes to a processed node, then remap it. +void DAGTypeLegalizer::AnalyzeNewValue(SDValue &Val) { + SDNode *N(Val.getNode()); + // If this was an existing node that is already done, avoid remapping it. + if (N->getNodeId() != NewNode) + return; + SDNode *M(AnalyzeNewNode(N)); + if (M != N) + Val.setNode(M); + if (M->getNodeId() == Processed) + // It morphed into an already processed node - remap it. + RemapValue(Val); } @@ -310,7 +321,7 @@ N->getNodeId() != DAGTypeLegalizer::ReadyToProcess && "RAUW deleted processed node!"); // It is possible, though rare, for the deleted node N to occur as a - // target in a map, so note the replacement N -> E in ReplacedNodes. + // target in a map, so note the replacement N -> E in ReplacedValues. assert(E && "Node not replaced?"); DTL.NoteDeletion(N, E); } @@ -336,7 +347,7 @@ // If expansion produced new nodes, make sure they are properly marked. ExpungeNode(From.getNode()); - AnalyzeNewNode(To); // Expunges To. + AnalyzeNewValue(To); // Expunges To. // Anything that used the old node should now use the new one. Note that this // can potentially cause recursive merging. @@ -345,7 +356,7 @@ // The old node may still be present in a map like ExpandedIntegers or // PromotedIntegers. Inform maps about the replacement. - ReplacedNodes[From] = To; + ReplacedValues[From] = To; } /// ReplaceNodeWith - Replace uses of the 'from' node's results with the 'to' @@ -356,9 +367,9 @@ // If expansion produced new nodes, make sure they are properly marked. ExpungeNode(From); - SDValue Val(To, 0); - AnalyzeNewNode(Val); // Expunges To. FIXME: All results mapped the same? - To = Val.getNode(); + To = AnalyzeNewNode(To); // Expunges To. + // If To morphed into an already processed node, its values may need + // remapping. This is done below. assert(From->getNumValues() == To->getNumValues() && "Node results don't match"); @@ -366,51 +377,61 @@ // Anything that used the old node should now use the new one. Note that this // can potentially cause recursive merging. NodeUpdateListener NUL(*this); - DAG.ReplaceAllUsesWith(From, To, &NUL); - - // The old node may still be present in a map like ExpandedIntegers or - // PromotedIntegers. Inform maps about the replacement. for (unsigned i = 0, e = From->getNumValues(); i != e; ++i) { - assert(From->getValueType(i) == To->getValueType(i) && - "Node results don't match"); - ReplacedNodes[SDValue(From, i)] = SDValue(To, i); + SDValue FromVal(From, i); + SDValue ToVal(To, i); + + // AnalyzeNewNode may have morphed a new node into a processed node. Remap + // values now. + if (To->getNodeId() == Processed) + RemapValue(ToVal); + + assert(FromVal.getValueType() == ToVal.getValueType() && + "Node results don't match!"); + + // Make anything that used the old value use the new value. + DAG.ReplaceAllUsesOfValueWith(FromVal, ToVal, &NUL); + + // The old node may still be present in a map like ExpandedIntegers or + // PromotedIntegers. Inform maps about the replacement. + ReplacedValues[FromVal] = ToVal; } } -/// RemapNode - If the specified value was already legalized to another value, +/// RemapValue - If the specified value was already legalized to another value, /// replace it by that value. -void DAGTypeLegalizer::RemapNode(SDValue &N) { - DenseMap::iterator I = ReplacedNodes.find(N); - if (I != ReplacedNodes.end()) { +void DAGTypeLegalizer::RemapValue(SDValue &N) { + DenseMap::iterator I = ReplacedValues.find(N); + if (I != ReplacedValues.end()) { // Use path compression to speed up future lookups if values get multiply // replaced with other values. - RemapNode(I->second); + RemapValue(I->second); N = I->second; } assert(N.getNode()->getNodeId() != NewNode && "Mapped to unanalyzed node!"); } -/// ExpungeNode - If N has a bogus mapping in ReplacedNodes, eliminate it. +/// ExpungeNode - If N has a bogus mapping in ReplacedValues, eliminate it. /// This can occur when a node is deleted then reallocated as a new node - -/// the mapping in ReplacedNodes applies to the deleted node, not the new +/// the mapping in ReplacedValues applies to the deleted node, not the new /// one. -/// The only map that can have a deleted node as a source is ReplacedNodes. +/// The only map that can have a deleted node as a source is ReplacedValues. /// Other maps can have deleted nodes as targets, but since their looked-up -/// values are always immediately remapped using RemapNode, resulting in a -/// not-deleted node, this is harmless as long as ReplacedNodes/RemapNode +/// values are always immediately remapped using RemapValue, resulting in a +/// not-deleted node, this is harmless as long as ReplacedValues/RemapValue /// always performs correct mappings. In order to keep the mapping correct, /// ExpungeNode should be called on any new nodes *before* adding them as -/// either source or target to ReplacedNodes (which typically means calling +/// either source or target to ReplacedValues (which typically means calling /// Expunge when a new node is first seen, since it may no longer be marked -/// NewNode by the time it is added to ReplacedNodes). +/// NewNode by the time it is added to ReplacedValues). void DAGTypeLegalizer::ExpungeNode(SDNode *N) { if (N->getNodeId() != NewNode) return; - // If N is not remapped by ReplacedNodes then there is nothing to do. + // If N is not remapped by ReplacedValues then there is nothing to do. unsigned i, e; for (i = 0, e = N->getNumValues(); i != e; ++i) - if (ReplacedNodes.find(SDValue(N, i)) != ReplacedNodes.end()) + if (ReplacedValues.find(SDValue(N, i)) != ReplacedValues.end()) break; if (i == e) @@ -421,52 +442,52 @@ for (DenseMap::iterator I = PromotedIntegers.begin(), E = PromotedIntegers.end(); I != E; ++I) { assert(I->first.getNode() != N); - RemapNode(I->second); + RemapValue(I->second); } for (DenseMap::iterator I = SoftenedFloats.begin(), E = SoftenedFloats.end(); I != E; ++I) { assert(I->first.getNode() != N); - RemapNode(I->second); + RemapValue(I->second); } for (DenseMap::iterator I = ScalarizedVectors.begin(), E = ScalarizedVectors.end(); I != E; ++I) { assert(I->first.getNode() != N); - RemapNode(I->second); + RemapValue(I->second); } for (DenseMap >::iterator I = ExpandedIntegers.begin(), E = ExpandedIntegers.end(); I != E; ++I){ assert(I->first.getNode() != N); - RemapNode(I->second.first); - RemapNode(I->second.second); + RemapValue(I->second.first); + RemapValue(I->second.second); } for (DenseMap >::iterator I = ExpandedFloats.begin(), E = ExpandedFloats.end(); I != E; ++I) { assert(I->first.getNode() != N); - RemapNode(I->second.first); - RemapNode(I->second.second); + RemapValue(I->second.first); + RemapValue(I->second.second); } for (DenseMap >::iterator I = SplitVectors.begin(), E = SplitVectors.end(); I != E; ++I) { assert(I->first.getNode() != N); - RemapNode(I->second.first); - RemapNode(I->second.second); + RemapValue(I->second.first); + RemapValue(I->second.second); } - for (DenseMap::iterator I = ReplacedNodes.begin(), - E = ReplacedNodes.end(); I != E; ++I) - RemapNode(I->second); + for (DenseMap::iterator I = ReplacedValues.begin(), + E = ReplacedValues.end(); I != E; ++I) + RemapValue(I->second); for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) - ReplacedNodes.erase(SDValue(N, i)); + ReplacedValues.erase(SDValue(N, i)); } void DAGTypeLegalizer::SetPromotedInteger(SDValue Op, SDValue Result) { - AnalyzeNewNode(Result); + AnalyzeNewValue(Result); SDValue &OpEntry = PromotedIntegers[Op]; assert(OpEntry.getNode() == 0 && "Node is already promoted!"); @@ -474,7 +495,7 @@ } void DAGTypeLegalizer::SetSoftenedFloat(SDValue Op, SDValue Result) { - AnalyzeNewNode(Result); + AnalyzeNewValue(Result); SDValue &OpEntry = SoftenedFloats[Op]; assert(OpEntry.getNode() == 0 && "Node is already converted to integer!"); @@ -482,7 +503,7 @@ } void DAGTypeLegalizer::SetScalarizedVector(SDValue Op, SDValue Result) { - AnalyzeNewNode(Result); + AnalyzeNewValue(Result); SDValue &OpEntry = ScalarizedVectors[Op]; assert(OpEntry.getNode() == 0 && "Node is already scalarized!"); @@ -492,8 +513,8 @@ void DAGTypeLegalizer::GetExpandedInteger(SDValue Op, SDValue &Lo, SDValue &Hi) { std::pair &Entry = ExpandedIntegers[Op]; - RemapNode(Entry.first); - RemapNode(Entry.second); + RemapValue(Entry.first); + RemapValue(Entry.second); assert(Entry.first.getNode() && "Operand isn't expanded"); Lo = Entry.first; Hi = Entry.second; @@ -502,8 +523,8 @@ void DAGTypeLegalizer::SetExpandedInteger(SDValue Op, SDValue Lo, SDValue Hi) { // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. - AnalyzeNewNode(Lo); - AnalyzeNewNode(Hi); + AnalyzeNewValue(Lo); + AnalyzeNewValue(Hi); // Remember that this is the result of the node. std::pair &Entry = ExpandedIntegers[Op]; @@ -515,8 +536,8 @@ void DAGTypeLegalizer::GetExpandedFloat(SDValue Op, SDValue &Lo, SDValue &Hi) { std::pair &Entry = ExpandedFloats[Op]; - RemapNode(Entry.first); - RemapNode(Entry.second); + RemapValue(Entry.first); + RemapValue(Entry.second); assert(Entry.first.getNode() && "Operand isn't expanded"); Lo = Entry.first; Hi = Entry.second; @@ -525,8 +546,8 @@ void DAGTypeLegalizer::SetExpandedFloat(SDValue Op, SDValue Lo, SDValue Hi) { // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. - AnalyzeNewNode(Lo); - AnalyzeNewNode(Hi); + AnalyzeNewValue(Lo); + AnalyzeNewValue(Hi); // Remember that this is the result of the node. std::pair &Entry = ExpandedFloats[Op]; @@ -538,8 +559,8 @@ void DAGTypeLegalizer::GetSplitVector(SDValue Op, SDValue &Lo, SDValue &Hi) { std::pair &Entry = SplitVectors[Op]; - RemapNode(Entry.first); - RemapNode(Entry.second); + RemapValue(Entry.first); + RemapValue(Entry.second); assert(Entry.first.getNode() && "Operand isn't split"); Lo = Entry.first; Hi = Entry.second; @@ -548,8 +569,8 @@ void DAGTypeLegalizer::SetSplitVector(SDValue Op, SDValue Lo, SDValue Hi) { // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. - AnalyzeNewNode(Lo); - AnalyzeNewNode(Hi); + AnalyzeNewValue(Lo); + AnalyzeNewValue(Hi); // Remember that this is the result of the node. std::pair &Entry = SplitVectors[Op]; @@ -610,8 +631,8 @@ Hi = DAG.getNode(ISD::TRUNCATE, HiVT, Hi); } -/// SplitInteger - Return the lower and upper halves of Op's bits in a value type -/// half the size of Op's. +/// SplitInteger - Return the lower and upper halves of Op's bits in a value +/// type half the size of Op's. void DAGTypeLegalizer::SplitInteger(SDValue Op, SDValue &Lo, SDValue &Hi) { MVT HalfVT = MVT::getIntegerVT(Op.getValueType().getSizeInBits()/2); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=58372&r1=58371&r2=58372&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Oct 29 01:42:19 2008 @@ -134,9 +134,9 @@ /// which operands are the expanded version of the input. DenseMap > SplitVectors; - /// ReplacedNodes - For nodes that have been replaced with another, - /// indicates the replacement node to use. - DenseMap ReplacedNodes; + /// ReplacedValues - For values that have been replaced with another, + /// indicates the replacement value to use. + DenseMap ReplacedValues; /// Worklist - This defines a worklist of nodes to process. In order to be /// pushed onto this worklist, all operands of a node must have already been @@ -157,8 +157,7 @@ /// for the specified node, adding it to the worklist if ready. void ReanalyzeNode(SDNode *N) { N->setNodeId(NewNode); - SDValue Val(N, 0); - AnalyzeNewNode(Val); + AnalyzeNewNode(N); // The node may have changed but we don't care. } @@ -166,16 +165,17 @@ ExpungeNode(Old); ExpungeNode(New); for (unsigned i = 0, e = Old->getNumValues(); i != e; ++i) - ReplacedNodes[SDValue(Old, i)] = SDValue(New, i); + ReplacedValues[SDValue(Old, i)] = SDValue(New, i); } private: - void AnalyzeNewNode(SDValue &Val); + SDNode *AnalyzeNewNode(SDNode *N); + void AnalyzeNewValue(SDValue &Val); void ReplaceValueWith(SDValue From, SDValue To); void ReplaceNodeWith(SDNode *From, SDNode *To); - void RemapNode(SDValue &N); + void RemapValue(SDValue &N); void ExpungeNode(SDNode *N); // Common routines. @@ -197,7 +197,7 @@ SDValue GetPromotedInteger(SDValue Op) { SDValue &PromotedOp = PromotedIntegers[Op]; - RemapNode(PromotedOp); + RemapValue(PromotedOp); assert(PromotedOp.getNode() && "Operand wasn't promoted?"); return PromotedOp; } @@ -326,7 +326,7 @@ SDValue GetSoftenedFloat(SDValue Op) { SDValue &SoftenedOp = SoftenedFloats[Op]; - RemapNode(SoftenedOp); + RemapValue(SoftenedOp); assert(SoftenedOp.getNode() && "Operand wasn't converted to integer?"); return SoftenedOp; } @@ -406,7 +406,7 @@ SDValue GetScalarizedVector(SDValue Op) { SDValue &ScalarizedOp = ScalarizedVectors[Op]; - RemapNode(ScalarizedOp); + RemapValue(ScalarizedOp); assert(ScalarizedOp.getNode() && "Operand wasn't scalarized?"); return ScalarizedOp; } From evan.cheng at apple.com Wed Oct 29 03:39:35 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Oct 2008 08:39:35 -0000 Subject: [llvm-commits] [llvm] r58375 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/PreAllocSplitting.cpp lib/CodeGen/RegAllocLinearScan.cpp test/CodeGen/X86/pre-split10.ll test/CodeGen/X86/pre-split3.ll Message-ID: <200810290839.m9T8da6T006971@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 29 03:39:34 2008 New Revision: 58375 URL: http://llvm.org/viewvc/llvm-project?rev=58375&view=rev Log: - More pre-split fixes: spill slot live interval computation bug; restore point bug. - If a def is spilt, remember its spill index to allow its reuse. Added: llvm/trunk/test/CodeGen/X86/pre-split10.ll Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/test/CodeGen/X86/pre-split3.ll Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=58375&r1=58374&r2=58375&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Oct 29 03:39:34 2008 @@ -156,6 +156,8 @@ return reg & ~(1U << (sizeof(unsigned)*8-1)); } + bool hasAtLeastOneValue() const { return !valnos.empty(); } + bool containsOneValue() const { return valnos.size() == 1; } unsigned getNumValNums() const { return (unsigned)valnos.size(); } Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58375&r1=58374&r2=58375&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Wed Oct 29 03:39:34 2008 @@ -30,6 +30,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" using namespace llvm; @@ -69,8 +70,8 @@ // IntervalSSMap - A map from live interval to spill slots. DenseMap IntervalSSMap; - // RestoreMIs - All the restores inserted due to live interval splitting. - SmallPtrSet RestoreMIs; + // Def2SpillMap - A map from a def instruction index to spill index. + DenseMap Def2SpillMap; public: static char ID; @@ -93,7 +94,7 @@ virtual void releaseMemory() { IntervalSSMap.clear(); - RestoreMIs.clear(); + Def2SpillMap.clear(); } virtual const char *getPassName() const { @@ -124,7 +125,8 @@ int CreateSpillStackSlot(unsigned, const TargetRegisterClass *); - bool IsAvailableInStack(unsigned, unsigned, int&) const; + bool IsAvailableInStack(MachineBasicBlock*, unsigned, unsigned, unsigned, + unsigned&, int&) const; void UpdateSpillSlotInterval(VNInfo*, unsigned, unsigned); @@ -221,6 +223,8 @@ unsigned LastIdx, SmallPtrSet &RefsInMBB, unsigned &RestoreIndex) { + // FIXME: Allow spill to be inserted to the beginning of the mbb. Update mbb + // begin index accordingly. MachineBasicBlock::iterator Pt = MBB->end(); unsigned EndIdx = LIs->getMBBEndIdx(MBB); @@ -229,8 +233,8 @@ if (RefsInMBB.empty() && LastIdx >= EndIdx) { MachineBasicBlock::iterator MII = MBB->end(); MachineBasicBlock::iterator EndPt = MI; + --MII; do { - --MII; unsigned Index = LIs->getInstructionIndex(MII); unsigned Gap = LIs->findGapBeforeInstr(Index); if (Gap) { @@ -238,6 +242,7 @@ RestoreIndex = Gap; break; } + --MII; } while (MII != EndPt); } else { MachineBasicBlock::iterator MII = MI; @@ -278,7 +283,7 @@ // Create live interval for stack slot. CurrSLI = &LSs->getOrCreateInterval(SS); - if (CurrSLI->getNumValNums()) + if (CurrSLI->hasAtLeastOneValue()) CurrSValNo = CurrSLI->getValNumInfo(0); else CurrSValNo = CurrSLI->getNextValue(~0U, 0, LSs->getVNInfoAllocator()); @@ -288,15 +293,30 @@ /// IsAvailableInStack - Return true if register is available in a split stack /// slot at the specified index. bool -PreAllocSplitting::IsAvailableInStack(unsigned Reg, unsigned Index, int &SS) const { +PreAllocSplitting::IsAvailableInStack(MachineBasicBlock *DefMBB, + unsigned Reg, unsigned DefIndex, + unsigned RestoreIndex, unsigned &SpillIndex, + int& SS) const { + if (!DefMBB) + return false; + DenseMap::iterator I = IntervalSSMap.find(Reg); if (I == IntervalSSMap.end()) return false; - if (LSs->getInterval(I->second).liveAt(Index)) { - SS = I->second; - return true; - } - return false; + DenseMap::iterator II = Def2SpillMap.find(DefIndex); + if (II == Def2SpillMap.end()) + return false; + + // If last spill of def is in the same mbb as barrier mbb (where restore will + // be), make sure it's not below the intended restore index. + // FIXME: Undo the previous spill? + assert(LIs->getMBBFromIndex(II->second) == DefMBB); + if (DefMBB == BarrierMBB && II->second >= RestoreIndex) + return false; + + SS = I->second; + SpillIndex = II->second; + return true; } /// UpdateSpillSlotInterval - Given the specified val# of the register live @@ -305,48 +325,58 @@ void PreAllocSplitting::UpdateSpillSlotInterval(VNInfo *ValNo, unsigned SpillIndex, unsigned RestoreIndex) { - const LiveRange *LR = CurrLI->getLiveRangeContaining(SpillIndex); - if (LR->contains(RestoreIndex)) { + assert(LIs->getMBBFromIndex(RestoreIndex) == BarrierMBB && + "Expect restore in the barrier mbb"); + + MachineBasicBlock *MBB = LIs->getMBBFromIndex(SpillIndex); + if (MBB == BarrierMBB) { + // Intra-block spill + restore. We are done. LiveRange SLR(SpillIndex, RestoreIndex, CurrSValNo); CurrSLI->addRange(SLR); return; } - SmallPtrSet Processed; - LiveRange SLR(SpillIndex, LR->end, CurrSValNo); + SmallPtrSet Processed; + unsigned EndIdx = LIs->getMBBEndIdx(MBB); + LiveRange SLR(SpillIndex, EndIdx+1, CurrSValNo); CurrSLI->addRange(SLR); - Processed.insert(LR); + Processed.insert(MBB); // Start from the spill mbb, figure out the extend of the spill slot's // live interval. SmallVector WorkList; - MachineBasicBlock *MBB = LIs->getMBBFromIndex(SpillIndex); - if (LR->end > LIs->getMBBEndIdx(MBB)) + const LiveRange *LR = CurrLI->getLiveRangeContaining(SpillIndex); + if (LR->end > EndIdx) // If live range extend beyond end of mbb, add successors to work list. for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI) WorkList.push_back(*SI); - // Live range may cross multiple basic blocks, add all reachable mbbs to - // the work list. - LIs->findReachableMBBs(LR->start, LR->end, WorkList); while (!WorkList.empty()) { MachineBasicBlock *MBB = WorkList.back(); WorkList.pop_back(); + if (Processed.count(MBB)) + continue; unsigned Idx = LIs->getMBBStartIdx(MBB); LR = CurrLI->getLiveRangeContaining(Idx); - if (LR && LR->valno == ValNo && !Processed.count(LR)) { - if (LR->contains(RestoreIndex)) { + if (LR && LR->valno == ValNo) { + EndIdx = LIs->getMBBEndIdx(MBB); + if (Idx <= RestoreIndex && RestoreIndex < EndIdx) { // Spill slot live interval stops at the restore. - LiveRange SLR(LR->start, RestoreIndex, CurrSValNo); + LiveRange SLR(Idx, RestoreIndex, CurrSValNo); CurrSLI->addRange(SLR); - LIs->findReachableMBBs(LR->start, RestoreIndex, WorkList); + } else if (LR->end > EndIdx) { + // Live range extends beyond end of mbb, process successors. + LiveRange SLR(Idx, EndIdx+1, CurrSValNo); + CurrSLI->addRange(SLR); + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), + SE = MBB->succ_end(); SI != SE; ++SI) + WorkList.push_back(*SI); } else { - LiveRange SLR(LR->start, LR->end, CurrSValNo); + LiveRange SLR(Idx, LR->end, CurrSValNo); CurrSLI->addRange(SLR); - LIs->findReachableMBBs(LR->start, LR->end, WorkList); } - Processed.insert(LR); + Processed.insert(MBB); } } } @@ -357,6 +387,9 @@ void PreAllocSplitting::UpdateRegisterInterval(VNInfo *ValNo, unsigned SpillIndex, unsigned RestoreIndex) { + assert(LIs->getMBBFromIndex(RestoreIndex) == BarrierMBB && + "Expect restore in the barrier mbb"); + SmallVector, 4> Before; SmallVector, 4> After; SmallVector BeforeKills; @@ -380,7 +413,7 @@ // Start from the restore mbb, figure out what part of the live interval // are defined by the restore. SmallVector WorkList; - MachineBasicBlock *MBB = LIs->getMBBFromIndex(RestoreIndex); + MachineBasicBlock *MBB = BarrierMBB; for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI) WorkList.push_back(*SI); @@ -547,7 +580,6 @@ } else if (MBB == DefMBB) { // There are no uses after the def. MachineInstr *DefMI = LIs->getInstructionFromIndex(ValNo->def); - assert(RestoreMIs.count(DefMI) && "Not defined by a join?"); if (UseMBBs.empty()) { // The only use must be below barrier in the barrier block. It's safe to // remove the def. @@ -641,7 +673,8 @@ TII->storeRegToStackSlot(*BarrierMBB, SpillPt, CurrLI->reg, true, SS, RC); SpillMI = prior(SpillPt); LIs->InsertMachineInstrInMaps(SpillMI, SpillIndex); - } else if (!IsAvailableInStack(CurrLI->reg, RestoreIndex, SS)) { + } else if (!IsAvailableInStack(DefMBB, CurrLI->reg, ValNo->def, + RestoreIndex, SpillIndex, SS)) { // If it's already split, just restore the value. There is no need to spill // the def again. if (!DefMI) @@ -667,11 +700,14 @@ LIs->InsertMachineInstrInMaps(SpillMI, SpillIndex); } + // Remember def instruction index to spill index mapping. + if (DefMI && SpillMI) + Def2SpillMap[ValNo->def] = SpillIndex; + // Add restore. TII->loadRegFromStackSlot(*BarrierMBB, RestorePt, CurrLI->reg, SS, RC); MachineInstr *LoadMI = prior(RestorePt); LIs->InsertMachineInstrInMaps(LoadMI, RestoreIndex); - RestoreMIs.insert(LoadMI); // If live interval is spilled in the same block as the barrier, just // create a hole in the interval. @@ -689,11 +725,8 @@ } // Update spill stack slot live interval. - if (SpillIndex) - // If value is already in stack at the restore point, there is - // no need to update the live interval. - UpdateSpillSlotInterval(ValNo, LIs->getUseIndex(SpillIndex)+1, - LIs->getDefIndex(RestoreIndex)); + UpdateSpillSlotInterval(ValNo, LIs->getUseIndex(SpillIndex)+1, + LIs->getDefIndex(RestoreIndex)); // Shrink wrap the live interval by walking up the CFG and find the // new kills. @@ -795,6 +828,27 @@ // Make sure blocks are numbered in order. MF.RenumberBlocks(); +#if 0 + // FIXME: Go top down. + MachineBasicBlock *Entry = MF.begin(); + SmallPtrSet Visited; + + for (df_ext_iterator > + DFI = df_ext_begin(Entry, Visited), E = df_ext_end(Entry, Visited); + DFI != E; ++DFI) { + BarrierMBB = *DFI; + for (MachineBasicBlock::iterator I = BarrierMBB->begin(), + E = BarrierMBB->end(); I != E; ++I) { + Barrier = &*I; + const TargetRegisterClass **BarrierRCs = + Barrier->getDesc().getRegClassBarriers(); + if (!BarrierRCs) + continue; + BarrierIdx = LIs->getInstructionIndex(Barrier); + MadeChange |= SplitRegLiveIntervals(BarrierRCs); + } + } +#else for (MachineFunction::reverse_iterator I = MF.rbegin(), E = MF.rend(); I != E; ++I) { BarrierMBB = &*I; @@ -809,6 +863,7 @@ MadeChange |= SplitRegLiveIntervals(BarrierRCs); } } +#endif return MadeChange; } Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=58375&r1=58374&r2=58375&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Oct 29 03:39:34 2008 @@ -550,7 +550,7 @@ SI.weight += Weight; VNInfo *VNI; - if (SI.getNumValNums()) + if (SI.hasAtLeastOneValue()) VNI = SI.getValNumInfo(0); else VNI = SI.getNextValue(~0U, 0, ls_->getVNInfoAllocator()); Added: llvm/trunk/test/CodeGen/X86/pre-split10.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pre-split10.ll?rev=58375&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/pre-split10.ll (added) +++ llvm/trunk/test/CodeGen/X86/pre-split10.ll Wed Oct 29 03:39:34 2008 @@ -0,0 +1,51 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -pre-alloc-split + +define i32 @main(i32 %argc, i8** %argv) nounwind { +entry: + br label %bb14.i + +bb14.i: ; preds = %bb14.i, %entry + %i8.0.reg2mem.0.i = phi i32 [ 0, %entry ], [ %0, %bb14.i ] ; [#uses=1] + %0 = add i32 %i8.0.reg2mem.0.i, 1 ; [#uses=2] + %1 = add double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %2 = add double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %3 = add double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %exitcond75.i = icmp eq i32 %0, 32 ; [#uses=1] + br i1 %exitcond75.i, label %bb24.i, label %bb14.i + +bb24.i: ; preds = %bb14.i + %4 = fdiv double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %5 = fdiv double %1, 0.000000e+00 ; [#uses=1] + %6 = fdiv double %2, 0.000000e+00 ; [#uses=1] + %7 = fdiv double %3, 0.000000e+00 ; [#uses=1] + br label %bb31.i + +bb31.i: ; preds = %bb31.i, %bb24.i + %tmp.0.reg2mem.0.i = phi i32 [ 0, %bb24.i ], [ %indvar.next64.i, %bb31.i ] ; [#uses=1] + %indvar.next64.i = add i32 %tmp.0.reg2mem.0.i, 1 ; [#uses=2] + %exitcond65.i = icmp eq i32 %indvar.next64.i, 64 ; [#uses=1] + br i1 %exitcond65.i, label %bb33.i, label %bb31.i + +bb33.i: ; preds = %bb31.i + br label %bb35.preheader.i + +bb5.i.i: ; preds = %bb35.preheader.i + %8 = call double @floor(double 0.000000e+00) nounwind readnone ; [#uses=0] + br label %bb7.i.i + +bb7.i.i: ; preds = %bb35.preheader.i, %bb5.i.i + br label %bb35.preheader.i + +bb35.preheader.i: ; preds = %bb7.i.i, %bb33.i + %9 = sub double 0.000000e+00, %4 ; [#uses=1] + store double %9, double* null, align 8 + %10 = sub double 0.000000e+00, %5 ; [#uses=1] + store double %10, double* null, align 8 + %11 = sub double 0.000000e+00, %6 ; [#uses=1] + store double %11, double* null, align 8 + %12 = sub double 0.000000e+00, %7 ; [#uses=1] + store double %12, double* null, align 8 + br i1 false, label %bb7.i.i, label %bb5.i.i +} + +declare double @floor(double) nounwind readnone Modified: llvm/trunk/test/CodeGen/X86/pre-split3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pre-split3.ll?rev=58375&r1=58374&r2=58375&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pre-split3.ll (original) +++ llvm/trunk/test/CodeGen/X86/pre-split3.ll Wed Oct 29 03:39:34 2008 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& \ -; RUN: grep {pre-alloc-split} | grep {Number of intervals split} | grep 2 +; RUN: grep {pre-alloc-split} | grep {Number of intervals split} | grep 1 define i32 @t(i32 %arg) { entry: From baldrick at free.fr Wed Oct 29 04:55:07 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 10:55:07 +0100 Subject: [llvm-commits] [llvm-gcc-4.2] r57992 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <0478FA7B-02BA-44DC-8DC9-2BC5E116569F@apple.com> References: <200810221814.m9MIEY6K018726@zion.cs.uiuc.edu> <200810230740.17736.baldrick@free.fr> <0478FA7B-02BA-44DC-8DC9-2BC5E116569F@apple.com> Message-ID: <200810291055.08330.baldrick@free.fr> Hi Devang, > > PS: I debugged this directly on tramp3d-v4 rather > > than reducing a testcase. I can try to reduce a > > testcase if you like. > > > I reduced test case in testsuite will help us avoid debugging tramp3d- > v4 directly again in future :) I reduced it using delta to the attached. If you apply this patch to llvm-gcc then it will barf at the appropriate point. Index: gcc-4.2.llvm/gcc/llvm-types.cpp =================================================================== --- gcc-4.2.llvm.orig/gcc/llvm-types.cpp 2008-10-29 09:47:52.000000000 +0100 +++ gcc-4.2.llvm/gcc/llvm-types.cpp 2008-10-29 10:54:20.000000000 +0100 @@ -2132,6 +2132,10 @@ unsigned FieldNo = Info->getLLVMFieldFor(FieldOffsetInBits, CurFieldNo, isZeroSizeField); SetFieldIndex(Field, FieldNo); + + assert((isBitfield(Field) || FieldNo == ~0U || + FieldOffsetInBits == 8*Info->ElementOffsetInBytes[FieldNo]) && + "Wrong LLVM field offset!"); } // Put the original gcc struct back the way it was; necessary to prevent the -------------- next part -------------- A non-text attachment was scrubbed... Name: tramp3d-v4.cpp Type: text/x-c++src Size: 12661 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081029/40e61008/attachment.bin From baldrick at free.fr Wed Oct 29 09:22:20 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 14:22:20 -0000 Subject: [llvm-commits] [llvm] r58378 - in /llvm/trunk: include/llvm/CodeGen/ValueTypes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200810291422.m9TEMKn2019084@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 09:22:20 2008 New Revision: 58378 URL: http://llvm.org/viewvc/llvm-project?rev=58378&view=rev Log: Add sanity checking for BUILD_PAIR (I noticed the other day that PPC custom lowering could create a BUILD_PAIR of two f64 with a result type of... f64! - already fixed). Fix a place that triggers the sanity check. Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=58378&r1=58377&r2=58378&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Wed Oct 29 09:22:20 2008 @@ -142,6 +142,24 @@ inline bool operator== (const MVT VT) const { return V == VT.V; } inline bool operator!= (const MVT VT) const { return V != VT.V; } + /// getFloatingPointVT - Returns the MVT that represents a floating point + /// type with the given number of bits. There are two floating point types + /// with 128 bits - this returns f128 rather than ppcf128. + static inline MVT getFloatingPointVT(unsigned BitWidth) { + switch (BitWidth) { + default: + assert(false && "Bad bit width!"); + case 32: + return f32; + case 64: + return f64; + case 80: + return f80; + case 128: + return f128; + } + } + /// getIntegerVT - Returns the MVT that represents an integer with the given /// number of bits. static inline MVT getIntegerVT(unsigned BitWidth) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=58378&r1=58377&r2=58378&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Oct 29 09:22:20 2008 @@ -758,11 +758,25 @@ switch (N->getOpcode()) { default: break; + case ISD::BUILD_PAIR: { + MVT VT = N->getValueType(0); + assert(N->getNumValues() == 1 && "Too many results!"); + assert(!VT.isVector() && (VT.isInteger() || VT.isFloatingPoint()) && + "Wrong return type!"); + assert(N->getNumOperands() == 2 && "Wrong number of operands!"); + assert(N->getOperand(0).getValueType() == N->getOperand(1).getValueType() && + "Mismatched operand types!"); + assert(N->getOperand(0).getValueType().isInteger() == VT.isInteger() && + "Wrong operand type!"); + assert(VT.getSizeInBits() == 2 * N->getOperand(0).getValueSizeInBits() && + "Wrong return type size"); + break; + } case ISD::BUILD_VECTOR: { - assert(N->getNumValues() == 1 && "Too many results for BUILD_VECTOR!"); - assert(N->getValueType(0).isVector() && "Wrong BUILD_VECTOR return type!"); + assert(N->getNumValues() == 1 && "Too many results!"); + assert(N->getValueType(0).isVector() && "Wrong return type!"); assert(N->getNumOperands() == N->getValueType(0).getVectorNumElements() && - "Wrong number of BUILD_VECTOR operands!"); + "Wrong number of operands!"); // FIXME: Change vector_shuffle to a variadic node with mask elements being // operands of the node. Currently the mask is a BUILD_VECTOR passed as an // operand, and it is not always possible to legalize it. Turning off the @@ -770,7 +784,7 @@ // MVT EltVT = N->getValueType(0).getVectorElementType(); // for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) // assert(I->getSDValue().getValueType() == EltVT && -// "Wrong BUILD_VECTOR operand type!"); +// "Wrong operand type!"); break; } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=58378&r1=58377&r2=58378&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Oct 29 09:22:20 2008 @@ -390,14 +390,17 @@ ValueVT : MVT::getIntegerVT(RoundBits); SDValue Lo, Hi; + MVT HalfVT = ValueVT.isInteger() ? + MVT::getIntegerVT(RoundBits/2) : + MVT::getFloatingPointVT(RoundBits/2); + if (RoundParts > 2) { - MVT HalfVT = MVT::getIntegerVT(RoundBits/2); Lo = getCopyFromParts(DAG, Parts, RoundParts/2, PartVT, HalfVT); Hi = getCopyFromParts(DAG, Parts+RoundParts/2, RoundParts/2, PartVT, HalfVT); } else { - Lo = Parts[0]; - Hi = Parts[1]; + Lo = DAG.getNode(ISD::BIT_CONVERT, HalfVT, Parts[0]); + Hi = DAG.getNode(ISD::BIT_CONVERT, HalfVT, Parts[1]); } if (TLI.isBigEndian()) std::swap(Lo, Hi); From baldrick at free.fr Wed Oct 29 09:25:28 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 14:25:28 -0000 Subject: [llvm-commits] [llvm] r58379 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp test/CodeGen/X86/2008-10-29-ExpandVAARG.ll Message-ID: <200810291425.m9TEPTHg019198@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 09:25:28 2008 New Revision: 58379 URL: http://llvm.org/viewvc/llvm-project?rev=58379&view=rev Log: Fix PR2977: LegalizeTypes support for expanding VAARG. Added: llvm/trunk/test/CodeGen/X86/2008-10-29-ExpandVAARG.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=58379&r1=58378&r2=58379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Oct 29 09:25:28 2008 @@ -575,6 +575,7 @@ case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break; case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break; case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break; + case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi); break; case ISD::ConstantFP: ExpandFloatRes_ConstantFP(N, Lo, Hi); break; case ISD::FABS: ExpandFloatRes_FABS(N, Lo, Hi); break; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=58379&r1=58378&r2=58379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Wed Oct 29 09:25:28 2008 @@ -960,6 +960,7 @@ case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break; case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break; case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break; + case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi); break; case ISD::ANY_EXTEND: ExpandIntRes_ANY_EXTEND(N, Lo, Hi); break; case ISD::AssertSext: ExpandIntRes_AssertSext(N, Lo, Hi); break; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=58379&r1=58378&r2=58379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Oct 29 09:25:28 2008 @@ -516,6 +516,7 @@ void ExpandRes_EXTRACT_ELEMENT (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandRes_NormalLoad (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandRes_VAARG (SDNode *N, SDValue &Lo, SDValue &Hi); // Generic Operand Expansion. SDValue ExpandOp_BIT_CONVERT (SDNode *N); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp?rev=58379&r1=58378&r2=58379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Wed Oct 29 09:25:28 2008 @@ -171,6 +171,23 @@ ReplaceValueWith(SDValue(N, 1), Chain); } +void DAGTypeLegalizer::ExpandRes_VAARG(SDNode *N, SDValue &Lo, SDValue &Hi) { + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + SDValue Chain = N->getOperand(0); + SDValue Ptr = N->getOperand(1); + + Lo = DAG.getVAArg(NVT, Chain, Ptr, N->getOperand(2)); + Hi = DAG.getVAArg(NVT, Lo.getValue(1), Ptr, N->getOperand(2)); + + // Handle endianness of the load. + if (TLI.isBigEndian()) + std::swap(Lo, Hi); + + // Modified the chain - switch anything that used the old chain to use + // the new one. + ReplaceValueWith(SDValue(N, 1), Hi.getValue(1)); +} + //===--------------------------------------------------------------------===// // Generic Operand Expansion. Added: llvm/trunk/test/CodeGen/X86/2008-10-29-ExpandVAARG.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-29-ExpandVAARG.ll?rev=58379&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-10-29-ExpandVAARG.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-10-29-ExpandVAARG.ll Wed Oct 29 09:25:28 2008 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 +; PR2977 +define i8* @ap_php_conv_p2(){ +entry: + %ap.addr = alloca i8* ; [#uses=36] + br label %sw.bb301 +sw.bb301: + %0 = va_arg i8** %ap.addr, i64 ; [#uses=1] + br label %sw.bb301 +} From baldrick at free.fr Wed Oct 29 10:57:41 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 15:57:41 -0000 Subject: [llvm-commits] [llvm] r58383 - /llvm/trunk/test/FrontendC/2004-02-13-Memset.c Message-ID: <200810291557.m9TFvgNL022742@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 10:57:37 2008 New Revision: 58383 URL: http://llvm.org/viewvc/llvm-project?rev=58383&view=rev Log: Make the declaration of bzero match size_t on x86-64-linux. Modified: llvm/trunk/test/FrontendC/2004-02-13-Memset.c Modified: llvm/trunk/test/FrontendC/2004-02-13-Memset.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2004-02-13-Memset.c?rev=58383&r1=58382&r2=58383&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2004-02-13-Memset.c (original) +++ llvm/trunk/test/FrontendC/2004-02-13-Memset.c Wed Oct 29 10:57:37 2008 @@ -1,7 +1,7 @@ // RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memset | count 3 void *memset(void*, int, long); -void bzero(void*, int); +void bzero(void*, long); void test(int* X, char *Y) { memset(X, 4, 1000); From edwintorok at gmail.com Wed Oct 29 11:32:07 2008 From: edwintorok at gmail.com (Torok Edwin) Date: Wed, 29 Oct 2008 16:32:07 -0000 Subject: [llvm-commits] [llvm] r58384 - /llvm/trunk/docs/tutorial/OCamlLangImpl1.html Message-ID: <200810291632.m9TGW7Et023853@zion.cs.uiuc.edu> Author: edwin Date: Wed Oct 29 11:32:06 2008 New Revision: 58384 URL: http://llvm.org/viewvc/llvm-project?rev=58384&view=rev Log: fix typo Modified: llvm/trunk/docs/tutorial/OCamlLangImpl1.html Modified: llvm/trunk/docs/tutorial/OCamlLangImpl1.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl1.html?rev=58384&r1=58383&r2=58384&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl1.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl1.html Wed Oct 29 11:32:06 2008 @@ -252,7 +252,7 @@ recursive call above.

The next thing Lexer.lex needs to do is recognize identifiers and -specific keywords like "def". Kaleidoscope does this with this a pattern match +specific keywords like "def". Kaleidoscope does this with a pattern match and a helper function.

From sabre at nondot.org Wed Oct 29 12:46:26 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Oct 2008 17:46:26 -0000 Subject: [llvm-commits] [llvm] r58385 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/trapping-load-unreachable.ll Message-ID: <200810291746.m9THkRgb026679@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 29 12:46:26 2008 New Revision: 58385 URL: http://llvm.org/viewvc/llvm-project?rev=58385&view=rev Log: Fix PR2967 by not deleting volatile load/stores that occur before unreachable. I don't really see this as being needed, but there is little harm from doing it. Added: llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=58385&r1=58384&r2=58385&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Oct 29 12:46:26 2008 @@ -1932,7 +1932,18 @@ while (Unreachable != BB->begin()) { BasicBlock::iterator BBI = Unreachable; --BBI; + // Do not delete instructions that can have side effects, like calls + // (which may never return) and volatile loads and stores. if (isa(BBI)) break; + + if (StoreInst *SI = dyn_cast(BBI)) + if (SI->isVolatile()) + break; + + if (LoadInst *LI = dyn_cast(BBI)) + if (LI->isVolatile()) + break; + // Delete this instruction BB->getInstList().erase(BBI); Changed = true; Added: llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll?rev=58385&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll (added) +++ llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll Wed Oct 29 12:46:26 2008 @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {volatile load} +; PR2967 + +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" +target triple = "i386-pc-linux-gnu" + +define void @foo(i32 %x) nounwind { +entry: + %0 = icmp eq i32 %x, 0 ; [#uses=1] + br i1 %0, label %bb, label %return + +bb: ; preds = %entry + %1 = volatile load i32* null ; [#uses=0] + unreachable + br label %return +return: ; preds = %entry + ret void +} From baldrick at free.fr Wed Oct 29 12:52:12 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 17:52:12 -0000 Subject: [llvm-commits] [llvm] r58386 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.cpp LegalizeTypes.h Message-ID: <200810291752.m9THqCUr026969@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 12:52:12 2008 New Revision: 58386 URL: http://llvm.org/viewvc/llvm-project?rev=58386&view=rev Log: Uniformize capitalization of NodeId. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=58386&r1=58385&r2=58386&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Wed Oct 29 12:52:12 2008 @@ -31,7 +31,7 @@ // done. Set it to null to avoid confusion. DAG.setRoot(SDValue()); - // Walk all nodes in the graph, assigning them a NodeID of 'ReadyToProcess' + // Walk all nodes in the graph, assigning them a NodeId of 'ReadyToProcess' // (and remembering them) if they are leaves and assigning 'NewNode' if // non-leaves. for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), @@ -140,25 +140,25 @@ for (SDNode::use_iterator UI = N->use_begin(), E = N->use_end(); UI != E; ++UI) { SDNode *User = *UI; - int NodeID = User->getNodeId(); - assert(NodeID != ReadyToProcess && NodeID != Processed && + int NodeId = User->getNodeId(); + assert(NodeId != ReadyToProcess && NodeId != Processed && "Invalid node id for user of unprocessed node!"); // This node has two options: it can either be a new node or its Node ID // may be a count of the number of operands it has that are not ready. - if (NodeID > 0) { - User->setNodeId(NodeID-1); + if (NodeId > 0) { + User->setNodeId(NodeId-1); // If this was the last use it was waiting on, add it to the ready list. - if (NodeID-1 == ReadyToProcess) + if (NodeId-1 == ReadyToProcess) Worklist.push_back(User); continue; } // Otherwise, this node is new: this is the first operand of it that - // became ready. Its new NodeID is the number of operands it has minus 1 + // became ready. Its new NodeId is the number of operands it has minus 1 // (as this node is now processed). - assert(NodeID == NewNode && "Unknown node ID!"); + assert(NodeId == NewNode && "Unknown node ID!"); User->setNodeId(User->getNumOperands()-1); // If the node only has a single operand, it is now ready. @@ -340,7 +340,7 @@ /// ReplaceValueWith - The specified value was legalized to the specified other -/// value. If they are different, update the DAG and NodeIDs replacing any uses +/// value. If they are different, update the DAG and NodeIds replacing any uses /// of From to use To instead. void DAGTypeLegalizer::ReplaceValueWith(SDValue From, SDValue To) { if (From == To) return; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=58386&r1=58385&r2=58386&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Oct 29 12:52:12 2008 @@ -35,9 +35,9 @@ TargetLowering &TLI; SelectionDAG &DAG; public: - // NodeIDFlags - This pass uses the NodeID on the SDNodes to hold information + // NodeIdFlags - This pass uses the NodeId on the SDNodes to hold information // about the state of the node. The enum has all the values. - enum NodeIDFlags { + enum NodeIdFlags { /// ReadyToProcess - All operands have been processed, so this node is ready /// to be handled. ReadyToProcess = 0, @@ -153,7 +153,7 @@ void run(); - /// ReanalyzeNode - Recompute the NodeID and correct processed operands + /// ReanalyzeNode - Recompute the NodeId and correct processed operands /// for the specified node, adding it to the worklist if ready. void ReanalyzeNode(SDNode *N) { N->setNodeId(NewNode); From baldrick at free.fr Wed Oct 29 12:59:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 17:59:32 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58387 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200810291759.m9THxWUV027348@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 12:59:31 2008 New Revision: 58387 URL: http://llvm.org/viewvc/llvm-project?rev=58387&view=rev Log: Really fix tramp3d-v4 on x86-64-linux. This reverts commit 57992 which only solved part of the problem: that gcc struct fields were sometimes being mapped to LLVM fields with a different offset from the start of the struct. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=58387&r1=58386&r2=58387&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Oct 29 12:59:31 2008 @@ -6023,38 +6023,6 @@ BitStart -= SL->getElementOffset(MemberIndex) * 8; } - // Type conversion does not ensure that there is always an LLVM field - // starting at the same byte as the gcc field. Correct for this now. - // An example of how this can occur is: - // Field A: offset 0, length 1 - // Field B: offset 4, length 4 (4 byte alignment) - // Field C: offset 6 - // Since field C overlaps field B, we delete field B and replace it with - // padding: - // LLVM A: offset 0, length 1 - // LLVM B: offset 1, length 5 (1 byte alignment) - padding array - // LLVM C: offset 6 - // A COMPONENT_REF for gcc field B will get LLVM field B which has - // offset 1 not 4. - unsigned ByteStart = BitStart/8; - if (ByteStart && !isBitfield(FieldDecl)) { - const Type *ContainingType = - cast(StructTy)->getTypeAtIndex(MemberIndex); - Value *Offset = ConstantInt::get(TD.getIntPtrType(), ByteStart); - - const ArrayType *ATy = dyn_cast(ContainingType); - if (ATy && ATy->getElementType() == Type::Int8Ty) { - // Only known case: the LLVM field is an array of bytes. - FieldPtr = Builder.CreateGEP(FieldPtr, Offset); - } else { - // Do pointer arithmetic. - FieldPtr = Builder.CreatePtrToInt(FieldPtr, Offset->getType()); - FieldPtr = Builder.CreateAdd(FieldPtr, Offset); - FieldPtr = Builder.CreateIntToPtr(FieldPtr, - PointerType::getUnqual(Type::Int8Ty)); - } - BitStart -= ByteStart * 8; - } } else { Value *Offset = Emit(field_offset, 0); Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=58387&r1=58386&r2=58387&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Wed Oct 29 12:59:31 2008 @@ -1425,10 +1425,22 @@ SavedTy = Elements.back(); if (ElementOffsetInBytes.back()+ElementSizeInBytes.back() > ByteOffset) { // The last element overlapped with this one, remove it. + uint64_t PoppedOffset = ElementOffsetInBytes.back(); Elements.pop_back(); ElementOffsetInBytes.pop_back(); ElementSizeInBytes.pop_back(); PaddingElement.pop_back(); + uint64_t EndOffset = getNewElementByteOffset(1); + if (EndOffset < PoppedOffset) { + // Make sure that some field starts at the position of the + // field we just popped. Otherwise we might end up with a + // gcc non-bitfield being mapped to an LLVM field with a + // different offset. + const Type *Pad = Type::Int8Ty; + if (PoppedOffset != EndOffset + 1) + Pad = ArrayType::get(Pad, PoppedOffset - EndOffset); + addElement(Pad, EndOffset, PoppedOffset - EndOffset); + } } } @@ -2132,6 +2144,10 @@ unsigned FieldNo = Info->getLLVMFieldFor(FieldOffsetInBits, CurFieldNo, isZeroSizeField); SetFieldIndex(Field, FieldNo); + + assert((isBitfield(Field) || FieldNo == ~0U || + FieldOffsetInBits == 8*Info->ElementOffsetInBytes[FieldNo]) && + "Wrong LLVM field offset!"); } // Put the original gcc struct back the way it was; necessary to prevent the From baldrick at free.fr Wed Oct 29 13:06:20 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 18:06:20 -0000 Subject: [llvm-commits] [llvm] r58389 - /llvm/trunk/test/FrontendC++/2008-10-29-WrongOffset.cpp Message-ID: <200810291806.m9TI6Ksh027583@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 29 13:06:20 2008 New Revision: 58389 URL: http://llvm.org/viewvc/llvm-project?rev=58389&view=rev Log: Testcase for PR2917. Added: llvm/trunk/test/FrontendC++/2008-10-29-WrongOffset.cpp Added: llvm/trunk/test/FrontendC++/2008-10-29-WrongOffset.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2008-10-29-WrongOffset.cpp?rev=58389&view=auto ============================================================================== --- llvm/trunk/test/FrontendC++/2008-10-29-WrongOffset.cpp (added) +++ llvm/trunk/test/FrontendC++/2008-10-29-WrongOffset.cpp Wed Oct 29 13:06:20 2008 @@ -0,0 +1,489 @@ +// RUN: %llvmgxx %s -c -o /dev/null +// PR2917 + +#include +template < int Dim, class T, class EngineTag > class Engine; +template < class Subject, class Sub1, bool SV > struct View1Implementation; +template < class LayoutTag, class PatchTag > struct MultiPatch; +template < class LayoutTag, class PatchTag, int Dim2 > struct MultiPatchView; +template < class Engine, class SubDomain > struct NewEngine +{ +}; +template < class T > class DomainTraits; +template < class DomT, class T, int Dim > struct DomainTraitsDomain +{ + typedef DomT NewDomain1_t; +}; +template < int Dim > class Interval; +template < int Dim > class Loc; +template < class DT > class DomainBase +{ +}; + +template < int Dim, class DT > class Domain:public DomainBase < DT > +{ +}; +template < int Dim > struct DomainTraits + >:public DomainTraitsDomain < Interval < Dim >, int, Dim > +{ + enum + { + singleValued = false + }; +}; +template < class T1 > struct NewDomain1 +{ + typedef typename DomainTraits < T1 >::NewDomain1_t SliceType_t; +}; +template < class Domain, class Sub > struct TemporaryNewDomain1 +{ + typedef typename NewDomain1 < Sub >::SliceType_t SliceType_t; +}; +template < int Dim > class Interval:public Domain < Dim, + DomainTraits < Interval < Dim > > > +{ +}; +template < int Dim > class GuardLayers +{ +}; +template < class T > class Observer +{ +}; + +template < class T > class Observable +{ +private:T & observed_m; + int count_m; +}; + +class RefCounted +{ +}; +template < class T > class RefCountedPtr +{ +public:typedef RefCountedPtr < T > This_t; + RefCountedPtr (T * const pT):ptr_m (pT) + { + } + inline T *operator-> () const + { + } + T *ptr_m; +}; + +template < class Dom, class T > class DomainMap +{ +}; + +template < class LayoutTag, int Dim > struct MultiPatchLayoutTraits +{ +}; +template < int Dim > class LayoutBaseData +{ +public:typedef Interval < Dim > Domain_t; + Domain_t domain_m; +}; +template < int Dim, class LBD > class LayoutBase +{ +public:typedef LayoutBaseData < Dim > LayoutData_t; + typedef typename LayoutData_t::Domain_t Domain_t; + typedef GuardLayers < Dim > GuardLayers_t; + inline const Domain_t & domain () const + { + return pdata_m->domain_m; + } + inline const Domain_t & innerDomain () const + { + } + inline GuardLayers_t externalGuards () const + { + } + RefCountedPtr < LBD > pdata_m; +}; +template < class Tag > struct Remote; +struct Brick +{ +}; +template < class Thing, class Sub > struct View1 +{ +}; +template < int Dim, class T, class LayoutTag, + class PatchTag > struct NewEngine >, Interval < Dim > > +{ + typedef Engine < Dim, T, MultiPatchView < LayoutTag, PatchTag, + Dim > >Type_t; +}; +template < int Dim, class T, class LayoutTag, class PatchTag, + int Dim2 > struct NewEngine >, Interval < Dim > > +{ + typedef Engine < Dim, T, MultiPatchView < LayoutTag, PatchTag, + Dim2 > >Type_t; +}; +template < int Dim, class T, class LayoutTag, + class PatchTag > class Engine < Dim, T, MultiPatch < LayoutTag, + PatchTag > >:public Observer < typename MultiPatchLayoutTraits < LayoutTag, + Dim >::Layout_t > +{ +public:typedef MultiPatch < LayoutTag, PatchTag > Tag_t; + typedef Interval < Dim > Domain_t; +}; +template < int Dim, class T, class LayoutTag, class PatchTag, + int Dim2 > class Engine < Dim, T, MultiPatchView < LayoutTag, PatchTag, + Dim2 > > +{ +public:typedef MultiPatchView < LayoutTag, PatchTag, Dim2 > Tag_t; + typedef Interval < Dim > Domain_t; + typedef T Element_t; + enum + { + dimensions = Dim + }; +}; +class Full; +template < int Dim, class T = double, class EngineTag = Full > class Vector { +}; + +template < int Dim > inline Interval < Dim > +shrinkRight (const Interval < Dim > &dom, int s) +{ +} + +template < int Dim > class GridLayout; +struct GridTag +{ +}; +template < int Dim > struct MultiPatchLayoutTraits +{ + typedef GridLayout < Dim > Layout_t; +}; +template < int Dim > class GridLayoutData:public LayoutBaseData < Dim >, + public RefCounted, public Observable < GridLayoutData < Dim > > +{ + typedef int AxisIndex_t; + mutable DomainMap < Interval < 1 >, AxisIndex_t > mapAloc_m[Dim]; +}; +template < int Dim > class GridLayout:public LayoutBase < Dim, + GridLayoutData < Dim > >, public Observable < GridLayout < Dim > >, + public Observer < GridLayoutData < Dim > > +{ +public:typedef GridLayout < Dim > This_t; + GridLayout (); +}; +template < class MeshTag, class T, class EngineTag > class Field; +enum CenteringType +{ + VertexType, EdgeType, FaceType, CellType +}; +enum ContinuityType +{ + Continuous = 0, Discontinuous +}; +template < int Dim > class Centering +{ +public:typedef Loc < Dim > Orientation; + inline int size () const + { + } +}; +template < int Dim > const Centering < Dim > +canonicalCentering (const enum CenteringType type, + const enum ContinuityType discontinuous, + const int dimension = 0); +template < class Mesh, class T, class EngineTag > class FieldEngine +{ +public:enum + { + dimensions = Mesh::dimensions + }; + enum + { + Dim = dimensions + }; + typedef Engine < Dim, T, EngineTag > Engine_t; + typedef typename Engine_t::Domain_t Domain_t; + typedef GuardLayers < Dim > GuardLayers_t; +template < class Layout2 > FieldEngine (const Centering < Dim > ¢ering, const Layout2 & layout, const Mesh & mesh, int materials = 1):num_materials_m (materials), centering_m (centering), + stride_m (centering.size ()), physicalCellDomain_m (layout.domain ()), + guards_m (layout.externalGuards ()), mesh_m (mesh) + { + } + unsigned int num_materials_m; + Centering < Dim > centering_m; + int stride_m; + Domain_t physicalCellDomain_m; + GuardLayers_t guards_m; + Mesh mesh_m; +}; + +template < class Subject > class SubFieldView; +template < class Mesh, class T, + class EngineTag > class SubFieldView < Field < Mesh, T, EngineTag > > +{ +public:typedef Field < Mesh, T, EngineTag > Type_t; +}; + +template < int Dim, class Mesh, class Domain > struct NewMeshTag +{ + typedef Mesh Type_t; +}; +template < class Mesh, class T, class EngineTag, + class Domain > struct View1Implementation , + Domain, false > +{ + typedef Field < Mesh, T, EngineTag > Subject_t; + typedef typename Subject_t::Engine_t Engine_t; + typedef typename NewEngine < Engine_t, Domain >::Type_t NewEngine_t; + typedef typename NewEngine_t::Element_t NewT_t; + typedef typename NewEngine_t::Tag_t NewEngineTag_t; + typedef typename NewMeshTag < NewEngine_t::dimensions, Mesh, + Domain >::Type_t NewMeshTag_t; + typedef Field < NewMeshTag_t, NewT_t, NewEngineTag_t > Type_t; +}; +template < class Mesh, class T, class EngineTag, + class Sub1 > struct View1 , Sub1 > +{ + typedef Field < Mesh, T, EngineTag > Subject_t; + typedef typename Subject_t::Domain_t Domain_t; + typedef TemporaryNewDomain1 < Domain_t, Sub1 > NewDomain_t; + typedef typename NewDomain_t::SliceType_t SDomain_t; + enum + { + sv = DomainTraits < SDomain_t >::singleValued + }; + typedef View1Implementation < Subject_t, SDomain_t, sv > Dispatch_t; + typedef typename Dispatch_t::Type_t Type_t; +}; +template < class Mesh, class T = double, class EngineTag = Brick > class Field { +public:typedef Mesh MeshTag_t; + typedef Mesh Mesh_t; + typedef Field < Mesh, T, EngineTag > This_t; + typedef FieldEngine < Mesh, T, EngineTag > FieldEngine_t; + enum + { + dimensions = FieldEngine_t::dimensions + }; + typedef Engine < dimensions, T, EngineTag > Engine_t; + typedef typename Engine_t::Domain_t Domain_t; + typedef Centering < dimensions > Centering_t; + template < class Layout2 > Field (const Centering_t & centering, + const Layout2 & layout, + const Mesh_t & + mesh):fieldEngine_m (centering, layout, + mesh) + { + } + inline typename SubFieldView < This_t >::Type_t center (int c) const + { + } + inline typename View1 < This_t, Domain_t >::Type_t all () const + { + } + template < class T1 > const This_t & operator= (const T1 & rhs) const + { + } +private: FieldEngine_t fieldEngine_m; +}; + +struct UniformRectilinearTag +{ +}; +struct CartesianTag +{ +}; +template < class MeshTraits > struct CartesianURM; +template < class MeshTraits > class UniformRectilinearMeshData; +template < class MeshTraits > class UniformRectilinearMesh; +template < int Dim, typename T = double, class MeshTag = + UniformRectilinearTag, class CoordinateSystemTag = CartesianTag, int CDim = + Dim > struct MeshTraits; +template < int Dim, typename T, class MeshTag, class CoordinateSystemTag, + int CDim > struct MeshTraitsBase +{ + typedef MeshTraits < Dim, T, MeshTag, CoordinateSystemTag, + CDim > MeshTraits_t; + enum + { + dimensions = Dim + }; + typedef Vector < CDim, T > PointType_t; +}; +template < int Dim, typename T, int CDim > struct MeshTraits :public MeshTraitsBase < Dim, T, + UniformRectilinearTag, CartesianTag, CDim > +{ + typedef typename MeshTraitsBase < Dim, T, UniformRectilinearTag, + CartesianTag, CDim >::MeshTraits_t MeshTraits_t; + typedef CartesianURM < MeshTraits_t > CoordinateSystem_t; + typedef UniformRectilinearMeshData < MeshTraits_t > MeshData_t; + typedef UniformRectilinearMesh < MeshTraits_t > Mesh_t; + typedef Vector < CDim, T > SpacingsType_t; +}; +template < int Dim > class NoMeshData:public RefCounted +{ +public:NoMeshData () + { + } + template < class Layout > + explicit NoMeshData (const Layout & + layout):physicalVertexDomain_m (layout. + innerDomain ()), + physicalCellDomain_m (shrinkRight (physicalVertexDomain_m, 1)), + totalVertexDomain_m (layout.domain ()), + totalCellDomain_m (shrinkRight (totalVertexDomain_m, 1)) + { + } +private:Interval < Dim > physicalVertexDomain_m, physicalCellDomain_m; + Interval < Dim > totalVertexDomain_m, totalCellDomain_m; +}; + +template < class MeshTraits > class UniformRectilinearMeshData:public NoMeshData < + MeshTraits:: + dimensions > +{ +public:typedef typename + MeshTraits::MeshData_t + MeshData_t; + typedef typename + MeshTraits::PointType_t + PointType_t; + typedef typename + MeshTraits::SpacingsType_t + SpacingsType_t; + enum + { + dimensions = MeshTraits::dimensions + }; + template < class Layout > UniformRectilinearMeshData (const Layout & layout, + const PointType_t & + origin, + const SpacingsType_t & + spacings): + NoMeshData < + dimensions > (layout), + origin_m (origin), + spacings_m (spacings) + { + } +private:PointType_t origin_m; + SpacingsType_t + spacings_m; +}; + +template < class MeshTraits > class UniformRectilinearMesh:public MeshTraits:: + CoordinateSystem_t +{ +public:typedef MeshTraits + MeshTraits_t; + typedef typename + MeshTraits::MeshData_t + MeshData_t; + typedef typename + MeshTraits::PointType_t + PointType_t; + typedef typename + MeshTraits::SpacingsType_t + SpacingsType_t; + enum + { + dimensions = MeshTraits::dimensions + }; + template < class Layout > + inline UniformRectilinearMesh (const Layout & layout, + const PointType_t & origin, + const SpacingsType_t & spacings): + data_m (new MeshData_t (layout, origin, spacings)) + { + } +private:RefCountedPtr < MeshData_t > data_m; +}; + +template < class MeshTraits > struct GenericURM +{ +}; +template < class MeshTraits > struct CartesianURM: + public + GenericURM < + MeshTraits > +{ +}; +template < int + dim, + class + MeshTag = UniformRectilinearTag, class CoordinateSystemTag = CartesianTag > struct ParallelTraits { + enum + { + Dim = dim + }; + typedef + GridLayout < + dim > + Layout_t; + typedef + MeshTraits < + dim, double, + MeshTag, + CoordinateSystemTag > + MeshTraits_t; + typedef typename + MeshTraits_t::Mesh_t + Mesh_t; + typedef + MultiPatch < + GridTag, + Remote < + Brick > > + Engine_t; +}; +template < class ComputeTraits > struct RhalkTraits: + public + ComputeTraits +{ + typedef typename + ComputeTraits::Mesh_t + Mesh_t; + typedef typename + ComputeTraits::Engine_t + Engine_t; + enum + { + Dim = ComputeTraits::Dim + }; + typedef + Centering < + Dim > + Centering_t; + typedef typename + Mesh_t::SpacingsType_t + Spacings_t; + typedef + Field < + Mesh_t, double, + Engine_t > + Scalar_t; +}; +enum +{ + Dim = 3 +}; +typedef + RhalkTraits < + ParallelTraits < + Dim, + UniformRectilinearTag, +CartesianTag > > + Traits_t; +Vector < Dim > origin; +Traits_t::Spacings_t spacings; +int +main (int argc, char **argv) +{ + Traits_t::Layout_t layout; + Traits_t::Mesh_t mesh (layout, origin, spacings); + Traits_t::Centering_t face = + canonicalCentering < Traits_t::Dim > (FaceType, Continuous); + Traits_t::Scalar_t v (face, layout, mesh); + for (int i = 0; i < Dim; ++i) + v.center (i).all () = std::numeric_limits < double >::signaling_NaN (); +} From dpatel at apple.com Wed Oct 29 13:14:42 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 29 Oct 2008 11:14:42 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r57992 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200810291055.08330.baldrick@free.fr> References: <200810221814.m9MIEY6K018726@zion.cs.uiuc.edu> <200810230740.17736.baldrick@free.fr> <0478FA7B-02BA-44DC-8DC9-2BC5E116569F@apple.com> <200810291055.08330.baldrick@free.fr> Message-ID: <2355F94C-62EE-418B-A557-C21FB4E44DF7@apple.com> Hi Duncan, On Oct 29, 2008, at 2:55 AM, Duncan Sands wrote: > Hi Devang, > >>> PS: I debugged this directly on tramp3d-v4 rather >>> than reducing a testcase. I can try to reduce a >>> testcase if you like. >> >> >> I reduced test case in testsuite will help us avoid debugging >> tramp3d- >> v4 directly again in future :) > > I reduced it using delta to the attached. If you apply this > patch to llvm-gcc then it will barf at the appropriate point. Thanks!. Did you add this in llvm tests ? - Devang > > > Index: gcc-4.2.llvm/gcc/llvm-types.cpp > =================================================================== > --- gcc-4.2.llvm.orig/gcc/llvm-types.cpp 2008-10-29 > 09:47:52.000000000 +0100 > +++ gcc-4.2.llvm/gcc/llvm-types.cpp 2008-10-29 10:54:20.000000000 > +0100 > @@ -2132,6 +2132,10 @@ > unsigned FieldNo = > Info->getLLVMFieldFor(FieldOffsetInBits, CurFieldNo, > isZeroSizeField); > SetFieldIndex(Field, FieldNo); > + > + assert((isBitfield(Field) || FieldNo == ~0U || > + FieldOffsetInBits == 8*Info- > >ElementOffsetInBytes[FieldNo]) && > + "Wrong LLVM field offset!"); > } > > // Put the original gcc struct back the way it was; necessary to > prevent the > From baldrick at free.fr Wed Oct 29 13:18:35 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 29 Oct 2008 19:18:35 +0100 Subject: [llvm-commits] [llvm-gcc-4.2] r57992 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <2355F94C-62EE-418B-A557-C21FB4E44DF7@apple.com> References: <200810221814.m9MIEY6K018726@zion.cs.uiuc.edu> <200810291055.08330.baldrick@free.fr> <2355F94C-62EE-418B-A557-C21FB4E44DF7@apple.com> Message-ID: <200810291918.35978.baldrick@free.fr> > Thanks!. Did you add this in llvm tests ? I did, and I also changed type conversion to not do this anymore (r58387). This gets tramp3d-v4 working on x86-64-linux (my previous change stopped the compiler from crashing, but didn't get the test working). Ciao, Duncan. From dalej at apple.com Wed Oct 29 13:26:46 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 29 Oct 2008 18:26:46 -0000 Subject: [llvm-commits] [llvm] r58391 - in /llvm/trunk/lib/Target/PowerPC: PPCInstr64Bit.td PPCInstrInfo.td PPCRegisterInfo.cpp PPCRegisterInfo.td Message-ID: <200810291826.m9TIQkPF028229@zion.cs.uiuc.edu> Author: johannes Date: Wed Oct 29 13:26:45 2008 New Revision: 58391 URL: http://llvm.org/viewvc/llvm-project?rev=58391&view=rev Log: Add a RM pseudoreg for the rounding mode, which allows ppcf128->int conversion to work with DeadInstructionElimination. This is now turned off but RM is harmless. It does not do a complete job of modeling the rounding mode. Revert marking MFCR as using all 7 CR subregisters; while correct, this caused the problem in PR 2964, plus the local RA crash noted in the comments. This was needed to make DeadInstructionElimination, but as we are not running that, it is backed out for now. Eventually it should go back in and the other problems fixed where they're broken. Modified: llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.td Modified: llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td?rev=58391&r1=58390&r2=58391&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td Wed Oct 29 13:26:45 2008 @@ -70,13 +70,15 @@ LR8,CTR8, CR0,CR1,CR5,CR6,CR7] in { // Convenient aliases for call instructions - def BL8_Macho : IForm<18, 0, 1, - (outs), (ins calltarget:$func, variable_ops), - "bl $func", BrB, []>; // See Pat patterns below. - def BLA8_Macho : IForm<18, 1, 1, - (outs), (ins aaddr:$func, variable_ops), - "bla $func", BrB, [(PPCcall_Macho (i64 imm:$func))]>; - let Uses = [CTR8] in { + let Uses = [RM] in { + def BL8_Macho : IForm<18, 0, 1, + (outs), (ins calltarget:$func, variable_ops), + "bl $func", BrB, []>; // See Pat patterns below. + def BLA8_Macho : IForm<18, 1, 1, + (outs), (ins aaddr:$func, variable_ops), + "bla $func", BrB, [(PPCcall_Macho (i64 imm:$func))]>; + } + let Uses = [CTR8, RM] in { def BCTRL8_Macho : XLForm_2_ext<19, 528, 20, 0, 1, (outs), (ins variable_ops), "bctrl", BrB, @@ -94,13 +96,15 @@ LR8,CTR8, CR0,CR1,CR5,CR6,CR7] in { // Convenient aliases for call instructions - def BL8_ELF : IForm<18, 0, 1, - (outs), (ins calltarget:$func, variable_ops), - "bl $func", BrB, []>; // See Pat patterns below. - def BLA8_ELF : IForm<18, 1, 1, - (outs), (ins aaddr:$func, variable_ops), - "bla $func", BrB, [(PPCcall_ELF (i64 imm:$func))]>; - let Uses = [CTR8] in { + let Uses = [RM] in { + def BL8_ELF : IForm<18, 0, 1, + (outs), (ins calltarget:$func, variable_ops), + "bl $func", BrB, []>; // See Pat patterns below. + def BLA8_ELF : IForm<18, 1, 1, + (outs), (ins aaddr:$func, variable_ops), + "bla $func", BrB, [(PPCcall_ELF (i64 imm:$func))]>; + } + let Uses = [CTR8, RM] in { def BCTRL8_ELF : XLForm_2_ext<19, 528, 20, 0, 1, (outs), (ins variable_ops), "bctrl", BrB, @@ -172,39 +176,39 @@ [(PPCstcx G8RC:$rS, xoaddr:$dst)]>, isDOT; -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in def TCRETURNdi8 :Pseudo< (outs), (ins calltarget:$dst, i32imm:$offset, variable_ops), "#TC_RETURNd8 $dst $offset", []>; -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in def TCRETURNai8 :Pseudo<(outs), (ins aaddr:$func, i32imm:$offset, variable_ops), "#TC_RETURNa8 $func $offset", [(PPCtc_return (i64 imm:$func), imm:$offset)]>; -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in def TCRETURNri8 : Pseudo<(outs), (ins CTRRC8:$dst, i32imm:$offset, variable_ops), "#TC_RETURNr8 $dst $offset", []>; let isTerminator = 1, isBarrier = 1, PPC970_Unit = 7, isBranch = 1, - isIndirectBranch = 1, isCall = 1, isReturn = 1, Uses = [CTR] in + isIndirectBranch = 1, isCall = 1, isReturn = 1, Uses = [CTR, RM] in def TAILBCTR8 : XLForm_2_ext<19, 528, 20, 0, 0, (outs), (ins), "bctr", BrB, []>, Requires<[In64BitMode]>; let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, - isBarrier = 1, isCall = 1, isReturn = 1 in + isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in def TAILB8 : IForm<18, 0, 0, (outs), (ins calltarget:$dst), "b $dst", BrB, []>; let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, - isBarrier = 1, isCall = 1, isReturn = 1 in + isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in def TAILBA8 : IForm<18, 0, 0, (outs), (ins aaddr:$dst), "ba $dst", BrB, []>; @@ -634,7 +638,7 @@ // -let PPC970_Unit = 3 in { // FPU Operations. +let PPC970_Unit = 3, Uses = [RM] in { // FPU Operations. def FCFID : XForm_26<63, 846, (outs F8RC:$frD), (ins F8RC:$frB), "fcfid $frD, $frB", FPGeneral, [(set F8RC:$frD, (PPCfcfid F8RC:$frB))]>, isPPC64; Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=58391&r1=58390&r2=58391&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Wed Oct 29 13:26:45 2008 @@ -385,7 +385,7 @@ "${:comment} SPILL_CR $cond $F", []>; let isTerminator = 1, isBarrier = 1, PPC970_Unit = 7 in { - let isReturn = 1, Uses = [LR] in + let isReturn = 1, Uses = [LR, RM] in def BLR : XLForm_2_br<19, 16, 0, (outs), (ins pred:$p), "b${p:cc}lr ${p:reg}", BrB, [(retflag)]>; @@ -423,13 +423,15 @@ CR0LT,CR0GT,CR0EQ,CR0UN,CR1LT,CR1GT,CR1EQ,CR1UN,CR5LT,CR5GT,CR5EQ, CR5UN,CR6LT,CR6GT,CR6EQ,CR6UN,CR7LT,CR7GT,CR7EQ,CR7UN] in { // Convenient aliases for call instructions - def BL_Macho : IForm<18, 0, 1, - (outs), (ins calltarget:$func, variable_ops), - "bl $func", BrB, []>; // See Pat patterns below. - def BLA_Macho : IForm<18, 1, 1, - (outs), (ins aaddr:$func, variable_ops), - "bla $func", BrB, [(PPCcall_Macho (i32 imm:$func))]>; - let Uses = [CTR] in { + let Uses = [RM] in { + def BL_Macho : IForm<18, 0, 1, + (outs), (ins calltarget:$func, variable_ops), + "bl $func", BrB, []>; // See Pat patterns below. + def BLA_Macho : IForm<18, 1, 1, + (outs), (ins aaddr:$func, variable_ops), + "bla $func", BrB, [(PPCcall_Macho (i32 imm:$func))]>; + } + let Uses = [CTR, RM] in { def BCTRL_Macho : XLForm_2_ext<19, 528, 20, 0, 1, (outs), (ins variable_ops), "bctrl", BrB, @@ -448,14 +450,16 @@ CR0LT,CR0GT,CR0EQ,CR0UN,CR1LT,CR1GT,CR1EQ,CR1UN,CR5LT,CR5GT,CR5EQ, CR5UN,CR6LT,CR6GT,CR6EQ,CR6UN,CR7LT,CR7GT,CR7EQ,CR7UN] in { // Convenient aliases for call instructions - def BL_ELF : IForm<18, 0, 1, - (outs), (ins calltarget:$func, variable_ops), - "bl $func", BrB, []>; // See Pat patterns below. - def BLA_ELF : IForm<18, 1, 1, - (outs), (ins aaddr:$func, variable_ops), - "bla $func", BrB, - [(PPCcall_ELF (i32 imm:$func))]>; - let Uses = [CTR] in { + let Uses = [RM] in { + def BL_ELF : IForm<18, 0, 1, + (outs), (ins calltarget:$func, variable_ops), + "bl $func", BrB, []>; // See Pat patterns below. + def BLA_ELF : IForm<18, 1, 1, + (outs), (ins aaddr:$func, variable_ops), + "bla $func", BrB, + [(PPCcall_ELF (i32 imm:$func))]>; + } + let Uses = [CTR, RM] in { def BCTRL_ELF : XLForm_2_ext<19, 528, 20, 0, 1, (outs), (ins variable_ops), "bctrl", BrB, @@ -464,40 +468,40 @@ } -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in def TCRETURNdi :Pseudo< (outs), (ins calltarget:$dst, i32imm:$offset, variable_ops), "#TC_RETURNd $dst $offset", []>; -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in def TCRETURNai :Pseudo<(outs), (ins aaddr:$func, i32imm:$offset, variable_ops), "#TC_RETURNa $func $offset", [(PPCtc_return (i32 imm:$func), imm:$offset)]>; -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in def TCRETURNri : Pseudo<(outs), (ins CTRRC:$dst, i32imm:$offset, variable_ops), "#TC_RETURNr $dst $offset", []>; let isTerminator = 1, isBarrier = 1, PPC970_Unit = 7, isBranch = 1, - isIndirectBranch = 1, isCall = 1, isReturn = 1, Uses = [CTR] in + isIndirectBranch = 1, isCall = 1, isReturn = 1, Uses = [CTR, RM] in def TAILBCTR : XLForm_2_ext<19, 528, 20, 0, 0, (outs), (ins), "bctr", BrB, []>, Requires<[In32BitMode]>; let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, - isBarrier = 1, isCall = 1, isReturn = 1 in + isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in def TAILB : IForm<18, 0, 0, (outs), (ins calltarget:$dst), "b $dst", BrB, []>; let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, - isBarrier = 1, isCall = 1, isReturn = 1 in + isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in def TAILBA : IForm<18, 0, 0, (outs), (ins aaddr:$dst), "ba $dst", BrB, []>; @@ -982,18 +986,20 @@ def FCMPUD : XForm_17<63, 0, (outs CRRC:$crD), (ins F8RC:$fA, F8RC:$fB), "fcmpu $crD, $fA, $fB", FPCompare>; -def FCTIWZ : XForm_26<63, 15, (outs F8RC:$frD), (ins F8RC:$frB), - "fctiwz $frD, $frB", FPGeneral, - [(set F8RC:$frD, (PPCfctiwz F8RC:$frB))]>; -def FRSP : XForm_26<63, 12, (outs F4RC:$frD), (ins F8RC:$frB), - "frsp $frD, $frB", FPGeneral, - [(set F4RC:$frD, (fround F8RC:$frB))]>; -def FSQRT : XForm_26<63, 22, (outs F8RC:$frD), (ins F8RC:$frB), - "fsqrt $frD, $frB", FPSqrt, - [(set F8RC:$frD, (fsqrt F8RC:$frB))]>; -def FSQRTS : XForm_26<59, 22, (outs F4RC:$frD), (ins F4RC:$frB), - "fsqrts $frD, $frB", FPSqrt, - [(set F4RC:$frD, (fsqrt F4RC:$frB))]>; +let Uses = [RM] in { + def FCTIWZ : XForm_26<63, 15, (outs F8RC:$frD), (ins F8RC:$frB), + "fctiwz $frD, $frB", FPGeneral, + [(set F8RC:$frD, (PPCfctiwz F8RC:$frB))]>; + def FRSP : XForm_26<63, 12, (outs F4RC:$frD), (ins F8RC:$frB), + "frsp $frD, $frB", FPGeneral, + [(set F4RC:$frD, (fround F8RC:$frB))]>; + def FSQRT : XForm_26<63, 22, (outs F8RC:$frD), (ins F8RC:$frB), + "fsqrt $frD, $frB", FPSqrt, + [(set F8RC:$frD, (fsqrt F8RC:$frB))]>; + def FSQRTS : XForm_26<59, 22, (outs F4RC:$frD), (ins F4RC:$frB), + "fsqrts $frD, $frB", FPSqrt, + [(set F4RC:$frD, (fsqrt F4RC:$frB))]>; + } } /// FMR is split into 3 versions, one for 4/8 byte FP, and one for extending. @@ -1095,10 +1101,15 @@ def MTCRF : XFXForm_5<31, 144, (outs), (ins crbitm:$FXM, GPRC:$rS), "mtcrf $FXM, $rS", BrMCRX>, PPC970_MicroCode, PPC970_Unit_CRU; -let Uses = [CR0, CR1, CR2, CR3, CR4, CR5, CR6, CR7] in { +// FIXME: this Uses all the CR registers. Marking it as such is +// necessary for DeadMachineInstructionElim to do the right thing. +// However, marking it also exposes PR 2964, and causes crashes in +// the Local RA because it doesn't like this sequence: +// vreg = MCRF CR0 +// MFCR +// For now DeadMachineInstructionElim is turned off, so don't do the marking. def MFCR : XFXForm_3<31, 19, (outs GPRC:$rT), (ins), "mfcr $rT", SprMFCR>, PPC970_MicroCode, PPC970_Unit_CRU; -} def MFOCRF: XFXForm_5a<31, 19, (outs GPRC:$rT), (ins crbitm:$FXM), "mfcr $rT, $FXM", SprMFCR>, PPC970_DGroup_First, PPC970_Unit_CRU; @@ -1106,33 +1117,38 @@ // Instructions to manipulate FPSCR. Only long double handling uses these. // FPSCR is not modelled; we use the SDNode Flag to keep things in order. -def MFFS : XForm_42<63, 583, (outs F8RC:$rT), (ins), - "mffs $rT", IntMFFS, - [(set F8RC:$rT, (PPCmffs))]>, - PPC970_DGroup_Single, PPC970_Unit_FPU; -def MTFSB0 : XForm_43<63, 70, (outs), (ins u5imm:$FM), - "mtfsb0 $FM", IntMTFSB0, - [(PPCmtfsb0 (i32 imm:$FM))]>, - PPC970_DGroup_Single, PPC970_Unit_FPU; -def MTFSB1 : XForm_43<63, 38, (outs), (ins u5imm:$FM), - "mtfsb1 $FM", IntMTFSB0, - [(PPCmtfsb1 (i32 imm:$FM))]>, - PPC970_DGroup_Single, PPC970_Unit_FPU; -def FADDrtz: AForm_2<63, 21, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), - "fadd $FRT, $FRA, $FRB", FPGeneral, - [(set F8RC:$FRT, (PPCfaddrtz F8RC:$FRA, F8RC:$FRB))]>, - PPC970_DGroup_Single, PPC970_Unit_FPU; -// MTFSF does not actually produce an FP result. We pretend it copies -// input reg B to the output. If we didn't do this it would look like the -// instruction had no outputs (because we aren't modelling the FPSCR) and -// it would be deleted. -def MTFSF : XFLForm<63, 711, (outs F8RC:$FRA), - (ins i32imm:$FM, F8RC:$rT, F8RC:$FRB), - "mtfsf $FM, $rT", "$FRB = $FRA", IntMTFSB0, - [(set F8RC:$FRA, (PPCmtfsf (i32 imm:$FM), - F8RC:$rT, F8RC:$FRB))]>, - PPC970_DGroup_Single, PPC970_Unit_FPU; +let Uses = [RM], Defs = [RM] in { + def MTFSB0 : XForm_43<63, 70, (outs), (ins u5imm:$FM), + "mtfsb0 $FM", IntMTFSB0, + [(PPCmtfsb0 (i32 imm:$FM))]>, + PPC970_DGroup_Single, PPC970_Unit_FPU; + def MTFSB1 : XForm_43<63, 38, (outs), (ins u5imm:$FM), + "mtfsb1 $FM", IntMTFSB0, + [(PPCmtfsb1 (i32 imm:$FM))]>, + PPC970_DGroup_Single, PPC970_Unit_FPU; + // MTFSF does not actually produce an FP result. We pretend it copies + // input reg B to the output. If we didn't do this it would look like the + // instruction had no outputs (because we aren't modelling the FPSCR) and + // it would be deleted. + def MTFSF : XFLForm<63, 711, (outs F8RC:$FRA), + (ins i32imm:$FM, F8RC:$rT, F8RC:$FRB), + "mtfsf $FM, $rT", "$FRB = $FRA", IntMTFSB0, + [(set F8RC:$FRA, (PPCmtfsf (i32 imm:$FM), + F8RC:$rT, F8RC:$FRB))]>, + PPC970_DGroup_Single, PPC970_Unit_FPU; +} +let Uses = [RM] in { + def MFFS : XForm_42<63, 583, (outs F8RC:$rT), (ins), + "mffs $rT", IntMFFS, + [(set F8RC:$rT, (PPCmffs))]>, + PPC970_DGroup_Single, PPC970_Unit_FPU; + def FADDrtz: AForm_2<63, 21, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), + "fadd $FRT, $FRA, $FRB", FPGeneral, + [(set F8RC:$FRT, (PPCfaddrtz F8RC:$FRA, F8RC:$FRB))]>, + PPC970_DGroup_Single, PPC970_Unit_FPU; +} + let PPC970_Unit = 1 in { // FXU Operations. @@ -1196,54 +1212,56 @@ // this type. // let PPC970_Unit = 3 in { // FPU Operations. -def FMADD : AForm_1<63, 29, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), - "fmadd $FRT, $FRA, $FRC, $FRB", FPFused, - [(set F8RC:$FRT, (fadd (fmul F8RC:$FRA, F8RC:$FRC), - F8RC:$FRB))]>, - Requires<[FPContractions]>; -def FMADDS : AForm_1<59, 29, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), - "fmadds $FRT, $FRA, $FRC, $FRB", FPGeneral, - [(set F4RC:$FRT, (fadd (fmul F4RC:$FRA, F4RC:$FRC), - F4RC:$FRB))]>, - Requires<[FPContractions]>; -def FMSUB : AForm_1<63, 28, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), - "fmsub $FRT, $FRA, $FRC, $FRB", FPFused, - [(set F8RC:$FRT, (fsub (fmul F8RC:$FRA, F8RC:$FRC), - F8RC:$FRB))]>, - Requires<[FPContractions]>; -def FMSUBS : AForm_1<59, 28, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), - "fmsubs $FRT, $FRA, $FRC, $FRB", FPGeneral, - [(set F4RC:$FRT, (fsub (fmul F4RC:$FRA, F4RC:$FRC), - F4RC:$FRB))]>, - Requires<[FPContractions]>; -def FNMADD : AForm_1<63, 31, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), - "fnmadd $FRT, $FRA, $FRC, $FRB", FPFused, - [(set F8RC:$FRT, (fneg (fadd (fmul F8RC:$FRA, F8RC:$FRC), - F8RC:$FRB)))]>, - Requires<[FPContractions]>; -def FNMADDS : AForm_1<59, 31, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), - "fnmadds $FRT, $FRA, $FRC, $FRB", FPGeneral, - [(set F4RC:$FRT, (fneg (fadd (fmul F4RC:$FRA, F4RC:$FRC), - F4RC:$FRB)))]>, - Requires<[FPContractions]>; -def FNMSUB : AForm_1<63, 30, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), - "fnmsub $FRT, $FRA, $FRC, $FRB", FPFused, - [(set F8RC:$FRT, (fneg (fsub (fmul F8RC:$FRA, F8RC:$FRC), - F8RC:$FRB)))]>, - Requires<[FPContractions]>; -def FNMSUBS : AForm_1<59, 30, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), - "fnmsubs $FRT, $FRA, $FRC, $FRB", FPGeneral, - [(set F4RC:$FRT, (fneg (fsub (fmul F4RC:$FRA, F4RC:$FRC), - F4RC:$FRB)))]>, - Requires<[FPContractions]>; +let Uses = [RM] in { + def FMADD : AForm_1<63, 29, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), + "fmadd $FRT, $FRA, $FRC, $FRB", FPFused, + [(set F8RC:$FRT, (fadd (fmul F8RC:$FRA, F8RC:$FRC), + F8RC:$FRB))]>, + Requires<[FPContractions]>; + def FMADDS : AForm_1<59, 29, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), + "fmadds $FRT, $FRA, $FRC, $FRB", FPGeneral, + [(set F4RC:$FRT, (fadd (fmul F4RC:$FRA, F4RC:$FRC), + F4RC:$FRB))]>, + Requires<[FPContractions]>; + def FMSUB : AForm_1<63, 28, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), + "fmsub $FRT, $FRA, $FRC, $FRB", FPFused, + [(set F8RC:$FRT, (fsub (fmul F8RC:$FRA, F8RC:$FRC), + F8RC:$FRB))]>, + Requires<[FPContractions]>; + def FMSUBS : AForm_1<59, 28, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), + "fmsubs $FRT, $FRA, $FRC, $FRB", FPGeneral, + [(set F4RC:$FRT, (fsub (fmul F4RC:$FRA, F4RC:$FRC), + F4RC:$FRB))]>, + Requires<[FPContractions]>; + def FNMADD : AForm_1<63, 31, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), + "fnmadd $FRT, $FRA, $FRC, $FRB", FPFused, + [(set F8RC:$FRT, (fneg (fadd (fmul F8RC:$FRA, F8RC:$FRC), + F8RC:$FRB)))]>, + Requires<[FPContractions]>; + def FNMADDS : AForm_1<59, 31, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), + "fnmadds $FRT, $FRA, $FRC, $FRB", FPGeneral, + [(set F4RC:$FRT, (fneg (fadd (fmul F4RC:$FRA, F4RC:$FRC), + F4RC:$FRB)))]>, + Requires<[FPContractions]>; + def FNMSUB : AForm_1<63, 30, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRC, F8RC:$FRB), + "fnmsub $FRT, $FRA, $FRC, $FRB", FPFused, + [(set F8RC:$FRT, (fneg (fsub (fmul F8RC:$FRA, F8RC:$FRC), + F8RC:$FRB)))]>, + Requires<[FPContractions]>; + def FNMSUBS : AForm_1<59, 30, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRC, F4RC:$FRB), + "fnmsubs $FRT, $FRA, $FRC, $FRB", FPGeneral, + [(set F4RC:$FRT, (fneg (fsub (fmul F4RC:$FRA, F4RC:$FRC), + F4RC:$FRB)))]>, + Requires<[FPContractions]>; +} // FSEL is artificially split into 4 and 8-byte forms for the result. To avoid // having 4 of these, force the comparison to always be an 8-byte double (code // should use an FMRSD if the input comparison value really wants to be a float) @@ -1256,38 +1274,40 @@ (outs F4RC:$FRT), (ins F8RC:$FRA, F4RC:$FRC, F4RC:$FRB), "fsel $FRT, $FRA, $FRC, $FRB", FPGeneral, [(set F4RC:$FRT, (PPCfsel F8RC:$FRA,F4RC:$FRC,F4RC:$FRB))]>; -def FADD : AForm_2<63, 21, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), - "fadd $FRT, $FRA, $FRB", FPGeneral, - [(set F8RC:$FRT, (fadd F8RC:$FRA, F8RC:$FRB))]>; -def FADDS : AForm_2<59, 21, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), - "fadds $FRT, $FRA, $FRB", FPGeneral, - [(set F4RC:$FRT, (fadd F4RC:$FRA, F4RC:$FRB))]>; -def FDIV : AForm_2<63, 18, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), - "fdiv $FRT, $FRA, $FRB", FPDivD, - [(set F8RC:$FRT, (fdiv F8RC:$FRA, F8RC:$FRB))]>; -def FDIVS : AForm_2<59, 18, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), - "fdivs $FRT, $FRA, $FRB", FPDivS, - [(set F4RC:$FRT, (fdiv F4RC:$FRA, F4RC:$FRB))]>; -def FMUL : AForm_3<63, 25, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), - "fmul $FRT, $FRA, $FRB", FPFused, - [(set F8RC:$FRT, (fmul F8RC:$FRA, F8RC:$FRB))]>; -def FMULS : AForm_3<59, 25, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), - "fmuls $FRT, $FRA, $FRB", FPGeneral, - [(set F4RC:$FRT, (fmul F4RC:$FRA, F4RC:$FRB))]>; -def FSUB : AForm_2<63, 20, - (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), - "fsub $FRT, $FRA, $FRB", FPGeneral, - [(set F8RC:$FRT, (fsub F8RC:$FRA, F8RC:$FRB))]>; -def FSUBS : AForm_2<59, 20, - (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), - "fsubs $FRT, $FRA, $FRB", FPGeneral, - [(set F4RC:$FRT, (fsub F4RC:$FRA, F4RC:$FRB))]>; +let Uses = [RM] in { + def FADD : AForm_2<63, 21, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), + "fadd $FRT, $FRA, $FRB", FPGeneral, + [(set F8RC:$FRT, (fadd F8RC:$FRA, F8RC:$FRB))]>; + def FADDS : AForm_2<59, 21, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), + "fadds $FRT, $FRA, $FRB", FPGeneral, + [(set F4RC:$FRT, (fadd F4RC:$FRA, F4RC:$FRB))]>; + def FDIV : AForm_2<63, 18, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), + "fdiv $FRT, $FRA, $FRB", FPDivD, + [(set F8RC:$FRT, (fdiv F8RC:$FRA, F8RC:$FRB))]>; + def FDIVS : AForm_2<59, 18, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), + "fdivs $FRT, $FRA, $FRB", FPDivS, + [(set F4RC:$FRT, (fdiv F4RC:$FRA, F4RC:$FRB))]>; + def FMUL : AForm_3<63, 25, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), + "fmul $FRT, $FRA, $FRB", FPFused, + [(set F8RC:$FRT, (fmul F8RC:$FRA, F8RC:$FRB))]>; + def FMULS : AForm_3<59, 25, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), + "fmuls $FRT, $FRA, $FRB", FPGeneral, + [(set F4RC:$FRT, (fmul F4RC:$FRA, F4RC:$FRB))]>; + def FSUB : AForm_2<63, 20, + (outs F8RC:$FRT), (ins F8RC:$FRA, F8RC:$FRB), + "fsub $FRT, $FRA, $FRB", FPGeneral, + [(set F8RC:$FRT, (fsub F8RC:$FRA, F8RC:$FRB))]>; + def FSUBS : AForm_2<59, 20, + (outs F4RC:$FRT), (ins F4RC:$FRA, F4RC:$FRB), + "fsubs $FRT, $FRA, $FRB", FPGeneral, + [(set F4RC:$FRT, (fsub F4RC:$FRA, F4RC:$FRB))]>; + } } let PPC970_Unit = 1 in { // FXU Operations. Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=58391&r1=58390&r2=58391&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Wed Oct 29 13:26:45 2008 @@ -347,6 +347,7 @@ Reserved.set(PPC::R1); Reserved.set(PPC::LR); Reserved.set(PPC::LR8); + Reserved.set(PPC::RM); // In Linux, r2 is reserved for the OS. if (!Subtarget.isDarwin()) @@ -1163,7 +1164,7 @@ for (unsigned I = 0, E = CSI.size(); I != E; ++I) { int Offset = MFI->getObjectOffset(CSI[I].getFrameIdx()); unsigned Reg = CSI[I].getReg(); - if (Reg == PPC::LR || Reg == PPC::LR8) continue; + if (Reg == PPC::LR || Reg == PPC::LR8 || Reg == PPC::RM) continue; MachineLocation CSDst(MachineLocation::VirtualFP, Offset); MachineLocation CSSrc(Reg); Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc)); Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.td?rev=58391&r1=58390&r2=58391&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.td Wed Oct 29 13:26:45 2008 @@ -254,6 +254,16 @@ // VRsave register def VRSAVE: SPR<256, "VRsave">, DwarfRegNum<[107]>; +// FP rounding mode: bits 30 and 31 of the FP status and control register +// This is not allocated as a normal register; it appears only in +// Uses and Defs. The ABI says it needs to be preserved by a function, +// but this is not achieved by saving and restoring it as with +// most registers, it has to be done in code; to make this work all the +// return and call instructions are described as Uses of RM, so instructions +// that do nothing but change RM will not get deleted. +// Also, in the architecture it is not really a SPR; 512 is arbitrary. +def RM: SPR<512, "**ROUNDING MODE**">, DwarfRegNum<[0]>; + /// Register classes // Allocate volatiles first // then nonvolatiles in reverse order since stmw/lmw save from rN to r31 From sabre at nondot.org Wed Oct 29 13:42:22 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Oct 2008 18:42:22 -0000 Subject: [llvm-commits] [llvm] r58393 - /llvm/trunk/test/CodeGen/PowerPC/compare-fcmp-ord.ll Message-ID: <200810291842.m9TIgMNa028774@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 29 13:42:22 2008 New Revision: 58393 URL: http://llvm.org/viewvc/llvm-project?rev=58393&view=rev Log: add testcase for PR2964 Modified: llvm/trunk/test/CodeGen/PowerPC/compare-fcmp-ord.ll Modified: llvm/trunk/test/CodeGen/PowerPC/compare-fcmp-ord.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/compare-fcmp-ord.ll?rev=58393&r1=58392&r2=58393&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/compare-fcmp-ord.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/compare-fcmp-ord.ll Wed Oct 29 13:42:22 2008 @@ -1,6 +1,10 @@ ; RUN: llvm-as < %s | llc -march=ppc32 | grep or | count 3 ; This should produce one 'or' or 'cror' instruction per function. + +; RUN: llvm-as < %s | llc -march=ppc32 | grep mfcr | count 3 +; PR2964 + define i32 @test(double %x, double %y) nounwind { entry: %tmp3 = fcmp ole double %x, %y ; [#uses=1] From alenhar2 at cs.uiuc.edu Wed Oct 29 16:45:07 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 29 Oct 2008 21:45:07 -0000 Subject: [llvm-commits] [poolalloc] r58397 - /poolalloc/trunk/lib/DSA/DataStructure.cpp Message-ID: <200810292145.m9TLj8AK002764@zion.cs.uiuc.edu> Author: alenhar2 Date: Wed Oct 29 16:45:02 2008 New Revision: 58397 URL: http://llvm.org/viewvc/llvm-project?rev=58397&view=rev Log: reenable IdenticalCall removal Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=58397&r1=58396&r2=58397&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DataStructure.cpp (original) +++ poolalloc/trunk/lib/DSA/DataStructure.cpp Wed Oct 29 16:45:02 2008 @@ -2005,9 +2005,6 @@ } static void removeIdenticalCalls(std::list &Calls) { - // Poolalloc doesn't like call sites to be removed if they are indirect - // disable this so all indirect call sites get call graph info - return; // Remove trivially identical function calls Calls.sort(); // Sort by callee as primary key! From alenhar2 at cs.uiuc.edu Wed Oct 29 16:45:36 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 29 Oct 2008 21:45:36 -0000 Subject: [llvm-commits] [poolalloc] r58398 - /poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Message-ID: <200810292145.m9TLjalj002786@zion.cs.uiuc.edu> Author: alenhar2 Date: Wed Oct 29 16:45:34 2008 New Revision: 58398 URL: http://llvm.org/viewvc/llvm-project?rev=58398&view=rev Log: don't reinline if resolved list doesn't change (dynamically discovered scc due to partial inlining) Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=58398&r1=58397&r2=58398&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Wed Oct 29 16:45:34 2008 @@ -236,6 +236,12 @@ std::vector::iterator uid = std::unique(CalleeFunctions.begin(), CalleeFunctions.end()); CalleeFunctions.resize(uid - CalleeFunctions.begin()); + std::vector PreResolvedFuncs; + GetAllAuxCallees(Graph, PreResolvedFuncs); + std::sort(PreResolvedFuncs.begin(), PreResolvedFuncs.end()); + uid = std::unique(PreResolvedFuncs.begin(), PreResolvedFuncs.end()); + PreResolvedFuncs.resize(uid - PreResolvedFuncs.begin()); + // The edges out of the current node are the call site targets... for (unsigned i = 0, e = CalleeFunctions.size(); i != e; ++i) { const Function *Callee = CalleeFunctions[i]; @@ -268,15 +274,27 @@ // Should we revisit the graph? Only do it if there are now new resolvable // callees or new callees - unsigned oldsize = CalleeFunctions.size(); - GetAnyAuxCallees(Graph, CalleeFunctions); - std::sort(CalleeFunctions.begin(), CalleeFunctions.end()); - std::vector::iterator uid = std::unique(CalleeFunctions.begin(), CalleeFunctions.end()); - CalleeFunctions.resize(uid - CalleeFunctions.begin()); + std::vector NewCalleeFuncs; + GetAnyAuxCallees(Graph, NewCalleeFuncs); + std::sort(NewCalleeFuncs.begin(), NewCalleeFuncs.end()); + std::vector::iterator uid = std::unique(NewCalleeFuncs.begin(), NewCalleeFuncs.end()); + NewCalleeFuncs.resize(uid - NewCalleeFuncs.begin()); + uid = std::set_difference(NewCalleeFuncs.begin(), NewCalleeFuncs.end(), + CalleeFunctions.begin(), CalleeFunctions.end(), + NewCalleeFuncs.begin()); + NewCalleeFuncs.resize(uid - NewCalleeFuncs.begin()); std::vector ResolvedFuncs; GetAllAuxCallees(Graph, ResolvedFuncs); - if (ResolvedFuncs.size() || CalleeFunctions.size() > oldsize) { + std::sort(ResolvedFuncs.begin(), ResolvedFuncs.end()); + uid = std::unique(ResolvedFuncs.begin(), ResolvedFuncs.end()); + ResolvedFuncs.resize(uid - ResolvedFuncs.begin()); + uid = std::set_difference(ResolvedFuncs.begin(), ResolvedFuncs.end(), + PreResolvedFuncs.begin(), PreResolvedFuncs.end(), + ResolvedFuncs.begin()); + ResolvedFuncs.resize(uid - ResolvedFuncs.begin()); + + if (ResolvedFuncs.size() || NewCalleeFuncs.size()) { DOUT << "Recalculating " << F->getName() << " due to new knowledge\n"; ValMap.erase(F); return calculateGraphs(F, Stack, NextID, ValMap); From alenhar2 at cs.uiuc.edu Wed Oct 29 17:05:18 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 29 Oct 2008 22:05:18 -0000 Subject: [llvm-commits] [poolalloc] r58399 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200810292205.m9TM5Jab003517@zion.cs.uiuc.edu> Author: alenhar2 Date: Wed Oct 29 17:05:18 2008 New Revision: 58399 URL: http://llvm.org/viewvc/llvm-project?rev=58399&view=rev Log: reenable this now that duplicate call elim is back in Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=58399&r1=58398&r2=58399&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Wed Oct 29 17:05:18 2008 @@ -615,8 +615,32 @@ cast(getOldValueIfAvailable(CS.getInstruction())); DataStructures::callee_iterator I = Graphs.callee_begin(OrigInst); - assert (I != Graphs.callee_end(OrigInst) && "No call graph info"); - CF = *I; + if (I != Graphs.callee_end(OrigInst)) + CF = *I; + + // If we didn't find the callee in the constructed call graph, try + // checking in the DSNode itself. + // This isn't ideal as it means that this call site didn't have inlining + // happen. + if (!CF) { + DSGraph* dg = Graphs.getDSGraph(*OrigInst->getParent()->getParent()); + DSNode* d = dg->getNodeForValue(OrigInst->getOperand(0)).getNode(); + std::vector g; + d->addFullFunctionList(g); + if (g.size()) { + EquivalenceClasses< const GlobalValue *> & EC = dg->getGlobalECs(); + for(std::vector::const_iterator ii = g.begin(), ee = g.end(); + !CF && ii != ee; ++ii) { + for (EquivalenceClasses::member_iterator MI = EC.findLeader(*ii); + MI != EC.member_end(); ++MI) // Loop over members in this set. + if ((CF = dyn_cast(*MI))) { + break; + } + } + } + } + + assert (CF && "No call graph info"); // Get the common graph for the set of functions this call may invoke. CalleeGraph = Graphs.getDSGraph(*CF); From isanbard at gmail.com Wed Oct 29 17:52:57 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Oct 2008 22:52:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58401 - /llvm-gcc-4.2/trunk/configure.in Message-ID: <200810292252.m9TMqvBe005183@zion.cs.uiuc.edu> Author: void Date: Wed Oct 29 17:52:57 2008 New Revision: 58401 URL: http://llvm.org/viewvc/llvm-project?rev=58401&view=rev Log: Default to 32-bit when compiling on Darwin. The system compiler defaults to 64-bit. Modified: llvm-gcc-4.2/trunk/configure.in Modified: llvm-gcc-4.2/trunk/configure.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure.in?rev=58401&r1=58400&r2=58401&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure.in (original) +++ llvm-gcc-4.2/trunk/configure.in Wed Oct 29 17:52:57 2008 @@ -988,6 +988,8 @@ # APPLE LOCAL begin dynamic-no-pic i[[3456789]]86-*-darwin*) host_makefile_frag="config/mh-x86-darwin" + CC="${CC-gcc} -m32" + CXX="${CXX-g++} -m32" ;; # APPLE LOCAL end dynamic-no-pic powerpc-*-aix*) From isanbard at gmail.com Wed Oct 29 17:53:06 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Oct 2008 22:53:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58402 - /llvm-gcc-4.2/trunk/configure Message-ID: <200810292253.m9TMr6Vl005199@zion.cs.uiuc.edu> Author: void Date: Wed Oct 29 17:53:06 2008 New Revision: 58402 URL: http://llvm.org/viewvc/llvm-project?rev=58402&view=rev Log: Regenerated. Modified: llvm-gcc-4.2/trunk/configure Modified: llvm-gcc-4.2/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure?rev=58402&r1=58401&r2=58402&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure (original) +++ llvm-gcc-4.2/trunk/configure Wed Oct 29 17:53:06 2008 @@ -1828,6 +1828,8 @@ # APPLE LOCAL begin dynamic-no-pic i[3456789]86-*-darwin*) host_makefile_frag="config/mh-x86-darwin" + CC="${CC-gcc} -m32" + CXX="${CXX-g++} -m32" ;; # APPLE LOCAL end dynamic-no-pic powerpc-*-aix*) @@ -1893,7 +1895,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1897: checking for $ac_word" >&5 +echo "configure:1899: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1923,7 +1925,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1927: checking for $ac_word" >&5 +echo "configure:1929: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1974,7 +1976,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1978: checking for $ac_word" >&5 +echo "configure:1980: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2006,7 +2008,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2010: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2012: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2017,12 +2019,12 @@ cat > conftest.$ac_ext << EOF -#line 2021 "configure" +#line 2023 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2048,12 +2050,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2052: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2054: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2057: checking whether we are using GNU C" >&5 +echo "configure:2059: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2062,7 +2064,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2068: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2081,7 +2083,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2085: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2087: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2148,7 +2150,7 @@ # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2152: checking for $ac_word" >&5 +echo "configure:2154: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2180,7 +2182,7 @@ # Extract the first word of "gnatbind", so it can be a program name with args. set dummy gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2184: checking for $ac_word" >&5 +echo "configure:2186: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2213,7 +2215,7 @@ fi echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 -echo "configure:2217: checking whether compiler driver understands Ada" >&5 +echo "configure:2219: checking whether compiler driver understands Ada" >&5 if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2245,7 +2247,7 @@ fi echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 -echo "configure:2249: checking how to compare bootstrapped objects" >&5 +echo "configure:2251: checking how to compare bootstrapped objects" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2365,9 +2367,9 @@ CFLAGS="$CFLAGS $gmpinc" # Check GMP actually works echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 -echo "configure:2369: checking for correct version of gmp.h" >&5 +echo "configure:2371: checking for correct version of gmp.h" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2391,9 +2393,9 @@ if test x"$have_gmp" = xyes; then echo $ac_n "checking for correct version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2395: checking for correct version of mpfr.h" >&5 +echo "configure:2397: checking for correct version of mpfr.h" >&5 cat > conftest.$ac_ext < @@ -2405,7 +2407,7 @@ ; return 0; } EOF -if { (eval echo configure:2409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2419,9 +2421,9 @@ saved_LIBS="$LIBS" LIBS="$LIBS $gmplibs" echo $ac_n "checking for any version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2423: checking for any version of mpfr.h" >&5 +echo "configure:2425: checking for any version of mpfr.h" >&5 cat > conftest.$ac_ext < #include @@ -2429,7 +2431,7 @@ mpfr_t n; mpfr_init(n); ; return 0; } EOF -if { (eval echo configure:2433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3540,7 +3542,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3544: checking for $ac_word" >&5 +echo "configure:3546: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3580,7 +3582,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3584: checking for $ac_word" >&5 +echo "configure:3586: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3619,7 +3621,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3623: checking for $ac_word" >&5 +echo "configure:3625: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_M4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3658,7 +3660,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3662: checking for $ac_word" >&5 +echo "configure:3664: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3698,7 +3700,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3702: checking for $ac_word" >&5 +echo "configure:3704: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3737,7 +3739,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3741: checking for $ac_word" >&5 +echo "configure:3743: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3790,7 +3792,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3794: checking for $ac_word" >&5 +echo "configure:3796: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_EXPECT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3831,7 +3833,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3835: checking for $ac_word" >&5 +echo "configure:3837: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RUNTEST'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3879,7 +3881,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3883: checking for $ac_word" >&5 +echo "configure:3885: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3910,7 +3912,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3914: checking for $ac_word" >&5 +echo "configure:3916: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3954,7 +3956,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3958: checking for $ac_word" >&5 +echo "configure:3960: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3985,7 +3987,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3989: checking for $ac_word" >&5 +echo "configure:3991: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4029,7 +4031,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4033: checking for $ac_word" >&5 +echo "configure:4035: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4060,7 +4062,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4064: checking for $ac_word" >&5 +echo "configure:4066: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4104,7 +4106,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4108: checking for $ac_word" >&5 +echo "configure:4110: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4135,7 +4137,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4139: checking for $ac_word" >&5 +echo "configure:4141: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4179,7 +4181,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4183: checking for $ac_word" >&5 +echo "configure:4185: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4210,7 +4212,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4214: checking for $ac_word" >&5 +echo "configure:4216: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4254,7 +4256,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4258: checking for $ac_word" >&5 +echo "configure:4260: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4285,7 +4287,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4289: checking for $ac_word" >&5 +echo "configure:4291: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4329,7 +4331,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4333: checking for $ac_word" >&5 +echo "configure:4335: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4360,7 +4362,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4364: checking for $ac_word" >&5 +echo "configure:4366: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4399,7 +4401,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4403: checking for $ac_word" >&5 +echo "configure:4405: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4430,7 +4432,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4434: checking for $ac_word" >&5 +echo "configure:4436: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4469,7 +4471,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4473: checking for $ac_word" >&5 +echo "configure:4475: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4500,7 +4502,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4504: checking for $ac_word" >&5 +echo "configure:4506: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4544,7 +4546,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4548: checking for $ac_word" >&5 +echo "configure:4550: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4575,7 +4577,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4579: checking for $ac_word" >&5 +echo "configure:4581: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4619,7 +4621,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4623: checking for $ac_word" >&5 +echo "configure:4625: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4650,7 +4652,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4654: checking for $ac_word" >&5 +echo "configure:4656: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4714,7 +4716,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in cc gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4718: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4720: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4731,7 +4733,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4735: checking for $ac_word" >&5 +echo "configure:4737: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4762,7 +4764,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4766: checking for $ac_word" >&5 +echo "configure:4768: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4807,7 +4809,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in c++ g++ cxx gxx; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4811: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4813: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CXX_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4824,7 +4826,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4828: checking for $ac_word" >&5 +echo "configure:4830: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4855,7 +4857,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4859: checking for $ac_word" >&5 +echo "configure:4861: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4900,7 +4902,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4904: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4906: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4917,7 +4919,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4921: checking for $ac_word" >&5 +echo "configure:4923: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4948,7 +4950,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4952: checking for $ac_word" >&5 +echo "configure:4954: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4988,7 +4990,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcj; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4992: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4994: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCJ_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5005,7 +5007,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5009: checking for $ac_word" >&5 +echo "configure:5011: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5036,7 +5038,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5040: checking for $ac_word" >&5 +echo "configure:5042: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5081,7 +5083,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gfortran; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5085: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5087: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GFORTRAN_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5098,7 +5100,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5102: checking for $ac_word" >&5 +echo "configure:5104: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5129,7 +5131,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5133: checking for $ac_word" >&5 +echo "configure:5135: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5238,7 +5240,7 @@ if test -z "$ac_cv_path_AR_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ar in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5242: checking for ar in $with_build_time_tools" >&5 +echo "configure:5244: checking for ar in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ar; then AR_FOR_TARGET=`cd $with_build_time_tools && pwd`/ar ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET @@ -5256,7 +5258,7 @@ # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5260: checking for $ac_word" >&5 +echo "configure:5262: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5293,7 +5295,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ar; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5297: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5299: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AR_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5310,7 +5312,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5314: checking for $ac_word" >&5 +echo "configure:5316: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5341,7 +5343,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5345: checking for $ac_word" >&5 +echo "configure:5347: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5393,7 +5395,7 @@ if test -z "$ac_cv_path_AS_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for as in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5397: checking for as in $with_build_time_tools" >&5 +echo "configure:5399: checking for as in $with_build_time_tools" >&5 if test -x $with_build_time_tools/as; then AS_FOR_TARGET=`cd $with_build_time_tools && pwd`/as ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET @@ -5411,7 +5413,7 @@ # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5415: checking for $ac_word" >&5 +echo "configure:5417: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5448,7 +5450,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in as; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5452: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5454: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AS_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5465,7 +5467,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5469: checking for $ac_word" >&5 +echo "configure:5471: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5496,7 +5498,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5500: checking for $ac_word" >&5 +echo "configure:5502: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5548,7 +5550,7 @@ if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for dlltool in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5552: checking for dlltool in $with_build_time_tools" >&5 +echo "configure:5554: checking for dlltool in $with_build_time_tools" >&5 if test -x $with_build_time_tools/dlltool; then DLLTOOL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dlltool ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET @@ -5566,7 +5568,7 @@ # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5570: checking for $ac_word" >&5 +echo "configure:5572: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5603,7 +5605,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in dlltool; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5607: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5609: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_DLLTOOL_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5620,7 +5622,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5624: checking for $ac_word" >&5 +echo "configure:5626: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5651,7 +5653,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5655: checking for $ac_word" >&5 +echo "configure:5657: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5703,7 +5705,7 @@ if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ld in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5707: checking for ld in $with_build_time_tools" >&5 +echo "configure:5709: checking for ld in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ld; then LD_FOR_TARGET=`cd $with_build_time_tools && pwd`/ld ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET @@ -5721,7 +5723,7 @@ # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5725: checking for $ac_word" >&5 +echo "configure:5727: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5758,7 +5760,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ld; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5762: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5764: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LD_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5775,7 +5777,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5779: checking for $ac_word" >&5 +echo "configure:5781: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5806,7 +5808,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5810: checking for $ac_word" >&5 +echo "configure:5812: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5858,7 +5860,7 @@ if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for lipo in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5862: checking for lipo in $with_build_time_tools" >&5 +echo "configure:5864: checking for lipo in $with_build_time_tools" >&5 if test -x $with_build_time_tools/lipo; then LIPO_FOR_TARGET=`cd $with_build_time_tools && pwd`/lipo ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET @@ -5876,7 +5878,7 @@ # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5880: checking for $ac_word" >&5 +echo "configure:5882: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5913,7 +5915,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in lipo; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5917: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5919: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LIPO_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5930,7 +5932,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5934: checking for $ac_word" >&5 +echo "configure:5936: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5961,7 +5963,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5965: checking for $ac_word" >&5 +echo "configure:5967: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6013,7 +6015,7 @@ if test -z "$ac_cv_path_NM_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for nm in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6017: checking for nm in $with_build_time_tools" >&5 +echo "configure:6019: checking for nm in $with_build_time_tools" >&5 if test -x $with_build_time_tools/nm; then NM_FOR_TARGET=`cd $with_build_time_tools && pwd`/nm ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET @@ -6031,7 +6033,7 @@ # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6035: checking for $ac_word" >&5 +echo "configure:6037: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6068,7 +6070,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in nm; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6072: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6074: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_NM_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6085,7 +6087,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6089: checking for $ac_word" >&5 +echo "configure:6091: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6116,7 +6118,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6120: checking for $ac_word" >&5 +echo "configure:6122: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6168,7 +6170,7 @@ if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for objdump in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6172: checking for objdump in $with_build_time_tools" >&5 +echo "configure:6174: checking for objdump in $with_build_time_tools" >&5 if test -x $with_build_time_tools/objdump; then OBJDUMP_FOR_TARGET=`cd $with_build_time_tools && pwd`/objdump ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET @@ -6186,7 +6188,7 @@ # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6190: checking for $ac_word" >&5 +echo "configure:6192: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6223,7 +6225,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in objdump; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6227: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6229: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_OBJDUMP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6240,7 +6242,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6244: checking for $ac_word" >&5 +echo "configure:6246: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6271,7 +6273,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6275: checking for $ac_word" >&5 +echo "configure:6277: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6323,7 +6325,7 @@ if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ranlib in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6327: checking for ranlib in $with_build_time_tools" >&5 +echo "configure:6329: checking for ranlib in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ranlib; then RANLIB_FOR_TARGET=`cd $with_build_time_tools && pwd`/ranlib ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET @@ -6341,7 +6343,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6345: checking for $ac_word" >&5 +echo "configure:6347: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6378,7 +6380,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ranlib; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6382: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6384: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_RANLIB_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6395,7 +6397,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6399: checking for $ac_word" >&5 +echo "configure:6401: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6426,7 +6428,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6430: checking for $ac_word" >&5 +echo "configure:6432: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6478,7 +6480,7 @@ if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for strip in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6482: checking for strip in $with_build_time_tools" >&5 +echo "configure:6484: checking for strip in $with_build_time_tools" >&5 if test -x $with_build_time_tools/strip; then STRIP_FOR_TARGET=`cd $with_build_time_tools && pwd`/strip ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET @@ -6496,7 +6498,7 @@ # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6500: checking for $ac_word" >&5 +echo "configure:6502: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6533,7 +6535,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in strip; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6537: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6539: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_STRIP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6550,7 +6552,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6554: checking for $ac_word" >&5 +echo "configure:6556: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6581,7 +6583,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6585: checking for $ac_word" >&5 +echo "configure:6587: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6633,7 +6635,7 @@ if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for windres in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6637: checking for windres in $with_build_time_tools" >&5 +echo "configure:6639: checking for windres in $with_build_time_tools" >&5 if test -x $with_build_time_tools/windres; then WINDRES_FOR_TARGET=`cd $with_build_time_tools && pwd`/windres ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET @@ -6651,7 +6653,7 @@ # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6655: checking for $ac_word" >&5 +echo "configure:6657: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6688,7 +6690,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in windres; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6692: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6694: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_WINDRES_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6705,7 +6707,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6709: checking for $ac_word" >&5 +echo "configure:6711: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6736,7 +6738,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6740: checking for $ac_word" >&5 +echo "configure:6742: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6786,7 +6788,7 @@ RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6 -echo "configure:6790: checking where to find the target ar" >&5 +echo "configure:6792: checking where to find the target ar" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6819,7 +6821,7 @@ fi fi echo $ac_n "checking where to find the target as""... $ac_c" 1>&6 -echo "configure:6823: checking where to find the target as" >&5 +echo "configure:6825: checking where to find the target as" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6852,7 +6854,7 @@ fi fi echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6 -echo "configure:6856: checking where to find the target cc" >&5 +echo "configure:6858: checking where to find the target cc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6885,7 +6887,7 @@ fi fi echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6 -echo "configure:6889: checking where to find the target c++" >&5 +echo "configure:6891: checking where to find the target c++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6921,7 +6923,7 @@ fi fi echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6 -echo "configure:6925: checking where to find the target c++ for libstdc++" >&5 +echo "configure:6927: checking where to find the target c++ for libstdc++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6957,7 +6959,7 @@ fi fi echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6 -echo "configure:6961: checking where to find the target dlltool" >&5 +echo "configure:6963: checking where to find the target dlltool" >&5 if test "x${build}" != "x${host}" ; then if expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6990,7 +6992,7 @@ fi fi echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6 -echo "configure:6994: checking where to find the target gcc" >&5 +echo "configure:6996: checking where to find the target gcc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7023,7 +7025,7 @@ fi fi echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6 -echo "configure:7027: checking where to find the target gcj" >&5 +echo "configure:7029: checking where to find the target gcj" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7059,7 +7061,7 @@ fi fi echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6 -echo "configure:7063: checking where to find the target gfortran" >&5 +echo "configure:7065: checking where to find the target gfortran" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7095,7 +7097,7 @@ fi fi echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6 -echo "configure:7099: checking where to find the target ld" >&5 +echo "configure:7101: checking where to find the target ld" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7128,7 +7130,7 @@ fi fi echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6 -echo "configure:7132: checking where to find the target lipo" >&5 +echo "configure:7134: checking where to find the target lipo" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7151,7 +7153,7 @@ fi fi echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6 -echo "configure:7155: checking where to find the target nm" >&5 +echo "configure:7157: checking where to find the target nm" >&5 if test "x${build}" != "x${host}" ; then if expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7184,7 +7186,7 @@ fi fi echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6 -echo "configure:7188: checking where to find the target objdump" >&5 +echo "configure:7190: checking where to find the target objdump" >&5 if test "x${build}" != "x${host}" ; then if expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7217,7 +7219,7 @@ fi fi echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6 -echo "configure:7221: checking where to find the target ranlib" >&5 +echo "configure:7223: checking where to find the target ranlib" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7250,7 +7252,7 @@ fi fi echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6 -echo "configure:7254: checking where to find the target strip" >&5 +echo "configure:7256: checking where to find the target strip" >&5 if test "x${build}" != "x${host}" ; then if expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7283,7 +7285,7 @@ fi fi echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6 -echo "configure:7287: checking where to find the target windres" >&5 +echo "configure:7289: checking where to find the target windres" >&5 if test "x${build}" != "x${host}" ; then if expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7344,7 +7346,7 @@ echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:7348: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:7350: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -7395,9 +7397,9 @@ # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it. CFLAGS="$CFLAGS -fkeep-inline-functions" echo $ac_n "checking whether -fkeep-inline-functions is supported""... $ac_c" 1>&6 -echo "configure:7399: checking whether -fkeep-inline-functions is supported" >&5 +echo "configure:7401: checking whether -fkeep-inline-functions is supported" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6; stage1_cflags="$stage1_cflags -fkeep-inline-functions" else From natebegeman at mac.com Wed Oct 29 18:07:17 2008 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 29 Oct 2008 23:07:17 -0000 Subject: [llvm-commits] [llvm] r58403 - /llvm/trunk/lib/Target/X86/X86Instr64bit.td Message-ID: <200810292307.m9TN7Hpl005659@zion.cs.uiuc.edu> Author: sampo Date: Wed Oct 29 18:07:17 2008 New Revision: 58403 URL: http://llvm.org/viewvc/llvm-project?rev=58403&view=rev Log: Fix PEXTRQ encoding Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=58403&r1=58402&r2=58403&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Wed Oct 29 18:07:17 2008 @@ -1500,7 +1500,7 @@ /// SS41I_extract32 - SSE 4.1 extract 32 bits to int reg or memory destination multiclass SS41I_extract64 opc, string OpcodeStr> { - def rr : SS4AIi8 Author: evancheng Date: Wed Oct 29 18:53:42 2008 New Revision: 58405 URL: http://llvm.org/viewvc/llvm-project?rev=58405&view=rev Log: Add a bit to MachineRelocation that tells JIT that target is responsible for resolving the address. e.g. ARM constpool. Modified: llvm/trunk/include/llvm/CodeGen/MachineRelocation.h Modified: llvm/trunk/include/llvm/CodeGen/MachineRelocation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRelocation.h?rev=58405&r1=58404&r2=58405&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineRelocation.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineRelocation.h Wed Oct 29 18:53:42 2008 @@ -63,10 +63,11 @@ unsigned GOTIndex; // Index in the GOT of this symbol/global } Target; - unsigned TargetReloType : 6; // The target relocation ID. - AddressType AddrType : 4; // The field of Target to use. - bool NeedStub : 1; // True if this relocation requires a stub. + unsigned TargetReloType : 6; // The target relocation ID + AddressType AddrType : 4; // The field of Target to use + bool NeedStub : 1; // True if this relocation requires a stub bool GOTRelative : 1; // Should this relocation be relative to the GOT? + bool TargetResolve : 1; // True if target should resolve the address public: // Relocation types used in a generic implementation. Currently, relocation @@ -90,6 +91,7 @@ Result.AddrType = isGV; Result.NeedStub = NeedStub; Result.GOTRelative = GOTrelative; + Result.TargetResolve = false; Result.Target.GV = GV; return Result; } @@ -109,6 +111,7 @@ Result.AddrType = isGVLazyPtr; Result.NeedStub = NeedStub; Result.GOTRelative = GOTrelative; + Result.TargetResolve = false; Result.Target.GV = GV; return Result; } @@ -125,6 +128,7 @@ Result.AddrType = isBB; Result.NeedStub = false; Result.GOTRelative = false; + Result.TargetResolve = false; Result.Target.MBB = MBB; return Result; } @@ -143,6 +147,7 @@ Result.AddrType = isExtSym; Result.NeedStub = true; Result.GOTRelative = GOTrelative; + Result.TargetResolve = false; Result.Target.ExtSym = ES; return Result; } @@ -151,7 +156,8 @@ /// pool entry. /// static MachineRelocation getConstPool(intptr_t offset,unsigned RelocationType, - unsigned CPI, intptr_t cst = 0) { + unsigned CPI, intptr_t cst = 0, + bool letTargetResolve = false) { assert((RelocationType & ~63) == 0 && "Relocation type too large!"); MachineRelocation Result; Result.Offset = offset; @@ -160,6 +166,7 @@ Result.AddrType = isConstPool; Result.NeedStub = false; Result.GOTRelative = false; + Result.TargetResolve = letTargetResolve; Result.Target.Index = CPI; return Result; } @@ -177,6 +184,7 @@ Result.AddrType = isJumpTable; Result.NeedStub = false; Result.GOTRelative = false; + Result.TargetResolve = false; Result.Target.Index = JTI; return Result; } @@ -257,6 +265,12 @@ return !NeedStub; } + /// letTargetResolve - Return true if the target JITInfo is usually + /// responsible for resolving the address of this relocation. + bool letTargetResolve() const { + return TargetResolve; + } + /// getGlobalValue - If this is a global value reference, return the /// referenced global. GlobalValue *getGlobalValue() const { From evan.cheng at apple.com Wed Oct 29 18:54:10 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Oct 2008 23:54:10 -0000 Subject: [llvm-commits] [llvm] r58406 - /llvm/trunk/include/llvm/Target/TargetJITInfo.h Message-ID: <200810292354.m9TNsATD007338@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 29 18:54:10 2008 New Revision: 58406 URL: http://llvm.org/viewvc/llvm-project?rev=58406&view=rev Log: This is not needed anymore. Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=58406&r1=58405&r2=58406&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Wed Oct 29 18:54:10 2008 @@ -107,15 +107,6 @@ // JIT to manage a GOT for it. bool needsGOT() const { return useGOT; } - /// hasCustomConstantPool - Allows a target to specify that constant - /// pool address resolution is handled by the target. - virtual bool hasCustomConstantPool() const { return false; } - - /// getCustomConstantPoolEntryAddress - When using a custom constant - /// pool, resolve a constant pool index to the address of where the - /// entry is stored. - virtual intptr_t getCustomConstantPoolEntryAddress(unsigned CPI) const - {return 0;} protected: bool useGOT; }; From evan.cheng at apple.com Wed Oct 29 18:54:46 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Oct 2008 23:54:46 -0000 Subject: [llvm-commits] [llvm] r58407 - /llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 29 18:54:46 2008 New Revision: 58407 URL: http://llvm.org/viewvc/llvm-project?rev=58407&view=rev Log: Let target resolve some relocation results. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58407&r1=58406&r2=58407&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Wed Oct 29 18:54:46 2008 @@ -876,30 +876,32 @@ for (unsigned i = 0, e = Relocations.size(); i != e; ++i) { MachineRelocation &MR = Relocations[i]; void *ResultPtr; - if (MR.isString()) { - ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString()); - - // If the target REALLY wants a stub for this function, emit it now. - if (!MR.doesntNeedStub()) - ResultPtr = Resolver.getExternalFunctionStub(ResultPtr); - } else if (MR.isGlobalValue()) { - ResultPtr = getPointerToGlobal(MR.getGlobalValue(), - BufferBegin+MR.getMachineCodeOffset(), - MR.doesntNeedStub()); - } else if (MR.isGlobalValueLazyPtr()) { - ResultPtr = getPointerToGVLazyPtr(MR.getGlobalValue(), + if (!MR.letTargetResolve()) { + if (MR.isString()) { + ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString()); + + // If the target REALLY wants a stub for this function, emit it now. + if (!MR.doesntNeedStub()) + ResultPtr = Resolver.getExternalFunctionStub(ResultPtr); + } else if (MR.isGlobalValue()) { + ResultPtr = getPointerToGlobal(MR.getGlobalValue(), + BufferBegin+MR.getMachineCodeOffset(), + MR.doesntNeedStub()); + } else if (MR.isGlobalValueLazyPtr()) { + ResultPtr = getPointerToGVLazyPtr(MR.getGlobalValue(), BufferBegin+MR.getMachineCodeOffset(), MR.doesntNeedStub()); - } else if (MR.isBasicBlock()) { - ResultPtr = (void*)getMachineBasicBlockAddress(MR.getBasicBlock()); - } else if (MR.isConstantPoolIndex()) { - ResultPtr=(void*)getConstantPoolEntryAddress(MR.getConstantPoolIndex()); - } else { - assert(MR.isJumpTableIndex()); - ResultPtr=(void*)getJumpTableEntryAddress(MR.getJumpTableIndex()); - } + } else if (MR.isBasicBlock()) { + ResultPtr = (void*)getMachineBasicBlockAddress(MR.getBasicBlock()); + } else if (MR.isConstantPoolIndex()) { + ResultPtr = (void*)getConstantPoolEntryAddress(MR.getConstantPoolIndex()); + } else { + assert(MR.isJumpTableIndex()); + ResultPtr=(void*)getJumpTableEntryAddress(MR.getJumpTableIndex()); + } - MR.setResultPointer(ResultPtr); + MR.setResultPointer(ResultPtr); + } // if we are managing the GOT and the relocation wants an index, // give it one @@ -1011,11 +1013,6 @@ } void JITEmitter::emitConstantPool(MachineConstantPool *MCP) { - if (TheJIT->getJITInfo().hasCustomConstantPool()) { - DOUT << "JIT: Target has custom constant pool handling. Omitting standard " - "constant pool\n"; - return; - } const std::vector &Constants = MCP->getConstants(); if (Constants.empty()) return; @@ -1129,10 +1126,6 @@ // method. // intptr_t JITEmitter::getConstantPoolEntryAddress(unsigned ConstantNum) const { - if (TheJIT->getJITInfo().hasCustomConstantPool()) { - return TheJIT->getJITInfo().getCustomConstantPoolEntryAddress(ConstantNum); - } - assert(ConstantNum < ConstantPool->getConstants().size() && "Invalid ConstantPoolIndex!"); return (intptr_t)ConstantPoolBase + From evan.cheng at apple.com Wed Oct 29 18:55:18 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Oct 2008 23:55:18 -0000 Subject: [llvm-commits] [llvm] r58408 - in /llvm/trunk/lib/Target/ARM: ARMConstantPoolValue.cpp ARMConstantPoolValue.h Message-ID: <200810292355.m9TNtI0b007395@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 29 18:55:17 2008 New Revision: 58408 URL: http://llvm.org/viewvc/llvm-project?rev=58408&view=rev Log: Add debugging support. Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=58408&r1=58407&r2=58408&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Wed Oct 29 18:55:17 2008 @@ -15,7 +15,9 @@ #include "llvm/ADT/FoldingSet.h" #include "llvm/GlobalValue.h" #include "llvm/Type.h" +#include "llvm/Support/Streams.h" #include "llvm/Support/raw_ostream.h" +#include using namespace llvm; ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, unsigned id, @@ -73,6 +75,15 @@ ID.AddInteger(PCAdjust); } +void ARMConstantPoolValue::dump() const { + cerr << " " << *this; +} + +void ARMConstantPoolValue::print(std::ostream &O) const { + raw_os_ostream RawOS(O); + print(RawOS); +} + void ARMConstantPoolValue::print(raw_ostream &O) const { if (GV) O << GV->getName(); Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=58408&r1=58407&r2=58408&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Wed Oct 29 18:55:17 2008 @@ -69,9 +69,23 @@ virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID); - virtual void print(raw_ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } + void print(std::ostream &O) const; + void print(raw_ostream *O) const { if (O) print(*O); } + void print(raw_ostream &O) const; + void dump() const; }; + + inline std::ostream &operator<<(std::ostream &O, const ARMConstantPoolValue &V) { + V.print(O); + return O; +} +inline raw_ostream &operator<<(raw_ostream &O, const ARMConstantPoolValue &V) { + V.print(O); + return O; } +} // End llvm namespace + #endif From evan.cheng at apple.com Wed Oct 29 18:55:43 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Oct 2008 23:55:43 -0000 Subject: [llvm-commits] [llvm] r58409 - in /llvm/trunk/lib/Target/ARM: ARMCodeEmitter.cpp ARMJITInfo.cpp ARMJITInfo.h ARMRelocations.h Message-ID: <200810292355.m9TNtiSj007422@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 29 18:55:43 2008 New Revision: 58409 URL: http://llvm.org/viewvc/llvm-project?rev=58409&view=rev Log: Correct way to handle CONSTPOOL_ENTRY instructions. Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp llvm/trunk/lib/Target/ARM/ARMJITInfo.h llvm/trunk/lib/Target/ARM/ARMRelocations.h Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=58409&r1=58408&r2=58409&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Wed Oct 29 18:55:43 2008 @@ -12,9 +12,10 @@ // //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "arm-emitter" +#define DEBUG_TYPE "jit" #include "ARM.h" #include "ARMAddressingModes.h" +#include "ARMConstantPoolValue.h" #include "ARMInstrInfo.h" #include "ARMRelocations.h" #include "ARMSubtarget.h" @@ -192,7 +193,7 @@ else if (MO.isSymbol()) emitExternalSymbolAddress(MO.getSymbolName(), ARM::reloc_arm_relative); else if (MO.isCPI()) - emitConstPoolAddress(MO.getIndex(), ARM::reloc_arm_relative); + emitConstPoolAddress(MO.getIndex(), ARM::reloc_arm_cp_entry); else if (MO.isJTI()) emitJumpTableAddress(MO.getIndex(), ARM::reloc_arm_relative); else if (MO.isMBB()) @@ -226,8 +227,9 @@ void ARMCodeEmitter::emitConstPoolAddress(unsigned CPI, unsigned Reloc, int Disp /* = 0 */, unsigned PCAdj /* = 0 */) { + // Tell JIT emitter we'll resolve the address. MCE.addRelocation(MachineRelocation::getConstPool(MCE.getCurrentPCOffset(), - Reloc, CPI, PCAdj)); + Reloc, CPI, PCAdj, true)); } /// emitJumpTableAddress - Arrange for the address of a jump table to @@ -246,7 +248,7 @@ } void ARMCodeEmitter::emitInstruction(const MachineInstr &MI) { - DOUT << MI; + DOUT << "JIT: " << "0x" << MCE.getCurrentPCValue() << ":\t" << MI; NumEmitted++; // Keep track of the # of mi's emitted if ((MI.getDesc().TSFlags & ARMII::FormMask) == ARMII::Pseudo) @@ -360,29 +362,47 @@ } void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) { - unsigned CPID = MI.getOperand(0).getImm(); + unsigned CPI = MI.getOperand(0).getImm(); unsigned CPIndex = MI.getOperand(1).getIndex(); const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPIndex]; - //FIXME: Can we get these here? - assert (!MCPE.isMachineConstantPoolEntry()); + // Remember the CONSTPOOL_ENTRY address for later relocation. + JTI->addConstantPoolEntryAddr(CPI, MCE.getCurrentPCValue()); - const Constant *CV = MCPE.Val.ConstVal; - // FIXME: We can get other types here. Need to handle them. - // According to the constant island pass, everything is multiples, - // of 4-bytes in size, though, so that helps. - assert (CV->getType()->isInteger()); - assert (cast(CV->getType())->getBitWidth() == 32); - - const ConstantInt *CI = dyn_cast(CV); - uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); - - DOUT << "Constant pool #" << CPID << ", value '" << Val << "' @ " << - (void*)MCE.getCurrentPCValue() << "\n"; - - if (JTI) - JTI->mapCPIDtoAddress(CPID, MCE.getCurrentPCValue()); - MCE.emitWordLE(Val); + // Emit constpool island entry. In most cases, the actual values will be + // resolved and relocated after code emission. + if (MCPE.isMachineConstantPoolEntry()) { + ARMConstantPoolValue *ACPV = + static_cast(MCPE.Val.MachineCPVal); + + DOUT << "\t** ARM constant pool #" << CPI << ", ' @ " + << (void*)MCE.getCurrentPCValue() << *ACPV << '\n'; + + GlobalValue *GV = ACPV->getGV(); + if (GV) { + assert(!ACPV->isStub() && "Don't know how to deal this yet!"); + emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); + } else { + assert(!ACPV->isNonLazyPointer() && "Don't know how to deal this yet!"); + emitExternalSymbolAddress(ACPV->getSymbol(), ARM::reloc_arm_absolute); + } + MCE.emitWordLE(0); + } else { + Constant *CV = MCPE.Val.ConstVal; + + DOUT << "\t** Constant pool #" << CPI << ", ' @ " + << (void*)MCE.getCurrentPCValue() << *CV << '\n'; + + if (GlobalValue *GV = dyn_cast(CV)) { + emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); + MCE.emitWordLE(0); + } else { + abort(); // FIXME: Is this right? + const ConstantInt *CI = dyn_cast(CV); + uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); + MCE.emitWordLE(Val); + } + } } void ARMCodeEmitter::emitPseudoInstruction(const MachineInstr &MI) { Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?rev=58409&r1=58408&r2=58409&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Wed Oct 29 18:55:43 2008 @@ -174,8 +174,14 @@ unsigned NumRelocs, unsigned char* GOTBase) { for (unsigned i = 0; i != NumRelocs; ++i, ++MR) { void *RelocPos = (char*)Function + MR->getMachineCodeOffset(); - intptr_t ResultPtr = (intptr_t)MR->getResultPointer(); + ARM::RelocationType RT = (ARM::RelocationType)MR->getRelocationType(); + // If this is a constpool relocation, get the address of the + // constpool_entry instruction. + intptr_t ResultPtr = (RT == ARM::reloc_arm_cp_entry) + ? getConstantPoolEntryAddr(MR->getConstantPoolIndex()) + : (intptr_t)MR->getResultPointer(); switch ((ARM::RelocationType)MR->getRelocationType()) { + case ARM::reloc_arm_cp_entry: case ARM::reloc_arm_relative: { // It is necessary to calculate the correct PC relative value. We // subtract the base addr from the target addr to form a byte offset. @@ -195,6 +201,10 @@ *((unsigned*)RelocPos) |= 0xF << 16; break; } + case ARM::reloc_arm_absolute: { + *((unsigned*)RelocPos) += (unsigned)ResultPtr; + break; + } case ARM::reloc_arm_branch: { // It is necessary to calculate the correct value of signed_immed_24 // field. We subtract the base addr from the target addr to form a Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.h?rev=58409&r1=58408&r2=58409&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.h Wed Oct 29 18:55:43 2008 @@ -22,7 +22,11 @@ class ARMJITInfo : public TargetJITInfo { ARMTargetMachine &TM; - std::map CPIDtoAddressMap; + + // ConstPoolId2AddrMap - A map from constant pool ids to the corresponding + // CONSTPOOL_ENTRY addresses. + std::map ConstPoolId2AddrMap; + public: explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) { useGOT = false; } @@ -52,22 +56,22 @@ /// pool address resolution is handled by the target. virtual bool hasCustomConstantPool() const { return true; } - /// getCustomConstantPoolEntryAddress - The ARM target puts all constant + /// getConstantPoolEntryAddr - The ARM target puts all constant /// pool entries into constant islands. Resolve the constant pool index /// into the address where the constant is stored. - virtual intptr_t getCustomConstantPoolEntryAddress(unsigned CPID) const - { - std::map::const_iterator elem; - elem = CPIDtoAddressMap.find(CPID); - assert (elem != CPIDtoAddressMap.end()); - return elem->second; - } + virtual intptr_t getConstantPoolEntryAddr(unsigned CPID) const { + std::map::const_iterator I + = ConstPoolId2AddrMap.find(CPID); + assert(I != ConstPoolId2AddrMap.end() && "Missing constpool_entry?"); + return I->second; + } - /// mapCPIDtoAddress - Map a Constant Pool Index (CPID) to the address + /// addConstantPoolEntryAddr - Map a Constant Pool Index (CPID) to the address /// where its associated value is stored. When relocations are processed, /// this value will be used to resolve references to the constant. - void mapCPIDtoAddress(unsigned CPID, intptr_t address) - { CPIDtoAddressMap[CPID] = address; } + void addConstantPoolEntryAddr(unsigned CPID, intptr_t Addr) { + ConstPoolId2AddrMap[CPID] = Addr; + } }; } Modified: llvm/trunk/lib/Target/ARM/ARMRelocations.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRelocations.h?rev=58409&r1=58408&r2=58409&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRelocations.h (original) +++ llvm/trunk/lib/Target/ARM/ARMRelocations.h Wed Oct 29 18:55:43 2008 @@ -19,8 +19,19 @@ namespace llvm { namespace ARM { enum RelocationType { + // reloc_arm_absolute - Absolute relocation, just add the relocated value + // to the value already in memory. + reloc_arm_absolute, + + // reloc_arm_relative - PC relative relocation, add the relocated value to + // the value already in memory, after we adjust it for where the PC is. reloc_arm_relative, + // reloc_arm_cp_entry - PC relative relocation for constpool_entry's whose + // addresses are kept locally in a map. + reloc_arm_cp_entry, + + // reloc_arm_branch - Branch address relocation. reloc_arm_branch }; } From isanbard at gmail.com Wed Oct 29 19:11:55 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 30 Oct 2008 00:11:55 -0000 Subject: [llvm-commits] [llvm] r58411 - /llvm/trunk/include/llvm/Support/DataTypes.h.in Message-ID: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> Author: void Date: Wed Oct 29 19:11:55 2008 New Revision: 58411 URL: http://llvm.org/viewvc/llvm-project?rev=58411&view=rev Log: Revert part of r58048. It was breaking on SnowLeopard claiming that "__STDC_CONSTANT_MACROS" needs to be #defined first. Modified: llvm/trunk/include/llvm/Support/DataTypes.h.in Modified: llvm/trunk/include/llvm/Support/DataTypes.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.in?rev=58411&r1=58410&r2=58411&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/DataTypes.h.in (original) +++ llvm/trunk/include/llvm/Support/DataTypes.h.in Wed Oct 29 19:11:55 2008 @@ -37,11 +37,6 @@ # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" #endif -#if !defined(__STDC_CONSTANT_MACROS) -# error "Must #define __STDC_CONSTANT_MACROS before " \ - "#including Support/DataTypes.h" -#endif - // Note that includes , if this is a C99 system. #ifdef HAVE_SYS_TYPES_H #include From gohman at apple.com Wed Oct 29 19:36:00 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 29 Oct 2008 17:36:00 -0700 Subject: [llvm-commits] [llvm] r58411 - /llvm/trunk/include/llvm/Support/DataTypes.h.in In-Reply-To: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> References: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> Message-ID: <473745C1-4D36-4E6F-AA74-5BFFE08D280D@apple.com> On Oct 29, 2008, at 5:11 PM, Bill Wendling wrote: > Author: void > Date: Wed Oct 29 19:11:55 2008 > New Revision: 58411 > > URL: http://llvm.org/viewvc/llvm-project?rev=58411&view=rev > Log: > Revert part of r58048. It was breaking on SnowLeopard claiming that > "__STDC_CONSTANT_MACROS" needs to be #defined first. > > Modified: > llvm/trunk/include/llvm/Support/DataTypes.h.in > > Modified: llvm/trunk/include/llvm/Support/DataTypes.h.in > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.in?rev=58411&r1=58410&r2=58411&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Support/DataTypes.h.in (original) > +++ llvm/trunk/include/llvm/Support/DataTypes.h.in Wed Oct 29 > 19:11:55 2008 > @@ -37,11 +37,6 @@ > # error "Must #define __STDC_LIMIT_MACROS before #including Support/ > DataTypes.h" > #endif > > -#if !defined(__STDC_CONSTANT_MACROS) > -# error "Must #define __STDC_CONSTANT_MACROS before " \ > - "#including Support/DataTypes.h" > -#endif This code was meant to be similar to the code a few lines up. Where is __STDC_LIMIT_MACROS defined in the SnowLeopard build? __STDC_CONSTANT_MACROS should be defined there too. Dan From isanbard at gmail.com Wed Oct 29 19:48:34 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Oct 2008 17:48:34 -0700 Subject: [llvm-commits] [llvm] r58411 - /llvm/trunk/include/llvm/Support/DataTypes.h.in In-Reply-To: <473745C1-4D36-4E6F-AA74-5BFFE08D280D@apple.com> References: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> <473745C1-4D36-4E6F-AA74-5BFFE08D280D@apple.com> Message-ID: <16e5fdf90810291748l37873764v25489e53f3198cce@mail.gmail.com> On Wed, Oct 29, 2008 at 5:36 PM, Dan Gohman wrote: > > On Oct 29, 2008, at 5:11 PM, Bill Wendling wrote: > >> >> -#if !defined(__STDC_CONSTANT_MACROS) >> -# error "Must #define __STDC_CONSTANT_MACROS before " \ >> - "#including Support/DataTypes.h" >> -#endif > > This code was meant to be similar to the code a few lines up. Yeah, I caught that. > Where is __STDC_LIMIT_MACROS defined in the SnowLeopard build? > __STDC_CONSTANT_MACROS should be defined there too. > They're both #defined in c++/4.2.1/tr1/cstdint, but I don't think that that file is being pulled in (otherwise, we wouldn't get the error). They're also defined in several PCHs. I'm not sure what's happening here. -bw From gohman at apple.com Wed Oct 29 20:06:46 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 29 Oct 2008 18:06:46 -0700 Subject: [llvm-commits] [llvm] r58411 - /llvm/trunk/include/llvm/Support/DataTypes.h.in In-Reply-To: <16e5fdf90810291748l37873764v25489e53f3198cce@mail.gmail.com> References: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> <473745C1-4D36-4E6F-AA74-5BFFE08D280D@apple.com> <16e5fdf90810291748l37873764v25489e53f3198cce@mail.gmail.com> Message-ID: On Oct 29, 2008, at 5:48 PM, Bill Wendling wrote: > On Wed, Oct 29, 2008 at 5:36 PM, Dan Gohman wrote: >> >> On Oct 29, 2008, at 5:11 PM, Bill Wendling wrote: >> >>> >>> -#if !defined(__STDC_CONSTANT_MACROS) >>> -# error "Must #define __STDC_CONSTANT_MACROS before " \ >>> - "#including Support/DataTypes.h" >>> -#endif >> >> This code was meant to be similar to the code a few lines up. > > Yeah, I caught that. > >> Where is __STDC_LIMIT_MACROS defined in the SnowLeopard build? >> __STDC_CONSTANT_MACROS should be defined there too. >> > They're both #defined in c++/4.2.1/tr1/cstdint, but I don't think that > that file is being pulled in (otherwise, we wouldn't get the error). > They're also defined in several PCHs. I'm not sure what's happening > here. The normal place for __STDC_LIMIT_MACROS to be defined is in LLVM's own Makefile.rules or CMakeLists.txt. __STDC_CONSTANT_MACROS is now also defined in both of those. Dan From gohman at apple.com Wed Oct 29 20:08:04 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 30 Oct 2008 01:08:04 -0000 Subject: [llvm-commits] [llvm] r58413 - /llvm/trunk/utils/NewNightlyTest.pl Message-ID: <200810300108.m9U184lc009822@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 29 20:08:03 2008 New Revision: 58413 URL: http://llvm.org/viewvc/llvm-project?rev=58413&view=rev Log: Spell DISABLE_ASSERTIONS correctly. Modified: llvm/trunk/utils/NewNightlyTest.pl Modified: llvm/trunk/utils/NewNightlyTest.pl URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/NewNightlyTest.pl?rev=58413&r1=58412&r2=58413&view=diff ============================================================================== --- llvm/trunk/utils/NewNightlyTest.pl (original) +++ llvm/trunk/utils/NewNightlyTest.pl Wed Oct 29 20:08:03 2008 @@ -144,7 +144,7 @@ if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". - "DISABLE-ASSERTIONS=1 ". + "DISABLE_ASSERTIONS=1 ". "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release-asserts"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } From isanbard at gmail.com Wed Oct 29 20:12:27 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Oct 2008 18:12:27 -0700 Subject: [llvm-commits] [llvm] r58411 - /llvm/trunk/include/llvm/Support/DataTypes.h.in In-Reply-To: References: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> <473745C1-4D36-4E6F-AA74-5BFFE08D280D@apple.com> <16e5fdf90810291748l37873764v25489e53f3198cce@mail.gmail.com> Message-ID: <16e5fdf90810291812n4d4cfdbes3f4bbe56f36b955a@mail.gmail.com> On Wed, Oct 29, 2008 at 6:06 PM, Dan Gohman wrote: > > On Oct 29, 2008, at 5:48 PM, Bill Wendling wrote: > >> On Wed, Oct 29, 2008 at 5:36 PM, Dan Gohman wrote: >>> >>> On Oct 29, 2008, at 5:11 PM, Bill Wendling wrote: >>> >>>> >>>> -#if !defined(__STDC_CONSTANT_MACROS) >>>> -# error "Must #define __STDC_CONSTANT_MACROS before " \ >>>> - "#including Support/DataTypes.h" >>>> -#endif >>> >>> This code was meant to be similar to the code a few lines up. >> >> Yeah, I caught that. >> >>> Where is __STDC_LIMIT_MACROS defined in the SnowLeopard build? >>> __STDC_CONSTANT_MACROS should be defined there too. >>> >> They're both #defined in c++/4.2.1/tr1/cstdint, but I don't think that >> that file is being pulled in (otherwise, we wouldn't get the error). >> They're also defined in several PCHs. I'm not sure what's happening >> here. > > The normal place for __STDC_LIMIT_MACROS to be defined is in > LLVM's own Makefile.rules or CMakeLists.txt. __STDC_CONSTANT_MACROS > is now also defined in both of those. > The problem comes when someone tries to compile a JIT that #includes the DataTypes.h file. This header is where it's coming from: include/llvm/ExecutionEngine/JITMemoryManager.h: -bw From echristo at apple.com Wed Oct 29 20:18:50 2008 From: echristo at apple.com (Eric Christopher) Date: Wed, 29 Oct 2008 18:18:50 -0700 Subject: [llvm-commits] [llvm] r58411 - /llvm/trunk/include/llvm/Support/DataTypes.h.in In-Reply-To: <16e5fdf90810291812n4d4cfdbes3f4bbe56f36b955a@mail.gmail.com> References: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> <473745C1-4D36-4E6F-AA74-5BFFE08D280D@apple.com> <16e5fdf90810291748l37873764v25489e53f3198cce@mail.gmail.com> <16e5fdf90810291812n4d4cfdbes3f4bbe56f36b955a@mail.gmail.com> Message-ID: >> > The problem comes when someone tries to compile a JIT that #includes > the DataTypes.h file. This header is where it's coming from: > > include/llvm/ExecutionEngine/JITMemoryManager.h: Yep, they're likely defining __STDC_LIMIT_MACROS themselves - they need to for __STDC_CONSTANT_MACROS as well. -eric From isanbard at gmail.com Wed Oct 29 20:21:41 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Oct 2008 18:21:41 -0700 Subject: [llvm-commits] [llvm] r58411 - /llvm/trunk/include/llvm/Support/DataTypes.h.in In-Reply-To: References: <200810300011.m9U0Btk9007943@zion.cs.uiuc.edu> <473745C1-4D36-4E6F-AA74-5BFFE08D280D@apple.com> <16e5fdf90810291748l37873764v25489e53f3198cce@mail.gmail.com> <16e5fdf90810291812n4d4cfdbes3f4bbe56f36b955a@mail.gmail.com> Message-ID: <16e5fdf90810291821p642fbcdbv9ad95937787d5a4d@mail.gmail.com> On Wed, Oct 29, 2008 at 6:18 PM, Eric Christopher wrote: >>> >> The problem comes when someone tries to compile a JIT that #includes >> the DataTypes.h file. This header is where it's coming from: >> >> include/llvm/ExecutionEngine/JITMemoryManager.h: > > Yep, they're likely defining __STDC_LIMIT_MACROS themselves - they > need to for __STDC_CONSTANT_MACROS as well. > Indeed they do! I'll revert my revertion. -bw From isanbard at gmail.com Wed Oct 29 20:22:58 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 30 Oct 2008 01:22:58 -0000 Subject: [llvm-commits] [llvm] r58414 - /llvm/trunk/include/llvm/Support/DataTypes.h.in Message-ID: <200810300122.m9U1Mxab010366@zion.cs.uiuc.edu> Author: void Date: Wed Oct 29 20:22:58 2008 New Revision: 58414 URL: http://llvm.org/viewvc/llvm-project?rev=58414&view=rev Log: Revert r58411. The user needs to #define this when using the JITMemoryManager.h header. Modified: llvm/trunk/include/llvm/Support/DataTypes.h.in Modified: llvm/trunk/include/llvm/Support/DataTypes.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.in?rev=58414&r1=58413&r2=58414&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/DataTypes.h.in (original) +++ llvm/trunk/include/llvm/Support/DataTypes.h.in Wed Oct 29 20:22:58 2008 @@ -37,6 +37,11 @@ # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" #endif +#if !defined(__STDC_CONSTANT_MACROS) +# error "Must #define __STDC_CONSTANT_MACROS before " \ + "#including Support/DataTypes.h" +#endif + // Note that includes , if this is a C99 system. #ifdef HAVE_SYS_TYPES_H #include From scottm at aero.org Wed Oct 29 20:51:49 2008 From: scottm at aero.org (Scott Michel) Date: Thu, 30 Oct 2008 01:51:49 -0000 Subject: [llvm-commits] [llvm] r58415 - in /llvm/trunk: lib/Target/CellSPU/SPUAsmPrinter.cpp lib/Target/CellSPU/SPUISelLowering.cpp test/CodeGen/CellSPU/call.ll Message-ID: <200810300151.m9U1pnQD011325@zion.cs.uiuc.edu> Author: pingbak Date: Wed Oct 29 20:51:48 2008 New Revision: 58415 URL: http://llvm.org/viewvc/llvm-project?rev=58415&view=rev Log: Resolve bug 2947: vararg-marked functions must spill registers R3-R79 to stack so that va_start/va_arg/et.al. will walk arguments correctly for Cell SPU. N.B.: Because neither clang nor llvm-gcc-4.2 can be built for CellSPU, this is still unexorcised code. Modified: llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/test/CodeGen/CellSPU/call.ll Modified: llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp?rev=58415&r1=58414&r2=58415&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp Wed Oct 29 20:51:48 2008 @@ -188,8 +188,10 @@ const MachineOperand &MO = MI->getOperand(OpNo); assert(MO.isImm() && "printMemRegImmS10 first operand is not immedate"); - printS10ImmOperand(MI, OpNo); - O << "("; + int64_t value = int64_t(MI->getOperand(OpNo).getImm()); + assert((value >= -(1 << (9+4)) && value <= (1 << (9+4)) - 1) + && "Invalid dform s10 offset argument"); + O << value << "("; printOperand(MI, OpNo+1); O << ")"; } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=58415&r1=58414&r2=58415&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Oct 29 20:51:48 2008 @@ -460,10 +460,7 @@ MVT SPUTargetLowering::getSetCCResultType(const SDValue &Op) const { MVT VT = Op.getValueType(); - if (VT.isInteger()) - return VT; - else - return MVT::i32; + return (VT.isInteger() ? VT : MVT(MVT::i32)); } //===----------------------------------------------------------------------===// @@ -926,7 +923,7 @@ MachineFunction &MF = DAG.getMachineFunction(); MachineFrameInfo *MFI = MF.getFrameInfo(); MachineRegisterInfo &RegInfo = MF.getRegInfo(); - SmallVector ArgValues; + SmallVector ArgValues; SDValue Root = Op.getOperand(0); bool isVarArg = cast(Op.getOperand(2))->getZExtValue() != 0; @@ -942,98 +939,57 @@ // Add DAG nodes to load the arguments or copy them out of registers. for (unsigned ArgNo = 0, e = Op.getNode()->getNumValues() - 1; ArgNo != e; ++ArgNo) { - SDValue ArgVal; - bool needsLoad = false; MVT ObjectVT = Op.getValue(ArgNo).getValueType(); unsigned ObjSize = ObjectVT.getSizeInBits()/8; + SDValue ArgVal; - switch (ObjectVT.getSimpleVT()) { - default: { - cerr << "LowerFORMAL_ARGUMENTS Unhandled argument type: " - << ObjectVT.getMVTString() - << "\n"; - abort(); - } - case MVT::i8: - if (!isVarArg && ArgRegIdx < NumArgRegs) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::R8CRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::i8); - ++ArgRegIdx; - } else { - needsLoad = true; - } - break; - case MVT::i16: - if (!isVarArg && ArgRegIdx < NumArgRegs) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::R16CRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::i16); - ++ArgRegIdx; - } else { - needsLoad = true; - } - break; - case MVT::i32: - if (!isVarArg && ArgRegIdx < NumArgRegs) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::R32CRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::i32); - ++ArgRegIdx; - } else { - needsLoad = true; - } - break; - case MVT::i64: - if (!isVarArg && ArgRegIdx < NumArgRegs) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::R64CRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::i64); - ++ArgRegIdx; - } else { - needsLoad = true; - } - break; - case MVT::f32: - if (!isVarArg && ArgRegIdx < NumArgRegs) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::R32FPRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::f32); - ++ArgRegIdx; - } else { - needsLoad = true; - } - break; - case MVT::f64: - if (!isVarArg && ArgRegIdx < NumArgRegs) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::R64FPRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::f64); - ++ArgRegIdx; - } else { - needsLoad = true; - } - break; - case MVT::v2f64: - case MVT::v4f32: - case MVT::v2i64: - case MVT::v4i32: - case MVT::v8i16: - case MVT::v16i8: - if (!isVarArg && ArgRegIdx < NumArgRegs) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::VECREGRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - ArgVal = DAG.getCopyFromReg(Root, VReg, ObjectVT); - ++ArgRegIdx; - } else { - needsLoad = true; + if (ArgRegIdx < NumArgRegs) { + const TargetRegisterClass *ArgRegClass; + + switch (ObjectVT.getSimpleVT()) { + default: { + cerr << "LowerFORMAL_ARGUMENTS Unhandled argument type: " + << ObjectVT.getMVTString() + << "\n"; + abort(); + } + case MVT::i8: + ArgRegClass = &SPU::R8CRegClass; + break; + case MVT::i16: + ArgRegClass = &SPU::R16CRegClass; + break; + case MVT::i32: + ArgRegClass = &SPU::R32CRegClass; + break; + case MVT::i64: + ArgRegClass = &SPU::R64CRegClass; + break; + case MVT::f32: + ArgRegClass = &SPU::R32FPRegClass; + break; + case MVT::f64: + ArgRegClass = &SPU::R64FPRegClass; + break; + case MVT::v2f64: + case MVT::v4f32: + case MVT::v2i64: + case MVT::v4i32: + case MVT::v8i16: + case MVT::v16i8: + ArgRegClass = &SPU::VECREGRegClass; + ++ArgRegIdx; + break; } - break; - } - // We need to load the argument to a virtual register if we determined above - // that we ran out of physical registers of the appropriate type - if (needsLoad) { + unsigned VReg = RegInfo.createVirtualRegister(ArgRegClass); + RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); + ArgVal = DAG.getCopyFromReg(Root, VReg, ObjectVT); + ++ArgRegIdx; + } else { + // We need to load the argument to a virtual register if we determined + // above that we ran out of physical registers of the appropriate type + // or we're forced to do vararg int FI = MFI->CreateFixedObject(ObjSize, ArgOffset); SDValue FIN = DAG.getFrameIndex(FI, PtrVT); ArgVal = DAG.getLoad(ObjectVT, Root, FIN, NULL, 0); @@ -1041,30 +997,31 @@ } ArgValues.push_back(ArgVal); + // Update the chain + Root = ArgVal.getOperand(0); } - // If the function takes variable number of arguments, make a frame index for - // the start of the first vararg value... for expansion of llvm.va_start. + // vararg handling: if (isVarArg) { - VarArgsFrameIndex = MFI->CreateFixedObject(PtrVT.getSizeInBits()/8, - ArgOffset); - SDValue FIN = DAG.getFrameIndex(VarArgsFrameIndex, PtrVT); - // If this function is vararg, store any remaining integer argument regs to - // their spots on the stack so that they may be loaded by deferencing the - // result of va_next. - SmallVector MemOps; + // unsigned int ptr_size = PtrVT.getSizeInBits() / 8; + // We will spill (79-3)+1 registers to the stack + SmallVector MemOps; + + // Create the frame slot + for (; ArgRegIdx != NumArgRegs; ++ArgRegIdx) { - unsigned VReg = RegInfo.createVirtualRegister(&SPU::GPRCRegClass); - RegInfo.addLiveIn(ArgRegs[ArgRegIdx], VReg); - SDValue Val = DAG.getCopyFromReg(Root, VReg, PtrVT); - SDValue Store = DAG.getStore(Val.getValue(1), Val, FIN, NULL, 0); + VarArgsFrameIndex = MFI->CreateFixedObject(StackSlotSize, ArgOffset); + SDValue FIN = DAG.getFrameIndex(VarArgsFrameIndex, PtrVT); + SDValue ArgVal = DAG.getRegister(ArgRegs[ArgRegIdx], MVT::v16i8); + SDValue Store = DAG.getStore(Root, ArgVal, FIN, NULL, 0); + Root = Store.getOperand(0); MemOps.push_back(Store); - // Increment the address by four for the next argument to store - SDValue PtrOff = DAG.getConstant(PtrVT.getSizeInBits()/8, PtrVT); - FIN = DAG.getNode(ISD::ADD, PtrOff.getValueType(), FIN, PtrOff); + + // Increment address by stack slot size for the next stored argument + ArgOffset += StackSlotSize; } if (!MemOps.empty()) - Root = DAG.getNode(ISD::TokenFactor, MVT::Other,&MemOps[0],MemOps.size()); + Root = DAG.getNode(ISD::TokenFactor,MVT::Other,&MemOps[0],MemOps.size()); } ArgValues.push_back(Root); @@ -1093,10 +1050,6 @@ LowerCALL(SDValue Op, SelectionDAG &DAG, const SPUSubtarget *ST) { CallSDNode *TheCall = cast(Op.getNode()); SDValue Chain = TheCall->getChain(); -#if 0 - bool isVarArg = TheCall->isVarArg(); - bool isTailCall = TheCall->isTailCall(); -#endif SDValue Callee = TheCall->getCallee(); unsigned NumOps = TheCall->getNumArgs(); unsigned StackSlotSize = SPUFrameInfo::stackSlotSize(); Modified: llvm/trunk/test/CodeGen/CellSPU/call.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/call.ll?rev=58415&r1=58414&r2=58415&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CellSPU/call.ll (original) +++ llvm/trunk/test/CodeGen/CellSPU/call.ll Wed Oct 29 20:51:48 2008 @@ -1,6 +1,7 @@ ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s ; RUN: grep brsl %t1.s | count 1 ; RUN: grep brasl %t1.s | count 1 +; RUN: grep stqd %t1.s | count 81 target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128" target triple = "spu" @@ -18,3 +19,10 @@ entry: ret i32 0 } + +; vararg call: ensure that all caller-saved registers are spilled to the +; stack: +define i32 @stub_2(...) { +entry: + ret i32 0 +} From sabre at nondot.org Wed Oct 29 22:58:17 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 30 Oct 2008 03:58:17 -0000 Subject: [llvm-commits] [llvm] r58416 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200810300358.m9U3wIYT015590@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 29 22:58:13 2008 New Revision: 58416 URL: http://llvm.org/viewvc/llvm-project?rev=58416&view=rev Log: mention fortran status. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=58416&r1=58415&r2=58416&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Wed Oct 29 22:58:13 2008 @@ -811,6 +811,19 @@
+ + + +
+
  • Fortran support generally works, but there are still several unresolved bugs + in Bugzilla. Please see the tools/gfortran component for details.
  • + +
  • The Fortran front-end currently does not build on Darwin (without tweaks) + due to unresolved dependencies on the C front-end.
  • + +
    From tonic at nondot.org Thu Oct 30 00:55:00 2008 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 30 Oct 2008 05:55:00 -0000 Subject: [llvm-commits] [llvm] r58423 - in /llvm/branches/release_24: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-10-27-StackRealignment.ll Message-ID: <200810300555.m9U5t1bu020950@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Oct 30 00:55:00 2008 New Revision: 58423 URL: http://llvm.org/viewvc/llvm-project?rev=58423&view=rev Log: Merge from mainline. Fix a nasty miscompilation of 176.gcc on linux/x86 where we synthesized a memset using 16-byte XMM stores, but where the stack realignment code didn't work. Until it does (PR2962) disable use of xmm regs in memcpy and memset formation for linux and other targets with insufficiently aligned stacks. This is part of PR2888 Added: llvm/branches/release_24/test/CodeGen/X86/2008-10-27-StackRealignment.ll - copied unchanged from r58317, llvm/trunk/test/CodeGen/X86/2008-10-27-StackRealignment.ll Modified: llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp?rev=58423&r1=58422&r2=58423&view=diff ============================================================================== --- llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp Thu Oct 30 00:55:00 2008 @@ -837,10 +837,15 @@ MVT X86TargetLowering::getOptimalMemOpType(uint64_t Size, unsigned Align, bool isSrcConst, bool isSrcStr) const { - if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16) - return MVT::v4i32; - if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16) - return MVT::v4f32; + // FIXME: This turns off use of xmm stores for memset/memcpy on targets like + // linux. This is because the stack realignment code can't handle certain + // cases like PR2962. This should be removed when PR2962 is fixed. + if (Subtarget->getStackAlignment() >= 16) { + if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16) + return MVT::v4i32; + if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16) + return MVT::v4f32; + } if (Subtarget->is64Bit() && Size >= 8) return MVT::i64; return MVT::i32; From tonic at nondot.org Thu Oct 30 01:00:18 2008 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 30 Oct 2008 06:00:18 -0000 Subject: [llvm-commits] [llvm] r58424 - /llvm/branches/release_24/lib/Support/raw_ostream.cpp Message-ID: <200810300600.m9U60I7G021221@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Oct 30 01:00:18 2008 New Revision: 58424 URL: http://llvm.org/viewvc/llvm-project?rev=58424&view=rev Log: Merge from mainline. fix PR2953, an off-by-one error handling formatted i/o. Thanks to T?r?k Edwin for the awesome reduced testcase. Modified: llvm/branches/release_24/lib/Support/raw_ostream.cpp Modified: llvm/branches/release_24/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/Support/raw_ostream.cpp?rev=58424&r1=58423&r2=58424&view=diff ============================================================================== --- llvm/branches/release_24/lib/Support/raw_ostream.cpp (original) +++ llvm/branches/release_24/lib/Support/raw_ostream.cpp Thu Oct 30 01:00:18 2008 @@ -175,7 +175,7 @@ unsigned BytesUsed = Fmt.print(&V[0], NextBufferSize); // If BytesUsed fit into the vector, we win. - if (BytesUsed < NextBufferSize) + if (BytesUsed <= NextBufferSize) return write(&V[0], BytesUsed); // Otherwise, try again with a new size. From tonic at nondot.org Thu Oct 30 01:06:32 2008 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 30 Oct 2008 06:06:32 -0000 Subject: [llvm-commits] [llvm] r58425 - in /llvm/branches/release_24/lib: CodeGen/LLVMTargetMachine.cpp Target/X86/X86TargetMachine.cpp Message-ID: <200810300606.m9U66WRF021589@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Oct 30 01:06:32 2008 New Revision: 58425 URL: http://llvm.org/viewvc/llvm-project?rev=58425&view=rev Log: Merge from mainline. Move the code that adds the DeadMachineInstructionElimPass from target-independent code to target-specific code. This prevents it from running on targets that aren't using fast-isel. In addition to saving compile time, this addresses the problem that not all targets are prepared for it. In order to use this pass, all instructions must declare all their fixed uses and defs of physical registers. Modified: llvm/branches/release_24/lib/CodeGen/LLVMTargetMachine.cpp llvm/branches/release_24/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/branches/release_24/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/CodeGen/LLVMTargetMachine.cpp?rev=58425&r1=58424&r2=58425&view=diff ============================================================================== --- llvm/branches/release_24/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/branches/release_24/lib/CodeGen/LLVMTargetMachine.cpp Thu Oct 30 01:06:32 2008 @@ -189,10 +189,6 @@ if (PrintMachineCode) PM.add(createMachineFunctionPrinterPass(cerr)); - // If we're using Fast-ISel, clean up the mess. - if (EnableFastISel) - PM.add(createDeadMachineInstructionElimPass()); - if (EnableLICM) PM.add(createMachineLICMPass()); Modified: llvm/branches/release_24/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/Target/X86/X86TargetMachine.cpp?rev=58425&r1=58424&r2=58425&view=diff ============================================================================== --- llvm/branches/release_24/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/branches/release_24/lib/Target/X86/X86TargetMachine.cpp Thu Oct 30 01:06:32 2008 @@ -174,6 +174,11 @@ bool X86TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) { // Install an instruction selector. PM.add(createX86ISelDag(*this, Fast)); + + // If we're using Fast-ISel, clean up the mess. + if (EnableFastISel) + PM.add(createDeadMachineInstructionElimPass()); + return false; } From wangmp at apple.com Thu Oct 30 03:01:46 2008 From: wangmp at apple.com (Mon P Wang) Date: Thu, 30 Oct 2008 08:01:46 -0000 Subject: [llvm-commits] [llvm] r58426 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h Message-ID: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> Author: wangmp Date: Thu Oct 30 03:01:45 2008 New Revision: 58426 URL: http://llvm.org/viewvc/llvm-project?rev=58426&view=rev Log: Add initial support for vector widening. Logic is set to widen for X86. One will only see an effect if legalizetype is not active. Will move support to LegalizeType soon. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=58426&r1=58425&r2=58426&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Thu Oct 30 03:01:45 2008 @@ -164,7 +164,10 @@ LegalizeAction getTypeAction(MVT VT) const { if (VT.isExtended()) { - if (VT.isVector()) return Expand; + if (VT.isVector()) { + // First try vector widening + return Promote; + } if (VT.isInteger()) // First promote to a power-of-two size, then expand if necessary. return VT == VT.getRoundIntegerType() ? Expand : Promote; @@ -261,6 +264,13 @@ unsigned &NumIntermediates, MVT &RegisterVT) const; + /// getWidenVectorType: given a vector type, returns the type to widen to + /// (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself. + /// If there is no vector type that we want to widen to, returns MVT::Other + /// When and were to widen is target dependent based on the cost of + /// scalarizing vs using the wider vector type. + virtual MVT getWidenVectorType(MVT VT); + typedef std::vector::const_iterator legal_fpimm_iterator; legal_fpimm_iterator legal_fpimm_begin() const { return LegalFPImmediates.begin(); @@ -1455,7 +1465,7 @@ MVT TransformToType[MVT::LAST_VALUETYPE]; // Defines the capacity of the TargetLowering::OpActions table - static const int OpActionsCapacity = 212; + static const int OpActionsCapacity = 218; /// OpActions - For each operation and each value type, keep a LegalizeAction /// that indicates how instruction selection should deal with the operation. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=58426&r1=58425&r2=58426&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 30 03:01:45 2008 @@ -86,12 +86,12 @@ DenseMap PromotedNodes; /// ExpandedNodes - For nodes that need to be expanded this map indicates - /// which which operands are the expanded version of the input. This allows + /// which operands are the expanded version of the input. This allows /// us to avoid expanding the same node more than once. DenseMap > ExpandedNodes; /// SplitNodes - For vector nodes that need to be split, this map indicates - /// which which operands are the split version of the input. This allows us + /// which operands are the split version of the input. This allows us /// to avoid splitting the same node more than once. std::map > SplitNodes; @@ -100,6 +100,11 @@ /// processed to the result. std::map ScalarizedNodes; + /// WidenNodes - For nodes that need to be widen from one vector type to + /// another, this contains the mapping of ones we have already widen. This + /// allows us to avoid widening more than once. + std::map WidenNodes; + void AddLegalizedOperand(SDValue From, SDValue To) { LegalizedNodes.insert(std::make_pair(From, To)); // If someone requests legalization of the new node, return itself. @@ -112,6 +117,12 @@ // If someone requests legalization of the new node, return itself. LegalizedNodes.insert(std::make_pair(To, To)); } + void AddWidenOperand(SDValue From, SDValue To) { + bool isNew = WidenNodes.insert(std::make_pair(From, To)).second; + assert(isNew && "Got into the map somehow?"); + // If someone requests legalization of the new node, return itself. + LegalizedNodes.insert(std::make_pair(To, To)); + } public: explicit SelectionDAGLegalize(SelectionDAG &DAG); @@ -169,6 +180,15 @@ /// types. void ExpandOp(SDValue O, SDValue &Lo, SDValue &Hi); + /// WidenVectorOp - Widen a vector operation in order to do the computation + /// in a wider type given to a wider type given by WidenVT (e.g., v3i32 to + /// v4i32). The produced value will have the correct value for the existing + /// elements but no guarantee is made about the new elements at the end of + /// the vector: it may be zero, sign-extended, or garbage. This is useful + /// when we have instruction operating on an illegal vector type and we want + /// to widen it to do the computation on a legal wider vector type. + SDValue WidenVectorOp(SDValue Op, MVT WidenVT); + /// SplitVectorOp - Given an operand of vector type, break it down into /// two smaller values. void SplitVectorOp(SDValue O, SDValue &Lo, SDValue &Hi); @@ -178,6 +198,62 @@ /// scalar (e.g. f32) value. SDValue ScalarizeVectorOp(SDValue O); + /// Useful 16 element vector used to pass operands for widening + typedef SmallVector SDValueVector; + + /// LoadWidenVectorOp - Load a vector for a wider type. Returns true if + /// the LdChain contains a single load and false if it contains a token + /// factor for multiple loads. It takes + /// Result: location to return the result + /// LdChain: location to return the load chain + /// Op: load operation to widen + /// NVT: widen vector result type we want for the load + bool LoadWidenVectorOp(SDValue& Result, SDValue& LdChain, + SDValue Op, MVT NVT); + + /// Helper genWidenVectorLoads - Helper function to generate a set of + /// loads to load a vector with a resulting wider type. It takes + /// LdChain: list of chains for the load we have generated + /// Chain: incoming chain for the ld vector + /// BasePtr: base pointer to load from + /// SV: memory disambiguation source value + /// SVOffset: memory disambiugation offset + /// Alignment: alignment of the memory + /// isVolatile: volatile load + /// LdWidth: width of memory that we want to load + /// ResType: the wider result result type for the resulting loaded vector + SDValue genWidenVectorLoads(SDValueVector& LdChain, SDValue Chain, + SDValue BasePtr, const Value *SV, + int SVOffset, unsigned Alignment, + bool isVolatile, unsigned LdWidth, + MVT ResType); + + /// StoreWidenVectorOp - Stores a widen vector into non widen memory + /// location. It takes + /// ST: store node that we want to replace + /// Chain: incoming store chain + /// BasePtr: base address of where we want to store into + SDValue StoreWidenVectorOp(StoreSDNode *ST, SDValue Chain, + SDValue BasePtr); + + /// Helper genWidenVectorStores - Helper function to generate a set of + /// stores to store a widen vector into non widen memory + // It takes + // StChain: list of chains for the stores we have generated + // Chain: incoming chain for the ld vector + // BasePtr: base pointer to load from + // SV: memory disambiguation source value + // SVOffset: memory disambiugation offset + // Alignment: alignment of the memory + // isVolatile: volatile lod + // ValOp: value to store + // StWidth: width of memory that we want to store + void genWidenVectorStores(SDValueVector& StChain, SDValue Chain, + SDValue BasePtr, const Value *SV, + int SVOffset, unsigned Alignment, + bool isVolatile, SDValue ValOp, + unsigned StWidth); + /// isShuffleLegal - Return non-null if a vector shuffle is legal with the /// specified mask and type. Targets can specify exactly which masks they /// support and the code generator is tasked with not creating illegal masks. @@ -300,6 +376,7 @@ PromotedNodes.clear(); SplitNodes.clear(); ScalarizedNodes.clear(); + WidenNodes.clear(); // Remove dead nodes now. DAG.RemoveDeadNodes(); @@ -403,14 +480,27 @@ return false; } -/// HandleOp - Legalize, Promote, or Expand the specified operand as +/// HandleOp - Legalize, Promote, Widen, or Expand the specified operand as /// appropriate for its type. void SelectionDAGLegalize::HandleOp(SDValue Op) { MVT VT = Op.getValueType(); switch (getTypeAction(VT)) { default: assert(0 && "Bad type action!"); case Legal: (void)LegalizeOp(Op); break; - case Promote: (void)PromoteOp(Op); break; + case Promote: + if (!VT.isVector()) { + (void)PromoteOp(Op); + break; + } + else { + // See if we can widen otherwise use Expand to either scalarize or split + MVT WidenVT = TLI.getWidenVectorType(VT); + if (WidenVT != MVT::Other) { + (void) WidenVectorOp(Op, WidenVT); + break; + } + // else fall thru to expand since we can't widen the vector + } case Expand: if (!VT.isVector()) { // If this is an illegal scalar, expand it into its two component @@ -424,7 +514,7 @@ // scalar operation. (void)ScalarizeVectorOp(Op); } else { - // Otherwise, this is an illegal multiple element vector. + // This is an illegal multiple element vector. // Split it in half and legalize both parts. SDValue X, Y; SplitVectorOp(Op, X, Y); @@ -742,7 +832,7 @@ // Store the vector. SDValue Ch = DAG.getStore(DAG.getEntryNode(), Tmp1, StackPtr, - PseudoSourceValue::getFixedStack(SPFI), 0); + PseudoSourceValue::getFixedStack(SPFI), 0); // Truncate or zero extend offset to target pointer type. unsigned CastOpc = IdxVT.bitsGT(PtrVT) ? ISD::TRUNCATE : ISD::ZERO_EXTEND; @@ -1417,6 +1507,12 @@ default: assert(0 && "Cannot expand insert element operand"); case Legal: Tmp2 = LegalizeOp(Node->getOperand(1)); break; case Promote: Tmp2 = PromoteOp(Node->getOperand(1)); break; + case Expand: + // FIXME: An alternative would be to check to see if the target is not + // going to custom lower this operation, we could bitcast to half elt + // width and perform two inserts at that width, if that is legal. + Tmp2 = Node->getOperand(1); + break; } Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3); @@ -1432,6 +1528,8 @@ break; } // FALLTHROUGH + case TargetLowering::Promote: + // Fall thru for vector case case TargetLowering::Expand: { // If the insert index is a constant, codegen this as a scalar_to_vector, // then a shuffle that inserts it into the right position in the vector. @@ -1574,6 +1672,26 @@ Result = ExpandEXTRACT_SUBVECTOR(Result); break; + case ISD::CONCAT_VECTORS: { + // Use extract/insert/build vector for now. We might try to be + // more clever later. + MVT PtrVT = TLI.getPointerTy(); + SmallVector Ops; + unsigned NumOperands = Node->getNumOperands(); + for (unsigned i=0; i < NumOperands; ++i) { + SDValue SubOp = Node->getOperand(i); + MVT VVT = SubOp.getNode()->getValueType(0); + MVT EltVT = VVT.getVectorElementType(); + unsigned NumSubElem = VVT.getVectorNumElements(); + for (unsigned j=0; j < NumSubElem; ++j) { + Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EltVT, SubOp, + DAG.getConstant(j, PtrVT))); + } + } + return LegalizeOp(DAG.getNode(ISD::BUILD_VECTOR, Node->getValueType(0), + &Ops[0], Ops.size())); + } + case ISD::CALLSEQ_START: { SDNode *CallEnd = FindCallEndFromCallStart(Node); @@ -2429,14 +2547,16 @@ break; } case Promote: - // Truncate the value and store the result. - Tmp3 = PromoteOp(ST->getValue()); - Result = DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, ST->getMemoryVT(), - isVolatile, Alignment); - break; - - case Expand: + if (!ST->getMemoryVT().isVector()) { + // Truncate the value and store the result. + Tmp3 = PromoteOp(ST->getValue()); + Result = DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, ST->getMemoryVT(), + isVolatile, Alignment); + break; + } + // Fall thru to expand for vector + case Expand: { unsigned IncrementSize = 0; SDValue Lo, Hi; @@ -2470,9 +2590,18 @@ Result = LegalizeOp(Result); break; } else { - SplitVectorOp(ST->getValue(), Lo, Hi); - IncrementSize = Lo.getNode()->getValueType(0).getVectorNumElements() * - EVT.getSizeInBits()/8; + // Check if we have widen this node with another value + std::map::iterator I = + WidenNodes.find(ST->getValue()); + if (I != WidenNodes.end()) { + Result = StoreWidenVectorOp(ST, Tmp1, Tmp2); + break; + } + else { + SplitVectorOp(ST->getValue(), Lo, Hi); + IncrementSize = Lo.getNode()->getValueType(0).getVectorNumElements() * + EVT.getSizeInBits()/8; + } } } else { ExpandOp(ST->getValue(), Lo, Hi); @@ -2501,6 +2630,7 @@ SVOffset, isVolatile, Alignment); Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); break; + } // case Expand } } else { switch (getTypeAction(ST->getValue().getValueType())) { @@ -2508,9 +2638,12 @@ Tmp3 = LegalizeOp(ST->getValue()); break; case Promote: - // We can promote the value, the truncstore will still take care of it. - Tmp3 = PromoteOp(ST->getValue()); - break; + if (!ST->getValue().getValueType().isVector()) { + // We can promote the value, the truncstore will still take care of it. + Tmp3 = PromoteOp(ST->getValue()); + break; + } + // Vector case falls through to expand case Expand: // Just store the low part. This may become a non-trunc store, so make // sure to use getTruncStore, not UpdateNodeOperands below. @@ -2709,6 +2842,7 @@ Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the condition. break; case Promote: { + assert(!Node->getOperand(0).getValueType().isVector() && "not possible"); Tmp1 = PromoteOp(Node->getOperand(0)); // Promote the condition. // Make sure the condition is either zero or one. unsigned BitWidth = Tmp1.getValueSizeInBits(); @@ -2966,7 +3100,7 @@ } Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); - + switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { default: assert(0 && "BinOp legalize operation not supported"); case TargetLowering::Legal: break; @@ -2979,7 +3113,7 @@ // Fall through if the custom lower can't deal with the operation case TargetLowering::Expand: { MVT VT = Op.getValueType(); - + // See if multiply or divide can be lowered using two-result operations. SDVTList VTs = DAG.getVTList(VT, VT); if (Node->getOpcode() == ISD::MUL) { @@ -3030,7 +3164,7 @@ 0); break; } - + // Check to see if we have a libcall for this operator. RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; bool isSigned = false; @@ -3039,7 +3173,7 @@ case ISD::SDIV: if (VT == MVT::i32) { LC = Node->getOpcode() == ISD::UDIV - ? RTLIB::UDIV_I32 : RTLIB::SDIV_I32; + ? RTLIB::UDIV_I32 : RTLIB::SDIV_I32; isSigned = Node->getOpcode() == ISD::SDIV; } break; @@ -3058,7 +3192,7 @@ Result = ExpandLibCall(LC, Node, isSigned, Dummy); break; } - + assert(Node->getValueType(0).isVector() && "Cannot expand this binary operator!"); // Expand the operation into a bunch of nasty scalar code. @@ -4548,6 +4682,9 @@ return Op; } break; + case TargetLowering::Promote: + assert(TVT.isVector() && "not vector type"); + // fall thru to expand since vectors are by default are promote case TargetLowering::Expand: break; } @@ -5348,7 +5485,7 @@ Args.push_back(Entry); } SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC), - TLI.getPointerTy()); + TLI.getPointerTy()); // Splice the libcall in wherever FindInputOutputChains tells us to. const Type *RetTy = Node->getValueType(0).getTypeForMVT(); @@ -5958,7 +6095,6 @@ return ExpandOp(Hi, Lo, Hi); return ExpandOp(Lo, Lo, Hi); case ISD::EXTRACT_VECTOR_ELT: - assert(VT==MVT::i64 && "Do not know how to expand this operator!"); // ExpandEXTRACT_VECTOR_ELT tolerates invalid result types. Lo = ExpandEXTRACT_VECTOR_ELT(Op); return ExpandOp(Lo, Lo, Hi); @@ -7423,6 +7559,690 @@ } +SDValue SelectionDAGLegalize::WidenVectorOp(SDValue Op, MVT WidenVT) { + std::map::iterator I = WidenNodes.find(Op); + if (I != WidenNodes.end()) return I->second; + + MVT VT = Op.getValueType(); + assert(VT.isVector() && "Cannot widen non-vector type!"); + + SDValue Result; + SDNode *Node = Op.getNode(); + MVT EVT = VT.getVectorElementType(); + + unsigned NumElts = VT.getVectorNumElements(); + unsigned NewNumElts = WidenVT.getVectorNumElements(); + assert(NewNumElts > NumElts && "Cannot widen to smaller type!"); + assert(NewNumElts < 17); + + // When widen is called, it is assumed that it is more efficient to use a + // wide type. The default action is to widen to operation to a wider legal + // vector type and then do the operation if it is legal by calling LegalizeOp + // again. If there is no vector equivalent, we will unroll the operation, do + // it, and rebuild the vector. If most of the operations are vectorizible to + // the legal type, the resulting code will be more efficient. If this is not + // the case, the resulting code will preform badly as we end up generating + // code to pack/unpack the results. It is the function that calls widen + // that is responsible for seeing this doesn't happen. For some cases, we + // have decided that it is not worth widening so we just split the operation. + switch (Node->getOpcode()) { + default: +#ifndef NDEBUG + Node->dump(&DAG); +#endif + assert(0 && "Unexpected operation in WidenVectorOp!"); + break; + case ISD::CopyFromReg: + assert(0 && "CopyFromReg must be legal!"); + case ISD::UNDEF: + case ISD::Constant: + case ISD::ConstantFP: + // To build a vector of these elements, clients should call BuildVector + // and with each element instead of creating a node with a vector type + assert(0 && "Unexpected operation in WidenVectorOp!"); + case ISD::VAARG: + // Variable Arguments with vector types doesn't make any sense to me + assert(0 && "Unexpected operation in WidenVectorOp!"); + break; + case ISD::BUILD_VECTOR: { + // Build a vector with undefined for the new nodes + SDValueVector NewOps(Node->op_begin(), Node->op_end()); + for (unsigned i = NumElts; i < NewNumElts; ++i) { + NewOps.push_back(DAG.getNode(ISD::UNDEF,EVT)); + } + Result = DAG.getNode(ISD::BUILD_VECTOR, WidenVT, &NewOps[0], NewOps.size()); + break; + } + case ISD::INSERT_VECTOR_ELT: { + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); + Result = DAG.getNode(ISD::INSERT_VECTOR_ELT, WidenVT, Tmp1, + Node->getOperand(1), Node->getOperand(2)); + break; + } + case ISD::VECTOR_SHUFFLE: { + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); + SDValue Tmp2 = WidenVectorOp(Node->getOperand(1), WidenVT); + // VECTOR_SHUFFLE 3rd operand must be a constant build vector that is + // used as permutation array. We build the vector here instead of widening + // because we don't want to legalize and have it turned to something else. + SDValue PermOp = Node->getOperand(2); + SDValueVector NewOps; + MVT PVT = PermOp.getValueType().getVectorElementType(); + for (unsigned i = 0; i < NumElts; ++i) { + if (PermOp.getOperand(i).getOpcode() == ISD::UNDEF) { + NewOps.push_back(PermOp.getOperand(i)); + } else { + unsigned Idx = + cast(PermOp.getOperand(i))->getZExtValue(); + if (Idx < NumElts) { + NewOps.push_back(PermOp.getOperand(i)); + } + else { + NewOps.push_back(DAG.getConstant(Idx + NewNumElts - NumElts, + PermOp.getOperand(i).getValueType())); + } + } + } + for (unsigned i = NumElts; i < NewNumElts; ++i) { + NewOps.push_back(DAG.getNode(ISD::UNDEF,PVT)); + } + + SDValue Tmp3 = DAG.getNode(ISD::BUILD_VECTOR, + MVT::getVectorVT(PVT, NewOps.size()), + &NewOps[0], NewOps.size()); + + Result = DAG.getNode(ISD::VECTOR_SHUFFLE, WidenVT, Tmp1, Tmp2, Tmp3); + break; + } + case ISD::LOAD: { + // If the load widen returns true, we can use a single load for the + // vector. Otherwise, it is returning a token factor for multiple + // loads. + SDValue TFOp; + if (LoadWidenVectorOp(Result, TFOp, Op, WidenVT)) + AddLegalizedOperand(Op.getValue(1), LegalizeOp(TFOp.getValue(1))); + else + AddLegalizedOperand(Op.getValue(1), LegalizeOp(TFOp.getValue(0))); + break; + } + + case ISD::BIT_CONVERT: { + SDValue Tmp1 = Node->getOperand(0); + // Converts between two different types so we need to determine + // the correct widen type for the input operand. + MVT TVT = Tmp1.getValueType(); + assert(TVT.isVector() && "can not widen non vector type"); + MVT TEVT = TVT.getVectorElementType(); + assert(WidenVT.getSizeInBits() % EVT.getSizeInBits() == 0 && + "can not widen bit bit convert that are not multiple of element type"); + MVT TWidenVT = MVT::getVectorVT(TEVT, + WidenVT.getSizeInBits()/EVT.getSizeInBits()); + Tmp1 = WidenVectorOp(Tmp1, TWidenVT); + assert(Tmp1.getValueType().getSizeInBits() == WidenVT.getSizeInBits()); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1); + + TargetLowering::LegalizeAction action = + TLI.getOperationAction(Node->getOpcode(), WidenVT); + switch (action) { + default: assert(0 && "action not supported"); + case TargetLowering::Legal: + break; + case TargetLowering::Promote: + // We defer the promotion to when we legalize the op + break; + case TargetLowering::Expand: + // Expand the operation into a bunch of nasty scalar code. + Result = LegalizeOp(UnrollVectorOp(Result)); + break; + } + break; + } + + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: { + SDValue Tmp1 = Node->getOperand(0); + // Converts between two different types so we need to determine + // the correct widen type for the input operand. + MVT TVT = Tmp1.getValueType(); + assert(TVT.isVector() && "can not widen non vector type"); + MVT TEVT = TVT.getVectorElementType(); + MVT TWidenVT = MVT::getVectorVT(TEVT, NewNumElts); + Tmp1 = WidenVectorOp(Tmp1, TWidenVT); + assert(Tmp1.getValueType().getVectorNumElements() == NewNumElts); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1); + + TargetLowering::LegalizeAction action = + TLI.getOperationAction(Node->getOpcode(), WidenVT); + switch (action) { + default: assert(0 && "action not supported"); + case TargetLowering::Legal: + break; + case TargetLowering::Promote: + // We defer the promotion to when we legalize the op + break; + case TargetLowering::Expand: + // Expand the operation into a bunch of nasty scalar code. + Result = LegalizeOp(UnrollVectorOp(Result)); + break; + } + break; + } + + case ISD::FP_EXTEND: + assert(0 && "Case not implemented. Dynamically dead with 2 FP types!"); + case ISD::TRUNCATE: + case ISD::SIGN_EXTEND: + case ISD::ZERO_EXTEND: + case ISD::ANY_EXTEND: + case ISD::FP_ROUND: + case ISD::SIGN_EXTEND_INREG: + case ISD::FABS: + case ISD::FNEG: + case ISD::FSQRT: + case ISD::FSIN: + case ISD::FCOS: { + // Unary op widening + SDValue Tmp1; + TargetLowering::LegalizeAction action = + TLI.getOperationAction(Node->getOpcode(), WidenVT); + + Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); + assert(Tmp1.getValueType() == WidenVT); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1); + switch (action) { + default: assert(0 && "action not supported"); + case TargetLowering::Legal: + break; + case TargetLowering::Promote: + // We defer the promotion to when we legalize the op + break; + case TargetLowering::Expand: + // Expand the operation into a bunch of nasty scalar code. + Result = LegalizeOp(UnrollVectorOp(Result)); + break; + } + break; + } + case ISD::FPOW: + case ISD::FPOWI: + case ISD::ADD: + case ISD::SUB: + case ISD::MUL: + case ISD::MULHS: + case ISD::MULHU: + case ISD::AND: + case ISD::OR: + case ISD::XOR: + case ISD::FADD: + case ISD::FSUB: + case ISD::FMUL: + case ISD::SDIV: + case ISD::SREM: + case ISD::FDIV: + case ISD::FREM: + case ISD::FCOPYSIGN: + case ISD::UDIV: + case ISD::UREM: + case ISD::BSWAP: { + // Binary op widening + TargetLowering::LegalizeAction action = + TLI.getOperationAction(Node->getOpcode(), WidenVT); + + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); + SDValue Tmp2 = WidenVectorOp(Node->getOperand(1), WidenVT); + assert(Tmp1.getValueType() == WidenVT && Tmp2.getValueType() == WidenVT); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1, Tmp2); + switch (action) { + default: assert(0 && "action not supported"); + case TargetLowering::Legal: + break; + case TargetLowering::Promote: + // We defer the promotion to when we legalize the op + break; + case TargetLowering::Expand: + // Expand the operation into a bunch of nasty scalar code by first + // Widening to the right type and then unroll the beast. + Result = LegalizeOp(UnrollVectorOp(Result)); + break; + } + break; + } + + case ISD::SHL: + case ISD::SRA: + case ISD::SRL: { + // Binary op with one non vector operand + TargetLowering::LegalizeAction action = + TLI.getOperationAction(Node->getOpcode(), WidenVT); + + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); + assert(Tmp1.getValueType() == WidenVT); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1, Node->getOperand(1)); + switch (action) { + default: assert(0 && "action not supported"); + case TargetLowering::Legal: + break; + case TargetLowering::Promote: + // We defer the promotion to when we legalize the op + break; + case TargetLowering::Expand: + // Expand the operation into a bunch of nasty scalar code. + Result = LegalizeOp(UnrollVectorOp(Result)); + break; + } + break; + } + case ISD::EXTRACT_VECTOR_ELT: { + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); + assert(Tmp1.getValueType() == WidenVT); + Result = DAG.getNode(Node->getOpcode(), EVT, Tmp1, Node->getOperand(1)); + break; + } + case ISD::CONCAT_VECTORS: { + // We concurrently support only widen on a multiple of the incoming vector. + // We could widen on a multiple of the incoming operand if necessary. + unsigned NumConcat = NewNumElts / NumElts; + assert(NewNumElts % NumElts == 0 && "Can widen only a multiple of vector"); + std::vector UnOps(NumElts, DAG.getNode(ISD::UNDEF, + VT.getVectorElementType())); + SDValue UndefVal = DAG.getNode(ISD::BUILD_VECTOR, VT, + &UnOps[0], UnOps.size()); + SmallVector MOps; + MOps.push_back(Op); + for (unsigned i = 1; i != NumConcat; ++i) { + MOps.push_back(UndefVal); + } + Result = LegalizeOp(DAG.getNode(ISD::CONCAT_VECTORS, WidenVT, + &MOps[0], MOps.size())); + break; + } + case ISD::EXTRACT_SUBVECTOR: { + SDValue Tmp1; + + // The incoming vector might already be the proper type + if (Node->getOperand(0).getValueType() != WidenVT) + Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); + else + Tmp1 = Node->getOperand(0); + assert(Tmp1.getValueType() == WidenVT); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1, Node->getOperand(1)); + break; + } + + case ISD::SELECT: { + TargetLowering::LegalizeAction action = + TLI.getOperationAction(Node->getOpcode(), WidenVT); + + // Determine new condition widen type and widen + SDValue Cond1 = Node->getOperand(0); + MVT CondVT = Cond1.getValueType(); + assert(CondVT.isVector() && "can not widen non vector type"); + MVT CondEVT = CondVT.getVectorElementType(); + MVT CondWidenVT = MVT::getVectorVT(CondEVT, NewNumElts); + Cond1 = WidenVectorOp(Cond1, CondWidenVT); + assert(Cond1.getValueType() == CondWidenVT && "Condition not widen"); + + SDValue Tmp1 = WidenVectorOp(Node->getOperand(1), WidenVT); + SDValue Tmp2 = WidenVectorOp(Node->getOperand(2), WidenVT); + assert(Tmp1.getValueType() == WidenVT && Tmp2.getValueType() == WidenVT); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Cond1, Tmp1, Tmp2); + switch (action) { + default: assert(0 && "action not supported"); + case TargetLowering::Legal: + break; + case TargetLowering::Promote: + // We defer the promotion to when we legalize the op + break; + case TargetLowering::Expand: + // Expand the operation into a bunch of nasty scalar code by first + // Widening to the right type and then unroll the beast. + Result = LegalizeOp(UnrollVectorOp(Result)); + break; + } + break; + } + + case ISD::SELECT_CC: { + TargetLowering::LegalizeAction action = + TLI.getOperationAction(Node->getOpcode(), WidenVT); + + // Determine new condition widen type and widen + SDValue Cond1 = Node->getOperand(0); + SDValue Cond2 = Node->getOperand(1); + MVT CondVT = Cond1.getValueType(); + assert(CondVT.isVector() && "can not widen non vector type"); + assert(CondVT == Cond2.getValueType() && "mismatch lhs/rhs"); + MVT CondEVT = CondVT.getVectorElementType(); + MVT CondWidenVT = MVT::getVectorVT(CondEVT, NewNumElts); + Cond1 = WidenVectorOp(Cond1, CondWidenVT); + Cond2 = WidenVectorOp(Cond2, CondWidenVT); + assert(Cond1.getValueType() == CondWidenVT && + Cond2.getValueType() == CondWidenVT && "condition not widen"); + + SDValue Tmp1 = WidenVectorOp(Node->getOperand(2), WidenVT); + SDValue Tmp2 = WidenVectorOp(Node->getOperand(3), WidenVT); + assert(Tmp1.getValueType() == WidenVT && Tmp2.getValueType() == WidenVT && + "operands not widen"); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Cond1, Cond2, Tmp1, + Tmp2, Node->getOperand(4)); + switch (action) { + default: assert(0 && "action not supported"); + case TargetLowering::Legal: + break; + case TargetLowering::Promote: + // We defer the promotion to when we legalize the op + break; + case TargetLowering::Expand: + // Expand the operation into a bunch of nasty scalar code by first + // Widening to the right type and then unroll the beast. + Result = LegalizeOp(UnrollVectorOp(Result)); + break; + } + break; + break; + } + + case ISD::ATOMIC_CMP_SWAP_8: + case ISD::ATOMIC_CMP_SWAP_16: + case ISD::ATOMIC_CMP_SWAP_32: + case ISD::ATOMIC_CMP_SWAP_64: + case ISD::ATOMIC_LOAD_ADD_8: + case ISD::ATOMIC_LOAD_SUB_8: + case ISD::ATOMIC_LOAD_AND_8: + case ISD::ATOMIC_LOAD_OR_8: + case ISD::ATOMIC_LOAD_XOR_8: + case ISD::ATOMIC_LOAD_NAND_8: + case ISD::ATOMIC_LOAD_MIN_8: + case ISD::ATOMIC_LOAD_MAX_8: + case ISD::ATOMIC_LOAD_UMIN_8: + case ISD::ATOMIC_LOAD_UMAX_8: + case ISD::ATOMIC_SWAP_8: + case ISD::ATOMIC_LOAD_ADD_16: + case ISD::ATOMIC_LOAD_SUB_16: + case ISD::ATOMIC_LOAD_AND_16: + case ISD::ATOMIC_LOAD_OR_16: + case ISD::ATOMIC_LOAD_XOR_16: + case ISD::ATOMIC_LOAD_NAND_16: + case ISD::ATOMIC_LOAD_MIN_16: + case ISD::ATOMIC_LOAD_MAX_16: + case ISD::ATOMIC_LOAD_UMIN_16: + case ISD::ATOMIC_LOAD_UMAX_16: + case ISD::ATOMIC_SWAP_16: + case ISD::ATOMIC_LOAD_ADD_32: + case ISD::ATOMIC_LOAD_SUB_32: + case ISD::ATOMIC_LOAD_AND_32: + case ISD::ATOMIC_LOAD_OR_32: + case ISD::ATOMIC_LOAD_XOR_32: + case ISD::ATOMIC_LOAD_NAND_32: + case ISD::ATOMIC_LOAD_MIN_32: + case ISD::ATOMIC_LOAD_MAX_32: + case ISD::ATOMIC_LOAD_UMIN_32: + case ISD::ATOMIC_LOAD_UMAX_32: + case ISD::ATOMIC_SWAP_32: + case ISD::ATOMIC_LOAD_ADD_64: + case ISD::ATOMIC_LOAD_SUB_64: + case ISD::ATOMIC_LOAD_AND_64: + case ISD::ATOMIC_LOAD_OR_64: + case ISD::ATOMIC_LOAD_XOR_64: + case ISD::ATOMIC_LOAD_NAND_64: + case ISD::ATOMIC_LOAD_MIN_64: + case ISD::ATOMIC_LOAD_MAX_64: + case ISD::ATOMIC_LOAD_UMIN_64: + case ISD::ATOMIC_LOAD_UMAX_64: + case ISD::ATOMIC_SWAP_64: { + // For now, we assume that using vectors for these operations don't make + // much sense so we just split it. We return an empty result + SDValue X, Y; + SplitVectorOp(Op, X, Y); + return Result; + break; + } + + } // end switch (Node->getOpcode()) + + assert(Result.getNode() && "Didn't set a result!"); + if (Result != Op) + Result = LegalizeOp(Result); + + AddWidenOperand(Op, Result); + return Result; +} + +// Utility function to find a legal vector type and its associated element +// type from a preferred width and whose vector type must be the same size +// as the VVT. +// TLI: Target lowering used to determine legal types +// Width: Preferred width of element type +// VVT: Vector value type whose size we must match. +// Returns VecEVT and EVT - the vector type and its associated element type +static void FindWidenVecType(TargetLowering &TLI, unsigned Width, MVT VVT, + MVT& EVT, MVT& VecEVT) { + // We start with the preferred width, make it a power of 2 and see if + // we can find a vector type of that width. If not, we reduce it by + // another power of 2. If we have widen the type, a vector of bytes should + // always be legal. + assert(TLI.isTypeLegal(VVT)); + unsigned EWidth = Width + 1; + do { + assert(EWidth > 0); + EWidth = (1 << Log2_32(EWidth-1)); + EVT = MVT::getIntegerVT(EWidth); + unsigned NumEVT = VVT.getSizeInBits()/EWidth; + VecEVT = MVT::getVectorVT(EVT, NumEVT); + } while (!TLI.isTypeLegal(VecEVT) || + VVT.getSizeInBits() != VecEVT.getSizeInBits()); +} + +SDValue SelectionDAGLegalize::genWidenVectorLoads(SDValueVector& LdChain, + SDValue Chain, + SDValue BasePtr, + const Value *SV, + int SVOffset, + unsigned Alignment, + bool isVolatile, + unsigned LdWidth, + MVT ResType) { + // We assume that we have good rules to handle loading power of two loads so + // we break down the operations to power of 2 loads. The strategy is to + // load the largest power of 2 that we can easily transform to a legal vector + // and then insert into that vector, and the cast the result into the legal + // vector that we want. This avoids unnecessary stack converts. + // TODO: If the Ldwidth is legal, alignment is the same as the LdWidth, and + // the load is nonvolatile, we an use a wider load for the value. + // Find a vector length we can load a large chunk + MVT EVT, VecEVT; + unsigned EVTWidth; + FindWidenVecType(TLI, LdWidth, ResType, EVT, VecEVT); + EVTWidth = EVT.getSizeInBits(); + + SDValue LdOp = DAG.getLoad(EVT, Chain, BasePtr, SV, SVOffset, + isVolatile, Alignment); + SDValue VecOp = DAG.getNode(ISD::SCALAR_TO_VECTOR, VecEVT, LdOp); + LdChain.push_back(LdOp.getValue(1)); + + // Check if we can load the element with one instruction + if (LdWidth == EVTWidth) { + return DAG.getNode(ISD::BIT_CONVERT, ResType, VecOp); + } + + // The vector element order is endianness dependent. + unsigned Idx = 1; + LdWidth -= EVTWidth; + unsigned Offset = 0; + + while (LdWidth > 0) { + unsigned Increment = EVTWidth / 8; + Offset += Increment; + BasePtr = DAG.getNode(ISD::ADD, BasePtr.getValueType(), BasePtr, + DAG.getIntPtrConstant(Increment)); + + if (LdWidth < EVTWidth) { + // Our current type we are using is too large, use a smaller size by + // using a smaller power of 2 + unsigned oEVTWidth = EVTWidth; + FindWidenVecType(TLI, LdWidth, ResType, EVT, VecEVT); + EVTWidth = EVT.getSizeInBits(); + // Readjust position and vector position based on new load type + Idx = Idx * (oEVTWidth/EVTWidth)+1; + VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, VecOp); + } + + SDValue LdOp = DAG.getLoad(EVT, Chain, BasePtr, SV, + SVOffset+Offset, isVolatile, + MinAlign(Alignment, Offset)); + LdChain.push_back(LdOp.getValue(1)); + VecOp = DAG.getNode(ISD::INSERT_VECTOR_ELT, VecEVT, VecOp, LdOp, + DAG.getIntPtrConstant(Idx++)); + + LdWidth -= EVTWidth; + } + + return DAG.getNode(ISD::BIT_CONVERT, ResType, VecOp); +} + +bool SelectionDAGLegalize::LoadWidenVectorOp(SDValue& Result, + SDValue& TFOp, + SDValue Op, + MVT NVT) { + // TODO: Add support for ConcatVec and the ability to load many vector + // types (e.g., v4i8). This will not work when a vector register + // to memory mapping is strange (e.g., vector elements are not + // stored in some sequential order). + + // It must be true that the widen vector type is bigger than where + // we need to load from. + LoadSDNode *LD = cast(Op.getNode()); + MVT LdVT = LD->getMemoryVT(); + assert(LdVT.isVector() && NVT.isVector()); + assert(LdVT.getVectorElementType() == NVT.getVectorElementType()); + + // Load information + SDValue Chain = LD->getChain(); + SDValue BasePtr = LD->getBasePtr(); + int SVOffset = LD->getSrcValueOffset(); + unsigned Alignment = LD->getAlignment(); + bool isVolatile = LD->isVolatile(); + const Value *SV = LD->getSrcValue(); + unsigned int LdWidth = LdVT.getSizeInBits(); + + // Load value as a large register + SDValueVector LdChain; + Result = genWidenVectorLoads(LdChain, Chain, BasePtr, SV, SVOffset, + Alignment, isVolatile, LdWidth, NVT); + + if (LdChain.size() == 1) { + TFOp = LdChain[0]; + return true; + } + else { + TFOp=DAG.getNode(ISD::TokenFactor, MVT::Other, &LdChain[0], LdChain.size()); + return false; + } +} + + +void SelectionDAGLegalize::genWidenVectorStores(SDValueVector& StChain, + SDValue Chain, + SDValue BasePtr, + const Value *SV, + int SVOffset, + unsigned Alignment, + bool isVolatile, + SDValue ValOp, + unsigned StWidth) { + // Breaks the stores into a series of power of 2 width stores. For any + // width, we convert the vector to the vector of element size that we + // want to store. This avoids requiring a stack convert. + + // Find a width of the element type we can store with + MVT VVT = ValOp.getValueType(); + MVT EVT, VecEVT; + unsigned EVTWidth; + FindWidenVecType(TLI, StWidth, VVT, EVT, VecEVT); + EVTWidth = EVT.getSizeInBits(); + + SDValue VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, ValOp); + SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EVT, VecOp, + DAG.getIntPtrConstant(0)); + SDValue StOp = DAG.getStore(Chain, EOp, BasePtr, SV, SVOffset, + isVolatile, Alignment); + StChain.push_back(StOp); + + // Check if we are done + if (StWidth == EVTWidth) { + return; + } + + unsigned Idx = 1; + StWidth -= EVTWidth; + unsigned Offset = 0; + + while (StWidth > 0) { + unsigned Increment = EVTWidth / 8; + Offset += Increment; + BasePtr = DAG.getNode(ISD::ADD, BasePtr.getValueType(), BasePtr, + DAG.getIntPtrConstant(Increment)); + + if (StWidth < EVTWidth) { + // Our current type we are using is too large, use a smaller size by + // using a smaller power of 2 + unsigned oEVTWidth = EVTWidth; + FindWidenVecType(TLI, StWidth, VVT, EVT, VecEVT); + EVTWidth = EVT.getSizeInBits(); + // Readjust position and vector position based on new load type + Idx = Idx * (oEVTWidth/EVTWidth)+1; + VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, VecOp); + } + + EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EVT, VecOp, + DAG.getIntPtrConstant(Idx)); + StChain.push_back(DAG.getStore(Chain, EOp, BasePtr, SV, + SVOffset + Offset, isVolatile, + MinAlign(Alignment, Offset))); + StWidth -= EVTWidth; + } +} + + +SDValue SelectionDAGLegalize::StoreWidenVectorOp(StoreSDNode *ST, + SDValue Chain, + SDValue BasePtr) { + // TODO: It might be cleaner if we can use SplitVector and have more legal + // vector types that can be stored into memory (e.g., v4xi8 can + // be stored as a word). This will not work when a vector register + // to memory mapping is strange (e.g., vector elements are not + // stored in some sequential order). + + MVT StVT = ST->getMemoryVT(); + SDValue ValOp = ST->getValue(); + + // Check if we have widen this node with another value + std::map::iterator I = WidenNodes.find(ValOp); + if (I != WidenNodes.end()) + ValOp = I->second; + + MVT VVT = ValOp.getValueType(); + + // It must be true that we the widen vector type is bigger than where + // we need to store. + assert(StVT.isVector() && VVT.isVector()); + assert(StVT.getSizeInBits() < VVT.getSizeInBits()); + assert(StVT.getVectorElementType() == VVT.getVectorElementType()); + + // Store value + SDValueVector StChain; + genWidenVectorStores(StChain, Chain, BasePtr, ST->getSrcValue(), + ST->getSrcValueOffset(), ST->getAlignment(), + ST->isVolatile(), ValOp, StVT.getSizeInBits()); + if (StChain.size() == 1) + return StChain[0]; + else + return DAG.getNode(ISD::TokenFactor, MVT::Other,&StChain[0],StChain.size()); +} + + // SelectionDAG::Legalize - This is the entry point for the file. // void SelectionDAG::Legalize() { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=58426&r1=58425&r2=58426&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Thu Oct 30 03:01:45 2008 @@ -79,7 +79,20 @@ case TargetLowering::Legal: return Legal; case TargetLowering::Promote: - return PromoteInteger; + // Promote can mean + // 1) On integers, it means to promote type (e.g., i8 to i32) + // 2) For vectors, it means try to widen (e.g., v3i32 to v4i32) + if (!VT.isVector()) { + return PromoteInteger; + } + else { + // TODO: move widen code to LegalizeType + if (VT.getVectorNumElements() == 1) { + return ScalarizeVector; + } else { + return SplitVector; + } + } case TargetLowering::Expand: // Expand can mean // 1) split scalar in half, 2) convert a float to an integer, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=58426&r1=58425&r2=58426&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Thu Oct 30 03:01:45 2008 @@ -573,7 +573,7 @@ RegisterVT); RegisterTypeForVT[i] = RegisterVT; TransformToType[i] = MVT::Other; // this isn't actually used - ValueTypeActions.setTypeAction(VT, Expand); + ValueTypeActions.setTypeAction(VT, Promote); } } } @@ -642,6 +642,20 @@ return 1; } +/// getWidenVectorType: given a vector type, returns the type to widen to +/// (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself. +/// If there is no vector type that we want to widen to, returns MVT::Other +/// When and were to widen is target dependent based on the cost of +/// scalarizing vs using the wider vector type. +MVT TargetLowering::getWidenVectorType(MVT VT) { + assert(VT.isVector()); + if (isTypeLegal(VT)) + return VT; + + // Default is not to widen until moved to LegalizeTypes + return MVT::Other; +} + /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate /// function arguments in the caller parameter area. This is the actual /// alignment, not its logarithm. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=58426&r1=58425&r2=58426&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Oct 30 03:01:45 2008 @@ -523,8 +523,9 @@ setOperationAction(ISD::FEXP, MVT::f80, Expand); setOperationAction(ISD::FEXP2, MVT::f80, Expand); - // First set operation action for all vector types to expand. Then we - // will selectively turn on ones that can be effectively codegen'd. + // First set operation action for all vector types to either to promote + // (for widening) or expand (for scalarization). Then we will selectively + // turn on ones that can be effectively codegen'd. for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { setOperationAction(ISD::ADD , (MVT::SimpleValueType)VT, Expand); @@ -543,6 +544,8 @@ setOperationAction(ISD::VECTOR_SHUFFLE, (MVT::SimpleValueType)VT, Expand); setOperationAction(ISD::EXTRACT_VECTOR_ELT,(MVT::SimpleValueType)VT,Expand); setOperationAction(ISD::INSERT_VECTOR_ELT,(MVT::SimpleValueType)VT, Expand); + setOperationAction(ISD::EXTRACT_SUBVECTOR,(MVT::SimpleValueType)VT, Expand); + setOperationAction(ISD::CONCAT_VECTORS,(MVT::SimpleValueType)VT, Expand); setOperationAction(ISD::FABS, (MVT::SimpleValueType)VT, Expand); setOperationAction(ISD::FSIN, (MVT::SimpleValueType)VT, Expand); setOperationAction(ISD::FCOS, (MVT::SimpleValueType)VT, Expand); @@ -7837,3 +7840,41 @@ return Res; } + +//===----------------------------------------------------------------------===// +// X86 Widen vector type +//===----------------------------------------------------------------------===// + +/// getWidenVectorType: given a vector type, returns the type to widen +/// to (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself. +/// If there is no vector type that we want to widen to, returns MVT::Other +/// When and were to widen is target dependent based on the cost of +/// scalarizing vs using the wider vector type. + +MVT X86TargetLowering::getWidenVectorType(MVT VT) { + assert(VT.isVector()); + if (isTypeLegal(VT)) + return VT; + + // TODO: In computeRegisterProperty, we can compute the list of legal vector + // type based on element type. This would speed up our search (though + // it may not be worth it since the size of the list is relatively + // small). + MVT EltVT = VT.getVectorElementType(); + unsigned NElts = VT.getVectorNumElements(); + + // On X86, it make sense to widen any vector wider than 1 + if (NElts <= 1) + return MVT::Other; + + for (unsigned nVT = MVT::FIRST_VECTOR_VALUETYPE; + nVT <= MVT::LAST_VECTOR_VALUETYPE; ++nVT) { + MVT SVT = (MVT::SimpleValueType)nVT; + + if (isTypeLegal(SVT) && + SVT.getVectorElementType() == EltVT && + SVT.getVectorNumElements() > NElts) + return SVT; + } + return MVT::Other; +} Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=58426&r1=58425&r2=58426&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Thu Oct 30 03:01:45 2008 @@ -486,6 +486,13 @@ (VT == MVT::f32 && X86ScalarSSEf32); // f32 is when SSE1 } + /// getWidenVectorType: given a vector type, returns the type to widen + /// to (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself. + /// If there is no vector type that we want to widen to, returns MVT::Other + /// When and were to widen is target dependent based on the cost of + /// scalarizing vs using the wider vector type. + virtual MVT getWidenVectorType(MVT VT); + /// createFastISel - This method returns a target specific FastISel object, /// or null if the target does not support "fast" ISel. virtual FastISel * From wangmp at apple.com Thu Oct 30 03:28:25 2008 From: wangmp at apple.com (Mon Ping Wang) Date: Thu, 30 Oct 2008 01:28:25 -0700 Subject: [llvm-commits] [llvm] r58426 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> References: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> Message-ID: Hi, I checked in the patch for vector widening after incorporating the comments to the patch. Instead of Expand, I use Promote to indicate widening for vectors. By default, no widening will happen because I haven't not move the support to LegalizeType yet. If you want to see the effective of widening, you will have to disable LegalizeType. I plan to try to get it in during this weekend after I submit the vector shuffle patch. I'll also check in some test cases when I update with that change. --- Mon Ping BTW, Dan and I noticed that for OperationAction, Promote is used to change vector types, e.g., for AND on X86, it can promote v16i8 to v2i64. This doesn't interfere with widening but I mention it as another use of LegalizeAction promote though in a different context. Maybe we should split LegalizeAction into two different enumerations, one for for LegalizeTypes and one for OperationAction. On Oct 30, 2008, at 1:01 AM, Mon P Wang wrote: > Author: wangmp > Date: Thu Oct 30 03:01:45 2008 > New Revision: 58426 > > URL: http://llvm.org/viewvc/llvm-project?rev=58426&view=rev > Log: > Add initial support for vector widening. Logic is set to widen for > X86. > One will only see an effect if legalizetype is not active. Will move > support to LegalizeType soon. > > Modified: > llvm/trunk/include/llvm/Target/TargetLowering.h > llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h > llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.h > > Modified: llvm/trunk/include/llvm/Target/TargetLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=58426&r1=58425&r2=58426&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) > +++ llvm/trunk/include/llvm/Target/TargetLowering.h Thu Oct 30 > 03:01:45 2008 > @@ -164,7 +164,10 @@ > > LegalizeAction getTypeAction(MVT VT) const { > if (VT.isExtended()) { > - if (VT.isVector()) return Expand; > + if (VT.isVector()) { > + // First try vector widening > + return Promote; > + } > if (VT.isInteger()) > // First promote to a power-of-two size, then expand if > necessary. > return VT == VT.getRoundIntegerType() ? Expand : Promote; > @@ -261,6 +264,13 @@ > unsigned &NumIntermediates, > MVT &RegisterVT) const; > > + /// getWidenVectorType: given a vector type, returns the type to > widen to > + /// (e.g., v7i8 to v8i8). If the vector type is legal, it returns > itself. > + /// If there is no vector type that we want to widen to, returns > MVT::Other > + /// When and were to widen is target dependent based on the cost of > + /// scalarizing vs using the wider vector type. > + virtual MVT getWidenVectorType(MVT VT); > + > typedef std::vector::const_iterator legal_fpimm_iterator; > legal_fpimm_iterator legal_fpimm_begin() const { > return LegalFPImmediates.begin(); > @@ -1455,7 +1465,7 @@ > MVT TransformToType[MVT::LAST_VALUETYPE]; > > // Defines the capacity of the TargetLowering::OpActions table > - static const int OpActionsCapacity = 212; > + static const int OpActionsCapacity = 218; > > /// OpActions - For each operation and each value type, keep a > LegalizeAction > /// that indicates how instruction selection should deal with the > operation. > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=58426&r1=58425&r2=58426&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 30 > 03:01:45 2008 > @@ -86,12 +86,12 @@ > DenseMap PromotedNodes; > > /// ExpandedNodes - For nodes that need to be expanded this map > indicates > - /// which which operands are the expanded version of the input. > This allows > + /// which operands are the expanded version of the input. This > allows > /// us to avoid expanding the same node more than once. > DenseMap > ExpandedNodes; > > /// SplitNodes - For vector nodes that need to be split, this map > indicates > - /// which which operands are the split version of the input. > This allows us > + /// which operands are the split version of the input. This > allows us > /// to avoid splitting the same node more than once. > std::map > SplitNodes; > > @@ -100,6 +100,11 @@ > /// processed to the result. > std::map ScalarizedNodes; > > + /// WidenNodes - For nodes that need to be widen from one vector > type to > + /// another, this contains the mapping of ones we have already > widen. This > + /// allows us to avoid widening more than once. > + std::map WidenNodes; > + > void AddLegalizedOperand(SDValue From, SDValue To) { > LegalizedNodes.insert(std::make_pair(From, To)); > // If someone requests legalization of the new node, return > itself. > @@ -112,6 +117,12 @@ > // If someone requests legalization of the new node, return > itself. > LegalizedNodes.insert(std::make_pair(To, To)); > } > + void AddWidenOperand(SDValue From, SDValue To) { > + bool isNew = WidenNodes.insert(std::make_pair(From, To)).second; > + assert(isNew && "Got into the map somehow?"); > + // If someone requests legalization of the new node, return > itself. > + LegalizedNodes.insert(std::make_pair(To, To)); > + } > > public: > explicit SelectionDAGLegalize(SelectionDAG &DAG); > @@ -169,6 +180,15 @@ > /// types. > void ExpandOp(SDValue O, SDValue &Lo, SDValue &Hi); > > + /// WidenVectorOp - Widen a vector operation in order to do the > computation > + /// in a wider type given to a wider type given by WidenVT (e.g., > v3i32 to > + /// v4i32). The produced value will have the correct value for > the existing > + /// elements but no guarantee is made about the new elements at > the end of > + /// the vector: it may be zero, sign-extended, or garbage. This > is useful > + /// when we have instruction operating on an illegal vector type > and we want > + /// to widen it to do the computation on a legal wider vector type. > + SDValue WidenVectorOp(SDValue Op, MVT WidenVT); > + > /// SplitVectorOp - Given an operand of vector type, break it down > into > /// two smaller values. > void SplitVectorOp(SDValue O, SDValue &Lo, SDValue &Hi); > @@ -178,6 +198,62 @@ > /// scalar (e.g. f32) value. > SDValue ScalarizeVectorOp(SDValue O); > > + /// Useful 16 element vector used to pass operands for widening > + typedef SmallVector SDValueVector; > + > + /// LoadWidenVectorOp - Load a vector for a wider type. Returns > true if > + /// the LdChain contains a single load and false if it contains a > token > + /// factor for multiple loads. It takes > + /// Result: location to return the result > + /// LdChain: location to return the load chain > + /// Op: load operation to widen > + /// NVT: widen vector result type we want for the load > + bool LoadWidenVectorOp(SDValue& Result, SDValue& LdChain, > + SDValue Op, MVT NVT); > + > + /// Helper genWidenVectorLoads - Helper function to generate a > set of > + /// loads to load a vector with a resulting wider type. It takes > + /// LdChain: list of chains for the load we have generated > + /// Chain: incoming chain for the ld vector > + /// BasePtr: base pointer to load from > + /// SV: memory disambiguation source value > + /// SVOffset: memory disambiugation offset > + /// Alignment: alignment of the memory > + /// isVolatile: volatile load > + /// LdWidth: width of memory that we want to load > + /// ResType: the wider result result type for the resulting > loaded vector > + SDValue genWidenVectorLoads(SDValueVector& LdChain, SDValue Chain, > + SDValue BasePtr, const Value *SV, > + int SVOffset, unsigned Alignment, > + bool isVolatile, unsigned LdWidth, > + MVT ResType); > + > + /// StoreWidenVectorOp - Stores a widen vector into non widen > memory > + /// location. It takes > + /// ST: store node that we want to replace > + /// Chain: incoming store chain > + /// BasePtr: base address of where we want to store into > + SDValue StoreWidenVectorOp(StoreSDNode *ST, SDValue Chain, > + SDValue BasePtr); > + > + /// Helper genWidenVectorStores - Helper function to generate a > set of > + /// stores to store a widen vector into non widen memory > + // It takes > + // StChain: list of chains for the stores we have generated > + // Chain: incoming chain for the ld vector > + // BasePtr: base pointer to load from > + // SV: memory disambiguation source value > + // SVOffset: memory disambiugation offset > + // Alignment: alignment of the memory > + // isVolatile: volatile lod > + // ValOp: value to store > + // StWidth: width of memory that we want to store > + void genWidenVectorStores(SDValueVector& StChain, SDValue Chain, > + SDValue BasePtr, const Value *SV, > + int SVOffset, unsigned Alignment, > + bool isVolatile, SDValue ValOp, > + unsigned StWidth); > + > /// isShuffleLegal - Return non-null if a vector shuffle is legal > with the > /// specified mask and type. Targets can specify exactly which > masks they > /// support and the code generator is tasked with not creating > illegal masks. > @@ -300,6 +376,7 @@ > PromotedNodes.clear(); > SplitNodes.clear(); > ScalarizedNodes.clear(); > + WidenNodes.clear(); > > // Remove dead nodes now. > DAG.RemoveDeadNodes(); > @@ -403,14 +480,27 @@ > return false; > } > > -/// HandleOp - Legalize, Promote, or Expand the specified operand as > +/// HandleOp - Legalize, Promote, Widen, or Expand the specified > operand as > /// appropriate for its type. > void SelectionDAGLegalize::HandleOp(SDValue Op) { > MVT VT = Op.getValueType(); > switch (getTypeAction(VT)) { > default: assert(0 && "Bad type action!"); > case Legal: (void)LegalizeOp(Op); break; > - case Promote: (void)PromoteOp(Op); break; > + case Promote: > + if (!VT.isVector()) { > + (void)PromoteOp(Op); > + break; > + } > + else { > + // See if we can widen otherwise use Expand to either > scalarize or split > + MVT WidenVT = TLI.getWidenVectorType(VT); > + if (WidenVT != MVT::Other) { > + (void) WidenVectorOp(Op, WidenVT); > + break; > + } > + // else fall thru to expand since we can't widen the vector > + } > case Expand: > if (!VT.isVector()) { > // If this is an illegal scalar, expand it into its two > component > @@ -424,7 +514,7 @@ > // scalar operation. > (void)ScalarizeVectorOp(Op); > } else { > - // Otherwise, this is an illegal multiple element vector. > + // This is an illegal multiple element vector. > // Split it in half and legalize both parts. > SDValue X, Y; > SplitVectorOp(Op, X, Y); > @@ -742,7 +832,7 @@ > > // Store the vector. > SDValue Ch = DAG.getStore(DAG.getEntryNode(), Tmp1, StackPtr, > - PseudoSourceValue::getFixedStack > (SPFI), 0); > + PseudoSourceValue::getFixedStack(SPFI), > 0); > > // Truncate or zero extend offset to target pointer type. > unsigned CastOpc = IdxVT.bitsGT(PtrVT) ? ISD::TRUNCATE : > ISD::ZERO_EXTEND; > @@ -1417,6 +1507,12 @@ > default: assert(0 && "Cannot expand insert element operand"); > case Legal: Tmp2 = LegalizeOp(Node->getOperand(1)); break; > case Promote: Tmp2 = PromoteOp(Node->getOperand(1)); break; > + case Expand: > + // FIXME: An alternative would be to check to see if the > target is not > + // going to custom lower this operation, we could bitcast to > half elt > + // width and perform two inserts at that width, if that is > legal. > + Tmp2 = Node->getOperand(1); > + break; > } > Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3); > > @@ -1432,6 +1528,8 @@ > break; > } > // FALLTHROUGH > + case TargetLowering::Promote: > + // Fall thru for vector case > case TargetLowering::Expand: { > // If the insert index is a constant, codegen this as a > scalar_to_vector, > // then a shuffle that inserts it into the right position in > the vector. > @@ -1574,6 +1672,26 @@ > Result = ExpandEXTRACT_SUBVECTOR(Result); > break; > > + case ISD::CONCAT_VECTORS: { > + // Use extract/insert/build vector for now. We might try to be > + // more clever later. > + MVT PtrVT = TLI.getPointerTy(); > + SmallVector Ops; > + unsigned NumOperands = Node->getNumOperands(); > + for (unsigned i=0; i < NumOperands; ++i) { > + SDValue SubOp = Node->getOperand(i); > + MVT VVT = SubOp.getNode()->getValueType(0); > + MVT EltVT = VVT.getVectorElementType(); > + unsigned NumSubElem = VVT.getVectorNumElements(); > + for (unsigned j=0; j < NumSubElem; ++j) { > + Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EltVT, > SubOp, > + DAG.getConstant(j, PtrVT))); > + } > + } > + return LegalizeOp(DAG.getNode(ISD::BUILD_VECTOR, Node- > >getValueType(0), > + &Ops[0], Ops.size())); > + } > + > case ISD::CALLSEQ_START: { > SDNode *CallEnd = FindCallEndFromCallStart(Node); > > @@ -2429,14 +2547,16 @@ > break; > } > case Promote: > - // Truncate the value and store the result. > - Tmp3 = PromoteOp(ST->getValue()); > - Result = DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue > (), > - SVOffset, ST->getMemoryVT(), > - isVolatile, Alignment); > - break; > - > - case Expand: > + if (!ST->getMemoryVT().isVector()) { > + // Truncate the value and store the result. > + Tmp3 = PromoteOp(ST->getValue()); > + Result = DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST- > >getSrcValue(), > + SVOffset, ST->getMemoryVT(), > + isVolatile, Alignment); > + break; > + } > + // Fall thru to expand for vector > + case Expand: { > unsigned IncrementSize = 0; > SDValue Lo, Hi; > > @@ -2470,9 +2590,18 @@ > Result = LegalizeOp(Result); > break; > } else { > - SplitVectorOp(ST->getValue(), Lo, Hi); > - IncrementSize = Lo.getNode()->getValueType > (0).getVectorNumElements() * > - EVT.getSizeInBits()/8; > + // Check if we have widen this node with another value > + std::map::iterator I = > + WidenNodes.find(ST->getValue()); > + if (I != WidenNodes.end()) { > + Result = StoreWidenVectorOp(ST, Tmp1, Tmp2); > + break; > + } > + else { > + SplitVectorOp(ST->getValue(), Lo, Hi); > + IncrementSize = Lo.getNode()->getValueType > (0).getVectorNumElements() * > + EVT.getSizeInBits()/8; > + } > } > } else { > ExpandOp(ST->getValue(), Lo, Hi); > @@ -2501,6 +2630,7 @@ > SVOffset, isVolatile, Alignment); > Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); > break; > + } // case Expand > } > } else { > switch (getTypeAction(ST->getValue().getValueType())) { > @@ -2508,9 +2638,12 @@ > Tmp3 = LegalizeOp(ST->getValue()); > break; > case Promote: > - // We can promote the value, the truncstore will still take > care of it. > - Tmp3 = PromoteOp(ST->getValue()); > - break; > + if (!ST->getValue().getValueType().isVector()) { > + // We can promote the value, the truncstore will still > take care of it. > + Tmp3 = PromoteOp(ST->getValue()); > + break; > + } > + // Vector case falls through to expand > case Expand: > // Just store the low part. This may become a non-trunc > store, so make > // sure to use getTruncStore, not UpdateNodeOperands below. > @@ -2709,6 +2842,7 @@ > Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the > condition. > break; > case Promote: { > + assert(!Node->getOperand(0).getValueType().isVector() && "not > possible"); > Tmp1 = PromoteOp(Node->getOperand(0)); // Promote the > condition. > // Make sure the condition is either zero or one. > unsigned BitWidth = Tmp1.getValueSizeInBits(); > @@ -2966,7 +3100,7 @@ > } > > Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); > - > + > switch (TLI.getOperationAction(Node->getOpcode(), Node- > >getValueType(0))) { > default: assert(0 && "BinOp legalize operation not supported"); > case TargetLowering::Legal: break; > @@ -2979,7 +3113,7 @@ > // Fall through if the custom lower can't deal with the > operation > case TargetLowering::Expand: { > MVT VT = Op.getValueType(); > - > + > // See if multiply or divide can be lowered using two-result > operations. > SDVTList VTs = DAG.getVTList(VT, VT); > if (Node->getOpcode() == ISD::MUL) { > @@ -3030,7 +3164,7 @@ > 0); > break; > } > - > + > // Check to see if we have a libcall for this operator. > RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; > bool isSigned = false; > @@ -3039,7 +3173,7 @@ > case ISD::SDIV: > if (VT == MVT::i32) { > LC = Node->getOpcode() == ISD::UDIV > - ? RTLIB::UDIV_I32 : RTLIB::SDIV_I32; > + ? RTLIB::UDIV_I32 : RTLIB::SDIV_I32; > isSigned = Node->getOpcode() == ISD::SDIV; > } > break; > @@ -3058,7 +3192,7 @@ > Result = ExpandLibCall(LC, Node, isSigned, Dummy); > break; > } > - > + > assert(Node->getValueType(0).isVector() && > "Cannot expand this binary operator!"); > // Expand the operation into a bunch of nasty scalar code. > @@ -4548,6 +4682,9 @@ > return Op; > } > break; > + case TargetLowering::Promote: > + assert(TVT.isVector() && "not vector type"); > + // fall thru to expand since vectors are by default are promote > case TargetLowering::Expand: > break; > } > @@ -5348,7 +5485,7 @@ > Args.push_back(Entry); > } > SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC), > - TLI.getPointerTy()); > + TLI.getPointerTy()); > > // Splice the libcall in wherever FindInputOutputChains tells us to. > const Type *RetTy = Node->getValueType(0).getTypeForMVT(); > @@ -5958,7 +6095,6 @@ > return ExpandOp(Hi, Lo, Hi); > return ExpandOp(Lo, Lo, Hi); > case ISD::EXTRACT_VECTOR_ELT: > - assert(VT==MVT::i64 && "Do not know how to expand this > operator!"); > // ExpandEXTRACT_VECTOR_ELT tolerates invalid result types. > Lo = ExpandEXTRACT_VECTOR_ELT(Op); > return ExpandOp(Lo, Lo, Hi); > @@ -7423,6 +7559,690 @@ > } > > > +SDValue SelectionDAGLegalize::WidenVectorOp(SDValue Op, MVT > WidenVT) { > + std::map::iterator I = WidenNodes.find(Op); > + if (I != WidenNodes.end()) return I->second; > + > + MVT VT = Op.getValueType(); > + assert(VT.isVector() && "Cannot widen non-vector type!"); > + > + SDValue Result; > + SDNode *Node = Op.getNode(); > + MVT EVT = VT.getVectorElementType(); > + > + unsigned NumElts = VT.getVectorNumElements(); > + unsigned NewNumElts = WidenVT.getVectorNumElements(); > + assert(NewNumElts > NumElts && "Cannot widen to smaller type!"); > + assert(NewNumElts < 17); > + > + // When widen is called, it is assumed that it is more efficient > to use a > + // wide type. The default action is to widen to operation to a > wider legal > + // vector type and then do the operation if it is legal by > calling LegalizeOp > + // again. If there is no vector equivalent, we will unroll the > operation, do > + // it, and rebuild the vector. If most of the operations are > vectorizible to > + // the legal type, the resulting code will be more efficient. If > this is not > + // the case, the resulting code will preform badly as we end up > generating > + // code to pack/unpack the results. It is the function that calls > widen > + // that is responsible for seeing this doesn't happen. For some > cases, we > + // have decided that it is not worth widening so we just split > the operation. > + switch (Node->getOpcode()) { > + default: > +#ifndef NDEBUG > + Node->dump(&DAG); > +#endif > + assert(0 && "Unexpected operation in WidenVectorOp!"); > + break; > + case ISD::CopyFromReg: > + assert(0 && "CopyFromReg must be legal!"); > + case ISD::UNDEF: > + case ISD::Constant: > + case ISD::ConstantFP: > + // To build a vector of these elements, clients should call > BuildVector > + // and with each element instead of creating a node with a > vector type > + assert(0 && "Unexpected operation in WidenVectorOp!"); > + case ISD::VAARG: > + // Variable Arguments with vector types doesn't make any sense > to me > + assert(0 && "Unexpected operation in WidenVectorOp!"); > + break; > + case ISD::BUILD_VECTOR: { > + // Build a vector with undefined for the new nodes > + SDValueVector NewOps(Node->op_begin(), Node->op_end()); > + for (unsigned i = NumElts; i < NewNumElts; ++i) { > + NewOps.push_back(DAG.getNode(ISD::UNDEF,EVT)); > + } > + Result = DAG.getNode(ISD::BUILD_VECTOR, WidenVT, &NewOps[0], > NewOps.size()); > + break; > + } > + case ISD::INSERT_VECTOR_ELT: { > + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); > + Result = DAG.getNode(ISD::INSERT_VECTOR_ELT, WidenVT, Tmp1, > + Node->getOperand(1), Node->getOperand(2)); > + break; > + } > + case ISD::VECTOR_SHUFFLE: { > + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); > + SDValue Tmp2 = WidenVectorOp(Node->getOperand(1), WidenVT); > + // VECTOR_SHUFFLE 3rd operand must be a constant build vector > that is > + // used as permutation array. We build the vector here instead > of widening > + // because we don't want to legalize and have it turned to > something else. > + SDValue PermOp = Node->getOperand(2); > + SDValueVector NewOps; > + MVT PVT = PermOp.getValueType().getVectorElementType(); > + for (unsigned i = 0; i < NumElts; ++i) { > + if (PermOp.getOperand(i).getOpcode() == ISD::UNDEF) { > + NewOps.push_back(PermOp.getOperand(i)); > + } else { > + unsigned Idx = > + cast(PermOp.getOperand(i))->getZExtValue(); > + if (Idx < NumElts) { > + NewOps.push_back(PermOp.getOperand(i)); > + } > + else { > + NewOps.push_back(DAG.getConstant(Idx + NewNumElts - > NumElts, > + PermOp.getOperand > (i).getValueType())); > + } > + } > + } > + for (unsigned i = NumElts; i < NewNumElts; ++i) { > + NewOps.push_back(DAG.getNode(ISD::UNDEF,PVT)); > + } > + > + SDValue Tmp3 = DAG.getNode(ISD::BUILD_VECTOR, > + MVT::getVectorVT(PVT, NewOps.size()), > + &NewOps[0], NewOps.size()); > + > + Result = DAG.getNode(ISD::VECTOR_SHUFFLE, WidenVT, Tmp1, Tmp2, > Tmp3); > + break; > + } > + case ISD::LOAD: { > + // If the load widen returns true, we can use a single load for > the > + // vector. Otherwise, it is returning a token factor for > multiple > + // loads. > + SDValue TFOp; > + if (LoadWidenVectorOp(Result, TFOp, Op, WidenVT)) > + AddLegalizedOperand(Op.getValue(1), LegalizeOp(TFOp.getValue > (1))); > + else > + AddLegalizedOperand(Op.getValue(1), LegalizeOp(TFOp.getValue > (0))); > + break; > + } > + > + case ISD::BIT_CONVERT: { > + SDValue Tmp1 = Node->getOperand(0); > + // Converts between two different types so we need to determine > + // the correct widen type for the input operand. > + MVT TVT = Tmp1.getValueType(); > + assert(TVT.isVector() && "can not widen non vector type"); > + MVT TEVT = TVT.getVectorElementType(); > + assert(WidenVT.getSizeInBits() % EVT.getSizeInBits() == 0 && > + "can not widen bit bit convert that are not multiple of > element type"); > + MVT TWidenVT = MVT::getVectorVT(TEVT, > + WidenVT.getSizeInBits()/ > EVT.getSizeInBits()); > + Tmp1 = WidenVectorOp(Tmp1, TWidenVT); > + assert(Tmp1.getValueType().getSizeInBits() == > WidenVT.getSizeInBits()); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1); > + > + TargetLowering::LegalizeAction action = > + TLI.getOperationAction(Node->getOpcode(), WidenVT); > + switch (action) { > + default: assert(0 && "action not supported"); > + case TargetLowering::Legal: > + break; > + case TargetLowering::Promote: > + // We defer the promotion to when we legalize the op > + break; > + case TargetLowering::Expand: > + // Expand the operation into a bunch of nasty scalar code. > + Result = LegalizeOp(UnrollVectorOp(Result)); > + break; > + } > + break; > + } > + > + case ISD::SINT_TO_FP: > + case ISD::UINT_TO_FP: > + case ISD::FP_TO_SINT: > + case ISD::FP_TO_UINT: { > + SDValue Tmp1 = Node->getOperand(0); > + // Converts between two different types so we need to determine > + // the correct widen type for the input operand. > + MVT TVT = Tmp1.getValueType(); > + assert(TVT.isVector() && "can not widen non vector type"); > + MVT TEVT = TVT.getVectorElementType(); > + MVT TWidenVT = MVT::getVectorVT(TEVT, NewNumElts); > + Tmp1 = WidenVectorOp(Tmp1, TWidenVT); > + assert(Tmp1.getValueType().getVectorNumElements() == NewNumElts); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1); > + > + TargetLowering::LegalizeAction action = > + TLI.getOperationAction(Node->getOpcode(), WidenVT); > + switch (action) { > + default: assert(0 && "action not supported"); > + case TargetLowering::Legal: > + break; > + case TargetLowering::Promote: > + // We defer the promotion to when we legalize the op > + break; > + case TargetLowering::Expand: > + // Expand the operation into a bunch of nasty scalar code. > + Result = LegalizeOp(UnrollVectorOp(Result)); > + break; > + } > + break; > + } > + > + case ISD::FP_EXTEND: > + assert(0 && "Case not implemented. Dynamically dead with 2 FP > types!"); > + case ISD::TRUNCATE: > + case ISD::SIGN_EXTEND: > + case ISD::ZERO_EXTEND: > + case ISD::ANY_EXTEND: > + case ISD::FP_ROUND: > + case ISD::SIGN_EXTEND_INREG: > + case ISD::FABS: > + case ISD::FNEG: > + case ISD::FSQRT: > + case ISD::FSIN: > + case ISD::FCOS: { > + // Unary op widening > + SDValue Tmp1; > + TargetLowering::LegalizeAction action = > + TLI.getOperationAction(Node->getOpcode(), WidenVT); > + > + Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); > + assert(Tmp1.getValueType() == WidenVT); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1); > + switch (action) { > + default: assert(0 && "action not supported"); > + case TargetLowering::Legal: > + break; > + case TargetLowering::Promote: > + // We defer the promotion to when we legalize the op > + break; > + case TargetLowering::Expand: > + // Expand the operation into a bunch of nasty scalar code. > + Result = LegalizeOp(UnrollVectorOp(Result)); > + break; > + } > + break; > + } > + case ISD::FPOW: > + case ISD::FPOWI: > + case ISD::ADD: > + case ISD::SUB: > + case ISD::MUL: > + case ISD::MULHS: > + case ISD::MULHU: > + case ISD::AND: > + case ISD::OR: > + case ISD::XOR: > + case ISD::FADD: > + case ISD::FSUB: > + case ISD::FMUL: > + case ISD::SDIV: > + case ISD::SREM: > + case ISD::FDIV: > + case ISD::FREM: > + case ISD::FCOPYSIGN: > + case ISD::UDIV: > + case ISD::UREM: > + case ISD::BSWAP: { > + // Binary op widening > + TargetLowering::LegalizeAction action = > + TLI.getOperationAction(Node->getOpcode(), WidenVT); > + > + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); > + SDValue Tmp2 = WidenVectorOp(Node->getOperand(1), WidenVT); > + assert(Tmp1.getValueType() == WidenVT && Tmp2.getValueType() == > WidenVT); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1, Tmp2); > + switch (action) { > + default: assert(0 && "action not supported"); > + case TargetLowering::Legal: > + break; > + case TargetLowering::Promote: > + // We defer the promotion to when we legalize the op > + break; > + case TargetLowering::Expand: > + // Expand the operation into a bunch of nasty scalar code by > first > + // Widening to the right type and then unroll the beast. > + Result = LegalizeOp(UnrollVectorOp(Result)); > + break; > + } > + break; > + } > + > + case ISD::SHL: > + case ISD::SRA: > + case ISD::SRL: { > + // Binary op with one non vector operand > + TargetLowering::LegalizeAction action = > + TLI.getOperationAction(Node->getOpcode(), WidenVT); > + > + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); > + assert(Tmp1.getValueType() == WidenVT); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1, Node- > >getOperand(1)); > + switch (action) { > + default: assert(0 && "action not supported"); > + case TargetLowering::Legal: > + break; > + case TargetLowering::Promote: > + // We defer the promotion to when we legalize the op > + break; > + case TargetLowering::Expand: > + // Expand the operation into a bunch of nasty scalar code. > + Result = LegalizeOp(UnrollVectorOp(Result)); > + break; > + } > + break; > + } > + case ISD::EXTRACT_VECTOR_ELT: { > + SDValue Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); > + assert(Tmp1.getValueType() == WidenVT); > + Result = DAG.getNode(Node->getOpcode(), EVT, Tmp1, Node- > >getOperand(1)); > + break; > + } > + case ISD::CONCAT_VECTORS: { > + // We concurrently support only widen on a multiple of the > incoming vector. > + // We could widen on a multiple of the incoming operand if > necessary. > + unsigned NumConcat = NewNumElts / NumElts; > + assert(NewNumElts % NumElts == 0 && "Can widen only a multiple > of vector"); > + std::vector UnOps(NumElts, DAG.getNode(ISD::UNDEF, > + VT.getVectorElementType())); > + SDValue UndefVal = DAG.getNode(ISD::BUILD_VECTOR, VT, > + &UnOps[0], UnOps.size()); > + SmallVector MOps; > + MOps.push_back(Op); > + for (unsigned i = 1; i != NumConcat; ++i) { > + MOps.push_back(UndefVal); > + } > + Result = LegalizeOp(DAG.getNode(ISD::CONCAT_VECTORS, WidenVT, > + &MOps[0], MOps.size())); > + break; > + } > + case ISD::EXTRACT_SUBVECTOR: { > + SDValue Tmp1; > + > + // The incoming vector might already be the proper type > + if (Node->getOperand(0).getValueType() != WidenVT) > + Tmp1 = WidenVectorOp(Node->getOperand(0), WidenVT); > + else > + Tmp1 = Node->getOperand(0); > + assert(Tmp1.getValueType() == WidenVT); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1, Node- > >getOperand(1)); > + break; > + } > + > + case ISD::SELECT: { > + TargetLowering::LegalizeAction action = > + TLI.getOperationAction(Node->getOpcode(), WidenVT); > + > + // Determine new condition widen type and widen > + SDValue Cond1 = Node->getOperand(0); > + MVT CondVT = Cond1.getValueType(); > + assert(CondVT.isVector() && "can not widen non vector type"); > + MVT CondEVT = CondVT.getVectorElementType(); > + MVT CondWidenVT = MVT::getVectorVT(CondEVT, NewNumElts); > + Cond1 = WidenVectorOp(Cond1, CondWidenVT); > + assert(Cond1.getValueType() == CondWidenVT && "Condition not > widen"); > + > + SDValue Tmp1 = WidenVectorOp(Node->getOperand(1), WidenVT); > + SDValue Tmp2 = WidenVectorOp(Node->getOperand(2), WidenVT); > + assert(Tmp1.getValueType() == WidenVT && Tmp2.getValueType() == > WidenVT); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Cond1, Tmp1, > Tmp2); > + switch (action) { > + default: assert(0 && "action not supported"); > + case TargetLowering::Legal: > + break; > + case TargetLowering::Promote: > + // We defer the promotion to when we legalize the op > + break; > + case TargetLowering::Expand: > + // Expand the operation into a bunch of nasty scalar code by > first > + // Widening to the right type and then unroll the beast. > + Result = LegalizeOp(UnrollVectorOp(Result)); > + break; > + } > + break; > + } > + > + case ISD::SELECT_CC: { > + TargetLowering::LegalizeAction action = > + TLI.getOperationAction(Node->getOpcode(), WidenVT); > + > + // Determine new condition widen type and widen > + SDValue Cond1 = Node->getOperand(0); > + SDValue Cond2 = Node->getOperand(1); > + MVT CondVT = Cond1.getValueType(); > + assert(CondVT.isVector() && "can not widen non vector type"); > + assert(CondVT == Cond2.getValueType() && "mismatch lhs/rhs"); > + MVT CondEVT = CondVT.getVectorElementType(); > + MVT CondWidenVT = MVT::getVectorVT(CondEVT, NewNumElts); > + Cond1 = WidenVectorOp(Cond1, CondWidenVT); > + Cond2 = WidenVectorOp(Cond2, CondWidenVT); > + assert(Cond1.getValueType() == CondWidenVT && > + Cond2.getValueType() == CondWidenVT && "condition not > widen"); > + > + SDValue Tmp1 = WidenVectorOp(Node->getOperand(2), WidenVT); > + SDValue Tmp2 = WidenVectorOp(Node->getOperand(3), WidenVT); > + assert(Tmp1.getValueType() == WidenVT && Tmp2.getValueType() == > WidenVT && > + "operands not widen"); > + Result = DAG.getNode(Node->getOpcode(), WidenVT, Cond1, Cond2, > Tmp1, > + Tmp2, Node->getOperand(4)); > + switch (action) { > + default: assert(0 && "action not supported"); > + case TargetLowering::Legal: > + break; > + case TargetLowering::Promote: > + // We defer the promotion to when we legalize the op > + break; > + case TargetLowering::Expand: > + // Expand the operation into a bunch of nasty scalar code by > first > + // Widening to the right type and then unroll the beast. > + Result = LegalizeOp(UnrollVectorOp(Result)); > + break; > + } > + break; > + break; > + } > + > + case ISD::ATOMIC_CMP_SWAP_8: > + case ISD::ATOMIC_CMP_SWAP_16: > + case ISD::ATOMIC_CMP_SWAP_32: > + case ISD::ATOMIC_CMP_SWAP_64: > + case ISD::ATOMIC_LOAD_ADD_8: > + case ISD::ATOMIC_LOAD_SUB_8: > + case ISD::ATOMIC_LOAD_AND_8: > + case ISD::ATOMIC_LOAD_OR_8: > + case ISD::ATOMIC_LOAD_XOR_8: > + case ISD::ATOMIC_LOAD_NAND_8: > + case ISD::ATOMIC_LOAD_MIN_8: > + case ISD::ATOMIC_LOAD_MAX_8: > + case ISD::ATOMIC_LOAD_UMIN_8: > + case ISD::ATOMIC_LOAD_UMAX_8: > + case ISD::ATOMIC_SWAP_8: > + case ISD::ATOMIC_LOAD_ADD_16: > + case ISD::ATOMIC_LOAD_SUB_16: > + case ISD::ATOMIC_LOAD_AND_16: > + case ISD::ATOMIC_LOAD_OR_16: > + case ISD::ATOMIC_LOAD_XOR_16: > + case ISD::ATOMIC_LOAD_NAND_16: > + case ISD::ATOMIC_LOAD_MIN_16: > + case ISD::ATOMIC_LOAD_MAX_16: > + case ISD::ATOMIC_LOAD_UMIN_16: > + case ISD::ATOMIC_LOAD_UMAX_16: > + case ISD::ATOMIC_SWAP_16: > + case ISD::ATOMIC_LOAD_ADD_32: > + case ISD::ATOMIC_LOAD_SUB_32: > + case ISD::ATOMIC_LOAD_AND_32: > + case ISD::ATOMIC_LOAD_OR_32: > + case ISD::ATOMIC_LOAD_XOR_32: > + case ISD::ATOMIC_LOAD_NAND_32: > + case ISD::ATOMIC_LOAD_MIN_32: > + case ISD::ATOMIC_LOAD_MAX_32: > + case ISD::ATOMIC_LOAD_UMIN_32: > + case ISD::ATOMIC_LOAD_UMAX_32: > + case ISD::ATOMIC_SWAP_32: > + case ISD::ATOMIC_LOAD_ADD_64: > + case ISD::ATOMIC_LOAD_SUB_64: > + case ISD::ATOMIC_LOAD_AND_64: > + case ISD::ATOMIC_LOAD_OR_64: > + case ISD::ATOMIC_LOAD_XOR_64: > + case ISD::ATOMIC_LOAD_NAND_64: > + case ISD::ATOMIC_LOAD_MIN_64: > + case ISD::ATOMIC_LOAD_MAX_64: > + case ISD::ATOMIC_LOAD_UMIN_64: > + case ISD::ATOMIC_LOAD_UMAX_64: > + case ISD::ATOMIC_SWAP_64: { > + // For now, we assume that using vectors for these operations > don't make > + // much sense so we just split it. We return an empty result > + SDValue X, Y; > + SplitVectorOp(Op, X, Y); > + return Result; > + break; > + } > + > + } // end switch (Node->getOpcode()) > + > + assert(Result.getNode() && "Didn't set a result!"); > + if (Result != Op) > + Result = LegalizeOp(Result); > + > + AddWidenOperand(Op, Result); > + return Result; > +} > + > +// Utility function to find a legal vector type and its associated > element > +// type from a preferred width and whose vector type must be the > same size > +// as the VVT. > +// TLI: Target lowering used to determine legal types > +// Width: Preferred width of element type > +// VVT: Vector value type whose size we must match. > +// Returns VecEVT and EVT - the vector type and its associated > element type > +static void FindWidenVecType(TargetLowering &TLI, unsigned Width, > MVT VVT, > + MVT& EVT, MVT& VecEVT) { > + // We start with the preferred width, make it a power of 2 and > see if > + // we can find a vector type of that width. If not, we reduce it by > + // another power of 2. If we have widen the type, a vector of > bytes should > + // always be legal. > + assert(TLI.isTypeLegal(VVT)); > + unsigned EWidth = Width + 1; > + do { > + assert(EWidth > 0); > + EWidth = (1 << Log2_32(EWidth-1)); > + EVT = MVT::getIntegerVT(EWidth); > + unsigned NumEVT = VVT.getSizeInBits()/EWidth; > + VecEVT = MVT::getVectorVT(EVT, NumEVT); > + } while (!TLI.isTypeLegal(VecEVT) || > + VVT.getSizeInBits() != VecEVT.getSizeInBits()); > +} > + > +SDValue SelectionDAGLegalize::genWidenVectorLoads(SDValueVector& > LdChain, > + SDValue Chain, > + SDValue > BasePtr, > + const Value *SV, > + int > SVOffset, > + unsigned > Alignment, > + bool > isVolatile, > + unsigned > LdWidth, > + MVT > ResType) { > + // We assume that we have good rules to handle loading power of > two loads so > + // we break down the operations to power of 2 loads. The > strategy is to > + // load the largest power of 2 that we can easily transform to a > legal vector > + // and then insert into that vector, and the cast the result into > the legal > + // vector that we want. This avoids unnecessary stack converts. > + // TODO: If the Ldwidth is legal, alignment is the same as the > LdWidth, and > + // the load is nonvolatile, we an use a wider load for the > value. > + // Find a vector length we can load a large chunk > + MVT EVT, VecEVT; > + unsigned EVTWidth; > + FindWidenVecType(TLI, LdWidth, ResType, EVT, VecEVT); > + EVTWidth = EVT.getSizeInBits(); > + > + SDValue LdOp = DAG.getLoad(EVT, Chain, BasePtr, SV, SVOffset, > + isVolatile, Alignment); > + SDValue VecOp = DAG.getNode(ISD::SCALAR_TO_VECTOR, VecEVT, LdOp); > + LdChain.push_back(LdOp.getValue(1)); > + > + // Check if we can load the element with one instruction > + if (LdWidth == EVTWidth) { > + return DAG.getNode(ISD::BIT_CONVERT, ResType, VecOp); > + } > + > + // The vector element order is endianness dependent. > + unsigned Idx = 1; > + LdWidth -= EVTWidth; > + unsigned Offset = 0; > + > + while (LdWidth > 0) { > + unsigned Increment = EVTWidth / 8; > + Offset += Increment; > + BasePtr = DAG.getNode(ISD::ADD, BasePtr.getValueType(), BasePtr, > + DAG.getIntPtrConstant(Increment)); > + > + if (LdWidth < EVTWidth) { > + // Our current type we are using is too large, use a smaller > size by > + // using a smaller power of 2 > + unsigned oEVTWidth = EVTWidth; > + FindWidenVecType(TLI, LdWidth, ResType, EVT, VecEVT); > + EVTWidth = EVT.getSizeInBits(); > + // Readjust position and vector position based on new load type > + Idx = Idx * (oEVTWidth/EVTWidth)+1; > + VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, VecOp); > + } > + > + SDValue LdOp = DAG.getLoad(EVT, Chain, BasePtr, SV, > + SVOffset+Offset, isVolatile, > + MinAlign(Alignment, Offset)); > + LdChain.push_back(LdOp.getValue(1)); > + VecOp = DAG.getNode(ISD::INSERT_VECTOR_ELT, VecEVT, VecOp, LdOp, > + DAG.getIntPtrConstant(Idx++)); > + > + LdWidth -= EVTWidth; > + } > + > + return DAG.getNode(ISD::BIT_CONVERT, ResType, VecOp); > +} > + > +bool SelectionDAGLegalize::LoadWidenVectorOp(SDValue& Result, > + SDValue& TFOp, > + SDValue Op, > + MVT NVT) { > + // TODO: Add support for ConcatVec and the ability to load many > vector > + // types (e.g., v4i8). This will not work when a vector > register > + // to memory mapping is strange (e.g., vector elements are > not > + // stored in some sequential order). > + > + // It must be true that the widen vector type is bigger than where > + // we need to load from. > + LoadSDNode *LD = cast(Op.getNode()); > + MVT LdVT = LD->getMemoryVT(); > + assert(LdVT.isVector() && NVT.isVector()); > + assert(LdVT.getVectorElementType() == NVT.getVectorElementType()); > + > + // Load information > + SDValue Chain = LD->getChain(); > + SDValue BasePtr = LD->getBasePtr(); > + int SVOffset = LD->getSrcValueOffset(); > + unsigned Alignment = LD->getAlignment(); > + bool isVolatile = LD->isVolatile(); > + const Value *SV = LD->getSrcValue(); > + unsigned int LdWidth = LdVT.getSizeInBits(); > + > + // Load value as a large register > + SDValueVector LdChain; > + Result = genWidenVectorLoads(LdChain, Chain, BasePtr, SV, SVOffset, > + Alignment, isVolatile, LdWidth, NVT); > + > + if (LdChain.size() == 1) { > + TFOp = LdChain[0]; > + return true; > + } > + else { > + TFOp=DAG.getNode(ISD::TokenFactor, MVT::Other, &LdChain[0], > LdChain.size()); > + return false; > + } > +} > + > + > +void SelectionDAGLegalize::genWidenVectorStores(SDValueVector& > StChain, > + SDValue Chain, > + SDValue BasePtr, > + const Value *SV, > + int SVOffset, > + unsigned > Alignment, > + bool > isVolatile, > + SDValue ValOp, > + unsigned > StWidth) { > + // Breaks the stores into a series of power of 2 width stores. > For any > + // width, we convert the vector to the vector of element size > that we > + // want to store. This avoids requiring a stack convert. > + > + // Find a width of the element type we can store with > + MVT VVT = ValOp.getValueType(); > + MVT EVT, VecEVT; > + unsigned EVTWidth; > + FindWidenVecType(TLI, StWidth, VVT, EVT, VecEVT); > + EVTWidth = EVT.getSizeInBits(); > + > + SDValue VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, ValOp); > + SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EVT, VecOp, > + DAG.getIntPtrConstant(0)); > + SDValue StOp = DAG.getStore(Chain, EOp, BasePtr, SV, SVOffset, > + isVolatile, Alignment); > + StChain.push_back(StOp); > + > + // Check if we are done > + if (StWidth == EVTWidth) { > + return; > + } > + > + unsigned Idx = 1; > + StWidth -= EVTWidth; > + unsigned Offset = 0; > + > + while (StWidth > 0) { > + unsigned Increment = EVTWidth / 8; > + Offset += Increment; > + BasePtr = DAG.getNode(ISD::ADD, BasePtr.getValueType(), BasePtr, > + DAG.getIntPtrConstant(Increment)); > + > + if (StWidth < EVTWidth) { > + // Our current type we are using is too large, use a smaller > size by > + // using a smaller power of 2 > + unsigned oEVTWidth = EVTWidth; > + FindWidenVecType(TLI, StWidth, VVT, EVT, VecEVT); > + EVTWidth = EVT.getSizeInBits(); > + // Readjust position and vector position based on new load type > + Idx = Idx * (oEVTWidth/EVTWidth)+1; > + VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, VecOp); > + } > + > + EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EVT, VecOp, > + DAG.getIntPtrConstant(Idx)); > + StChain.push_back(DAG.getStore(Chain, EOp, BasePtr, SV, > + SVOffset + Offset, isVolatile, > + MinAlign(Alignment, Offset))); > + StWidth -= EVTWidth; > + } > +} > + > + > +SDValue SelectionDAGLegalize::StoreWidenVectorOp(StoreSDNode *ST, > + SDValue Chain, > + SDValue BasePtr) { > + // TODO: It might be cleaner if we can use SplitVector and have > more legal > + // vector types that can be stored into memory (e.g., > v4xi8 can > + // be stored as a word). This will not work when a vector > register > + // to memory mapping is strange (e.g., vector elements are > not > + // stored in some sequential order). > + > + MVT StVT = ST->getMemoryVT(); > + SDValue ValOp = ST->getValue(); > + > + // Check if we have widen this node with another value > + std::map::iterator I = WidenNodes.find(ValOp); > + if (I != WidenNodes.end()) > + ValOp = I->second; > + > + MVT VVT = ValOp.getValueType(); > + > + // It must be true that we the widen vector type is bigger than > where > + // we need to store. > + assert(StVT.isVector() && VVT.isVector()); > + assert(StVT.getSizeInBits() < VVT.getSizeInBits()); > + assert(StVT.getVectorElementType() == VVT.getVectorElementType()); > + > + // Store value > + SDValueVector StChain; > + genWidenVectorStores(StChain, Chain, BasePtr, ST->getSrcValue(), > + ST->getSrcValueOffset(), ST->getAlignment(), > + ST->isVolatile(), ValOp, StVT.getSizeInBits > ()); > + if (StChain.size() == 1) > + return StChain[0]; > + else > + return DAG.getNode(ISD::TokenFactor, MVT::Other,&StChain > [0],StChain.size()); > +} > + > + > // SelectionDAG::Legalize - This is the entry point for the file. > // > void SelectionDAG::Legalize() { > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=58426&r1=58425&r2=58426&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Thu Oct 30 > 03:01:45 2008 > @@ -79,7 +79,20 @@ > case TargetLowering::Legal: > return Legal; > case TargetLowering::Promote: > - return PromoteInteger; > + // Promote can mean > + // 1) On integers, it means to promote type (e.g., i8 to i32) > + // 2) For vectors, it means try to widen (e.g., v3i32 to > v4i32) > + if (!VT.isVector()) { > + return PromoteInteger; > + } > + else { > + // TODO: move widen code to LegalizeType > + if (VT.getVectorNumElements() == 1) { > + return ScalarizeVector; > + } else { > + return SplitVector; > + } > + } > case TargetLowering::Expand: > // Expand can mean > // 1) split scalar in half, 2) convert a float to an integer, > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=58426&r1=58425&r2=58426&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Thu Oct > 30 03:01:45 2008 > @@ -573,7 +573,7 @@ > RegisterVT); > RegisterTypeForVT[i] = RegisterVT; > TransformToType[i] = MVT::Other; // this isn't actually used > - ValueTypeActions.setTypeAction(VT, Expand); > + ValueTypeActions.setTypeAction(VT, Promote); > } > } > } > @@ -642,6 +642,20 @@ > return 1; > } > > +/// getWidenVectorType: given a vector type, returns the type to > widen to > +/// (e.g., v7i8 to v8i8). If the vector type is legal, it returns > itself. > +/// If there is no vector type that we want to widen to, returns > MVT::Other > +/// When and were to widen is target dependent based on the cost of > +/// scalarizing vs using the wider vector type. > +MVT TargetLowering::getWidenVectorType(MVT VT) { > + assert(VT.isVector()); > + if (isTypeLegal(VT)) > + return VT; > + > + // Default is not to widen until moved to LegalizeTypes > + return MVT::Other; > +} > + > /// getByValTypeAlignment - Return the desired alignment for ByVal > aggregate > /// function arguments in the caller parameter area. This is the > actual > /// alignment, not its logarithm. > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=58426&r1=58425&r2=58426&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Oct 30 > 03:01:45 2008 > @@ -523,8 +523,9 @@ > setOperationAction(ISD::FEXP, MVT::f80, Expand); > setOperationAction(ISD::FEXP2, MVT::f80, Expand); > > - // First set operation action for all vector types to expand. > Then we > - // will selectively turn on ones that can be effectively codegen'd. > + // First set operation action for all vector types to either to > promote > + // (for widening) or expand (for scalarization). Then we will > selectively > + // turn on ones that can be effectively codegen'd. > for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; > VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { > setOperationAction(ISD::ADD , (MVT::SimpleValueType)VT, Expand); > @@ -543,6 +544,8 @@ > setOperationAction(ISD::VECTOR_SHUFFLE, (MVT::SimpleValueType) > VT, Expand); > setOperationAction(ISD::EXTRACT_VECTOR_ELT,(MVT::SimpleValueType) > VT,Expand); > setOperationAction(ISD::INSERT_VECTOR_ELT,(MVT::SimpleValueType) > VT, Expand); > + setOperationAction(ISD::EXTRACT_SUBVECTOR,(MVT::SimpleValueType) > VT, Expand); > + setOperationAction(ISD::CONCAT_VECTORS,(MVT::SimpleValueType) > VT, Expand); > setOperationAction(ISD::FABS, (MVT::SimpleValueType)VT, Expand); > setOperationAction(ISD::FSIN, (MVT::SimpleValueType)VT, Expand); > setOperationAction(ISD::FCOS, (MVT::SimpleValueType)VT, Expand); > @@ -7837,3 +7840,41 @@ > > return Res; > } > + > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// X86 Widen vector type > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +/// getWidenVectorType: given a vector type, returns the type to > widen > +/// to (e.g., v7i8 to v8i8). If the vector type is legal, it > returns itself. > +/// If there is no vector type that we want to widen to, returns > MVT::Other > +/// When and were to widen is target dependent based on the cost of > +/// scalarizing vs using the wider vector type. > + > +MVT X86TargetLowering::getWidenVectorType(MVT VT) { > + assert(VT.isVector()); > + if (isTypeLegal(VT)) > + return VT; > + > + // TODO: In computeRegisterProperty, we can compute the list of > legal vector > + // type based on element type. This would speed up our > search (though > + // it may not be worth it since the size of the list is > relatively > + // small). > + MVT EltVT = VT.getVectorElementType(); > + unsigned NElts = VT.getVectorNumElements(); > + > + // On X86, it make sense to widen any vector wider than 1 > + if (NElts <= 1) > + return MVT::Other; > + > + for (unsigned nVT = MVT::FIRST_VECTOR_VALUETYPE; > + nVT <= MVT::LAST_VECTOR_VALUETYPE; ++nVT) { > + MVT SVT = (MVT::SimpleValueType)nVT; > + > + if (isTypeLegal(SVT) && > + SVT.getVectorElementType() == EltVT && > + SVT.getVectorNumElements() > NElts) > + return SVT; > + } > + return MVT::Other; > +} > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=58426&r1=58425&r2=58426&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Thu Oct 30 03:01:45 > 2008 > @@ -486,6 +486,13 @@ > (VT == MVT::f32 && X86ScalarSSEf32); // f32 is when SSE1 > } > > + /// getWidenVectorType: given a vector type, returns the type > to widen > + /// to (e.g., v7i8 to v8i8). If the vector type is legal, it > returns itself. > + /// If there is no vector type that we want to widen to, > returns MVT::Other > + /// When and were to widen is target dependent based on the > cost of > + /// scalarizing vs using the wider vector type. > + virtual MVT getWidenVectorType(MVT VT); > + > /// createFastISel - This method returns a target specific > FastISel object, > /// or null if the target does not support "fast" ISel. > virtual FastISel * > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From duncan.sands at math.u-psud.fr Thu Oct 30 03:53:09 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Thu, 30 Oct 2008 09:53:09 +0100 Subject: [llvm-commits] [llvm] r58426 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: References: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> Message-ID: <200810300953.09609.duncan.sands@math.u-psud.fr> Hi, > BTW, Dan and I noticed that for OperationAction, Promote is used to > change vector types, e.g., for AND on X86, it can promote v16i8 to > v2i64. This doesn't interfere with widening but I mention it as > another use of LegalizeAction promote though in a different context. > Maybe we should split LegalizeAction into two different enumerations, > one for for LegalizeTypes and one for OperationAction. this is effectively already the case for LegalizeTypes: it has its own enumeration: enum LegalizeAction { Legal, // The target natively supports this type. PromoteInteger, // Replace this integer type with a larger one. ExpandInteger, // Split this integer type into two of half the size. SoftenFloat, // Convert this float type to a same size integer type. ExpandFloat, // Split this float type into two of half the size. ScalarizeVector, // Replace this one-element vector with its element type. SplitVector // This vector type should be split into smaller vectors. }; It translates the traditional type action into one of these by looking at details of the type. When the type legalization code is finally removed from LegalizeDAG, I think it would make sense to move this enumeration type to TargetLowering and use it directly for type legalization methods, and have the old LegalizeAction be only for operation legalization. Ciao, Duncan. From evan.cheng at apple.com Thu Oct 30 11:10:54 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 30 Oct 2008 16:10:54 -0000 Subject: [llvm-commits] [llvm] r58433 - in /llvm/trunk/lib/Target/ARM: ARMTargetMachine.cpp ARMTargetMachine.h Message-ID: <200810301610.m9UGAsIe004252@zion.cs.uiuc.edu> Author: evancheng Date: Thu Oct 30 11:10:54 2008 New Revision: 58433 URL: http://llvm.org/viewvc/llvm-project?rev=58433&view=rev Log: ARM JIT should observe -relocation-model command line option. Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=58433&r1=58432&r2=58433&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Thu Oct 30 11:10:54 2008 @@ -85,7 +85,9 @@ InstrInfo(Subtarget), FrameInfo(Subtarget), JITInfo(*this), - TLInfo(*this) {} + TLInfo(*this) { + DefRelocModel = getRelocationModel(); +} unsigned ARMTargetMachine::getJITMatchQuality() { #if defined(__arm__) @@ -157,7 +159,8 @@ bool ARMTargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { // FIXME: Move this to TargetJITInfo! - setRelocationModel(Reloc::Static); + if (DefRelocModel == Reloc::Default) + setRelocationModel(Reloc::Static); // Machine code emitter pass for ARM. PM.add(createARMCodeEmitterPass(*this, MCE)); Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=58433&r1=58432&r2=58433&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Thu Oct 30 11:10:54 2008 @@ -34,6 +34,7 @@ ARMFrameInfo FrameInfo; ARMJITInfo JITInfo; ARMTargetLowering TLInfo; + Reloc::Model DefRelocModel; // Reloc model before it's overridden. protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter From duncan.sands at math.u-psud.fr Thu Oct 30 04:38:24 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Thu, 30 Oct 2008 10:38:24 +0100 Subject: [llvm-commits] [llvm] r58426 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> References: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> Message-ID: <200810301038.25151.duncan.sands@math.u-psud.fr> Hi Mon Ping, > LegalizeAction getTypeAction(MVT VT) const { > if (VT.isExtended()) { > - if (VT.isVector()) return Expand; > + if (VT.isVector()) { > + // First try vector widening > + return Promote; > + } is the plan to do something like what is done for arbitrary precision integers: first promote to a type which is a power-of-two in length, then (if that type is not legal) expand until reaching a legal type. In the context of vectors I guess I'm asking if you plan to do: v10i32 -> v16i32 -> two v8i32 -> four v4i32? Only the last of these is a simple value type, so the above getTypeAction logic will return "Promote" for all of them, even those you want to split like the v16i32... In fact aren't you going to widen such vectors for ever (infinite loop)? > + /// When and were to widen is target dependent based on the cost of When and were -> When and where > + /// WidenNodes - For nodes that need to be widen from one vector type to need to be widen -> need to be widened > + /// another, this contains the mapping of ones we have already widen. This of ones we have already widen -> of those we have already widened > + void AddWidenOperand(SDValue From, SDValue To) { AddWidenOperand -> AddWidenedOperand > + /// WidenVectorOp - Widen a vector operation in order to do the computation > + /// in a wider type given to a wider type given by WidenVT (e.g., v3i32 to This sentence does not parse for me... > + /// v4i32). The produced value will have the correct value for the existing > + /// elements but no guarantee is made about the new elements at the end of > + /// the vector: it may be zero, sign-extended, or garbage. This is useful What do zero-extension and sign-extension mean in this context? > + /// when we have instruction operating on an illegal vector type and we want have instruction -> have an instruction > + /// to widen it to do the computation on a legal wider vector type. In general the wider type will not be legal. For example when the vector type is an extended type. > + /// Useful 16 element vector used to pass operands for widening 16 element vector -> 16 element vector type Missing full stop at end of line. > + /// LoadWidenVectorOp - Load a vector for a wider type. Returns true if I will comment fully on the implementation once you submit it for LegalizeTypes. > + case ISD::CONCAT_VECTORS: { Is this for widening? > + // Fall thru to expand for vector That doesn't seem wise: if the operation is "widen" surely you have to always widen rather than sometimes expand? After all, users of this node are going to expect to find a widened value in the WidenedNodes map, but it may not be there. > + // Check if we have widen this node with another value > + std::map::iterator I = > + WidenNodes.find(ST->getValue()); Speak of the devil! Here is someone who expected to find a widened node but doesn't always! I hope this is just a temporary measure because widening support does not yet exist for all operations... > + // When widen is called, it is assumed that it is more efficient to use a > + // wide type. The default action is to widen to operation to a wider legal > + // vector type and then do the operation if it is legal by calling LegalizeOp > + // again. If there is no vector equivalent, we will unroll the operation, do > + // it, and rebuild the vector. If most of the operations are vectorizible to > + // the legal type, the resulting code will be more efficient. If this is not > + // the case, the resulting code will preform badly as we end up generating > + // code to pack/unpack the results. It is the function that calls widen > + // that is responsible for seeing this doesn't happen. For some cases, we > + // have decided that it is not worth widening so we just split the operation. I don't like this roll-back strategy at all... Do you have some examples where it is better to split than to widen? > + // Promote can mean > + // 1) On integers, it means to promote type (e.g., i8 to i32) "For integers, it means use the promoted integer type (e.g. i8 to i32)." > + // 2) For vectors, it means try to widen (e.g., v3i32 to v4i32) "For vectors, it means use the widened vector type (e.g. v3i32 to v4i32)" I don't think there should be any "try" about it: if the type action says widen then it should be widened. > + return PromoteInteger; > + } > + else { -> } else { > +/// getWidenVectorType: given a vector type, returns the type to widen to getWidenVectorType -> getWidenedVectorType > +/// If there is no vector type that we want to widen to, returns MVT::Other Missing full stop at end of line. Also, I don't think this information about whether we want to widen or not should be here. The type action should say whether it is to be widened or to be split. Probably this routine should simply always return the vector type obtained by (1) if there is a legal vector type with the same element type but more elements, return the smallest such vector type; (2) otherwise, round the number of elements up to the next power of two. By the way, if the number of elements is already a power of two and there is no wider legal vector type, then you really want to split not widen, so I think this routine should assert in that case. > +/// When and were to widen is target dependent based on the cost of When and were -> When and where > + // First set operation action for all vector types to either to promote to either to -> to either > + // (for widening) or expand (for scalarization). Then we will selectively or expand (for scalarization) -> or expand (for scalarization or splitting) > + setOperationAction(ISD::EXTRACT_SUBVECTOR,(MVT::SimpleValueType)VT, Expand); > + setOperationAction(ISD::CONCAT_VECTORS,(MVT::SimpleValueType)VT, Expand); What are these changes for? > +/// If there is no vector type that we want to widen to, returns MVT::Other > +/// When and were to widen is target dependent based on the cost of As above. > +MVT X86TargetLowering::getWidenVectorType(MVT VT) { As I mentioned above, I think all this logic should be in the type action, not here. > + /// If there is no vector type that we want to widen to, returns MVT::Other > + /// When and were to widen is target dependent based on the cost of As above. Ciao, Duncan. From ofv at wanadoo.es Thu Oct 30 12:15:55 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 30 Oct 2008 17:15:55 -0000 Subject: [llvm-commits] [llvm] r58434 - /llvm/trunk/CMakeLists.txt Message-ID: <200810301715.m9UHFtfv009561@zion.cs.uiuc.edu> Author: ofv Date: Thu Oct 30 12:15:54 2008 New Revision: 58434 URL: http://llvm.org/viewvc/llvm-project?rev=58434&view=rev Log: CMake: Cygwin pretends to be Unix. Patch by Jay Foad. Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=58434&r1=58433&r2=58434&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Oct 30 12:15:54 2008 @@ -31,8 +31,13 @@ ) if(WIN32) - set(LLVM_ON_WIN32 1) - set(LLVM_ON_UNIX 0) + if(CYGWIN) + set(LLVM_ON_WIN32 0) + set(LLVM_ON_UNIX 1) + else(CYGWIN) + set(LLVM_ON_WIN32 1) + set(LLVM_ON_UNIX 0) + endif(CYGWIN) set(LTDL_SHLIB_EXT ".dll") set(EXEEXT ".exe") # Maximum path length is 160 for non-unicode paths @@ -65,7 +70,10 @@ # set(CMAKE_VERBOSE_MAKEFILE true) add_definitions( -D__STDC_LIMIT_MACROS ) -add_definitions( -D__STDC_CONSTANT_MACROS ) +add_definitions( -D__STDC_CONSTANT_MACROS -m32 ) + +set( CMAKE_EXE_LINKER_FLAGS "-m32 ${CMAKE_EXE_LINKER_FLAGS}" ) +set( CMAKE_LINK_LIBRARY_FLAG "-m32 ${CMAKE_LINK_LIBRARY_FLAG}" ) if( MSVC ) add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS ) From ofv at wanadoo.es Thu Oct 30 12:21:37 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 30 Oct 2008 17:21:37 -0000 Subject: [llvm-commits] [llvm] r58435 - /llvm/trunk/CMakeLists.txt Message-ID: <200810301721.m9UHLbqU009790@zion.cs.uiuc.edu> Author: ofv Date: Thu Oct 30 12:21:37 2008 New Revision: 58435 URL: http://llvm.org/viewvc/llvm-project?rev=58435&view=rev Log: CMake: Reverted some unintentional changes on the previous commit. Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=58435&r1=58434&r2=58435&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Oct 30 12:21:37 2008 @@ -70,10 +70,7 @@ # set(CMAKE_VERBOSE_MAKEFILE true) add_definitions( -D__STDC_LIMIT_MACROS ) -add_definitions( -D__STDC_CONSTANT_MACROS -m32 ) - -set( CMAKE_EXE_LINKER_FLAGS "-m32 ${CMAKE_EXE_LINKER_FLAGS}" ) -set( CMAKE_LINK_LIBRARY_FLAG "-m32 ${CMAKE_LINK_LIBRARY_FLAG}" ) +add_definitions( -D__STDC_CONSTANT_MACROS ) if( MSVC ) add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS ) From grosbach at apple.com Thu Oct 30 12:30:37 2008 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 30 Oct 2008 10:30:37 -0700 Subject: [llvm-commits] [llvm] r58405 - r58409 In-Reply-To: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> References: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> Message-ID: <74F3DBF7-7EC3-4837-B1A2-E7C92EDE08EF@apple.com> On Oct 29, 2008, at 4:54 PM, Evan Cheng wrote: > > void JITEmitter::emitConstantPool(MachineConstantPool *MCP) { > - if (TheJIT->getJITInfo().hasCustomConstantPool()) { > - DOUT << "JIT: Target has custom constant pool handling. > Omitting standard " > - "constant pool\n"; > - return; > - } If this is removed, the JIT will still emit the generic constant pool at the start of the function. The ARM backend doesn't use that pool (all the constants are put into the constant islands), so the generic pool is a waste of space and completely unreferenced. There needs to be a way for the target to tell the generic bits that the target is handling all of the constant pool entries. > + MCE.emitWordLE(0); > + } else { > + abort(); // FIXME: Is this right? > + const ConstantInt *CI = dyn_cast(CV); > + uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); > + MCE.emitWordLE(Val); > + } This breaks simple cases like the following: #include int main(int argc, char *argv[]) { unsigned a; a = 0xaaaaaaaa; } These were working before and hit this abort now. > --- llvm/trunk/include/llvm/CodeGen/MachineRelocation.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineRelocation.h Wed Oct 29 > 18:53:42 2008 > @@ -63,10 +63,11 @@ > unsigned GOTIndex; // Index in the GOT of this symbol/global > } Target; > > - unsigned TargetReloType : 6; // The target relocation ID. > - AddressType AddrType : 4; // The field of Target to use. > - bool NeedStub : 1; // True if this relocation requires > a stub. > + unsigned TargetReloType : 6; // The target relocation ID > + AddressType AddrType : 4; // The field of Target to use > + bool NeedStub : 1; // True if this relocation requires > a stub > bool GOTRelative : 1; // Should this relocation be relative > to the GOT? > + bool TargetResolve : 1; // True if target should resolve the > address I thought we were avoiding adding entries to the MachineRelocation class? I have mixed feeling about this. On the one hand, it makes sense to have relocation related bits (pun intended) be part of the relocation class. On the other hand, this implies that the target will be mixing and matching whether a constant pool entry will be resolved by the target or by the generic code on a per-constant basis, which is not true. The decision to put the constants elsewhere is made on an all-or- nothing basis, and it seems that this should mirror that decision. On the gripping hand, I like that this allows for target-specific stuff that's not just the constant pool entries. Perhaps the implication is that the non-target specific JIT shouldn't be doing the constant pool layout, and should be delegating that, and the associated relocation address resolution, to the target always? As a sidenote, shouldn't these all have been a single commit rather than one per file? The changes are related and require one another for a successful build. Having related changes be checked in as an atomic commit is very useful when doing forensics later. -Jim From evan.cheng at apple.com Thu Oct 30 12:48:12 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 30 Oct 2008 10:48:12 -0700 Subject: [llvm-commits] [llvm] r58405 - r58409 In-Reply-To: <74F3DBF7-7EC3-4837-B1A2-E7C92EDE08EF@apple.com> References: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> <74F3DBF7-7EC3-4837-B1A2-E7C92EDE08EF@apple.com> Message-ID: <3EB0549E-54FD-4F51-9F33-329A6EBA02A3@apple.com> On Oct 30, 2008, at 10:30 AM, Jim Grosbach wrote: > On Oct 29, 2008, at 4:54 PM, Evan Cheng wrote: >> >> void JITEmitter::emitConstantPool(MachineConstantPool *MCP) { >> - if (TheJIT->getJITInfo().hasCustomConstantPool()) { >> - DOUT << "JIT: Target has custom constant pool handling. >> Omitting standard " >> - "constant pool\n"; >> - return; >> - } > > If this is removed, the JIT will still emit the generic constant pool > at the start of the function. The ARM backend doesn't use that pool > (all the constants are put into the constant islands), so the generic > pool is a waste of space and completely unreferenced. There needs to > be a way for the target to tell the generic bits that the target is > handling all of the constant pool entries. You're right. I am not crazy about this solution but I don't see a better one right now. We can restore this part. > > >> + MCE.emitWordLE(0); >> + } else { >> + abort(); // FIXME: Is this right? >> + const ConstantInt *CI = dyn_cast(CV); >> + uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); >> + MCE.emitWordLE(Val); >> + } > > > This breaks simple cases like the following: > #include > > int main(int argc, char *argv[]) > { > unsigned a; > > a = 0xaaaaaaaa; > } > > These were working before and hit this abort now. Right. It's intended. I want a better solution for all the cases. I'll deal with this shortly. > > >> --- llvm/trunk/include/llvm/CodeGen/MachineRelocation.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineRelocation.h Wed Oct 29 >> 18:53:42 2008 >> @@ -63,10 +63,11 @@ >> unsigned GOTIndex; // Index in the GOT of this symbol/global >> } Target; >> >> - unsigned TargetReloType : 6; // The target relocation ID. >> - AddressType AddrType : 4; // The field of Target to use. >> - bool NeedStub : 1; // True if this relocation requires >> a stub. >> + unsigned TargetReloType : 6; // The target relocation ID >> + AddressType AddrType : 4; // The field of Target to use >> + bool NeedStub : 1; // True if this relocation requires >> a stub >> bool GOTRelative : 1; // Should this relocation be relative >> to the GOT? >> + bool TargetResolve : 1; // True if target should resolve the >> address > > I thought we were avoiding adding entries to the MachineRelocation > class? We have bits available. This should not cause any bloat. > > > I have mixed feeling about this. On the one hand, it makes sense to > have relocation related bits (pun intended) be part of the relocation > class. On the other hand, this implies that the target will be mixing > and matching whether a constant pool entry will be resolved by the > target or by the generic code on a per-constant basis, which is not > true. The decision to put the constants elsewhere is made on an all- > or- > nothing basis, and it seems that this should mirror that decision. On That's true for ARM. But it may not always be true. The main reason for the change is the old scheme cannot deal with machine constantpool entries. Also, this is a clearer separation. The CONSTPOOL_ENTRY is an instruction, so the target code emitter should populate it. > > the gripping hand, I like that this allows for target-specific stuff > that's not just the constant pool entries. > > Perhaps the implication is that the non-target specific JIT shouldn't > be doing the constant pool layout, and should be delegating that, and > the associated relocation address resolution, to the target always? > > As a sidenote, shouldn't these all have been a single commit rather > than one per file? The changes are related and require one another for > a successful build. Having related changes be checked in as an atomic > commit is very useful when doing forensics later. *Shrug*. Some parts of these check-ins are not tied to the others. Evan > > > > -Jim > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From wangmp at apple.com Thu Oct 30 13:21:53 2008 From: wangmp at apple.com (Mon P Wang) Date: Thu, 30 Oct 2008 18:21:53 -0000 Subject: [llvm-commits] [llvm] r58443 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200810301821.m9UILrKU025008@zion.cs.uiuc.edu> Author: wangmp Date: Thu Oct 30 13:21:52 2008 New Revision: 58443 URL: http://llvm.org/viewvc/llvm-project?rev=58443&view=rev Log: Add missing vsetcc expansion for widening Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=58443&r1=58442&r2=58443&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 30 13:21:52 2008 @@ -7941,9 +7941,20 @@ break; } break; + } + case ISD::VSETCC: { + // Determine widen for the operand + SDValue Tmp1 = Node->getOperand(0); + MVT TmpVT = Tmp1.getValueType(); + assert(TmpVT.isVector() && "can not widen non vector type"); + MVT TmpEVT = TmpVT.getVectorElementType(); + MVT TmpWidenVT = MVT::getVectorVT(TmpEVT, NewNumElts); + Tmp1 = WidenVectorOp(Tmp1, TmpWidenVT); + SDValue Tmp2 = WidenVectorOp(Node->getOperand(1), TmpWidenVT); + Result = DAG.getNode(Node->getOpcode(), WidenVT, Tmp1, Tmp2, + Node->getOperand(2)); break; } - case ISD::ATOMIC_CMP_SWAP_8: case ISD::ATOMIC_CMP_SWAP_16: case ISD::ATOMIC_CMP_SWAP_32: From sabre at nondot.org Thu Oct 30 13:49:56 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 30 Oct 2008 18:49:56 -0000 Subject: [llvm-commits] [test-suite] r58448 - in /test-suite/trunk: Makefile.programs Makefile.rules Message-ID: <200810301849.m9UInvQF025997@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 30 13:49:56 2008 New Revision: 58448 URL: http://llvm.org/viewvc/llvm-project?rev=58448&view=rev Log: add support for using 'make native' as a recursive target. Modified: test-suite/trunk/Makefile.programs test-suite/trunk/Makefile.rules Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=58448&r1=58447&r2=58448&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Thu Oct 30 13:49:56 2008 @@ -431,7 +431,7 @@ JIT_OPTS += -enable-correct-eh-support endif -native: $(PROGRAMS_TO_TEST:%=Output/%.native) +native:: $(PROGRAMS_TO_TEST:%=Output/%.native) stripped-bytecode:: $(PROGRAMS_TO_TEST:%=Output/%.llvm.stripped.bc) ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES Modified: test-suite/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=58448&r1=58447&r2=58448&view=diff ============================================================================== --- test-suite/trunk/Makefile.rules (original) +++ test-suite/trunk/Makefile.rules Thu Oct 30 13:49:56 2008 @@ -123,7 +123,7 @@ # which are marked as Phony. # .PHONY: all dynamic bytecodelib install-bytecode-library -.PHONY: clean distclean install test bytecode prdirs +.PHONY: clean distclean install test bytecode native prdirs ########################################################################### # Miscellaneous paths and commands: @@ -462,7 +462,7 @@ #--------------------------------------------------------- ifdef DIRS -all install clean test bytecode stripped-bytecode install-bytecode:: +all install clean test bytecode native stripped-bytecode install-bytecode:: $(VERB) for dir in ${DIRS}; do \ if [ ! -f $$dir/Makefile ]; \ then \ @@ -480,10 +480,12 @@ clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS)) test :: $(addsuffix /.maketest , $(PARALLEL_DIRS)) bytecode :: $(addsuffix /.makebytecode, $(PARALLEL_DIRS)) +native :: $(addsuffix /.makenative, $(PARALLEL_DIRS)) stripped-bytecode :: $(addsuffix /.makestripped-bytecode, $(PARALLEL_DIRS)) install-bytecode :: $(addsuffix /.makeinstall-bytecode, $(PARALLEL_DIRS)) -%/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode %/.makestripped-bytecode %/.makeinstall-bytecode: +%/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode \ +%/.makestripped-bytecode %/.makeinstall-bytecode %/.makenative: $(VERB) if [ ! -f $(@D)/Makefile ]; \ then \ $(MKDIR) $(@D); \ From baldrick at free.fr Thu Oct 30 14:24:30 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 30 Oct 2008 19:24:30 -0000 Subject: [llvm-commits] [llvm] r58449 - /llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Message-ID: <200810301924.m9UJOUNL027361@zion.cs.uiuc.edu> Author: baldrick Date: Thu Oct 30 14:24:28 2008 New Revision: 58449 URL: http://llvm.org/viewvc/llvm-project?rev=58449&view=rev Log: Shift amounts should have the type given by getShiftAmountTy (i32 in the case of CellSPU). Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=58449&r1=58448&r2=58449&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Thu Oct 30 14:24:28 2008 @@ -2175,17 +2175,17 @@ ? DAG.getNode(ISD::ZERO_EXTEND, MVT::i16, N0) : DAG.getConstant(cast(N0)->getZExtValue(), MVT::i16)); - N1Opc = N1.getValueType().bitsLT(MVT::i16) + N1Opc = N1.getValueType().bitsLT(MVT::i32) ? ISD::ZERO_EXTEND : ISD::TRUNCATE; N1 = (N1.getOpcode() != ISD::Constant - ? DAG.getNode(N1Opc, MVT::i16, N1) + ? DAG.getNode(N1Opc, MVT::i32, N1) : DAG.getConstant(cast(N1)->getZExtValue(), - MVT::i16)); + MVT::i32)); SDValue ExpandArg = DAG.getNode(ISD::OR, MVT::i16, N0, DAG.getNode(ISD::SHL, MVT::i16, - N0, DAG.getConstant(8, MVT::i16))); + N0, DAG.getConstant(8, MVT::i32))); return DAG.getNode(ISD::TRUNCATE, MVT::i8, DAG.getNode(Opc, MVT::i16, ExpandArg, N1)); } @@ -2526,7 +2526,7 @@ SDValue N = Op.getOperand(0); SDValue Elt0 = DAG.getConstant(0, MVT::i16); SDValue Mask0 = DAG.getConstant(0x0f, MVT::i16); - SDValue Shift1 = DAG.getConstant(8, MVT::i16); + SDValue Shift1 = DAG.getConstant(8, MVT::i32); SDValue Promote = DAG.getNode(SPUISD::PROMOTE_SCALAR, vecVT, N, N); SDValue CNTB = DAG.getNode(SPUISD::CNTB, vecVT, Promote); From daniel at zuster.org Thu Oct 30 14:26:59 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 30 Oct 2008 19:26:59 -0000 Subject: [llvm-commits] [llvm] r58450 - in /llvm/trunk: include/llvm/Transforms/IPO/InlinerPass.h include/llvm/Transforms/Utils/InlineCost.h lib/Transforms/IPO/InlineAlways.cpp lib/Transforms/IPO/InlineSimple.cpp lib/Transforms/IPO/Inliner.cpp lib/Transforms/Utils/BasicInliner.cpp lib/Transforms/Utils/InlineCost.cpp test/Transforms/Inline/2008-10-30-AlwaysInline.ll Message-ID: <200810301926.m9UJQxd7027461@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Oct 30 14:26:59 2008 New Revision: 58450 URL: http://llvm.org/viewvc/llvm-project?rev=58450&view=rev Log: Add InlineCost class for represent the estimated cost of inlining a function. - This explicitly models the costs for functions which should "always" or "never" be inlined. This fixes bugs where such costs were not previously respected. Added: llvm/trunk/test/Transforms/Inline/2008-10-30-AlwaysInline.ll Modified: llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp llvm/trunk/lib/Transforms/IPO/Inliner.cpp llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Modified: llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h?rev=58450&r1=58449&r2=58450&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO/InlinerPass.h Thu Oct 30 14:26:59 2008 @@ -18,6 +18,7 @@ #define INLINER_H #include "llvm/CallGraphSCCPass.h" +#include "llvm/Transforms/Utils/InlineCost.h" namespace llvm { class CallSite; @@ -53,7 +54,7 @@ /// returned is greater than the current inline threshold, the call site is /// not inlined. /// - virtual int getInlineCost(CallSite CS) = 0; + virtual InlineCost getInlineCost(CallSite CS) = 0; // getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a // higher threshold to determine if the function call should be inlined. Modified: llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h?rev=58450&r1=58449&r2=58450&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/InlineCost.h Thu Oct 30 14:26:59 2008 @@ -15,6 +15,7 @@ #define LLVM_TRANSFORMS_UTILS_INLINECOST_H #include "llvm/ADT/SmallPtrSet.h" +#include #include #include @@ -24,6 +25,41 @@ class Function; class CallSite; + /// InlineCost - Represent the cost of inlining a function. This + /// supports special values for functions which should "always" or + /// "never" be inlined. Otherwise, the cost represents a unitless + /// amount; smaller values increase the likelyhood of the function + /// being inlined. + class InlineCost { + enum Kind { + Value, + Always, + Never + }; + + int Cost : 30; + unsigned Type : 2; + + InlineCost(int C, int T) : Cost(C), Type(T) { + assert(Cost == C && "Cost exceeds InlineCost precision"); + } + public: + static InlineCost get(int Cost) { return InlineCost(Cost, Value); } + static InlineCost getAlways() { return InlineCost(0, Always); } + static InlineCost getNever() { return InlineCost(0, Never); } + + bool isVariable() const { return Type == Value; } + bool isAlways() const { return Type == Always; } + bool isNever() const { return Type == Never; } + + /// getValue() - Return a "variable" inline cost's amount. It is + /// an error to call this on an "always" or "never" InlineCost. + int getValue() const { + assert(Type == Value && "Invalid access of InlineCost"); + return Cost; + } + }; + /// InlineCostAnalyzer - Cost analyzer used by inliner. class InlineCostAnalyzer { struct ArgInfo { @@ -83,8 +119,8 @@ /// getInlineCost - The heuristic used to determine if we should inline the /// function call or not. /// - int getInlineCost(CallSite CS, - SmallPtrSet &NeverInline); + InlineCost getInlineCost(CallSite CS, + SmallPtrSet &NeverInline); /// getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a /// higher threshold to determine if the function call should be inlined. Modified: llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp?rev=58450&r1=58449&r2=58450&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp Thu Oct 30 14:26:59 2008 @@ -39,7 +39,7 @@ // Use extremely low threshold. AlwaysInliner() : Inliner(&ID, -2000000000) {} static char ID; // Pass identification, replacement for typeid - int getInlineCost(CallSite CS) { + InlineCost getInlineCost(CallSite CS) { return CA.getInlineCost(CS, NeverInline); } float getInlineFudgeFactor(CallSite CS) { Modified: llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp?rev=58450&r1=58449&r2=58450&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp Thu Oct 30 14:26:59 2008 @@ -37,7 +37,7 @@ SimpleInliner() : Inliner(&ID) {} SimpleInliner(int Threshold) : Inliner(&ID, Threshold) {} static char ID; // Pass identification, replacement for typeid - int getInlineCost(CallSite CS) { + InlineCost getInlineCost(CallSite CS) { return CA.getInlineCost(CS, NeverInline); } float getInlineFudgeFactor(CallSite CS) { Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=58450&r1=58449&r2=58450&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Thu Oct 30 14:26:59 2008 @@ -76,9 +76,22 @@ /// shouldInline - Return true if the inliner should attempt to inline /// at the given CallSite. bool Inliner::shouldInline(CallSite CS) { - int Cost = getInlineCost(CS); + InlineCost IC = getInlineCost(CS); float FudgeFactor = getInlineFudgeFactor(CS); + if (IC.isAlways()) { + DOUT << " Inlining: cost=always" + << ", Call: " << *CS.getInstruction(); + return true; + } + + if (IC.isNever()) { + DOUT << " NOT Inlining: cost=never" + << ", Call: " << *CS.getInstruction(); + return false; + } + + int Cost = IC.getValue(); int CurrentThreshold = InlineThreshold; Function *Fn = CS.getCaller(); if (Fn && !Fn->isDeclaration() Modified: llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp?rev=58450&r1=58449&r2=58450&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Thu Oct 30 14:26:59 2008 @@ -107,16 +107,27 @@ --index; continue; } - int InlineCost = CA.getInlineCost(CS, NeverInline); - if (InlineCost >= (int) BasicInlineThreshold) { - DOUT << " NOT Inlining: cost = " << InlineCost - << ", call: " << *CS.getInstruction(); + InlineCost IC = CA.getInlineCost(CS, NeverInline); + if (IC.isAlways()) { + DOUT << " Inlining: cost=always" + <<", call: " << *CS.getInstruction(); + } else if (IC.isNever()) { + DOUT << " NOT Inlining: cost=never" + <<", call: " << *CS.getInstruction(); continue; + } else { + int Cost = IC.getValue(); + + if (Cost >= BasicInlineThreshold) { + DOUT << " NOT Inlining: cost = " << Cost + << ", call: " << *CS.getInstruction(); + continue; + } else { + DOUT << " Inlining: cost = " << Cost + << ", call: " << *CS.getInstruction(); + } } - DOUT << " Inlining: cost=" << InlineCost - <<", call: " << *CS.getInstruction(); - // Inline if (InlineFunction(CS, NULL, TD)) { if (Callee->use_empty() && Callee->hasInternalLinkage()) Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=58450&r1=58449&r2=58450&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Thu Oct 30 14:26:59 2008 @@ -169,7 +169,7 @@ // getInlineCost - The heuristic used to determine if we should inline the // function call or not. // -int InlineCostAnalyzer::getInlineCost(CallSite CS, +InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS, SmallPtrSet &NeverInline) { Instruction *TheCall = CS.getInstruction(); Function *Callee = CS.getCalledFunction(); @@ -187,7 +187,7 @@ // Don't inline functions marked noinline. NeverInline.count(Callee)) - return 2000000000; + return llvm::InlineCost::getNever(); // InlineCost - This value measures how good of an inline candidate this call // site is to inline. A lower inline cost make is more likely for the call to @@ -224,10 +224,14 @@ // If we should never inline this, return a huge cost. if (CalleeFI.NeverInline) - return 2000000000; + return InlineCost::getNever(); + // FIXME: It would be nice to kill off CalleeFI.NeverInline. Then we + // could move this up and avoid computing the FunctionInfo for + // things we are going to just return always inline for. This + // requires handling setjmp somewhere else, however. if (!Callee->isDeclaration() && Callee->hasFnAttr(Attribute::AlwaysInline)) - return -2000000000; + return InlineCost::getAlways(); // Add to the inline quality for properties that make the call valuable to // inline. This includes factors that indicate that the result of inlining @@ -274,7 +278,7 @@ // Look at the size of the callee. Each instruction counts as 5. InlineCost += CalleeFI.NumInsts*5; - return InlineCost; + return llvm::InlineCost::get(InlineCost); } // getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a Added: llvm/trunk/test/Transforms/Inline/2008-10-30-AlwaysInline.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/2008-10-30-AlwaysInline.ll?rev=58450&view=auto ============================================================================== --- llvm/trunk/test/Transforms/Inline/2008-10-30-AlwaysInline.ll (added) +++ llvm/trunk/test/Transforms/Inline/2008-10-30-AlwaysInline.ll Thu Oct 30 14:26:59 2008 @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -always-inline | llvm-dis | not grep call + +; Ensure that threshold doesn't disrupt always inline. +; RUN: llvm-as < %s | opt -inline-threshold=-2000000001 -always-inline | llvm-dis | not grep call + + +define internal i32 @if0() alwaysinline { + ret i32 1 +} + +define i32 @f0() { + %r = call i32 @if0() + ret i32 %r +} From baldrick at free.fr Thu Oct 30 14:28:33 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 30 Oct 2008 19:28:33 -0000 Subject: [llvm-commits] [llvm] r58451 - /llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200810301928.m9UJSXee027526@zion.cs.uiuc.edu> Author: baldrick Date: Thu Oct 30 14:28:32 2008 New Revision: 58451 URL: http://llvm.org/viewvc/llvm-project?rev=58451&view=rev Log: Shift amounts should have type getShiftAmountTy (i32 for PPC, not i8). Correct this, and some formatting while there. Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=58451&r1=58450&r2=58451&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Thu Oct 30 14:28:32 2008 @@ -1176,7 +1176,7 @@ unsigned Log2b = Log2_32(VT.getSizeInBits()); SDValue Clz = DAG.getNode(ISD::CTLZ, VT, Zext); SDValue Scc = DAG.getNode(ISD::SRL, VT, Clz, - DAG.getConstant(Log2b, MVT::i32)); + DAG.getConstant(Log2b, MVT::i32)); return DAG.getNode(ISD::TRUNCATE, MVT::i32, Scc); } // Leave comparisons against 0 and -1 alone for now, since they're usually @@ -3015,7 +3015,7 @@ DAG.getNode(ISD::XOR, MVT::i32, CWD, DAG.getConstant(3, MVT::i32)), DAG.getConstant(3, MVT::i32)), - DAG.getConstant(1, MVT::i8)); + DAG.getConstant(1, MVT::i32)); SDValue RetVal = DAG.getNode(ISD::XOR, MVT::i32, CWD1, CWD2); @@ -3039,12 +3039,12 @@ MVT AmtVT = Amt.getValueType(); SDValue Tmp1 = DAG.getNode(ISD::SUB, AmtVT, - DAG.getConstant(BitWidth, AmtVT), Amt); + DAG.getConstant(BitWidth, AmtVT), Amt); SDValue Tmp2 = DAG.getNode(PPCISD::SHL, VT, Hi, Amt); SDValue Tmp3 = DAG.getNode(PPCISD::SRL, VT, Lo, Tmp1); SDValue Tmp4 = DAG.getNode(ISD::OR , VT, Tmp2, Tmp3); SDValue Tmp5 = DAG.getNode(ISD::ADD, AmtVT, Amt, - DAG.getConstant(-BitWidth, AmtVT)); + DAG.getConstant(-BitWidth, AmtVT)); SDValue Tmp6 = DAG.getNode(PPCISD::SHL, VT, Lo, Tmp5); SDValue OutHi = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); SDValue OutLo = DAG.getNode(PPCISD::SHL, VT, Lo, Amt); @@ -3067,12 +3067,12 @@ MVT AmtVT = Amt.getValueType(); SDValue Tmp1 = DAG.getNode(ISD::SUB, AmtVT, - DAG.getConstant(BitWidth, AmtVT), Amt); + DAG.getConstant(BitWidth, AmtVT), Amt); SDValue Tmp2 = DAG.getNode(PPCISD::SRL, VT, Lo, Amt); SDValue Tmp3 = DAG.getNode(PPCISD::SHL, VT, Hi, Tmp1); SDValue Tmp4 = DAG.getNode(ISD::OR , VT, Tmp2, Tmp3); SDValue Tmp5 = DAG.getNode(ISD::ADD, AmtVT, Amt, - DAG.getConstant(-BitWidth, AmtVT)); + DAG.getConstant(-BitWidth, AmtVT)); SDValue Tmp6 = DAG.getNode(PPCISD::SRL, VT, Hi, Tmp5); SDValue OutLo = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); SDValue OutHi = DAG.getNode(PPCISD::SRL, VT, Hi, Amt); @@ -3094,16 +3094,16 @@ MVT AmtVT = Amt.getValueType(); SDValue Tmp1 = DAG.getNode(ISD::SUB, AmtVT, - DAG.getConstant(BitWidth, AmtVT), Amt); + DAG.getConstant(BitWidth, AmtVT), Amt); SDValue Tmp2 = DAG.getNode(PPCISD::SRL, VT, Lo, Amt); SDValue Tmp3 = DAG.getNode(PPCISD::SHL, VT, Hi, Tmp1); SDValue Tmp4 = DAG.getNode(ISD::OR , VT, Tmp2, Tmp3); SDValue Tmp5 = DAG.getNode(ISD::ADD, AmtVT, Amt, - DAG.getConstant(-BitWidth, AmtVT)); + DAG.getConstant(-BitWidth, AmtVT)); SDValue Tmp6 = DAG.getNode(PPCISD::SRA, VT, Hi, Tmp5); SDValue OutHi = DAG.getNode(PPCISD::SRA, VT, Hi, Amt); SDValue OutLo = DAG.getSelectCC(Tmp5, DAG.getConstant(0, AmtVT), - Tmp4, Tmp6, ISD::SETLE); + Tmp4, Tmp6, ISD::SETLE); SDValue OutOps[] = { OutLo, OutHi }; return DAG.getMergeValues(OutOps, 2); } From daniel at zuster.org Thu Oct 30 14:31:35 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 30 Oct 2008 19:31:35 -0000 Subject: [llvm-commits] [llvm] r58452 - in /llvm/trunk: lib/Target/ARM/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CppBackend/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/AsmPrinter/ test/FrontendObjC++/ Message-ID: <200810301931.m9UJVZ0p027710@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Oct 30 14:31:35 2008 New Revision: 58452 URL: http://llvm.org/viewvc/llvm-project?rev=58452&view=rev Log: Set svn:ignore for some Release-Asserts and Output dirs. Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ (props changed) llvm/trunk/lib/Target/CellSPU/ (props changed) llvm/trunk/lib/Target/CppBackend/ (props changed) llvm/trunk/lib/Target/Mips/ (props changed) llvm/trunk/lib/Target/PIC16/ (props changed) llvm/trunk/lib/Target/PowerPC/AsmPrinter/ (props changed) llvm/trunk/test/FrontendObjC++/ (props changed) Propchange: llvm/trunk/lib/Target/ARM/AsmPrinter/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Oct 30 14:31:35 2008 @@ -1,2 +1,3 @@ Debug Release +Release-Asserts Propchange: llvm/trunk/lib/Target/CellSPU/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Oct 30 14:31:35 2008 @@ -1,3 +1,4 @@ *.inc Debug Release +Release-Asserts Propchange: llvm/trunk/lib/Target/CppBackend/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Oct 30 14:31:35 2008 @@ -1,3 +1,4 @@ Release Debug +Release-Asserts Propchange: llvm/trunk/lib/Target/Mips/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Oct 30 14:31:35 2008 @@ -1,3 +1,4 @@ *.inc Debug Release +Release-Asserts Propchange: llvm/trunk/lib/Target/PIC16/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Oct 30 14:31:35 2008 @@ -1,3 +1,4 @@ Release Debug PIC16Gen*.inc +Release-Asserts Propchange: llvm/trunk/lib/Target/PowerPC/AsmPrinter/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Oct 30 14:31:35 2008 @@ -1,2 +1,3 @@ Debug Release +Release-Asserts Propchange: llvm/trunk/test/FrontendObjC++/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Thu Oct 30 14:31:35 2008 @@ -0,0 +1 @@ +Output From daniel at zuster.org Thu Oct 30 14:35:32 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 30 Oct 2008 19:35:32 -0000 Subject: [llvm-commits] [llvm] r58453 - /llvm/trunk/ Message-ID: <200810301935.m9UJZWOE027866@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Oct 30 14:35:32 2008 New Revision: 58453 URL: http://llvm.org/viewvc/llvm-project?rev=58453&view=rev Log: Set svn:ignore on cscope.{files,out} in root llvm directory. Modified: llvm/trunk/ (props changed) Propchange: llvm/trunk/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Oct 30 14:35:32 2008 @@ -14,3 +14,5 @@ svn-commit.* *.patch *.patch.raw +cscope.files +cscope.out From grosbach at apple.com Thu Oct 30 15:26:17 2008 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 30 Oct 2008 20:26:17 -0000 Subject: [llvm-commits] [test-suite] r58454 - /test-suite/trunk/Makefile.rules Message-ID: <200810302026.m9UKQHAS029686@zion.cs.uiuc.edu> Author: grosbach Date: Thu Oct 30 15:26:15 2008 New Revision: 58454 URL: http://llvm.org/viewvc/llvm-project?rev=58454&view=rev Log: ENABLE_PROFILING, DISABLE_ASSERTIONS, and ENABLE_OPTIMIZED are {0,1} values, not just checked via ifdef. I.e., Change so 'make ENABLE_OPTIMIZED=0' et. al. behave as expected Modified: test-suite/trunk/Makefile.rules Modified: test-suite/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=58454&r1=58453&r2=58454&view=diff ============================================================================== --- test-suite/trunk/Makefile.rules (original) +++ test-suite/trunk/Makefile.rules Thu Oct 30 15:26:15 2008 @@ -137,11 +137,11 @@ BURG_OPTS = -I -ifdef ENABLE_PROFILING +ifeq ($(ENABLE_PROFILING),1) ENABLE_OPTIMIZED = 1 CONFIGURATION := Profile else - ifdef ENABLE_OPTIMIZED + ifeq ($(ENABLE_OPTIMIZED),1) CONFIGURATION := Release else CONFIGURATION := Debug @@ -150,7 +150,7 @@ # If ENABLE_ASSERTIONS=1 is specified (make command line or configured), # then adjust the CONFIGURATION name appropriately (to match LLVM makefiles) -ifdef DISABLE_ASSERTIONS +ifeq ($(DISABLE_ASSERTIONS),1) CONFIGURATION := $(CONFIGURATION)-Asserts endif @@ -158,7 +158,7 @@ # Enable this for profiling support with 'gprof' # This automatically enables optimized builds. # -ifdef ENABLE_PROFILING +ifeq ($(ENABLE_PROFILING),1) PROFILE = -pg endif From baldrick at free.fr Thu Oct 30 15:26:50 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 30 Oct 2008 20:26:50 -0000 Subject: [llvm-commits] [llvm] r58455 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200810302026.m9UKQoWi029718@zion.cs.uiuc.edu> Author: baldrick Date: Thu Oct 30 15:26:50 2008 New Revision: 58455 URL: http://llvm.org/viewvc/llvm-project?rev=58455&view=rev Log: Fix PR2986: do not use a potentially illegal type for the shift amount type. Add a check that shifts and rotates use the type returned by getShiftAmountTy for the amount. This exposed some problems in CellSPU and PPC, which have already been fixed. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=58455&r1=58454&r2=58455&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 30 15:26:50 2008 @@ -2390,6 +2390,8 @@ "Shift operators return type must be the same as their first arg"); assert(VT.isInteger() && N2.getValueType().isInteger() && "Shifts only work on integers"); + assert(N2.getValueType() == TLI.getShiftAmountTy() && + "Wrong type for shift amount"); // Always fold shifts of i1 values so the code generator doesn't need to // handle them. Since we know the size of the shift has to be less than the @@ -2763,12 +2765,15 @@ return DAG.getConstantFP(APFloat(Val), VT); } + const TargetLowering &TLI = DAG.getTargetLoweringInfo(); Value = DAG.getNode(ISD::ZERO_EXTEND, VT, Value); unsigned Shift = 8; for (unsigned i = NumBits; i > 8; i >>= 1) { Value = DAG.getNode(ISD::OR, VT, DAG.getNode(ISD::SHL, VT, Value, - DAG.getConstant(Shift, MVT::i8)), Value); + DAG.getConstant(Shift, + TLI.getShiftAmountTy())), + Value); Shift <<= 1; } From baldrick at free.fr Thu Oct 30 15:34:41 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 30 Oct 2008 20:34:41 -0000 Subject: [llvm-commits] [llvm] r58456 - /llvm/trunk/test/CodeGen/PowerPC/2008-10-30-IllegalShift.ll Message-ID: <200810302034.m9UKYh8b030003@zion.cs.uiuc.edu> Author: baldrick Date: Thu Oct 30 15:34:30 2008 New Revision: 58456 URL: http://llvm.org/viewvc/llvm-project?rev=58456&view=rev Log: Testcase for PR2986. Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-30-IllegalShift.ll Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-30-IllegalShift.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-10-30-IllegalShift.ll?rev=58456&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2008-10-30-IllegalShift.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2008-10-30-IllegalShift.ll Thu Oct 30 15:34:30 2008 @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -march=ppc32 +; PR2986 + at argc = external global i32 ; [#uses=1] + at buffer = external global [32 x i8], align 4 ; <[32 x i8]*> [#uses=1] + +define void @test1() nounwind noinline { +entry: + %0 = load i32* @argc, align 4 ; [#uses=1] + %1 = trunc i32 %0 to i8 ; [#uses=1] + tail call void @llvm.memset.i32(i8* getelementptr ([32 x i8]* @buffer, i32 0, i32 0), i8 %1, i32 17, i32 4) + unreachable +} + +declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind From gohman at apple.com Thu Oct 30 15:40:11 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 30 Oct 2008 20:40:11 -0000 Subject: [llvm-commits] [llvm] r58457 - in /llvm/trunk: include/llvm/Support/PatternMatch.h lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll Message-ID: <200810302040.m9UKeCjI030257@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 30 15:40:10 2008 New Revision: 58457 URL: http://llvm.org/viewvc/llvm-project?rev=58457&view=rev Log: Canonicalize sext(i1) to i1?-1:0, and update various instcombine optimizations accordingly. Modified: llvm/trunk/include/llvm/Support/PatternMatch.h llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/logical-select.ll Modified: llvm/trunk/include/llvm/Support/PatternMatch.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=58457&r1=58456&r2=58457&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PatternMatch.h (original) +++ llvm/trunk/include/llvm/Support/PatternMatch.h Thu Oct 30 15:40:10 2008 @@ -51,6 +51,22 @@ /// m_ConstantInt() - Match an arbitrary ConstantInt and ignore it. inline leaf_ty m_ConstantInt() { return leaf_ty(); } +struct constantint_ty { + int64_t Val; + explicit constantint_ty(int64_t val) : Val(val) {} + + template + bool match(ITy *V) { + return isa(V) && cast(V)->getSExtValue() == Val; + } +}; + +/// m_ConstantInt(int64_t) - Match a ConstantInt with a specific value +/// and ignore it. +inline constantint_ty m_ConstantInt(int64_t Val) { + return constantint_ty(Val); +} + struct zero_ty { template bool match(ITy *V) { @@ -322,6 +338,36 @@ } //===----------------------------------------------------------------------===// +// Matchers for SelectInst classes +// + +template +struct SelectClass_match { + Cond_t C; + LHS_t L; + RHS_t R; + + SelectClass_match(const Cond_t &Cond, const LHS_t &LHS, + const RHS_t &RHS) + : C(Cond), L(LHS), R(RHS) {} + + template + bool match(OpTy *V) { + if (SelectInst *I = dyn_cast(V)) + return C.match(I->getOperand(0)) && + L.match(I->getOperand(1)) && + R.match(I->getOperand(2)); + return false; + } +}; + +template +inline SelectClass_match +m_Select(const Cond &C, const LHS &L, const RHS &R) { + return SelectClass_match(C, L, R); +} + +//===----------------------------------------------------------------------===// // Matchers for CastInst classes // Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=58457&r1=58456&r2=58457&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 30 15:40:10 2008 @@ -2012,6 +2012,14 @@ KnownZero, KnownOne)) return &I; } + + // zext(i1) - 1 -> select i1, 0, -1 + if (ZExtInst *ZI = dyn_cast(LHS)) + if (CI->isAllOnesValue() && + ZI->getOperand(0)->getType() == Type::Int1Ty) + return SelectInst::Create(ZI->getOperand(0), + Constant::getNullValue(I.getType()), + ConstantInt::getAllOnesValue(I.getType())); } if (isa(LHS)) @@ -4338,24 +4346,55 @@ } } - // (A & sext(C0)) | (B & ~sext(C0) -> C0 ? A : B - if (isa(C) && - cast(C)->getOperand(0)->getType() == Type::Int1Ty) { + // (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : B, and commuted variants + if (match(A, m_Select(m_Value(), m_ConstantInt(-1), m_ConstantInt(0)))) { + if (match(D, m_Not(m_Value(A)))) + return SelectInst::Create(cast(A)->getOperand(0), C, B); + if (match(B, m_Not(m_Value(A)))) + return SelectInst::Create(cast(A)->getOperand(0), C, D); + } + if (match(B, m_Select(m_Value(), m_ConstantInt(-1), m_ConstantInt(0)))) { + if (match(C, m_Not(m_Value(B)))) + return SelectInst::Create(cast(B)->getOperand(0), A, D); + if (match(A, m_Not(m_Value(B)))) + return SelectInst::Create(cast(B)->getOperand(0), C, D); + } + if (match(C, m_Select(m_Value(), m_ConstantInt(-1), m_ConstantInt(0)))) { if (match(D, m_Not(m_Value(C)))) return SelectInst::Create(cast(C)->getOperand(0), A, B); - // And commutes, try both ways. if (match(B, m_Not(m_Value(C)))) return SelectInst::Create(cast(C)->getOperand(0), A, D); } - // Or commutes, try both ways. - if (isa(D) && - cast(D)->getOperand(0)->getType() == Type::Int1Ty) { + if (match(D, m_Select(m_Value(), m_ConstantInt(-1), m_ConstantInt(0)))) { if (match(C, m_Not(m_Value(D)))) return SelectInst::Create(cast(D)->getOperand(0), A, B); - // And commutes, try both ways. if (match(A, m_Not(m_Value(D)))) return SelectInst::Create(cast(D)->getOperand(0), C, B); } + if (match(A, m_Select(m_Value(), m_ConstantInt(0), m_ConstantInt(-1)))) { + if (match(D, m_Not(m_Value(A)))) + return SelectInst::Create(cast(A)->getOperand(0), B, C); + if (match(B, m_Not(m_Value(A)))) + return SelectInst::Create(cast(A)->getOperand(0), D, C); + } + if (match(B, m_Select(m_Value(), m_ConstantInt(0), m_ConstantInt(-1)))) { + if (match(C, m_Not(m_Value(B)))) + return SelectInst::Create(cast(B)->getOperand(0), D, A); + if (match(A, m_Not(m_Value(B)))) + return SelectInst::Create(cast(B)->getOperand(0), D, C); + } + if (match(C, m_Select(m_Value(), m_ConstantInt(0), m_ConstantInt(-1)))) { + if (match(D, m_Not(m_Value(C)))) + return SelectInst::Create(cast(C)->getOperand(0), B, A); + if (match(B, m_Not(m_Value(C)))) + return SelectInst::Create(cast(C)->getOperand(0), D, A); + } + if (match(D, m_Select(m_Value(), m_ConstantInt(0), m_ConstantInt(-1)))) { + if (match(C, m_Not(m_Value(D)))) + return SelectInst::Create(cast(D)->getOperand(0), B, A); + if (match(A, m_Not(m_Value(D)))) + return SelectInst::Create(cast(D)->getOperand(0), B, C); + } } // (X >> Z) | (Y >> Z) -> (X|Y) >> Z for all shifts. @@ -7965,37 +8004,11 @@ Value *Src = CI.getOperand(0); - // sext (x ashr x, 31 -> all ones if signed - // sext (x >s -1) -> ashr x, 31 -> all ones if not signed - if (ICmpInst *ICI = dyn_cast(Src)) { - // If we are just checking for a icmp eq of a single bit and zext'ing it - // to an integer, then shift the bit to the appropriate place and then - // cast to integer to avoid the comparison. - if (ConstantInt *Op1C = dyn_cast(ICI->getOperand(1))) { - const APInt &Op1CV = Op1C->getValue(); - - // sext (x x>>s31 true if signbit set. - // sext (x >s -1) to i32 --> (x>>s31)^-1 true if signbit clear. - if ((ICI->getPredicate() == ICmpInst::ICMP_SLT && Op1CV == 0) || - (ICI->getPredicate() == ICmpInst::ICMP_SGT &&Op1CV.isAllOnesValue())){ - Value *In = ICI->getOperand(0); - Value *Sh = ConstantInt::get(In->getType(), - In->getType()->getPrimitiveSizeInBits()-1); - In = InsertNewInstBefore(BinaryOperator::CreateAShr(In, Sh, - In->getName()+".lobit"), - CI); - if (In->getType() != CI.getType()) - In = CastInst::CreateIntegerCast(In, CI.getType(), - true/*SExt*/, "tmp", &CI); - - if (ICI->getPredicate() == ICmpInst::ICMP_SGT) - In = InsertNewInstBefore(BinaryOperator::CreateNot(In, - In->getName()+".not"), CI); - - return ReplaceInstUsesWith(CI, In); - } - } - } + // Canonicalize sign-extend from i1 to a select. + if (Src->getType() == Type::Int1Ty) + return SelectInst::Create(Src, + ConstantInt::getAllOnesValue(CI.getType()), + Constant::getNullValue(CI.getType())); // See if the value being truncated is already sign extended. If so, just // eliminate the trunc/sext pair. @@ -8468,7 +8481,7 @@ // can be adjusted to fit the min/max idiom. We may edit ICI in // place here, so make sure the select is the only user. if (ICI->hasOneUse()) - if (ConstantInt *CI = dyn_cast(CmpRHS)) + if (ConstantInt *CI = dyn_cast(CmpRHS)) { switch (Pred) { default: break; case ICmpInst::ICMP_ULT: @@ -8513,6 +8526,44 @@ } } + // (x ashr x, 31 -> all ones if signed + // (x >s -1) ? -1 : 0 -> ashr x, 31 -> all ones if not signed + CmpInst::Predicate Pred = ICI->getPredicate(); + if (match(TrueVal, m_ConstantInt(0)) && + match(FalseVal, m_ConstantInt(-1))) + Pred = CmpInst::getInversePredicate(Pred); + else if (!match(TrueVal, m_ConstantInt(-1)) || + !match(FalseVal, m_ConstantInt(0))) + Pred = CmpInst::BAD_ICMP_PREDICATE; + if (Pred != CmpInst::BAD_ICMP_PREDICATE) { + // If we are just checking for a icmp eq of a single bit and zext'ing it + // to an integer, then shift the bit to the appropriate place and then + // cast to integer to avoid the comparison. + const APInt &Op1CV = CI->getValue(); + + // sext (x x>>s31 true if signbit set. + // sext (x >s -1) to i32 --> (x>>s31)^-1 true if signbit clear. + if ((Pred == ICmpInst::ICMP_SLT && Op1CV == 0) || + (Pred == ICmpInst::ICMP_SGT &&Op1CV.isAllOnesValue())) { + Value *In = ICI->getOperand(0); + Value *Sh = ConstantInt::get(In->getType(), + In->getType()->getPrimitiveSizeInBits()-1); + In = InsertNewInstBefore(BinaryOperator::CreateAShr(In, Sh, + In->getName()+".lobit"), + *ICI); + if (In->getType() != CI->getType()) + In = CastInst::CreateIntegerCast(In, CI->getType(), + true/*SExt*/, "tmp", ICI); + + if (Pred == ICmpInst::ICMP_SGT) + In = InsertNewInstBefore(BinaryOperator::CreateNot(In, + In->getName()+".not"), *ICI); + + return ReplaceInstUsesWith(SI, In); + } + } + } + if (CmpLHS == TrueVal && CmpRHS == FalseVal) { // Transform (X == Y) ? X : Y -> Y if (Pred == ICmpInst::ICMP_EQ) Modified: llvm/trunk/test/Transforms/InstCombine/logical-select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/logical-select.ll?rev=58457&r1=58456&r2=58457&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/logical-select.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/logical-select.ll Thu Oct 30 15:40:10 2008 @@ -1,4 +1,7 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select | count 2 +; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN grep select %t | count 4 +; RUN not grep and %t +; RUN not grep or %t define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { %e = icmp slt i32 %a, %b @@ -18,3 +21,24 @@ %j = or i32 %i, %g ret i32 %j } +define i32 @goo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { +entry: + %0 = icmp slt i32 %a, %b + %iftmp.0.0 = select i1 %0, i32 -1, i32 0 + %1 = and i32 %iftmp.0.0, %c + %not = xor i32 %iftmp.0.0, -1 + %2 = and i32 %not, %d + %3 = or i32 %1, %2 + ret i32 %3 +} + +define i32 @par(i32 %a, i32 %b, i32 %c, i32 %d) nounwind { +entry: + %0 = icmp slt i32 %a, %b + %iftmp.1.0 = select i1 %0, i32 -1, i32 0 + %1 = and i32 %iftmp.1.0, %c + %not = xor i32 %iftmp.1.0, -1 + %2 = and i32 %not, %d + %3 = or i32 %1, %2 + ret i32 %3 +} From grosbach at apple.com Thu Oct 30 15:40:46 2008 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 30 Oct 2008 13:40:46 -0700 Subject: [llvm-commits] [llvm] r58405 - r58409 In-Reply-To: <3EB0549E-54FD-4F51-9F33-329A6EBA02A3@apple.com> References: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> <74F3DBF7-7EC3-4837-B1A2-E7C92EDE08EF@apple.com> <3EB0549E-54FD-4F51-9F33-329A6EBA02A3@apple.com> Message-ID: On Oct 30, 2008, at 10:48 AM, Evan Cheng wrote: > >>> >>> + MCE.emitWordLE(0); >>> + } else { >>> + abort(); // FIXME: Is this right? >>> + const ConstantInt *CI = dyn_cast(CV); >>> + uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); >>> + MCE.emitWordLE(Val); >>> + } >> >> >> This breaks simple cases like the following: >> #include >> >> int main(int argc, char *argv[]) >> { >> unsigned a; >> >> a = 0xaaaaaaaa; >> } >> >> These were working before and hit this abort now. > > Right. It's intended. I want a better solution for all the cases. I'll > deal with this shortly. A stronger solution later would be great. I don't see the need for the abort(), though. That breaks working code. Just the FIXME, perhaps with an explanatory note, should suffice. >> >> I have mixed feeling about this. On the one hand, it makes sense to >> have relocation related bits (pun intended) be part of the relocation >> class. On the other hand, this implies that the target will be mixing >> and matching whether a constant pool entry will be resolved by the >> target or by the generic code on a per-constant basis, which is not >> true. The decision to put the constants elsewhere is made on an all- >> or- >> nothing basis, and it seems that this should mirror that decision. On > > That's true for ARM. But it may not always be true. The main reason > for the change is the old scheme cannot deal with machine constantpool > entries. Also, this is a clearer separation. The CONSTPOOL_ENTRY is an > instruction, so the target code emitter should populate it. Machine constantpool entries are an orthogonal issue. >> Perhaps the implication is that the non-target specific JIT shouldn't >> be doing the constant pool layout, and should be delegating that, and >> the associated relocation address resolution, to the target always? >> This is the root of it, I believe. If the constant pool layout is always part of the target, a lot of the strangeness of this stuff goes away. If we want a simple default implementation as part of the parent class, that's perfectly reasonable, but it seems it doesn't belong in the ExecutionEngine/JIT target independent portions. -Jim From gohman at apple.com Thu Oct 30 15:43:12 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 30 Oct 2008 13:43:12 -0700 Subject: [llvm-commits] [llvm] r58351 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/logical-select.ll In-Reply-To: <200810290630.55670.duncan.sands@math.u-psud.fr> References: <200810282239.m9SMd4Xn009705@zion.cs.uiuc.edu> <200810290630.55670.duncan.sands@math.u-psud.fr> Message-ID: <635A58EE-5F1B-4F9C-8FB8-B68E3910A3C7@apple.com> On Oct 28, 2008, at 10:30 PM, Duncan Sands wrote: > Hi Dan, > >> + // (A & sext(C0)) | (B & ~sext(C0) -> C0 ? A : B > > missing closing parenthesis after ~sext(C0). Fixed, thanks. > Also, why > use C0 and not C? It's meant to be operand 0 of C, where C is from this comment: // (A & C)|(B & D) on the if statement that encloses this code. Dan From evan.cheng at apple.com Thu Oct 30 16:02:43 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 30 Oct 2008 14:02:43 -0700 Subject: [llvm-commits] [llvm] r58405 - r58409 In-Reply-To: References: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> <74F3DBF7-7EC3-4837-B1A2-E7C92EDE08EF@apple.com> <3EB0549E-54FD-4F51-9F33-329A6EBA02A3@apple.com> Message-ID: <3D0A20DF-3A7B-48CF-B284-8D4B62E16D46@apple.com> On Oct 30, 2008, at 1:40 PM, Jim Grosbach wrote: > > On Oct 30, 2008, at 10:48 AM, Evan Cheng wrote: >> >>>> >>>> + MCE.emitWordLE(0); >>>> + } else { >>>> + abort(); // FIXME: Is this right? >>>> + const ConstantInt *CI = dyn_cast(CV); >>>> + uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); >>>> + MCE.emitWordLE(Val); >>>> + } >>> >>> >>> This breaks simple cases like the following: >>> #include >>> >>> int main(int argc, char *argv[]) >>> { >>> unsigned a; >>> >>> a = 0xaaaaaaaa; >>> } >>> >>> These were working before and hit this abort now. >> >> Right. It's intended. I want a better solution for all the cases. >> I'll >> deal with this shortly. > > A stronger solution later would be great. I don't see the need for the > abort(), though. That breaks working code. Just the FIXME, perhaps > with an explanatory note, should suffice. Having an abort is useful because it allows us to use bugpoint to reduce test cases. > > >>> >>> I have mixed feeling about this. On the one hand, it makes sense to >>> have relocation related bits (pun intended) be part of the >>> relocation >>> class. On the other hand, this implies that the target will be >>> mixing >>> and matching whether a constant pool entry will be resolved by the >>> target or by the generic code on a per-constant basis, which is not >>> true. The decision to put the constants elsewhere is made on an all- >>> or- >>> nothing basis, and it seems that this should mirror that decision. >>> On >> >> That's true for ARM. But it may not always be true. The main reason >> for the change is the old scheme cannot deal with machine >> constantpool >> entries. Also, this is a clearer separation. The CONSTPOOL_ENTRY is >> an >> instruction, so the target code emitter should populate it. > > Machine constantpool entries are an orthogonal issue. > >>> Perhaps the implication is that the non-target specific JIT >>> shouldn't >>> be doing the constant pool layout, and should be delegating that, >>> and >>> the associated relocation address resolution, to the target always? >>> > > This is the root of it, I believe. If the constant pool layout is > always part of the target, a lot of the strangeness of this stuff goes > away. If we want a simple default implementation as part of the parent > class, that's perfectly reasonable, but it seems it doesn't belong in > the ExecutionEngine/JIT target independent portions. Perhaps the right solution is to move this out to TargetJITInfo. That allows us to provide a generic implementation. Evan > > > -Jim > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Thu Oct 30 16:12:40 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 30 Oct 2008 21:12:40 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58458 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200810302112.m9ULCfUR014691@zion.cs.uiuc.edu> Author: baldrick Date: Thu Oct 30 16:12:33 2008 New Revision: 58458 URL: http://llvm.org/viewvc/llvm-project?rev=58458&view=rev Log: Fix PR2987, a long standing if fairly harmless bug which could result in zero sized fields being indexed to wrong LLVM fields. In the testcase it was indexed to a field 2 bytes into the struct when it should have been 4 bytes in. This bug was exposed by extra sanity checking I added in commit 58387. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=58458&r1=58457&r2=58458&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Oct 30 16:12:33 2008 @@ -1553,22 +1553,22 @@ // Handle zero sized fields now. // Skip over LLVM fields that start and end before the GCC field starts. - // Such fields are always nonzero sized, and we don't want to skip past + // Such fields are always nonzero sized, and we don't want to skip past // zero sized ones as well, which happens if you use only the Offset // comparison. while (CurFieldNo < ElementOffsetInBytes.size() && - getFieldEndOffsetInBytes(CurFieldNo)*8 <= FieldOffsetInBits && - ElementSizeInBytes[CurFieldNo] != 0) + getFieldEndOffsetInBytes(CurFieldNo)*8 < + FieldOffsetInBits + (ElementSizeInBytes[CurFieldNo] != 0)) ++CurFieldNo; - // If the next field is zero sized, advance past this one. This is a nicety - // that causes us to assign C fields different LLVM fields in cases like + // If the next field is zero sized, advance past this one. This is a nicety + // that causes us to assign C fields different LLVM fields in cases like // struct X {}; struct Y { struct X a, b, c }; if (CurFieldNo+1 < ElementOffsetInBytes.size() && ElementSizeInBytes[CurFieldNo+1] == 0) { return CurFieldNo++; } - + // Otherwise, if this is a zero sized field, return it. if (CurFieldNo < ElementOffsetInBytes.size() && ElementSizeInBytes[CurFieldNo] == 0) { From baldrick at free.fr Thu Oct 30 16:13:11 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 30 Oct 2008 21:13:11 -0000 Subject: [llvm-commits] [llvm] r58459 - /llvm/trunk/test/FrontendC/2008-10-30-ZeroPlacement.c Message-ID: <200810302113.m9ULDBi2014726@zion.cs.uiuc.edu> Author: baldrick Date: Thu Oct 30 16:13:11 2008 New Revision: 58459 URL: http://llvm.org/viewvc/llvm-project?rev=58459&view=rev Log: Testcase for PR2987. Added: llvm/trunk/test/FrontendC/2008-10-30-ZeroPlacement.c Added: llvm/trunk/test/FrontendC/2008-10-30-ZeroPlacement.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2008-10-30-ZeroPlacement.c?rev=58459&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2008-10-30-ZeroPlacement.c (added) +++ llvm/trunk/test/FrontendC/2008-10-30-ZeroPlacement.c Thu Oct 30 16:13:11 2008 @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -c %s +// PR2987 +struct S2045 +{ + unsigned short int a; + union { } b; + union __attribute__ ((aligned (4))) { } c[0]; +}; +struct S2045 s2045; From tonic at nondot.org Thu Oct 30 16:20:51 2008 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 30 Oct 2008 21:20:51 -0000 Subject: [llvm-commits] [llvm] r58460 - in /llvm/branches/release_24/test/FrontendC: 2008-08-07-AlignPadding1.c 2008-08-07-AlignPadding2.c Message-ID: <200810302120.m9ULKqgI030717@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Oct 30 16:20:47 2008 New Revision: 58460 URL: http://llvm.org/viewvc/llvm-project?rev=58460&view=rev Log: Merge from mainline. Modified: llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding1.c llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding2.c Modified: llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding1.c URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding1.c?rev=58460&r1=58459&r2=58460&view=diff ============================================================================== --- llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding1.c (original) +++ llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding1.c Thu Oct 30 16:20:47 2008 @@ -1,4 +1,4 @@ -/* RUN: %llvmgcc %s -m64 -S -o - -emit-llvm -O0 | grep {zeroinitializer.*zeroinitializer.*zeroinitializer.*zeroinitializer.*zeroinitializer.*zeroinitializer} +/* RUN: %llvmgcc %s -S -o - -emit-llvm -O0 | grep {zeroinitializer.*zeroinitializer.*zeroinitializer.*zeroinitializer.*zeroinitializer.*zeroinitializer} The FE must generate padding here both at the end of each PyG_Head and between array elements. Reduced from Python. */ Modified: llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding2.c URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding2.c?rev=58460&r1=58459&r2=58460&view=diff ============================================================================== --- llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding2.c (original) +++ llvm/branches/release_24/test/FrontendC/2008-08-07-AlignPadding2.c Thu Oct 30 16:20:47 2008 @@ -1,4 +1,4 @@ -/* RUN: %llvmgcc %s -m64 -S -o - -emit-llvm -O0 | grep zeroinitializer | count 1 +/* RUN: %llvmgcc %s -S -o - -emit-llvm -O0 | grep zeroinitializer | count 1 The FE must not generate padding here between array elements. PR 2533. */ From cedric.venet at laposte.net Thu Oct 30 16:22:00 2008 From: cedric.venet at laposte.net (Cedric Venet) Date: Thu, 30 Oct 2008 21:22:00 -0000 Subject: [llvm-commits] [llvm] r58461 - /llvm/trunk/CMakeLists.txt Message-ID: <200810302122.m9ULM0WI030768@zion.cs.uiuc.edu> Author: venet Date: Thu Oct 30 16:22:00 2008 New Revision: 58461 URL: http://llvm.org/viewvc/llvm-project?rev=58461&view=rev Log: Change the name of the generated solution file for a CMake build. (from 'project' to 'LLVM'). !!!!!!!!!! Warning !!!!!!!!!!!!!!! If you already have created a solution with cmake, you will need to manually open to the new one. Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=58461&r1=58460&r2=58461&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Oct 30 16:22:00 2008 @@ -1,3 +1,4 @@ +project(LLVM) cmake_minimum_required(VERSION 2.6.1) set(PACKAGE_NAME llvm) From wangmp at apple.com Thu Oct 30 16:58:21 2008 From: wangmp at apple.com (Mon Ping Wang) Date: Thu, 30 Oct 2008 14:58:21 -0700 Subject: [llvm-commits] [llvm] r58426 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <200810301038.25151.duncan.sands@math.u-psud.fr> References: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> <200810301038.25151.duncan.sands@math.u-psud.fr> Message-ID: <72EC1520-8940-4078-A5A4-EB56EE12FF46@apple.com> Hi Duncan, On Oct 30, 2008, at 2:38 AM, Duncan Sands wrote: > Hi Mon Ping, > >> LegalizeAction getTypeAction(MVT VT) const { >> if (VT.isExtended()) { >> - if (VT.isVector()) return Expand; >> + if (VT.isVector()) { >> + // First try vector widening >> + return Promote; >> + } > > is the plan to do something like what is done for arbitrary > precision integers: first promote to a type which is a power-of-two > in length, then (if that type is not legal) expand until reaching > a legal type. In the context of vectors I guess I'm asking if you > plan to do: v10i32 -> v16i32 -> two v8i32 -> four v4i32? Only the > last of these is a simple value type, so the above getTypeAction > logic will return "Promote" for all of them, even those you want > to split like the v16i32... In fact aren't you going to widen > such vectors for ever (infinite loop)? > The intention is that if there we will only promote if there is a legal wider type. Since there is no legal V16i32, we will not try to promote directly to that so we won't go into a infinite loop. Ideally, given a v10i32 with v4i32 being legal on the machine, we first split it down to two v4i32 and a v2i32. The v2i32 can then be promoted to v4i32 and thus we end up with three v4i32. I discuss this a little more below. >> + /// When and were to widen is target dependent based on the cost >> of > > When and were -> When and where > >> + /// WidenNodes - For nodes that need to be widen from one vector >> type to > > need to be widen -> need to be widened > >> + /// another, this contains the mapping of ones we have already >> widen. This > > of ones we have already widen -> of those we have already widened > >> + void AddWidenOperand(SDValue From, SDValue To) { > > AddWidenOperand -> AddWidenedOperand > I'll fix these syntax problems and the ones you found below. >> + /// WidenVectorOp - Widen a vector operation in order to do the >> computation >> + /// in a wider type given to a wider type given by WidenVT >> (e.g., v3i32 to > > This sentence does not parse for me... > I clean it up with something like Widen a vector operation to a legal type given by WidenVT >> + /// v4i32). The produced value will have the correct value for >> the existing >> + /// elements but no guarantee is made about the new elements at >> the end of >> + /// the vector: it may be zero, sign-extended, or garbage. This >> is useful > > What do zero-extension and sign-extension mean in this context? > What I should have wrote that it may be filled with 0s, 1s, or garbage. >> + /// when we have instruction operating on an illegal vector type >> and we want > > have instruction -> have an instruction > >> + /// to widen it to do the computation on a legal wider vector >> type. > > In general the wider type will not be legal. For example when the > vector type > is an extended type. > >> + /// Useful 16 element vector used to pass operands for widening > > 16 element vector -> 16 element vector type > Missing full stop at end of line. > >> + /// LoadWidenVectorOp - Load a vector for a wider type. Returns >> true if > > I will comment fully on the implementation once you submit it for > LegalizeTypes. > >> + case ISD::CONCAT_VECTORS: { > > Is this for widening? > That slipped in. This is needed for the vector shuffle patch. >> + // Fall thru to expand for vector > > That doesn't seem wise: if the operation is "widen" surely you have > to always widen rather than sometimes expand? After all, users of > this > node are going to expect to find a widened value in the WidenedNodes > map, but it may not be there. What I should have done is rewrite getTypeAction in TargetLowering to check the TLI is possible for widening of that vector type. At the time, for some strange reason, I thought that function we were calling that was wrapped in the class and I didn't have access to the TLI. This will map exactly what will be done in LegalizeTypes. > >> + // Check if we have widen this node with another value >> + std::map::iterator I = >> + WidenNodes.find(ST->getValue()); > > Speak of the devil! Here is someone who expected to find a widened > node but doesn't always! I hope this is just a temporary measure > because widening support does not yet exist for all operations... This is due to the issue above. I can get rid of this case once I fixed it. > > >> + // When widen is called, it is assumed that it is more efficient >> to use a >> + // wide type. The default action is to widen to operation to a >> wider legal >> + // vector type and then do the operation if it is legal by >> calling LegalizeOp >> + // again. If there is no vector equivalent, we will unroll the >> operation, do >> + // it, and rebuild the vector. If most of the operations are >> vectorizible to >> + // the legal type, the resulting code will be more efficient. >> If this is not >> + // the case, the resulting code will preform badly as we end up >> generating >> + // code to pack/unpack the results. It is the function that >> calls widen >> + // that is responsible for seeing this doesn't happen. For some >> cases, we >> + // have decided that it is not worth widening so we just split >> the operation. > > I don't like this roll-back strategy at all... Do you have some > examples where > it is better to split than to widen? > The last sentence is incorrect. When we decide to widen, we should always widen. For operations where a vector operation doesn't exist, we will generate some nasty scalar code and the rebuild the vector. >> + // Promote can mean >> + // 1) On integers, it means to promote type (e.g., i8 to >> i32) > > "For integers, it means use the promoted integer type (e.g. i8 to > i32)." > >> + // 2) For vectors, it means try to widen (e.g., v3i32 to >> v4i32) > "For vectors, it means use the widened vector type (e.g. v3i32 to > v4i32)" > > I don't think there should be any "try" about it: if the type action > says > widen then it should be widened. > The issue occurs for the "Extended Vectors" where we don't have a known vector types coming in. ValueTypeActions.getTypeAction(VT) will return "promote" for this case as it doesn't have access to the TLI to see if there is a type we can widen to. In LegalizeType/ TargetLowering getTypeAction, we should check the TLI to decide if we can widen and if so, return that we are widening. >> + return PromoteInteger; >> + } >> + else { > > -> } else { > >> +/// getWidenVectorType: given a vector type, returns the type to >> widen to > > getWidenVectorType -> getWidenedVectorType > >> +/// If there is no vector type that we want to widen to, returns >> MVT::Other > > Missing full stop at end of line. > Also, I don't think this information about whether we want to widen or > not should be here. The type action should say whether it is to be > widened or to be split. Probably this routine should simply always > return the vector type obtained by (1) if there is a legal vector type > with the same element type but more elements, return the smallest such > vector type; (2) otherwise, round the number of elements up to the > next power of two. By the way, if the number of elements is already > a power of two and there is no wider legal vector type, then you > really > want to split not widen, so I think this routine should assert in that > case. > My logic for getTypeAction is that it will get promote and then check the TLI to see if a legal vector type exist. If it doesn't, it should return split or scalarize. Otherwise, it will widen. The check to TLI is redundant for known types defined in ValueType as we already know if a legal type exist to widen to. Any client other than getTypeAction shouldn't need to check for MVT::Other because once we are trying to widen, the type must always exist. So if we had vector of 3 elements and there is no valid 4 element vector type, we should just split and not try the next power of 2 and then split down to 4 operations. The rational that I see for going to the power of 2 is that is more likely that the split logic (where we split in 1/2) has a higher chance of finding the correct legal type. The down side is that if we go to a power of 2, we might end up doing work that doesn't benefit us. Given the example above of v10i32, if we promote to v16i32, we will break it down to 4 v4i32 where one of the v4i32 is not useful. With what I have done, we don't do any better, i.e., v10xi32 to two v5xi32 to "two v3xi32 and two v2xi32" that ends up to four v4i32. What would be better is to beef up the split logic to see what is the largest legal vector for that element type and try to split based on that. >> +/// When and were to widen is target dependent based on the cost of > > When and were -> When and where > >> + // First set operation action for all vector types to either to >> promote > > to either to -> to either > >> + // (for widening) or expand (for scalarization). Then we will >> selectively > > or expand (for scalarization) -> or expand (for scalarization or > splitting) > >> + setOperationAction(ISD::EXTRACT_SUBVECTOR, >> (MVT::SimpleValueType)VT, Expand); >> + setOperationAction(ISD::CONCAT_VECTORS,(MVT::SimpleValueType) >> VT, Expand); > > What are these changes for? > I don't need them anymore so I can remove it. >> +/// If there is no vector type that we want to widen to, returns >> MVT::Other >> +/// When and were to widen is target dependent based on the cost of > > As above. > >> +MVT X86TargetLowering::getWidenVectorType(MVT VT) { > > As I mentioned above, I think all this logic should be in the type > action, not here. I agree. > > >> + /// If there is no vector type that we want to widen to, >> returns MVT::Other >> + /// When and were to widen is target dependent based on the >> cost of > > As above. > > Ciao, > > Duncan. Thanks for your comments! -- Mon Ping -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081030/37329e76/attachment.html From kremenek at apple.com Thu Oct 30 17:35:58 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 30 Oct 2008 22:35:58 -0000 Subject: [llvm-commits] [llvm] r58463 - /llvm/tags/checker/checker-120/ Message-ID: <200810302235.m9UMZwRl029523@zion.cs.uiuc.edu> Author: kremenek Date: Thu Oct 30 17:35:58 2008 New Revision: 58463 URL: http://llvm.org/viewvc/llvm-project?rev=58463&view=rev Log: Tagging checker-120. Added: llvm/tags/checker/checker-120/ - copied from r58462, llvm/trunk/ From kremenek at apple.com Thu Oct 30 17:45:34 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 30 Oct 2008 22:45:34 -0000 Subject: [llvm-commits] [llvm] r58465 - /llvm/tags/checker/checker-120/ Message-ID: <200810302245.m9UMjYWF000596@zion.cs.uiuc.edu> Author: kremenek Date: Thu Oct 30 17:45:31 2008 New Revision: 58465 URL: http://llvm.org/viewvc/llvm-project?rev=58465&view=rev Log: Removing checker-120. Removed: llvm/tags/checker/checker-120/ From kremenek at apple.com Thu Oct 30 18:17:53 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 30 Oct 2008 23:17:53 -0000 Subject: [llvm-commits] [llvm] r58471 - /llvm/tags/checker/checker-120/ Message-ID: <200810302317.m9UNHr9M006695@zion.cs.uiuc.edu> Author: kremenek Date: Thu Oct 30 18:17:52 2008 New Revision: 58471 URL: http://llvm.org/viewvc/llvm-project?rev=58471&view=rev Log: Tagging checker-120. Added: llvm/tags/checker/checker-120/ - copied from r58470, llvm/trunk/ From evan.cheng at apple.com Thu Oct 30 18:43:36 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 30 Oct 2008 23:43:36 -0000 Subject: [llvm-commits] [llvm] r58474 - /llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Message-ID: <200810302343.m9UNhaZU011919@zion.cs.uiuc.edu> Author: evancheng Date: Thu Oct 30 18:43:36 2008 New Revision: 58474 URL: http://llvm.org/viewvc/llvm-project?rev=58474&view=rev Log: I think we got non-machine specific constpool entries covered. Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=58474&r1=58473&r2=58474&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Thu Oct 30 18:43:36 2008 @@ -397,7 +397,8 @@ emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); MCE.emitWordLE(0); } else { - abort(); // FIXME: Is this right? + assert(CV->getType()->isInteger() && + "Not expecting non-integer constpool entries yet!"); const ConstantInt *CI = dyn_cast(CV); uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); MCE.emitWordLE(Val); From grosbach at apple.com Thu Oct 30 18:44:39 2008 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 30 Oct 2008 23:44:39 -0000 Subject: [llvm-commits] [llvm] r58475 - in /llvm/trunk: include/llvm/Target/TargetJITInfo.h lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200810302344.m9UNid1K012246@zion.cs.uiuc.edu> Author: grosbach Date: Thu Oct 30 18:44:39 2008 New Revision: 58475 URL: http://llvm.org/viewvc/llvm-project?rev=58475&view=rev Log: Revert errant deletion. The target needs to be able to specify that it doesn't want the generic constant pool to be emitted. Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=58475&r1=58474&r2=58475&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Thu Oct 30 18:44:39 2008 @@ -107,6 +107,9 @@ // JIT to manage a GOT for it. bool needsGOT() const { return useGOT; } + /// hasCustomConstantPool - Allows a target to specify that constant + /// pool address resolution is handled by the target. + virtual bool hasCustomConstantPool() const { return false; } protected: bool useGOT; }; Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58475&r1=58474&r2=58475&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Oct 30 18:44:39 2008 @@ -1013,6 +1013,11 @@ } void JITEmitter::emitConstantPool(MachineConstantPool *MCP) { + if (TheJIT->getJITInfo().hasCustomConstantPool()) { + DOUT << "JIT: Target has custom constant pool handling. Omitting standard " + "constant pool\n"; + return; + } const std::vector &Constants = MCP->getConstants(); if (Constants.empty()) return; From evan.cheng at apple.com Thu Oct 30 18:46:48 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 30 Oct 2008 16:46:48 -0700 Subject: [llvm-commits] [llvm] r58475 - in /llvm/trunk: include/llvm/Target/TargetJITInfo.h lib/ExecutionEngine/JIT/JITEmitter.cpp In-Reply-To: <200810302344.m9UNid1K012246@zion.cs.uiuc.edu> References: <200810302344.m9UNid1K012246@zion.cs.uiuc.edu> Message-ID: Thanks! Evan On Oct 30, 2008, at 4:44 PM, Jim Grosbach wrote: > Author: grosbach > Date: Thu Oct 30 18:44:39 2008 > New Revision: 58475 > > URL: http://llvm.org/viewvc/llvm-project?rev=58475&view=rev > Log: > Revert errant deletion. The target needs to be able to specify that > it doesn't want the generic constant pool to be emitted. > > Modified: > llvm/trunk/include/llvm/Target/TargetJITInfo.h > llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp > > Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=58475&r1=58474&r2=58475&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Thu Oct 30 > 18:44:39 2008 > @@ -107,6 +107,9 @@ > // JIT to manage a GOT for it. > bool needsGOT() const { return useGOT; } > > + /// hasCustomConstantPool - Allows a target to specify that > constant > + /// pool address resolution is handled by the target. > + virtual bool hasCustomConstantPool() const { return false; } > protected: > bool useGOT; > }; > > Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58475&r1=58474&r2=58475&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) > +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Oct 30 > 18:44:39 2008 > @@ -1013,6 +1013,11 @@ > } > > void JITEmitter::emitConstantPool(MachineConstantPool *MCP) { > + if (TheJIT->getJITInfo().hasCustomConstantPool()) { > + DOUT << "JIT: Target has custom constant pool handling. > Omitting standard " > + "constant pool\n"; > + return; > + } > const std::vector &Constants = MCP- > >getConstants(); > if (Constants.empty()) return; > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From tonic at nondot.org Thu Oct 30 19:11:34 2008 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 31 Oct 2008 00:11:34 -0000 Subject: [llvm-commits] [test-suite] r58477 - /test-suite/branches/release_24/MultiSource/Applications/Makefile Message-ID: <200810310011.m9V0BYei029351@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Oct 30 19:11:34 2008 New Revision: 58477 URL: http://llvm.org/viewvc/llvm-project?rev=58477&view=rev Log: Really remove lua. Modified: test-suite/branches/release_24/MultiSource/Applications/Makefile Modified: test-suite/branches/release_24/MultiSource/Applications/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_24/MultiSource/Applications/Makefile?rev=58477&r1=58476&r2=58477&view=diff ============================================================================== --- test-suite/branches/release_24/MultiSource/Applications/Makefile (original) +++ test-suite/branches/release_24/MultiSource/Applications/Makefile Thu Oct 30 19:11:34 2008 @@ -5,7 +5,7 @@ include $(LEVEL)/Makefile.config PARALLEL_DIRS = Burg aha sgefa siod lambda-0.1.3 d spiff hbd treecc SPASS \ - hexxagon oggenc JM viterbi minisat SIBsim4 ClamAV sqlite3 lemon lua + hexxagon oggenc JM viterbi minisat SIBsim4 ClamAV sqlite3 lemon # Obsequi uses Linux-only features; need to fix that ifeq ($(OS),Linux) From isanbard at gmail.com Thu Oct 30 19:35:09 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 31 Oct 2008 00:35:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58482 - /llvm-gcc-4.2/trunk/gcc/stub-c.c Message-ID: <200810310035.m9V0Z9vZ019892@zion.cs.uiuc.edu> Author: void Date: Thu Oct 30 19:35:09 2008 New Revision: 58482 URL: http://llvm.org/viewvc/llvm-project?rev=58482&view=rev Log: Unbreak gfortran compilation. It needs these stub functions. Modified: llvm-gcc-4.2/trunk/gcc/stub-c.c Modified: llvm-gcc-4.2/trunk/gcc/stub-c.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/stub-c.c?rev=58482&r1=58481&r2=58482&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/stub-c.c (original) +++ llvm-gcc-4.2/trunk/gcc/stub-c.c Thu Oct 30 19:35:09 2008 @@ -157,3 +157,26 @@ { gcc_assert(0); } + +bool cvt_utf8_utf16 (const unsigned char *, size_t, unsigned char **, + size_t *) ATTRIBUTE_WEAK; + +bool +cvt_utf8_utf16 (const unsigned char * inbuf ATTRIBUTE_UNUSED, + size_t length ATTRIBUTE_UNUSED, + unsigned char ** uniCharBuf ATTRIBUTE_UNUSED, + size_t * numUniChars ATTRIBUTE_UNUSED) +{ + gcc_assert(0); +} + +tree create_init_utf16_var (const unsigned char *, size_t, + size_t *) ATTRIBUTE_WEAK; + +tree +create_init_utf16_var (const unsigned char * inbuf ATTRIBUTE_UNUSED, + size_t length ATTRIBUTE_UNUSED, + size_t * numUniChars ATTRIBUTE_UNUSED) +{ + gcc_assert(0); +} From gohman at apple.com Thu Oct 30 19:57:25 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 31 Oct 2008 00:57:25 -0000 Subject: [llvm-commits] [llvm] r58483 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/extractps.ll Message-ID: <200810310057.m9V0vQr3028769@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 30 19:57:24 2008 New Revision: 58483 URL: http://llvm.org/viewvc/llvm-project?rev=58483&view=rev Log: Use MOVSSmr instead of EXTRACTPSmr in the case of extracting vector element 0 for a store, as it's smaller and faster. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/extractps.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=58483&r1=58482&r2=58483&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Oct 30 19:57:24 2008 @@ -4194,11 +4194,15 @@ } else if (VT == MVT::f32) { // EXTRACTPS outputs to a GPR32 register which will require a movd to copy // the result back to FR32 register. It's only worth matching if the - // result has a single use which is a store or a bitcast to i32. + // result has a single use which is a store or a bitcast to i32. And in + // the case of a store, it's not worth it if the index is a constant 0, + // because a MOVSSmr can be used instead, which is smaller and faster. if (!Op.hasOneUse()) return SDValue(); SDNode *User = *Op.getNode()->use_begin(); - if (User->getOpcode() != ISD::STORE && + if ((User->getOpcode() != ISD::STORE || + (isa(Op.getOperand(1)) && + cast(Op.getOperand(1))->isNullValue())) && (User->getOpcode() != ISD::BIT_CONVERT || User->getValueType(0) != MVT::i32)) return SDValue(); Modified: llvm/trunk/test/CodeGen/X86/extractps.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/extractps.ll?rev=58483&r1=58482&r2=58483&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/extractps.ll (original) +++ llvm/trunk/test/CodeGen/X86/extractps.ll Thu Oct 30 19:57:24 2008 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86 -mcpu=penryn > %t ; RUN: not grep movd %t -; RUN: not grep movss %t -; RUN: grep {extractps \\\$0, %xmm0, } %t +; RUN: grep {movss %xmm} %t | count 1 +; RUN: grep {extractps \\\$1, %xmm0, } %t | count 1 ; PR2647 external global float, align 16 ; :0 [#uses=2] @@ -14,6 +14,14 @@ store float %4, float* @0, align 16 ret void } +define internal void @""() nounwind { + load float* @0, align 16 ; :1 [#uses=1] + insertelement <4 x float> undef, float %1, i32 1 ; <<4 x float>>:2 [#uses=1] + call <4 x float> @llvm.x86.sse.rsqrt.ss( <4 x float> %2 ) ; <<4 x float>>:3 [#uses=1] + extractelement <4 x float> %3, i32 1 ; :4 [#uses=1] + store float %4, float* @0, align 16 + ret void +} declare <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float>) nounwind readnone From ofv at wanadoo.es Thu Oct 30 20:24:53 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Fri, 31 Oct 2008 01:24:53 -0000 Subject: [llvm-commits] [llvm] r58484 - /llvm/trunk/cmake/modules/LLVMConfig.cmake Message-ID: <200810310124.m9V1Ore4004238@zion.cs.uiuc.edu> Author: ofv Date: Thu Oct 30 20:24:51 2008 New Revision: 58484 URL: http://llvm.org/viewvc/llvm-project?rev=58484&view=rev Log: CMake: Establish dependencies among executables and libraries, using data manually extracted from llvm-config. Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfig.cmake?rev=58484&r1=58483&r2=58484&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVMConfig.cmake (original) +++ llvm/trunk/cmake/modules/LLVMConfig.cmake Thu Oct 30 20:24:51 2008 @@ -7,7 +7,7 @@ endmacro(llvm_config executable link_components) -macro(msvc_llvm_config executable link_components) +function(msvc_llvm_config executable link_components) foreach(c ${link_components}) if( c STREQUAL "jit" ) set_target_properties(${executable} @@ -15,8 +15,55 @@ LINK_FLAGS "/INCLUDE:_X86TargetMachineModule") endif( c STREQUAL "jit" ) endforeach(c) - target_link_libraries(${executable} ${llvm_libs}) -endmacro(msvc_llvm_config executable link_components) + msvc_map_components_to_libraries(${link_components} LIBRARIES) + target_link_libraries(${executable} ${LIBRARIES}) +endfunction(msvc_llvm_config executable link_components) + + +function(msvc_map_components_to_libraries link_components out_libs) + foreach(c ${link_components}) + if( c STREQUAL "native" ) + # TODO: we assume ARCH is X86. In this case, we must use nativecodegen + # component instead. Do nothing, as in llvm-config script. + elseif( c STREQUAL "nativecodegen" ) + # TODO: we assume ARCH is X86. + list(APPEND expanded_components "LLVMX86CodeGen") + elseif( c STREQUAL "backend" ) + # same case as in `native'. + elseif( c STREQUAL "engine" ) + # TODO: as we assume we are on X86, this is `jit'. + list(APPEND expanded_components "LLVMJIT") + elseif( c STREQUAL "X86" ) + # TODO: we assume we are on X86. + list(APPEND expanded_components "LLVMX86CodeGen") + list(APPEND expanded_components "LLVMX86AsmPrinter") + elseif( c STREQUAL "all" ) + list(APPEND expanded_components ${llvm_libs}) + else( c STREQUAL "native" ) + list(APPEND expanded_components LLVM${c}) + endif( c STREQUAL "native" ) + endforeach(c) + # We must match capitalization. + string(TOUPPER "${llvm_libs}" capitalized_libs) + set(curr_idx 0) + list(LENGTH expanded_components lst_size) + while( ${curr_idx} LESS ${lst_size} ) + list(GET expanded_components ${curr_idx} c) + string(TOUPPER "${c}" capitalized) + list(FIND capitalized_libs ${capitalized} idx) + if( idx LESS 0 ) + message(FATAL_ERROR "Library ${c} not found in list of llvm libraries.") + endif( idx LESS 0 ) + list(GET llvm_libs ${idx} canonical_lib) + list(APPEND result ${canonical_lib}) + list(APPEND result ${MSVC_LIB_DEPS_${canonical_lib}}) + list(APPEND expanded_components ${MSVC_LIB_DEPS_${canonical_lib}}) + list(LENGTH expanded_components lst_size) + math(EXPR curr_idx "${curr_idx} + 1") + endwhile( ${curr_idx} LESS ${lst_size} ) + list(REMOVE_DUPLICATES result) + set(${out_libs} ${result} PARENT_SCOPE) +endfunction(msvc_map_components_to_libraries) macro(nix_llvm_config executable link_components) @@ -53,3 +100,76 @@ endforeach(c) endif( NOT HAVE_LLVM_CONFIG ) endmacro(nix_llvm_config executable link_components) + + +# This data is used on MSVC for stablishing executable/library +# dependencies. Comes from the llvm-config script, which is built and +# installed on the bin directory for MinGW or Linux. At the end of the +# script, you'll see lines like this: +# +# LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a +# libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a +# +# This is translated to: +# +# set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter +# LLVMCodeGen LLVMCore LLVMSupport LLVMTarget) +# +# It is necessary to remove the `lib' prefix, the `.a' and `.o' +# suffixes. Watch out for this line: +# +# LLVMExecutionEngine.o LLVMJIT.o: libLLVMCodeGen.a libLLVMCore.a +# libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a +# +# See how there are two elements before the colon. This must be +# translated as if it were: +# +# LLVMExecutionEngine.o: libLLVMCodeGen.a libLLVMCore.a +# libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a LLVMJIT.o: +# libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a +# libLLVMTarget.a +# +# TODO: do this transformations on cmake. +# +# It is very important that the LLVM built for extracting this data +# must contain all targets, not just X86. + + +set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMAlpha LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCodeGen LLVMCore LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) +set(MSVC_LIB_DEPS_LLVMCBase LLVMSupport) +set(MSVC_LIB_DEPS_LLVMCellSPU LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMIA64 LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMInterpreter LLVMExecutionEngine LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) +set(MSVC_LIB_DEPS_LLVMMips LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMPIC16 LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMSparc LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMX86CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem) +set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport) +set(MSVC_LIB_DEPS_LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMBitReader LLVMCore LLVMSupport) +set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport LLVMSystem) +set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils) +set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem) +set(MSVC_LIB_DEPS_LLVMDebugger LLVMAnalysis LLVMBitReader LLVMCore LLVMSupport LLVMSystem) +set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMCore LLVMScalarOpts LLVMSupport LLVMTransformUtils) +set(MSVC_LIB_DEPS_LLVMLinker LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem) +set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMTransformUtils) +set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget) +set(MSVC_LIB_DEPS_LLVMSupport LLVMSystem) +set(MSVC_LIB_DEPS_LLVMSystem ) +set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMSupport) +set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMipa) +set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport) +set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) From ofv at wanadoo.es Thu Oct 30 20:37:26 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Fri, 31 Oct 2008 01:37:26 -0000 Subject: [llvm-commits] [llvm] r58485 - /llvm/trunk/cmake/modules/LLVMConfig.cmake Message-ID: <200810310137.m9V1bQoA008360@zion.cs.uiuc.edu> Author: ofv Date: Thu Oct 30 20:37:26 2008 New Revision: 58485 URL: http://llvm.org/viewvc/llvm-project?rev=58485&view=rev Log: CMake: Fix some unwanted commentary line wraps on the last change. Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfig.cmake?rev=58485&r1=58484&r2=58485&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVMConfig.cmake (original) +++ llvm/trunk/cmake/modules/LLVMConfig.cmake Thu Oct 30 20:37:26 2008 @@ -106,31 +106,26 @@ # dependencies. Comes from the llvm-config script, which is built and # installed on the bin directory for MinGW or Linux. At the end of the # script, you'll see lines like this: -# -# LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a -# libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a -# + +# LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a + # This is translated to: -# -# set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter -# LLVMCodeGen LLVMCore LLVMSupport LLVMTarget) -# + +# set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget) + # It is necessary to remove the `lib' prefix, the `.a' and `.o' # suffixes. Watch out for this line: -# -# LLVMExecutionEngine.o LLVMJIT.o: libLLVMCodeGen.a libLLVMCore.a -# libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a -# + +# LLVMExecutionEngine.o LLVMJIT.o: libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a + # See how there are two elements before the colon. This must be # translated as if it were: -# -# LLVMExecutionEngine.o: libLLVMCodeGen.a libLLVMCore.a -# libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a LLVMJIT.o: -# libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a -# libLLVMTarget.a -# + +# LLVMExecutionEngine.o: libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a +# LLVMJIT.o: libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a + # TODO: do this transformations on cmake. -# + # It is very important that the LLVM built for extracting this data # must contain all targets, not just X86. From daniel at zuster.org Thu Oct 30 20:50:01 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 31 Oct 2008 01:50:01 -0000 Subject: [llvm-commits] [llvm] r58486 - /llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Message-ID: <200810310150.m9V1o1Qb020164@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Oct 30 20:50:01 2008 New Revision: 58486 URL: http://llvm.org/viewvc/llvm-project?rev=58486&view=rev Log: Fix warning. Modified: llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Modified: llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp?rev=58486&r1=58485&r2=58486&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Thu Oct 30 20:50:01 2008 @@ -118,7 +118,7 @@ } else { int Cost = IC.getValue(); - if (Cost >= BasicInlineThreshold) { + if (Cost >= (int) BasicInlineThreshold) { DOUT << " NOT Inlining: cost = " << Cost << ", call: " << *CS.getInstruction(); continue; From isanbard at gmail.com Thu Oct 30 23:00:24 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 31 Oct 2008 04:00:24 -0000 Subject: [llvm-commits] [llvm] r58489 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp Target/X86/X86RegisterInfo.cpp Message-ID: <200810310400.m9V40OJL006216@zion.cs.uiuc.edu> Author: void Date: Thu Oct 30 23:00:23 2008 New Revision: 58489 URL: http://llvm.org/viewvc/llvm-project?rev=58489&view=rev Log: Don't skip over all "terminator" instructions when determining where to put the callee-saved restore code. It could skip over conditional jumps accidentally. Instead, just skip the "return" instructions. Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=58489&r1=58488&r2=58489&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Thu Oct 30 23:00:23 2008 @@ -273,10 +273,10 @@ MBB = FI; I = MBB->end(); --I; - // Skip over all terminator instructions, which are part of the return + // Skip over all "return" instructions, which are part of the return // sequence. MachineBasicBlock::iterator I2 = I; - while (I2 != MBB->begin() && (--I2)->getDesc().isTerminator()) + while (I2 != MBB->begin() && (--I2)->getDesc().isReturn()) I = I2; bool AtStart = I == MBB->begin(); Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=58489&r1=58488&r2=58489&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Oct 30 23:00:23 2008 @@ -850,8 +850,7 @@ while (MBBI != MBB.begin()) { MachineBasicBlock::iterator PI = prior(MBBI); unsigned Opc = PI->getOpcode(); - if (Opc != X86::POP32r && Opc != X86::POP64r && - !PI->getDesc().isTerminator()) + if (Opc != X86::POP32r && Opc != X86::POP64r && !PI->getDesc().isReturn()) break; --MBBI; } From clattner at apple.com Fri Oct 31 01:09:57 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 30 Oct 2008 23:09:57 -0700 Subject: [llvm-commits] [llvm] r58489 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp Target/X86/X86RegisterInfo.cpp In-Reply-To: <200810310400.m9V40OJL006216@zion.cs.uiuc.edu> References: <200810310400.m9V40OJL006216@zion.cs.uiuc.edu> Message-ID: On Oct 30, 2008, at 9:00 PM, Bill Wendling wrote: > Author: void > Date: Thu Oct 30 23:00:23 2008 > New Revision: 58489 > > URL: http://llvm.org/viewvc/llvm-project?rev=58489&view=rev > Log: > Don't skip over all "terminator" instructions when determining where > to put the > callee-saved restore code. It could skip over conditional jumps > accidentally. Instead, just skip the "return" instructions. Testcase? -Chris From wendling at apple.com Fri Oct 31 01:24:42 2008 From: wendling at apple.com (Bill Wendling) Date: Thu, 30 Oct 2008 23:24:42 -0700 Subject: [llvm-commits] [llvm] r58489 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp Target/X86/X86RegisterInfo.cpp In-Reply-To: References: <200810310400.m9V40OJL006216@zion.cs.uiuc.edu> Message-ID: <800823F8-0E18-48FD-8D2C-33EC0382F53C@apple.com> On Oct 30, 2008, at 11:09 PM, Chris Lattner wrote: > On Oct 30, 2008, at 9:00 PM, Bill Wendling wrote: > >> Author: void >> Date: Thu Oct 30 23:00:23 2008 >> New Revision: 58489 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=58489&view=rev >> Log: >> Don't skip over all "terminator" instructions when determining >> where to put the >> callee-saved restore code. It could skip over conditional jumps >> accidentally. Instead, just skip the "return" instructions. > > Testcase? > No. This came about because of stuff I'm doing for stack protectors. I'd basically end up with an epilogue that looked like this: cmpl %edx, %ecx addl $1068, %esp jne LBB1_5 ## CallStackCheckFailBlk popl %esi popl %edi popl %ebx popl %ebp ret instead of this: cmpl %edx, %ecx jne LBB1_5 ## CallStackCheckFailBlk addl $1068, %esp popl %esi popl %edi popl %ebx popl %ebp ret But that's after I inserted some code. -bw From clattner at apple.com Fri Oct 31 01:41:23 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 30 Oct 2008 23:41:23 -0700 Subject: [llvm-commits] [llvm] r58489 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp Target/X86/X86RegisterInfo.cpp In-Reply-To: <800823F8-0E18-48FD-8D2C-33EC0382F53C@apple.com> References: <200810310400.m9V40OJL006216@zion.cs.uiuc.edu> <800823F8-0E18-48FD-8D2C-33EC0382F53C@apple.com> Message-ID: On Oct 30, 2008, at 11:24 PM, Bill Wendling wrote: > On Oct 30, 2008, at 11:09 PM, Chris Lattner wrote: > >> On Oct 30, 2008, at 9:00 PM, Bill Wendling wrote: >> >>> Author: void >>> Date: Thu Oct 30 23:00:23 2008 >>> New Revision: 58489 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=58489&view=rev >>> Log: >>> Don't skip over all "terminator" instructions when determining >>> where to put the >>> callee-saved restore code. It could skip over conditional jumps >>> accidentally. Instead, just skip the "return" instructions. >> >> Testcase? >> > No. This came about because of stuff I'm doing for stack protectors. > I'd basically end up with an epilogue that looked like this: > > cmpl %edx, %ecx > addl $1068, %esp > jne LBB1_5 ## CallStackCheckFailBlk > popl %esi > popl %edi > popl %ebx > popl %ebp > ret > > instead of this: > > cmpl %edx, %ecx > jne LBB1_5 ## CallStackCheckFailBlk > addl $1068, %esp > popl %esi > popl %edi > popl %ebx > popl %ebp > ret > > But that's after I inserted some code. I don't think this is right. We should never have a jump and ret in the same block. You stack protector stuff should put the ret in a separate fall-through block or something. -Chris From wangmp at apple.com Fri Oct 31 04:30:11 2008 From: wangmp at apple.com (Mon Ping Wang) Date: Fri, 31 Oct 2008 02:30:11 -0700 Subject: [llvm-commits] patch: generalize vector shuffle Message-ID: <5EACDEF3-CC6D-46C5-9722-ED7E6B6B3F5D@apple.com> Hi, This is a patch that implements changing the shuffle vector definition to = shufflevector > , > , ; yields > As discussed in llvmdev, the reason for this change is to help maintain the incoming vector structure of the user code instead of converting to insert and extract. During the SelectionDAG, we normalize the shuffle vector such that the vectors and mask are the same size and then we legalize the shuffle vectors. The normalization process tries to retain the structure of the vector shuffle by trying to convert it to a series of concat vectors, extract subvector, and vector shuffles. If it can't, it falls back to using insert/extracts. This implementation normalizes during DAG construction while in a earlier implementation normalized during the Legalize phase. The pros of doing this way is that after DAG construction, none of the DAG passes would have to worry about non- normalized shuffles, we might be able to optimize the normalized shuffles, and in LegalizeTypes, we wouldn't have to do a pass to normalize the vector shuffles. (We could probably do normalization when we iterate the DAG to build the worklist in LegalizeTypes). The downside is no DAG optimization can generate a non-normalized shufflevector and there may be cases where after normalization, we may obscure the what the original structure is. Here is the patch. I've a few more test cases that I didn't include in the patch. Thanks, -- Mon Ping -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/652254a2/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: genshuffle2.patch Type: application/octet-stream Size: 64747 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/652254a2/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/652254a2/attachment-0001.html From wangmp at apple.com Fri Oct 31 04:38:03 2008 From: wangmp at apple.com (Mon Ping Wang) Date: Fri, 31 Oct 2008 02:38:03 -0700 Subject: [llvm-commits] Patch: generalize vector shuffle Message-ID: <7C812DE7-E002-4767-A0AE-192738C25237@apple.com> I got an empty message when I looked at the email. I apologize if you get the same message twice. Begin forwarded message: Hi, This is a patch that implements changing the shuffle vector definition to = shufflevector > , > , ; yields > As discussed in llvmdev, the reason for this change is to help maintain the incoming vector structure of the user code instead of converting to insert and extract. During the SelectionDAG, we normalize the shuffle vector such that the vectors and mask are the same size and then we legalize the shuffle vectors. The normalization process tries to retain the structure of the vector shuffle by trying to convert it to a series of concat vectors, extract subvector, and vector shuffles. If it can't, it falls back to using insert/extracts. This implementation normalizes during DAG construction while in a earlier implementation normalized during the Legalize phase. The pros of doing this way is that after DAG construction, none of the DAG passes would have to worry about non- normalized shuffles, we might be able to optimize the normalized shuffles, and in LegalizeTypes, we wouldn't have to do a pass to normalize the vector shuffles. (We could probably do normalization when we iterate the DAG to build the worklist in LegalizeTypes). The downside is no DAG optimization can generate a non-normalized shufflevector and there may be cases where after normalization, we may obscure the what the original structure is. Here is the patch. I've a few more test cases that I didn't include in the patch. Thanks, -- Mon Ping -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/2835b8c4/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: genshuffle2.patch Type: application/octet-stream Size: 64747 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/2835b8c4/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/2835b8c4/attachment-0001.html From sanjiv.gupta at microchip.com Fri Oct 31 04:40:15 2008 From: sanjiv.gupta at microchip.com (sanjiv gupta) Date: Fri, 31 Oct 2008 15:10:15 +0530 Subject: [llvm-commits] Patch for handling multiple values in ExpandIntegerOperand In-Reply-To: <200810182048.56939.baldrick@free.fr> References: <1224336602.3139.19.camel@idc-lt-i00171.microchip.com> <200810181823.21150.baldrick@free.fr> <1224350958.3139.29.camel@idc-lt-i00171.microchip.com> <200810182048.56939.baldrick@free.fr> Message-ID: <1225446015.2970.23.camel@idc-lt-i00171.microchip.com> On Sat, 2008-10-18 at 20:48 +0200, Duncan Sands wrote: > > Please refer to one of your posts to see why number of values can't be > > same. > > > > http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-September/016767.html > > As I mentioned there, in such cases you need to use MergeValues. > Take a look at X86TargetLowering::ExpandFP_TO_SINT for an example > of this. > > Ciao, > > Duncan. Looks like some target independent code also requires that the number of values can't be same. For example: TRUNC:i8 (add:i16) gets replaced by the first value of adde:(i8, flag) ignoring the flag. So the patch I submitted is quite generic and only extends the functionally to handle the case where the original node had multiple values. Our target needs this since we are replacing loads, and a load has multiple values. Do you think the patch is unsafe? Thanks, - Sanjiv From baldrick at free.fr Fri Oct 31 04:52:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 31 Oct 2008 10:52:32 +0100 Subject: [llvm-commits] Patch for handling multiple values in ExpandIntegerOperand In-Reply-To: <1225446015.2970.23.camel@idc-lt-i00171.microchip.com> References: <1224336602.3139.19.camel@idc-lt-i00171.microchip.com> <200810182048.56939.baldrick@free.fr> <1225446015.2970.23.camel@idc-lt-i00171.microchip.com> Message-ID: <200810311052.33386.baldrick@free.fr> Hi, > Looks like some target independent code also requires that the number of > values can't be same. For example: TRUNC:i8 (add:i16) gets replaced by > the first value of adde:(i8, flag) ignoring the flag. these routines are defined to return one value. In the code in question that value needs to replace one value of N. If N has more than one value, how do you know which one to replace? > So the patch I submitted is quite generic and only extends the > functionally to handle the case where the original node had multiple > values. Our target needs this since we are replacing loads, and a load > has multiple values. Do you think the patch is unsafe? Yes, because it assumes that you want to replace the first values of N. I think it makes more sense to change everything (include the target independent routines) to return nodes rather than values, and have these new nodes entirely replace N. Ciao, Duncan. From anton at korobeynikov.info Fri Oct 31 05:19:48 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Fri, 31 Oct 2008 13:19:48 +0300 Subject: [llvm-commits] [llvm] r58489 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp Target/X86/X86RegisterInfo.cpp In-Reply-To: References: <200810310400.m9V40OJL006216@zion.cs.uiuc.edu> <800823F8-0E18-48FD-8D2C-33EC0382F53C@apple.com> Message-ID: > I don't think this is right. We should never have a jump and ret in > the same block. You stack protector stuff should put the ret in a > separate fall-through block or something. Also, how does this stuff work with other types of terminators, e.g. eh_return? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From sanjiv.gupta at microchip.com Fri Oct 31 05:26:20 2008 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Fri, 31 Oct 2008 10:26:20 -0000 Subject: [llvm-commits] [llvm] r58505 - /llvm/trunk/lib/VMCore/Type.cpp Message-ID: <200810311026.m9VAQKSc028696@zion.cs.uiuc.edu> Author: sgupta Date: Fri Oct 31 05:26:20 2008 New Revision: 58505 URL: http://llvm.org/viewvc/llvm-project?rev=58505&view=rev Log: For some targets pointer and int are 16-bits. Allow 16-bits as a valid index in such cases. Modified: llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=58505&r1=58504&r2=58505&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Fri Oct 31 05:26:20 2008 @@ -1516,7 +1516,8 @@ bool SequentialType::indexValid(const Value *V) const { if (const IntegerType *IT = dyn_cast(V->getType())) - return IT->getBitWidth() == 32 || IT->getBitWidth() == 64; + return IT->getBitWidth() == 16 || + IT->getBitWidth() == 32 || IT->getBitWidth() == 64; return false; } From duncan.sands at math.u-psud.fr Fri Oct 31 06:24:41 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Fri, 31 Oct 2008 12:24:41 +0100 Subject: [llvm-commits] [llvm] r58505 - /llvm/trunk/lib/VMCore/Type.cpp In-Reply-To: <200810311026.m9VAQKSc028696@zion.cs.uiuc.edu> References: <200810311026.m9VAQKSc028696@zion.cs.uiuc.edu> Message-ID: <200810311224.41486.duncan.sands@math.u-psud.fr> > For some targets pointer and int are 16-bits. Allow 16-bits as a valid index > in such cases. Please don't forget to update the documentation. Ciao, Duncan. From sanjiv.gupta at microchip.com Fri Oct 31 06:36:10 2008 From: sanjiv.gupta at microchip.com (sanjiv gupta) Date: Fri, 31 Oct 2008 17:06:10 +0530 Subject: [llvm-commits] Patch for handling multiple values in ExpandIntegerOperand In-Reply-To: <200810311052.33386.baldrick@free.fr> References: <1224336602.3139.19.camel@idc-lt-i00171.microchip.com> <200810182048.56939.baldrick@free.fr> <1225446015.2970.23.camel@idc-lt-i00171.microchip.com> <200810311052.33386.baldrick@free.fr> Message-ID: <1225452971.2970.38.camel@idc-lt-i00171.microchip.com> On Fri, 2008-10-31 at 10:52 +0100, Duncan Sands wrote: > Hi, > > > Looks like some target independent code also requires that the number of > > values can't be same. For example: TRUNC:i8 (add:i16) gets replaced by > > the first value of adde:(i8, flag) ignoring the flag. > > these routines are defined to return one value. In the code in question > that value needs to replace one value of N. If N has more than one value, > how do you know which one to replace? > > > So the patch I submitted is quite generic and only extends the > > functionally to handle the case where the original node had multiple > > values. Our target needs this since we are replacing loads, and a load > > has multiple values. Do you think the patch is unsafe? > > Yes, because it assumes that you want to replace the first values of N. > I think it makes more sense to change everything (include the target > independent routines) to return nodes rather than values, and have these > new nodes entirely replace N. > > Ciao, > > Duncan. The code routine in question here is DAG::getNode(), which returns an SDValue. When it sees that the Operand of the TRUNCATE:i8 (adde:i8,flag) has same value, it simply returns the first value of Operand. I don't think that we can/want to change the return type of getNode(). Probably you are referring to change the return types of functions like: SDValue DAGTypeLegalizer::ExpandIntOp_TRUNCATE(SDNode *N) to SDNode *. For example, change the above function to SDNode* DAGTypeLegalizer::ExpandIntOp_TRUNCATE(SDNode *N) { SDValue InL, InH; GetExpandedInteger(N->getOperand(0), InL, InH); // Just truncate the low part of the source. SDValue Val = DAG.getNode(ISD::TRUNCATE, N->getValueType(0), InL); SDNode *Res = Val.getNode(); // Return Merge_Values if the number of values of N and Res do not match. ??? } is my understanding correct? - Sanjiv From baldrick at free.fr Fri Oct 31 06:55:53 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 31 Oct 2008 12:55:53 +0100 Subject: [llvm-commits] Patch for handling multiple values in ExpandIntegerOperand In-Reply-To: <1225452971.2970.38.camel@idc-lt-i00171.microchip.com> References: <1224336602.3139.19.camel@idc-lt-i00171.microchip.com> <200810311052.33386.baldrick@free.fr> <1225452971.2970.38.camel@idc-lt-i00171.microchip.com> Message-ID: <200810311255.53960.baldrick@free.fr> Hi, > The code routine in question here is DAG::getNode(), which returns an > SDValue. When it sees that the Operand of the TRUNCATE:i8 > (adde:i8,flag) has same value, it simply returns the first value of > Operand. I don't think that we can/want to change the return type of > getNode(). excellent point. > Probably you are referring to change the return types of functions like: > > SDValue DAGTypeLegalizer::ExpandIntOp_TRUNCATE(SDNode *N) > > to SDNode *. > ... > // Return Merge_Values if the number of values of N and Res do not > match. ??? > > is my understanding correct? Yes, but as you point out that is not reliable. This also means that the ReplaceNodeResults (target lowering) routines are potentially broken. I think that means that target lowering needs access to ReplaceValueWith, and that ReplaceNodeWith should probably be removed. Ciao, Dncan. From baldrick at free.fr Fri Oct 31 09:06:53 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 31 Oct 2008 14:06:53 -0000 Subject: [llvm-commits] [llvm] r58508 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h test/CodeGen/PowerPC/2008-10-31-PPCF128Libcalls.ll Message-ID: <200810311406.m9VE6sk1003787@zion.cs.uiuc.edu> Author: baldrick Date: Fri Oct 31 09:06:52 2008 New Revision: 58508 URL: http://llvm.org/viewvc/llvm-project?rev=58508&view=rev Log: Add a bunch of libcalls for ppcf128 that were somehow completely forgotten about when writing LegalizeTypes. Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-31-PPCF128Libcalls.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=58508&r1=58507&r2=58508&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Fri Oct 31 09:06:52 2008 @@ -112,7 +112,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FADD(SDNode *N) { MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)), - GetSoftenedFloat(N->getOperand(1)) }; + GetSoftenedFloat(N->getOperand(1)) }; return MakeLibCall(GetFPLibCall(N->getValueType(0), RTLIB::ADD_F32, RTLIB::ADD_F64, @@ -175,7 +175,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FMUL(SDNode *N) { MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)), - GetSoftenedFloat(N->getOperand(1)) }; + GetSoftenedFloat(N->getOperand(1)) }; return MakeLibCall(GetFPLibCall(N->getValueType(0), RTLIB::MUL_F32, RTLIB::MUL_F64, @@ -226,7 +226,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FSUB(SDNode *N) { MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDValue Ops[2] = { GetSoftenedFloat(N->getOperand(0)), - GetSoftenedFloat(N->getOperand(1)) }; + GetSoftenedFloat(N->getOperand(1)) }; return MakeLibCall(GetFPLibCall(N->getValueType(0), RTLIB::SUB_F32, RTLIB::SUB_F64, @@ -580,11 +580,26 @@ case ISD::ConstantFP: ExpandFloatRes_ConstantFP(N, Lo, Hi); break; case ISD::FABS: ExpandFloatRes_FABS(N, Lo, Hi); break; case ISD::FADD: ExpandFloatRes_FADD(N, Lo, Hi); break; + case ISD::FCEIL: ExpandFloatRes_FCEIL(N, Lo, Hi); break; + case ISD::FCOS: ExpandFloatRes_FCOS(N, Lo, Hi); break; case ISD::FDIV: ExpandFloatRes_FDIV(N, Lo, Hi); break; + case ISD::FEXP: ExpandFloatRes_FEXP(N, Lo, Hi); break; + case ISD::FEXP2: ExpandFloatRes_FEXP2(N, Lo, Hi); break; + case ISD::FFLOOR: ExpandFloatRes_FFLOOR(N, Lo, Hi); break; + case ISD::FLOG: ExpandFloatRes_FLOG(N, Lo, Hi); break; + case ISD::FLOG2: ExpandFloatRes_FLOG2(N, Lo, Hi); break; + case ISD::FLOG10: ExpandFloatRes_FLOG10(N, Lo, Hi); break; case ISD::FMUL: ExpandFloatRes_FMUL(N, Lo, Hi); break; + case ISD::FNEARBYINT: ExpandFloatRes_FNEARBYINT(N, Lo, Hi); break; case ISD::FNEG: ExpandFloatRes_FNEG(N, Lo, Hi); break; case ISD::FP_EXTEND: ExpandFloatRes_FP_EXTEND(N, Lo, Hi); break; + case ISD::FPOW: ExpandFloatRes_FPOW(N, Lo, Hi); break; + case ISD::FPOWI: ExpandFloatRes_FPOWI(N, Lo, Hi); break; + case ISD::FRINT: ExpandFloatRes_FRINT(N, Lo, Hi); break; + case ISD::FSIN: ExpandFloatRes_FABS(N, Lo, Hi); break; + case ISD::FSQRT: ExpandFloatRes_FSQRT(N, Lo, Hi); break; case ISD::FSUB: ExpandFloatRes_FSUB(N, Lo, Hi); break; + case ISD::FTRUNC: ExpandFloatRes_FTRUNC(N, Lo, Hi); break; case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi); break; case ISD::SINT_TO_FP: case ISD::UINT_TO_FP: ExpandFloatRes_XINT_TO_FP(N, Lo, Hi); break; @@ -607,21 +622,6 @@ &C.getRawData()[0])), NVT); } -void DAGTypeLegalizer::ExpandFloatRes_FADD(SDNode *N, SDValue &Lo, - SDValue &Hi) { - SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) }; - SDValue Call = MakeLibCall(GetFPLibCall(N->getValueType(0), - RTLIB::ADD_F32, - RTLIB::ADD_F64, - RTLIB::ADD_F80, - RTLIB::ADD_PPCF128), - N->getValueType(0), Ops, 2, - false); - assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && - "Call lowered wrongly!"); - Lo = Call.getOperand(0); Hi = Call.getOperand(1); -} - void DAGTypeLegalizer::ExpandFloatRes_FABS(SDNode *N, SDValue &Lo, SDValue &Hi) { assert(N->getValueType(0) == MVT::ppcf128 && @@ -635,16 +635,114 @@ DAG.getCondCode(ISD::SETEQ)); } +void DAGTypeLegalizer::ExpandFloatRes_FADD(SDNode *N, SDValue &Lo, + SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::ADD_F32, RTLIB::ADD_F64, + RTLIB::ADD_F80, RTLIB::ADD_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FCEIL(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::CEIL_F32, RTLIB::CEIL_F64, + RTLIB::CEIL_F80, RTLIB::CEIL_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FCOS(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::COS_F32, RTLIB::COS_F64, + RTLIB::COS_F80, RTLIB::COS_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + void DAGTypeLegalizer::ExpandFloatRes_FDIV(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) }; SDValue Call = MakeLibCall(GetFPLibCall(N->getValueType(0), - RTLIB::DIV_F32, - RTLIB::DIV_F64, - RTLIB::DIV_F80, - RTLIB::DIV_PPCF128), - N->getValueType(0), Ops, 2, - false); + RTLIB::DIV_F32, + RTLIB::DIV_F64, + RTLIB::DIV_F80, + RTLIB::DIV_PPCF128), + N->getValueType(0), Ops, 2, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FEXP(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::EXP_F32, RTLIB::EXP_F64, + RTLIB::EXP_F80, RTLIB::EXP_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FEXP2(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::EXP2_F32, RTLIB::EXP2_F64, + RTLIB::EXP2_F80, RTLIB::EXP2_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FFLOOR(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::FLOOR_F32,RTLIB::FLOOR_F64, + RTLIB::FLOOR_F80,RTLIB::FLOOR_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FLOG(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::LOG_F32, RTLIB::LOG_F64, + RTLIB::LOG_F80, RTLIB::LOG_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FLOG2(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::LOG2_F32, RTLIB::LOG2_F64, + RTLIB::LOG2_F80, RTLIB::LOG2_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FLOG10(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::LOG10_F32,RTLIB::LOG10_F64, + RTLIB::LOG10_F80,RTLIB::LOG10_PPCF128), + N, false); assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); Lo = Call.getOperand(0); Hi = Call.getOperand(1); @@ -654,12 +752,24 @@ SDValue &Hi) { SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) }; SDValue Call = MakeLibCall(GetFPLibCall(N->getValueType(0), - RTLIB::MUL_F32, - RTLIB::MUL_F64, - RTLIB::MUL_F80, - RTLIB::MUL_PPCF128), - N->getValueType(0), Ops, 2, - false); + RTLIB::MUL_F32, + RTLIB::MUL_F64, + RTLIB::MUL_F80, + RTLIB::MUL_PPCF128), + N->getValueType(0), Ops, 2, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::NEARBYINT_F32, + RTLIB::NEARBYINT_F64, + RTLIB::NEARBYINT_F80, + RTLIB::NEARBYINT_PPCF128), + N, false); assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); Lo = Call.getOperand(0); Hi = Call.getOperand(1); @@ -679,16 +789,81 @@ Lo = DAG.getConstantFP(APFloat(APInt(NVT.getSizeInBits(), 0)), NVT); } +void DAGTypeLegalizer::ExpandFloatRes_FPOW(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::POW_F32, RTLIB::POW_F64, + RTLIB::POW_F80, RTLIB::POW_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FPOWI(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::POWI_F32, RTLIB::POWI_F64, + RTLIB::POWI_F80, RTLIB::POWI_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FRINT(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::RINT_F32, RTLIB::RINT_F64, + RTLIB::RINT_F80, RTLIB::RINT_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FSIN(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::SIN_F32, RTLIB::SIN_F64, + RTLIB::SIN_F80, RTLIB::SIN_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FSQRT(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::SQRT_F32, RTLIB::SQRT_F64, + RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128), + N, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + void DAGTypeLegalizer::ExpandFloatRes_FSUB(SDNode *N, SDValue &Lo, SDValue &Hi) { SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) }; SDValue Call = MakeLibCall(GetFPLibCall(N->getValueType(0), - RTLIB::SUB_F32, - RTLIB::SUB_F64, - RTLIB::SUB_F80, - RTLIB::SUB_PPCF128), - N->getValueType(0), Ops, 2, - false); + RTLIB::SUB_F32, + RTLIB::SUB_F64, + RTLIB::SUB_F80, + RTLIB::SUB_PPCF128), + N->getValueType(0), Ops, 2, false); + assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && + "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FTRUNC(SDNode *N, + SDValue &Lo, SDValue &Hi) { + SDValue Call = LibCallify(GetFPLibCall(N->getValueType(0), + RTLIB::TRUNC_F32, RTLIB::TRUNC_F64, + RTLIB::TRUNC_F80, RTLIB::TRUNC_PPCF128), + N, false); assert(Call.getNode()->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); Lo = Call.getOperand(0); Hi = Call.getOperand(1); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=58508&r1=58507&r2=58508&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Fri Oct 31 09:06:52 2008 @@ -656,7 +656,7 @@ Args.push_back(Entry); } SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC), - TLI.getPointerTy()); + TLI.getPointerTy()); const Type *RetTy = RetVT.getTypeForMVT(); std::pair CallInfo = @@ -665,6 +665,26 @@ return CallInfo.first; } +/// LibCallify - Convert the node into a libcall with the same prototype. +SDValue DAGTypeLegalizer::LibCallify(RTLIB::Libcall LC, SDNode *N, + bool isSigned) { + unsigned NumOps = N->getNumOperands(); + if (NumOps == 0) { + return MakeLibCall(LC, N->getValueType(0), 0, 0, isSigned); + } else if (NumOps == 1) { + SDValue Op = N->getOperand(0); + return MakeLibCall(LC, N->getValueType(0), &Op, 1, isSigned); + } else if (NumOps == 2) { + SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) }; + return MakeLibCall(LC, N->getValueType(0), Ops, 2, isSigned); + } + SmallVector Ops(NumOps); + for (unsigned i = 0; i < NumOps; ++i) + Ops[i] = N->getOperand(i); + + return MakeLibCall(LC, N->getValueType(0), &Ops[0], NumOps, isSigned); +} + SDValue DAGTypeLegalizer::GetVectorElementPointer(SDValue VecPtr, MVT EltVT, SDValue Index) { // Make sure the index type is big enough to compute in. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=58508&r1=58507&r2=58508&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Fri Oct 31 09:06:52 2008 @@ -194,7 +194,8 @@ // Common routines. SDValue CreateStackStoreLoad(SDValue Op, MVT DestVT); SDValue MakeLibCall(RTLIB::Libcall LC, MVT RetVT, - const SDValue *Ops, unsigned NumOps, bool isSigned); + const SDValue *Ops, unsigned NumOps, bool isSigned); + SDValue LibCallify(RTLIB::Libcall LC, SDNode *N, bool isSigned); SDValue BitConvertToInteger(SDValue Op); SDValue JoinIntegers(SDValue Lo, SDValue Hi); @@ -392,11 +393,26 @@ void ExpandFloatRes_ConstantFP(SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_FABS (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_FADD (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FCEIL (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FCOS (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_FDIV (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FEXP (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FEXP2 (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FFLOOR (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FLOG (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FLOG2 (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FLOG10 (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_FMUL (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FNEARBYINT(SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_FNEG (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_FP_EXTEND (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FPOW (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FPOWI (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FRINT (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FSIN (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FSQRT (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_FSUB (SDNode *N, SDValue &Lo, SDValue &Hi); + void ExpandFloatRes_FTRUNC (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_LOAD (SDNode *N, SDValue &Lo, SDValue &Hi); void ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo, SDValue &Hi); Added: llvm/trunk/test/CodeGen/PowerPC/2008-10-31-PPCF128Libcalls.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-10-31-PPCF128Libcalls.ll?rev=58508&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2008-10-31-PPCF128Libcalls.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2008-10-31-PPCF128Libcalls.ll Fri Oct 31 09:06:52 2008 @@ -0,0 +1,37 @@ +; RUN: llvm-as < %s | llc +; PR2988 +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-f128:64:128" +target triple = "powerpc-apple-darwin10.0" + at a = common global ppc_fp128 0xM00000000000000000000000000000000, align 16 ; [#uses=2] + at b = common global ppc_fp128 0xM00000000000000000000000000000000, align 16 ; [#uses=2] + at c = common global ppc_fp128 0xM00000000000000000000000000000000, align 16 ; [#uses=3] + at d = common global ppc_fp128 0xM00000000000000000000000000000000, align 16 ; [#uses=2] + +define void @foo() nounwind { +entry: + %0 = load ppc_fp128* @a, align 16 ; [#uses=1] + %1 = call ppc_fp128 @llvm.sqrt.ppcf128(ppc_fp128 %0) ; [#uses=1] + store ppc_fp128 %1, ppc_fp128* @a, align 16 + %2 = load ppc_fp128* @b, align 16 ; [#uses=1] + %3 = call ppc_fp128 @"\01_sinl$LDBL128"(ppc_fp128 %2) nounwind readonly ; [#uses=1] + store ppc_fp128 %3, ppc_fp128* @b, align 16 + %4 = load ppc_fp128* @c, align 16 ; [#uses=1] + %5 = call ppc_fp128 @"\01_cosl$LDBL128"(ppc_fp128 %4) nounwind readonly ; [#uses=1] + store ppc_fp128 %5, ppc_fp128* @c, align 16 + %6 = load ppc_fp128* @d, align 16 ; [#uses=1] + %7 = load ppc_fp128* @c, align 16 ; [#uses=1] + %8 = call ppc_fp128 @llvm.pow.ppcf128(ppc_fp128 %6, ppc_fp128 %7) ; [#uses=1] + store ppc_fp128 %8, ppc_fp128* @d, align 16 + br label %return + +return: ; preds = %entry + ret void +} + +declare ppc_fp128 @llvm.sqrt.ppcf128(ppc_fp128) nounwind readonly + +declare ppc_fp128 @"\01_sinl$LDBL128"(ppc_fp128) nounwind readonly + +declare ppc_fp128 @"\01_cosl$LDBL128"(ppc_fp128) nounwind readonly + +declare ppc_fp128 @llvm.pow.ppcf128(ppc_fp128, ppc_fp128) nounwind readonly From gohman at apple.com Fri Oct 31 11:12:56 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 31 Oct 2008 16:12:56 -0000 Subject: [llvm-commits] [llvm] r58512 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Message-ID: <200810311612.m9VGCuSZ008662@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 31 11:12:56 2008 New Revision: 58512 URL: http://llvm.org/viewvc/llvm-project?rev=58512&view=rev Log: Totally disable the setSubgraphColor calls temporarily, as they're currently troublesome even for #ifndef NDEBUG builds. Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58512&r1=58511&r2=58512&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Fri Oct 31 11:12:56 2008 @@ -180,7 +180,7 @@ // Skip already selected nodes. if (isSelected(Node->getNodeId())) continue; -#ifndef NDEBUG +#if 0 DAG.setSubgraphColor(Node, "red"); #endif SDNode *ResNode = Select(SDValue(Node, 0)); @@ -190,7 +190,7 @@ continue; // Replace node. if (ResNode) { -#ifndef NDEBUG +#if 0 DAG.setSubgraphColor(ResNode, "yellow"); DAG.setSubgraphColor(ResNode, "black"); #endif From evan.cheng at apple.com Fri Oct 31 11:42:00 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 16:42:00 -0000 Subject: [llvm-commits] [llvm] r58514 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Message-ID: <200810311642.m9VGg0DT009694@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 31 11:41:59 2008 New Revision: 58514 URL: http://llvm.org/viewvc/llvm-project?rev=58514&view=rev Log: Add a fixme. Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58514&r1=58513&r2=58514&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Fri Oct 31 11:41:59 2008 @@ -769,6 +769,9 @@ ShrinkWrapLiveInterval(ValNo, BarrierMBB, NULL, DefMBB, Visited, Uses, UseMIs, UseMBBs); + // FIXME: If ValNo->hasPHIKill is false, then renumber the val# by + // the restore. + // Remove live range from barrier to the restore. FIXME: Find a better // point to re-start the live interval. UpdateRegisterInterval(ValNo, LIs->getUseIndex(BarrierIdx)+1, From evan.cheng at apple.com Fri Oct 31 11:46:32 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 09:46:32 -0700 Subject: [llvm-commits] [llvm] r58489 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp Target/X86/X86RegisterInfo.cpp In-Reply-To: References: <200810310400.m9V40OJL006216@zion.cs.uiuc.edu> <800823F8-0E18-48FD-8D2C-33EC0382F53C@apple.com> Message-ID: Chris is right. Sorry I didn't point this out. Bill, the original plan was for you to introduce a separate block for the stack check code? Evan On Oct 30, 2008, at 11:41 PM, Chris Lattner wrote: > > On Oct 30, 2008, at 11:24 PM, Bill Wendling wrote: > >> On Oct 30, 2008, at 11:09 PM, Chris Lattner wrote: >> >>> On Oct 30, 2008, at 9:00 PM, Bill Wendling wrote: >>> >>>> Author: void >>>> Date: Thu Oct 30 23:00:23 2008 >>>> New Revision: 58489 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=58489&view=rev >>>> Log: >>>> Don't skip over all "terminator" instructions when determining >>>> where to put the >>>> callee-saved restore code. It could skip over conditional jumps >>>> accidentally. Instead, just skip the "return" instructions. >>> >>> Testcase? >>> >> No. This came about because of stuff I'm doing for stack protectors. >> I'd basically end up with an epilogue that looked like this: >> >> cmpl %edx, %ecx >> addl $1068, %esp >> jne LBB1_5 ## CallStackCheckFailBlk >> popl %esi >> popl %edi >> popl %ebx >> popl %ebp >> ret >> >> instead of this: >> >> cmpl %edx, %ecx >> jne LBB1_5 ## CallStackCheckFailBlk >> addl $1068, %esp >> popl %esi >> popl %edi >> popl %ebx >> popl %ebp >> ret >> >> But that's after I inserted some code. > > I don't think this is right. We should never have a jump and ret in > the same block. You stack protector stuff should put the ret in a > separate fall-through block or something. > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From criswell at uiuc.edu Fri Oct 31 11:47:52 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 31 Oct 2008 16:47:52 -0000 Subject: [llvm-commits] [poolalloc] r58515 - /poolalloc/trunk/include/poolalloc/PoolAllocate.h Message-ID: <200810311647.m9VGlqwa009907@zion.cs.uiuc.edu> Author: criswell Date: Fri Oct 31 11:47:52 2008 New Revision: 58515 URL: http://llvm.org/viewvc/llvm-project?rev=58515&view=rev Log: Make getPool() smarter. It now checks whether the pool handle it looks up is accessible by the function specified by the caller. This allows callers to query information on both original functions and their clones and get correct answers from getPool(). Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=58515&r1=58514&r2=58515&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Fri Oct 31 11:47:52 2008 @@ -17,6 +17,9 @@ #ifndef POOLALLOCATE_H #define POOLALLOCATE_H +#include "llvm/Argument.h" +#include "llvm/Constants.h" +#include "llvm/Instructions.h" #include "llvm/Pass.h" #include "llvm/DerivedTypes.h" #include "llvm/Support/CallSite.h" @@ -172,7 +175,7 @@ public: static char ID; PoolAllocate (bool passAllArguments = false, - bool SAFECode = false, + bool SAFECode = true, intptr_t IDp = (intptr_t) (&ID)) : ModulePass((intptr_t)IDp), PassAllArguments(passAllArguments) @@ -245,13 +248,72 @@ return Graphs->getGlobalsGraph (); } + // + // Method: getPool() + // + // Description: + // Returns the pool handle associated with the DSNode in the given function. + // + // Inputs: + // N - The DSNode of the value for which the caller wants a pool handle. + // F - The function in which the value for which we want a pool handle + // exists. + // + // Notes: + // o) The DSNode N may *not* be in the current function. The caller may + // have mapped a value in the cloned function back to the original + // function. + // virtual Value * getPool (const DSNode * N, Function & F) { + // + // Grab the structure containg information about the function and its + // clones. + // PA::FuncInfo * FI = getFuncInfoOrClone (F); + assert (FI && "Function has no FuncInfoOrClone!\n"); + + // + // Look for a mapping from the DSNode to the pool handle. + // std::map::iterator I = FI->PoolDescriptors.find(N); if (I != FI->PoolDescriptors.end()) { - return I->second; + Value * Pool = I->second; + + // + // Now the fun part: + // The specified function could either be a clone or the original + // function. This means that the pool descriptor that is matched with + // the DSNode is: + // o) A constant accessible from both the original function and its + // clones. + // o) A global variable accessible from both the original function and + // its clones. + // o) An allocation accessible only to the function. + // o) A function parameter accessible only to the local function. + // + // In short, we need to filter out the case where we find a pool handle, + // but it's only accessible from a clone and not the original function. + // + assert ((isa(Pool) || + isa(Pool) || + isa(Pool) || + isa(Pool)) && + "Pool of unknown type!\n"); + if ((isa(Pool)) || (isa(Pool))) { + return Pool; + } else if (AllocationInst * AI = dyn_cast(Pool)) { + if (AI->getParent()->getParent() == &F) + return Pool; + } else if (Argument * Arg = dyn_cast(Pool)) { + if (Arg->getParent() == &F) + return Pool; + } } + // + // We either do not have a pool, or the pool is not accessible from the + // specified function. Return NULL. + // return 0; } @@ -368,7 +430,7 @@ TargetData * TD; public: static char ID; - PoolAllocateSimple(bool passAllArgs=false, bool SAFECode = false) + PoolAllocateSimple(bool passAllArgs=false, bool SAFECode = true) : PoolAllocate (passAllArgs, SAFECode, (intptr_t)&ID) {} ~PoolAllocateSimple() {return;} void getAnalysisUsage(AnalysisUsage &AU) const; From evan.cheng at apple.com Fri Oct 31 11:51:24 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 09:51:24 -0700 Subject: [llvm-commits] [llvm] r58512 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: <200810311612.m9VGCuSZ008662@zion.cs.uiuc.edu> References: <200810311612.m9VGCuSZ008662@zion.cs.uiuc.edu> Message-ID: <18725AD4-748C-489D-8B1B-7EBE700B6917@apple.com> Do we want another configure script --enable-visualization which enables this along with the visualization code? Evan On Oct 31, 2008, at 9:12 AM, Dan Gohman wrote: > Author: djg > Date: Fri Oct 31 11:12:56 2008 > New Revision: 58512 > > URL: http://llvm.org/viewvc/llvm-project?rev=58512&view=rev > Log: > Totally disable the setSubgraphColor calls temporarily, as they're > currently troublesome even for #ifndef NDEBUG builds. > > Modified: > llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h > > Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58512&r1=58511&r2=58512&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) > +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Fri Oct 31 > 11:12:56 2008 > @@ -180,7 +180,7 @@ > // Skip already selected nodes. > if (isSelected(Node->getNodeId())) > continue; > -#ifndef NDEBUG > +#if 0 > DAG.setSubgraphColor(Node, "red"); > #endif > SDNode *ResNode = Select(SDValue(Node, 0)); > @@ -190,7 +190,7 @@ > continue; > // Replace node. > if (ResNode) { > -#ifndef NDEBUG > +#if 0 > DAG.setSubgraphColor(ResNode, "yellow"); > DAG.setSubgraphColor(ResNode, "black"); > #endif > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From alenhar2 at cs.uiuc.edu Fri Oct 31 11:52:16 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 31 Oct 2008 16:52:16 -0000 Subject: [llvm-commits] [poolalloc] r58516 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200810311652.m9VGqGnj010128@zion.cs.uiuc.edu> Author: alenhar2 Date: Fri Oct 31 11:52:16 2008 New Revision: 58516 URL: http://llvm.org/viewvc/llvm-project?rev=58516&view=rev Log: add safecode as a commandline option too Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=58516&r1=58515&r2=58516&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Fri Oct 31 11:52:16 2008 @@ -26,6 +26,7 @@ #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/ADT/hash_set.h" +#include "llvm/Support/CommandLine.h" #include "dsa/DataStructure.h" #include "poolalloc/Config/config.h" @@ -41,6 +42,8 @@ namespace PA { + extern cl::opt PA_SAFECODE; + class Heuristic; /// FuncInfo - Represent the pool allocation information for one function in @@ -179,7 +182,7 @@ intptr_t IDp = (intptr_t) (&ID)) : ModulePass((intptr_t)IDp), PassAllArguments(passAllArguments) - {SAFECodeEnabled = BoundsChecksEnabled = SAFECode;} + {SAFECodeEnabled = BoundsChecksEnabled = SAFECode | PA::PA_SAFECODE;} virtual bool runOnModule(Module &M); virtual void getAnalysisUsage(AnalysisUsage &AU) const; Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=58516&r1=58515&r2=58516&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Fri Oct 31 11:52:16 2008 @@ -46,6 +46,8 @@ const Type *PoolAllocate::PoolDescPtrTy = 0; +cl::opt PA::PA_SAFECODE("pa-safecode", cl::ReallyHidden); + #if 0 #define TIME_REGION(VARNAME, DESC) \ NamedRegionTimer VARNAME(DESC) From evan.cheng at apple.com Fri Oct 31 11:52:57 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 16:52:57 -0000 Subject: [llvm-commits] [llvm] r58517 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.td Message-ID: <200810311652.m9VGqw6S010172@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 31 11:52:57 2008 New Revision: 58517 URL: http://llvm.org/viewvc/llvm-project?rev=58517&view=rev Log: Change x86 register allocation ordering to match that of gcc. Otherwise some tools get confused by prologue generated by llvm. Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=58517&r1=58516&r2=58517&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Fri Oct 31 11:52:57 2008 @@ -238,14 +238,14 @@ // Does the function dedicate RBP / EBP to being a frame ptr? // If so, don't allocate SPL or BPL. static const unsigned X86_GR8_AO_64_fp[] = - {X86::AL, X86::CL, X86::DL, X86::SIL, X86::DIL, - X86::R8B, X86::R9B, X86::R10B, X86::R11B, - X86::BL, X86::R14B, X86::R15B, X86::R12B, X86::R13B}; + {X86::AL, X86::CL, X86::DL, X86::SIL, X86::DIL, + X86::R8B, X86::R9B, X86::R10B, X86::R11B, + X86::BL, X86::R12B, X86::R13B, X86::R14B, X86::R15B}; // If not, just don't allocate SPL. static const unsigned X86_GR8_AO_64[] = - {X86::AL, X86::CL, X86::DL, X86::SIL, X86::DIL, - X86::R8B, X86::R9B, X86::R10B, X86::R11B, - X86::BL, X86::R14B, X86::R15B, X86::R12B, X86::R13B, X86::BPL}; + {X86::AL, X86::CL, X86::DL, X86::SIL, X86::DIL, + X86::R8B, X86::R9B, X86::R10B, X86::R11B, + X86::BL, X86::R12B, X86::R13B, X86::R14B, X86::R15B, X86::BPL}; // In 32-mode, none of the 8-bit registers aliases EBP or ESP. static const unsigned X86_GR8_AO_32[] = {X86::AL, X86::CL, X86::DL, X86::AH, X86::CH, X86::DH, X86::BL, X86::BH}; @@ -291,16 +291,16 @@ // Does the function dedicate RBP / EBP to being a frame ptr? // If so, don't allocate SP or BP. static const unsigned X86_GR16_AO_64_fp[] = - {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, - X86::R8W, X86::R9W, X86::R10W, X86::R11W, - X86::BX, X86::R14W, X86::R15W, X86::R12W, X86::R13W}; + {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, + X86::R8W, X86::R9W, X86::R10W, X86::R11W, + X86::BX, X86::R12W, X86::R13W, X86::R14W, X86::R15W}; static const unsigned X86_GR16_AO_32_fp[] = {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, X86::BX}; // If not, just don't allocate SPL. static const unsigned X86_GR16_AO_64[] = - {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, - X86::R8W, X86::R9W, X86::R10W, X86::R11W, - X86::BX, X86::R14W, X86::R15W, X86::R12W, X86::R13W, X86::BP}; + {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, + X86::R8W, X86::R9W, X86::R10W, X86::R11W, + X86::BX, X86::R12W, X86::R13W, X86::R14W, X86::R15W, X86::BP}; static const unsigned X86_GR16_AO_32[] = {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, X86::BX, X86::BP}; @@ -355,16 +355,16 @@ // Does the function dedicate RBP / EBP to being a frame ptr? // If so, don't allocate ESP or EBP. static const unsigned X86_GR32_AO_64_fp[] = - {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, - X86::R8D, X86::R9D, X86::R10D, X86::R11D, - X86::EBX, X86::R14D, X86::R15D, X86::R12D, X86::R13D}; + {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, + X86::R8D, X86::R9D, X86::R10D, X86::R11D, + X86::EBX, X86::R12D, X86::R13D, X86::R14D, X86::R15D}; static const unsigned X86_GR32_AO_32_fp[] = {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, X86::EBX}; // If not, just don't allocate SPL. static const unsigned X86_GR32_AO_64[] = - {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, - X86::R8D, X86::R9D, X86::R10D, X86::R11D, - X86::EBX, X86::R14D, X86::R15D, X86::R12D, X86::R13D, X86::EBP}; + {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, + X86::R8D, X86::R9D, X86::R10D, X86::R11D, + X86::EBX, X86::R12D, X86::R13D, X86::R14D, X86::R15D, X86::EBP}; static const unsigned X86_GR32_AO_32[] = {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, X86::EBX, X86::EBP}; @@ -409,7 +409,7 @@ def GR64 : RegisterClass<"X86", [i64], 64, [RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11, - RBX, R14, R15, R12, R13, RBP, RSP]> { + RBX, R12, R13, R14, R15, RBP, RSP]> { let SubRegClassList = [GR8, GR16, GR32]; let MethodProtos = [{ iterator allocation_order_end(const MachineFunction &MF) const; From edwintorok at gmail.com Fri Oct 31 12:16:26 2008 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Fri, 31 Oct 2008 19:16:26 +0200 Subject: [llvm-commits] [PATCH] catch user error in Pass.h Message-ID: <490B3D6A.1090100@gmail.com> Hi, The attached patch adds an assert to Pass.h to prevent mistakes like this which successfully compiles&links: MyFunctionPass() : FunctionPass(ID) {} instead of MyFunctionPass() : FunctionPass(&ID) {} OK to commit? Best regards, --Edwin -------------- next part -------------- A non-text attachment was scrubbed... Name: pass.patch Type: text/x-diff Size: 742 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/78948633/attachment.bin From dpatel at apple.com Fri Oct 31 12:23:52 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 31 Oct 2008 10:23:52 -0700 Subject: [llvm-commits] [PATCH] catch user error in Pass.h In-Reply-To: <490B3D6A.1090100@gmail.com> References: <490B3D6A.1090100@gmail.com> Message-ID: On Oct 31, 2008, at 10:16 AM, T?r?k Edwin wrote: > Hi, > > The attached patch adds an assert to Pass.h to prevent mistakes like > this which successfully compiles&links: > > MyFunctionPass() : FunctionPass(ID) {} > > instead of > > MyFunctionPass() : FunctionPass(&ID) {} > > > OK to commit? ok. Watch out for 80 cols limit. > > > Best regards, > --Edwin > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits - Devang From edwintorok at gmail.com Fri Oct 31 12:27:42 2008 From: edwintorok at gmail.com (Torok Edwin) Date: Fri, 31 Oct 2008 17:27:42 -0000 Subject: [llvm-commits] [llvm] r58518 - /llvm/trunk/include/llvm/Pass.h Message-ID: <200810311727.m9VHRg6c011323@zion.cs.uiuc.edu> Author: edwin Date: Fri Oct 31 12:27:41 2008 New Revision: 58518 URL: http://llvm.org/viewvc/llvm-project?rev=58518&view=rev Log: Add an assert to catch user errors like: MyFunctionPass() : FunctionPass(ID) {} when the user actually meant to write: MyFunctionPass() : FunctionPass(&ID) {} Modified: llvm/trunk/include/llvm/Pass.h Modified: llvm/trunk/include/llvm/Pass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=58518&r1=58517&r2=58518&view=diff ============================================================================== --- llvm/trunk/include/llvm/Pass.h (original) +++ llvm/trunk/include/llvm/Pass.h Fri Oct 31 12:27:41 2008 @@ -81,8 +81,12 @@ void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {} - explicit Pass(const void *pid) : Resolver(0), PassID((intptr_t)pid) {} + explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) { + assert(pid && "pid cannot be 0"); + } + explicit Pass(const void *pid) : Resolver(0), PassID((intptr_t)pid) { + assert(pid && "pid cannot be 0"); + } virtual ~Pass(); /// getPassName - Return a nice clean name for a pass. This usually From gohman at apple.com Fri Oct 31 12:37:14 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 31 Oct 2008 10:37:14 -0700 Subject: [llvm-commits] [llvm] r58512 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: <18725AD4-748C-489D-8B1B-7EBE700B6917@apple.com> References: <200810311612.m9VGCuSZ008662@zion.cs.uiuc.edu> <18725AD4-748C-489D-8B1B-7EBE700B6917@apple.com> Message-ID: I'd rather not add more build flavors. I think it would be sufficient to disable most of the setSubgraphColor code by default but enabled by an llc command-line option. Dan On Oct 31, 2008, at 9:51 AM, Evan Cheng wrote: > Do we want another configure script --enable-visualization which > enables this along with the visualization code? > > Evan > > On Oct 31, 2008, at 9:12 AM, Dan Gohman wrote: > >> Author: djg >> Date: Fri Oct 31 11:12:56 2008 >> New Revision: 58512 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=58512&view=rev >> Log: >> Totally disable the setSubgraphColor calls temporarily, as they're >> currently troublesome even for #ifndef NDEBUG builds. >> >> Modified: >> llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h >> >> Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58512&r1=58511&r2=58512&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Fri Oct 31 >> 11:12:56 2008 >> @@ -180,7 +180,7 @@ >> // Skip already selected nodes. >> if (isSelected(Node->getNodeId())) >> continue; >> -#ifndef NDEBUG >> +#if 0 >> DAG.setSubgraphColor(Node, "red"); >> #endif >> SDNode *ResNode = Select(SDValue(Node, 0)); >> @@ -190,7 +190,7 @@ >> continue; >> // Replace node. >> if (ResNode) { >> -#ifndef NDEBUG >> +#if 0 >> DAG.setSubgraphColor(ResNode, "yellow"); >> DAG.setSubgraphColor(ResNode, "black"); >> #endif >> >> >> _______________________________________________ >> 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 alenhar2 at cs.uiuc.edu Fri Oct 31 12:58:28 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 31 Oct 2008 17:58:28 -0000 Subject: [llvm-commits] [poolalloc] r58519 - /poolalloc/trunk/include/dsa/DataStructure.h Message-ID: <200810311758.m9VHwSYH012674@zion.cs.uiuc.edu> Author: alenhar2 Date: Fri Oct 31 12:58:24 2008 New Revision: 58519 URL: http://llvm.org/viewvc/llvm-project?rev=58519&view=rev Log: use correct printname Modified: poolalloc/trunk/include/dsa/DataStructure.h Modified: poolalloc/trunk/include/dsa/DataStructure.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=58519&r1=58518&r2=58519&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DataStructure.h (original) +++ poolalloc/trunk/include/dsa/DataStructure.h Fri Oct 31 12:58:24 2008 @@ -347,7 +347,7 @@ public: static char ID; TDDataStructures(intptr_t CID = (intptr_t)&ID, const char* printname = "td.", bool useEQ = false) - : DataStructures(CID, "td."), useEQBU(useEQ) {} + : DataStructures(CID, printname), useEQBU(useEQ) {} ~TDDataStructures() { releaseMemory(); } virtual bool runOnModule(Module &M); @@ -380,7 +380,7 @@ public: static char ID; EQTDDataStructures() - :TDDataStructures((intptr_t)&ID, "td.", false) + :TDDataStructures((intptr_t)&ID, "eqtd.", false) {} }; From evan.cheng at apple.com Fri Oct 31 13:04:31 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 11:04:31 -0700 Subject: [llvm-commits] [llvm] r58512 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h In-Reply-To: References: <200810311612.m9VGCuSZ008662@zion.cs.uiuc.edu> <18725AD4-748C-489D-8B1B-7EBE700B6917@apple.com> Message-ID: <1DE43A46-D6E1-4310-B9A2-6A41521751F5@apple.com> Ok. Thanks! Evan On Oct 31, 2008, at 10:37 AM, Dan Gohman wrote: > I'd rather not add more build flavors. I think > it would be sufficient to disable most of the > setSubgraphColor code by default but enabled > by an llc command-line option. > > Dan > > On Oct 31, 2008, at 9:51 AM, Evan Cheng wrote: > >> Do we want another configure script --enable-visualization which >> enables this along with the visualization code? >> >> Evan >> >> On Oct 31, 2008, at 9:12 AM, Dan Gohman wrote: >> >>> Author: djg >>> Date: Fri Oct 31 11:12:56 2008 >>> New Revision: 58512 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=58512&view=rev >>> Log: >>> Totally disable the setSubgraphColor calls temporarily, as they're >>> currently troublesome even for #ifndef NDEBUG builds. >>> >>> Modified: >>> llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h >>> >>> Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=58512&r1=58511&r2=58512&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) >>> +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Fri Oct 31 >>> 11:12:56 2008 >>> @@ -180,7 +180,7 @@ >>> // Skip already selected nodes. >>> if (isSelected(Node->getNodeId())) >>> continue; >>> -#ifndef NDEBUG >>> +#if 0 >>> DAG.setSubgraphColor(Node, "red"); >>> #endif >>> SDNode *ResNode = Select(SDValue(Node, 0)); >>> @@ -190,7 +190,7 @@ >>> continue; >>> // Replace node. >>> if (ResNode) { >>> -#ifndef NDEBUG >>> +#if 0 >>> DAG.setSubgraphColor(ResNode, "yellow"); >>> DAG.setSubgraphColor(ResNode, "black"); >>> #endif >>> >>> >>> _______________________________________________ >>> 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 > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From asl at math.spbu.ru Fri Oct 31 13:05:04 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 31 Oct 2008 18:05:04 -0000 Subject: [llvm-commits] [llvm] r58520 - /llvm/trunk/include/llvm/Support/Compiler.h Message-ID: <200810311805.m9VI5562012952@zion.cs.uiuc.edu> Author: asl Date: Fri Oct 31 13:05:01 2008 New Revision: 58520 URL: http://llvm.org/viewvc/llvm-project?rev=58520&view=rev Log: Symbol visibility is unsupported on cygwin too. Patch by Jay Foad! Modified: llvm/trunk/include/llvm/Support/Compiler.h Modified: llvm/trunk/include/llvm/Support/Compiler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=58520&r1=58519&r2=58520&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Compiler.h (original) +++ llvm/trunk/include/llvm/Support/Compiler.h Fri Oct 31 13:05:01 2008 @@ -17,7 +17,7 @@ // The VISIBILITY_HIDDEN macro, used for marking classes with the GCC-specific // visibility("hidden") attribute. -#if (__GNUC__ >= 4) && !defined(__MINGW32__) +#if (__GNUC__ >= 4) && !defined(__MINGW32__) && !defined(__CYGWIN__) #define VISIBILITY_HIDDEN __attribute__ ((visibility("hidden"))) #else #define VISIBILITY_HIDDEN From alenhar2 at cs.uiuc.edu Fri Oct 31 13:15:08 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 31 Oct 2008 18:15:08 -0000 Subject: [llvm-commits] [poolalloc] r58521 - /poolalloc/trunk/lib/DSA/TopDownClosure.cpp Message-ID: <200810311815.m9VIF8bU013309@zion.cs.uiuc.edu> Author: alenhar2 Date: Fri Oct 31 13:15:08 2008 New Revision: 58521 URL: http://llvm.org/viewvc/llvm-project?rev=58521&view=rev Log: global ecs may be formed at the end of inlining due to global-arg binding which were not being handled Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=58521&r1=58520&r2=58521&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Fri Oct 31 13:15:08 2008 @@ -136,6 +136,7 @@ IndCallMap.erase(IndCallMap.begin()); } + formGlobalECs(); ArgsRemainIncomplete.clear(); GlobalsGraph->removeTriviallyDeadNodes(); @@ -232,6 +233,17 @@ } + { + DSGraph* GG = DSG->getGlobalsGraph(); + ReachabilityCloner RC(GG, DSG, + DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes); + for (DSScalarMap::global_iterator + GI = DSG->getScalarMap().global_begin(), + E = DSG->getScalarMap().global_end(); GI != E; ++GI) + RC.getClonedNH(DSG->getNodeForValue(*GI)); + } + // Next, now that this graph is finalized, we need to recompute the // incompleteness markers for this graph and remove unreachable nodes. DSG->maskIncompleteMarkers(); From alenhar2 at cs.uiuc.edu Fri Oct 31 13:21:24 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 31 Oct 2008 18:21:24 -0000 Subject: [llvm-commits] [poolalloc] r58522 - /poolalloc/trunk/Regressions/2008-10-31.missingECs.ll Message-ID: <200810311821.m9VILOgX013552@zion.cs.uiuc.edu> Author: alenhar2 Date: Fri Oct 31 13:21:24 2008 New Revision: 58522 URL: http://llvm.org/viewvc/llvm-project?rev=58522&view=rev Log: regression from john. in TD flavors, the 2 globals that wind up in the arg are not in the same eq class in the globals graph causing ComputeMapping to fail Added: poolalloc/trunk/Regressions/2008-10-31.missingECs.ll Added: poolalloc/trunk/Regressions/2008-10-31.missingECs.ll URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/Regressions/2008-10-31.missingECs.ll?rev=58522&view=auto ============================================================================== --- poolalloc/trunk/Regressions/2008-10-31.missingECs.ll (added) +++ poolalloc/trunk/Regressions/2008-10-31.missingECs.ll Fri Oct 31 13:21:24 2008 @@ -0,0 +1,45 @@ +; ModuleID = '2008-10-31.missingECs.bc' +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-f80:128:128" +target triple = "i386-apple-darwin9.1" + %struct.Index_Map = type { i32, %struct.item_set** } + %struct.Item = type { [4 x i16], %struct.rule* } + %struct.anon = type { %struct.nonterminal* } + %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* } + %struct.intlist = type { i32, %struct.intlist* } + %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* } + %struct.list = type { i8*, %struct.list* } + %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** } + %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* } + %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* } + %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] } + %struct.patternAST = type { %struct.symbol*, i8*, %struct.list* } + %struct.plank = type { i8*, %struct.list*, i32 } + %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* } + %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 } + %struct.ruleAST = type { i8*, %struct.patternAST*, i32, %struct.intlist*, %struct.rule*, %struct.strTableElement*, %struct.strTableElement* } + %struct.stateMap = type { i8*, %struct.plank*, i32, i16* } + %struct.strTableElement = type { i8*, %struct.intlist*, i8* } + %struct.symbol = type { i8*, i32, %struct.anon } + %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** } + +declare void @doEnterNonTerm(%struct.ruleAST*) nounwind + +declare void @doRule(%struct.ruleAST*) nounwind + +define fastcc void @reveachList(i8* (i8*)* %f, %struct.list* %l) nounwind { +entry: + unreachable +} + +define void @main(i32 %argc, i8** %argv) noreturn nounwind { +entry: + br i1 false, label %bb.i9.i.i, label %bb.i12.i.i + +bb.i12.i.i: ; preds = %entry + call fastcc void @reveachList(i8* (i8*)* bitcast (void (%struct.ruleAST*)* @doEnterNonTerm to i8* (i8*)*), %struct.list* null) nounwind + unreachable + +bb.i9.i.i: ; preds = %entry + call fastcc void @reveachList(i8* (i8*)* bitcast (void (%struct.ruleAST*)* @doRule to i8* (i8*)*), %struct.list* null) nounwind + unreachable +} From edwintorok at gmail.com Fri Oct 31 12:28:33 2008 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Fri, 31 Oct 2008 19:28:33 +0200 Subject: [llvm-commits] [PATCH] catch user error in Pass.h In-Reply-To: References: <490B3D6A.1090100@gmail.com> Message-ID: <490B4041.5040602@gmail.com> On 2008-10-31 19:23, Devang Patel wrote: > On Oct 31, 2008, at 10:16 AM, T?r?k Edwin wrote: > > >> Hi, >> >> The attached patch adds an assert to Pass.h to prevent mistakes like >> this which successfully compiles&links: >> >> MyFunctionPass() : FunctionPass(ID) {} >> >> instead of >> >> MyFunctionPass() : FunctionPass(&ID) {} >> >> >> OK to commit? >> > > ok. Watch out for 80 cols limit. > Fixed the 80 col limit, and committed. Thanks, --Edwin From isanbard at gmail.com Fri Oct 31 13:30:19 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 31 Oct 2008 18:30:19 -0000 Subject: [llvm-commits] [llvm] r58523 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp Target/X86/X86RegisterInfo.cpp Message-ID: <200810311830.m9VIUJqx013883@zion.cs.uiuc.edu> Author: void Date: Fri Oct 31 13:30:19 2008 New Revision: 58523 URL: http://llvm.org/viewvc/llvm-project?rev=58523&view=rev Log: Revert r58489. It isn't correct for all cases. Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=58523&r1=58522&r2=58523&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Fri Oct 31 13:30:19 2008 @@ -273,10 +273,10 @@ MBB = FI; I = MBB->end(); --I; - // Skip over all "return" instructions, which are part of the return + // Skip over all terminator instructions, which are part of the return // sequence. MachineBasicBlock::iterator I2 = I; - while (I2 != MBB->begin() && (--I2)->getDesc().isReturn()) + while (I2 != MBB->begin() && (--I2)->getDesc().isTerminator()) I = I2; bool AtStart = I == MBB->begin(); Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=58523&r1=58522&r2=58523&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Oct 31 13:30:19 2008 @@ -850,7 +850,8 @@ while (MBBI != MBB.begin()) { MachineBasicBlock::iterator PI = prior(MBBI); unsigned Opc = PI->getOpcode(); - if (Opc != X86::POP32r && Opc != X86::POP64r && !PI->getDesc().isReturn()) + if (Opc != X86::POP32r && Opc != X86::POP64r && + !PI->getDesc().isTerminator()) break; --MBBI; } From gohman at apple.com Fri Oct 31 14:06:34 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 31 Oct 2008 19:06:34 -0000 Subject: [llvm-commits] [llvm] r58524 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Message-ID: <200810311906.m9VJ6YPN015005@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 31 14:06:33 2008 New Revision: 58524 URL: http://llvm.org/viewvc/llvm-project?rev=58524&view=rev Log: Remove some unused virtual function bodies. 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=58524&r1=58523&r2=58524&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Oct 31 14:06:33 2008 @@ -1349,17 +1349,15 @@ RegReductionPriorityQueue() : Queue(SF(this)), currentQueueId(0) {} - virtual void initNodes(std::vector &sunits) {} + virtual void initNodes(std::vector &sunits) = 0; - virtual void addNode(const SUnit *SU) {} + virtual void addNode(const SUnit *SU) = 0; - virtual void updateNode(const SUnit *SU) {} + virtual void updateNode(const SUnit *SU) = 0; - virtual void releaseState() {} + virtual void releaseState() = 0; - virtual unsigned getNodePriority(const SUnit *SU) const { - return 0; - } + virtual unsigned getNodePriority(const SUnit *SU) const = 0; unsigned size() const { return Queue.size(); } From criswell at uiuc.edu Fri Oct 31 14:10:37 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 31 Oct 2008 19:10:37 -0000 Subject: [llvm-commits] [poolalloc] r58525 - /poolalloc/trunk/lib/DSA/CallTargets.cpp Message-ID: <200810311910.m9VJAbTd015158@zion.cs.uiuc.edu> Author: criswell Date: Fri Oct 31 14:10:36 2008 New Revision: 58525 URL: http://llvm.org/viewvc/llvm-project?rev=58525&view=rev Log: Handle the case where we have a calls and invokes to function pointers that are NULL. Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=58525&r1=58524&r2=58525&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/CallTargets.cpp (original) +++ poolalloc/trunk/lib/DSA/CallTargets.cpp Fri Oct 31 14:10:36 2008 @@ -51,21 +51,27 @@ CallSite cs = CallSite::get(B); AllSites.push_back(cs); if (!cs.getCalledFunction()) { - IndCall++; - DSNode* N = T->getDSGraph(*cs.getCaller()) - ->getNodeForValue(cs.getCalledValue()).getNode(); - N->addFullFunctionList(IndMap[cs]); - if (N->isCompleteNode() && IndMap[cs].size()) { + if (isa(cs.getCalledValue())) { + ++DirCall; CompleteSites.insert(cs); - ++CompleteInd; - } - if (N->isCompleteNode() && !IndMap[cs].size()) { - ++CompleteEmpty; - cerr << "Call site empty: '" - << cs.getInstruction()->getName() - << "' In '" - << cs.getInstruction()->getParent()->getParent()->getName() - << "'\n"; + } else { + IndCall++; + DSNode* N = T->getDSGraph(*cs.getCaller()) + ->getNodeForValue(cs.getCalledValue()).getNode(); + assert (N && "CallTarget: findIndTargets: No DSNode!\n"); + N->addFullFunctionList(IndMap[cs]); + if (N->isCompleteNode() && IndMap[cs].size()) { + CompleteSites.insert(cs); + ++CompleteInd; + } + if (N->isCompleteNode() && !IndMap[cs].size()) { + ++CompleteEmpty; + cerr << "Call site empty: '" + << cs.getInstruction()->getName() + << "' In '" + << cs.getInstruction()->getParent()->getParent()->getName() + << "'\n"; + } } } else { ++DirCall; From evan.cheng at apple.com Fri Oct 31 14:10:44 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 19:10:44 -0000 Subject: [llvm-commits] [llvm] r58526 - /llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Message-ID: <200810311910.m9VJAiu2015174@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 31 14:10:44 2008 New Revision: 58526 URL: http://llvm.org/viewvc/llvm-project?rev=58526&view=rev Log: Encode PICADD; some code clean up. Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=58526&r1=58525&r2=58526&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Oct 31 14:10:44 2008 @@ -74,8 +74,13 @@ unsigned getMachineSoRegOpValue(const MachineInstr &MI, const TargetInstrDesc &TID, + const MachineOperand &MO, unsigned OpIdx); + unsigned getMachineSoImmOpValue(const MachineInstr &MI, + const TargetInstrDesc &TID, + const MachineOperand &MO); + unsigned getAddrMode1SBit(const MachineInstr &MI, const TargetInstrDesc &TID) const; @@ -104,11 +109,10 @@ /// getMachineOpValue - Return binary encoding of operand. If the machine /// operand requires relocation, record the relocation and return zero. + unsigned getMachineOpValue(const MachineInstr &MI,const MachineOperand &MO); unsigned getMachineOpValue(const MachineInstr &MI, unsigned OpIdx) { return getMachineOpValue(MI, MI.getOperand(OpIdx)); } - unsigned getMachineOpValue(const MachineInstr &MI, - const MachineOperand &MO); /// getBaseOpcodeFor - Return the opcode value. /// @@ -257,6 +261,70 @@ MCE.emitWordLE(getInstrBinary(MI)); } +void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) { + unsigned CPI = MI.getOperand(0).getImm(); + unsigned CPIndex = MI.getOperand(1).getIndex(); + const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPIndex]; + + // Remember the CONSTPOOL_ENTRY address for later relocation. + JTI->addConstantPoolEntryAddr(CPI, MCE.getCurrentPCValue()); + + // Emit constpool island entry. In most cases, the actual values will be + // resolved and relocated after code emission. + if (MCPE.isMachineConstantPoolEntry()) { + ARMConstantPoolValue *ACPV = + static_cast(MCPE.Val.MachineCPVal); + + DOUT << "\t** ARM constant pool #" << CPI << ", ' @ " + << (void*)MCE.getCurrentPCValue() << *ACPV << '\n'; + + GlobalValue *GV = ACPV->getGV(); + if (GV) { + assert(!ACPV->isStub() && "Don't know how to deal this yet!"); + emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); + } else { + assert(!ACPV->isNonLazyPointer() && "Don't know how to deal this yet!"); + emitExternalSymbolAddress(ACPV->getSymbol(), ARM::reloc_arm_absolute); + } + MCE.emitWordLE(0); + } else { + Constant *CV = MCPE.Val.ConstVal; + + DOUT << "\t** Constant pool #" << CPI << ", ' @ " + << (void*)MCE.getCurrentPCValue() << *CV << '\n'; + + if (GlobalValue *GV = dyn_cast(CV)) { + emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); + MCE.emitWordLE(0); + } else { + assert(CV->getType()->isInteger() && + "Not expecting non-integer constpool entries yet!"); + const ConstantInt *CI = dyn_cast(CV); + uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); + MCE.emitWordLE(Val); + } + } +} + +void ARMCodeEmitter::emitPseudoInstruction(const MachineInstr &MI) { + unsigned Opcode = MI.getDesc().Opcode; + switch (Opcode) { + default: + abort(); // FIXME: + case ARM::CONSTPOOL_ENTRY: + emitConstPoolInstruction(MI); + break; + case ARM::PICADD: { + // PICADD is just an add instruction that implicitly read pc. + unsigned Binary = getBinaryCodeForInstr(MI); + const TargetInstrDesc &TID = MI.getDesc(); + MCE.emitWordLE(getAddrMode1InstrBinary(MI, TID, Binary)); + break; + } + } +} + + unsigned ARMCodeEmitter::getAddrModeNoneInstrBinary(const MachineInstr &MI, const TargetInstrDesc &TID, unsigned Binary) { @@ -295,9 +363,9 @@ unsigned ARMCodeEmitter::getMachineSoRegOpValue(const MachineInstr &MI, const TargetInstrDesc &TID, + const MachineOperand &MO, unsigned OpIdx) { - // Set last operand (register Rm) - unsigned Binary = getMachineOpValue(MI, OpIdx); + unsigned Binary = getMachineOpValue(MI, MO); const MachineOperand &MO1 = MI.getOperand(OpIdx + 1); const MachineOperand &MO2 = MI.getOperand(OpIdx + 2); @@ -351,6 +419,17 @@ return Binary | ARM_AM::getSORegOffset(MO2.getImm()) << 7; } +unsigned ARMCodeEmitter::getMachineSoImmOpValue(const MachineInstr &MI, + const TargetInstrDesc &TID, + const MachineOperand &MO) { + unsigned SoImm = MO.getImm(); + // Encode rotate_imm. + unsigned Binary = ARM_AM::getSOImmValRot(SoImm) << ARMII::RotImmShift; + // Encode immed_8. + Binary |= ARM_AM::getSOImmVal(SoImm); + return Binary; +} + unsigned ARMCodeEmitter::getAddrMode1SBit(const MachineInstr &MI, const TargetInstrDesc &TID) const { for (unsigned i = MI.getNumOperands(), e = TID.getNumOperands(); i != e; --i){ @@ -361,63 +440,6 @@ return 0; } -void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) { - unsigned CPI = MI.getOperand(0).getImm(); - unsigned CPIndex = MI.getOperand(1).getIndex(); - const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPIndex]; - - // Remember the CONSTPOOL_ENTRY address for later relocation. - JTI->addConstantPoolEntryAddr(CPI, MCE.getCurrentPCValue()); - - // Emit constpool island entry. In most cases, the actual values will be - // resolved and relocated after code emission. - if (MCPE.isMachineConstantPoolEntry()) { - ARMConstantPoolValue *ACPV = - static_cast(MCPE.Val.MachineCPVal); - - DOUT << "\t** ARM constant pool #" << CPI << ", ' @ " - << (void*)MCE.getCurrentPCValue() << *ACPV << '\n'; - - GlobalValue *GV = ACPV->getGV(); - if (GV) { - assert(!ACPV->isStub() && "Don't know how to deal this yet!"); - emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); - } else { - assert(!ACPV->isNonLazyPointer() && "Don't know how to deal this yet!"); - emitExternalSymbolAddress(ACPV->getSymbol(), ARM::reloc_arm_absolute); - } - MCE.emitWordLE(0); - } else { - Constant *CV = MCPE.Val.ConstVal; - - DOUT << "\t** Constant pool #" << CPI << ", ' @ " - << (void*)MCE.getCurrentPCValue() << *CV << '\n'; - - if (GlobalValue *GV = dyn_cast(CV)) { - emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); - MCE.emitWordLE(0); - } else { - assert(CV->getType()->isInteger() && - "Not expecting non-integer constpool entries yet!"); - const ConstantInt *CI = dyn_cast(CV); - uint32_t Val = *(uint32_t*)CI->getValue().getRawData(); - MCE.emitWordLE(Val); - } - } -} - -void ARMCodeEmitter::emitPseudoInstruction(const MachineInstr &MI) { - unsigned Opcode = MI.getDesc().Opcode; - switch (Opcode) { - default: - abort(); // FIXME: - case ARM::CONSTPOOL_ENTRY: { - emitConstPoolInstruction(MI); - break; - } - } -} - unsigned ARMCodeEmitter::getAddrMode1InstrBinary(const MachineInstr &MI, const TargetInstrDesc &TID, unsigned Binary) { @@ -437,13 +459,19 @@ // Encode first non-shifter register operand if there is one. unsigned Format = TID.TSFlags & ARMII::FormMask; - bool hasRnOperand= !(Format == ARMII::DPRdMisc || - Format == ARMII::DPRdIm || - Format == ARMII::DPRdReg || - Format == ARMII::DPRdSoReg); - if (hasRnOperand) { - Binary |= getMachineOpValue(MI, OpIdx) << ARMII::RegRnShift; - ++OpIdx; + bool HasRnReg = !(Format == ARMII::DPRdMisc || + Format == ARMII::DPRdIm || + Format == ARMII::DPRdReg || + Format == ARMII::DPRdSoReg); + if (HasRnReg) { + if (TID.getOpcode() == ARM::PICADD) + // Special handling for PICADD. It implicitly use add. + Binary |= + ARMRegisterInfo::getRegisterNumbering(ARM::PC) << ARMII::RegRnShift; + else { + Binary |= getMachineOpValue(MI, OpIdx) << ARMII::RegRnShift; + ++OpIdx; + } } // Encode shifter operand. @@ -451,23 +479,20 @@ Format == ARMII::DPRnSoReg || Format == ARMII::DPRSoReg || Format == ARMII::DPRSoRegS); + + const MachineOperand &MO = MI.getOperand(OpIdx); if (HasSoReg) // Encode SoReg. - return Binary | getMachineSoRegOpValue(MI, TID, OpIdx); + return Binary | getMachineSoRegOpValue(MI, TID, MO, OpIdx); - const MachineOperand &MO = MI.getOperand(OpIdx); if (MO.isReg()) // Encode register Rm. - return Binary | getMachineOpValue(MI, NumDefs); + return Binary | ARMRegisterInfo::getRegisterNumbering(MO.getReg()); // Encode so_imm. // Set bit I(25) to identify this is the immediate form of Binary |= 1 << ARMII::I_BitShift; - unsigned SoImm = MO.getImm(); - // Encode rotate_imm. - Binary |= ARM_AM::getSOImmValRot(SoImm) << ARMII::RotImmShift; - // Encode immed_8. - Binary |= ARM_AM::getSOImmVal(SoImm); + Binary |= getMachineSoImmOpValue(MI, TID, MO); return Binary; } From evan.cheng at apple.com Fri Oct 31 14:11:09 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 19:11:09 -0000 Subject: [llvm-commits] [llvm] r58527 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200810311911.m9VJB9va015201@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 31 14:11:09 2008 New Revision: 58527 URL: http://llvm.org/viewvc/llvm-project?rev=58527&view=rev Log: Forgot this in last commit. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=58527&r1=58526&r2=58527&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Fri Oct 31 14:11:09 2008 @@ -466,7 +466,7 @@ [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>; let isNotDuplicable = 1 in { -def PICADD : AXI1<0x0, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p), +def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p), Pseudo, "$cp:\n\tadd$p $dst, pc, $a", [(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>; From wangmp at apple.com Fri Oct 31 14:13:43 2008 From: wangmp at apple.com (Mon P Wang) Date: Fri, 31 Oct 2008 19:13:43 -0000 Subject: [llvm-commits] [llvm] r58528 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200810311913.m9VJDhKp015280@zion.cs.uiuc.edu> Author: wangmp Date: Fri Oct 31 14:13:42 2008 New Revision: 58528 URL: http://llvm.org/viewvc/llvm-project?rev=58528&view=rev Log: x86_64 rip-relative and magic mode address Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=58528&r1=58527&r2=58528&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Fri Oct 31 14:13:42 2008 @@ -338,7 +338,7 @@ unsigned BaseReg = Base.getReg(); // Is a SIB byte needed? - if (IndexReg.getReg() == 0 && + if ((!Is64BitMode || DispForReloc) && IndexReg.getReg() == 0 && (BaseReg == 0 || getX86RegNum(BaseReg) != N86::ESP)) { if (BaseReg == 0) { // Just a displacement? // Emit special case [disp32] encoding @@ -395,9 +395,13 @@ if (BaseReg == 0) { // Handle the SIB byte for the case where there is no base. The // displacement has already been output. - assert(IndexReg.getReg() && "Index register must be specified!"); - emitSIBByte(SS, getX86RegNum(IndexReg.getReg()), 5); - } else { + unsigned IndexRegNo; + if (IndexReg.getReg()) + IndexRegNo = getX86RegNum(IndexReg.getReg()); + else + IndexRegNo = 4; // For example [ESP+1*+4] + emitSIBByte(SS, IndexRegNo, 5); + } else { unsigned BaseRegNo = getX86RegNum(BaseReg); unsigned IndexRegNo; if (IndexReg.getReg()) From evan.cheng at apple.com Fri Oct 31 14:15:52 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 19:15:52 -0000 Subject: [llvm-commits] [llvm] r58529 - /llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Message-ID: <200810311915.m9VJFqHS015362@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 31 14:15:52 2008 New Revision: 58529 URL: http://llvm.org/viewvc/llvm-project?rev=58529&view=rev Log: Actually make debug output understandable. Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=58529&r1=58528&r2=58529&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Oct 31 14:15:52 2008 @@ -275,8 +275,8 @@ ARMConstantPoolValue *ACPV = static_cast(MCPE.Val.MachineCPVal); - DOUT << "\t** ARM constant pool #" << CPI << ", ' @ " - << (void*)MCE.getCurrentPCValue() << *ACPV << '\n'; + DOUT << "\t** ARM constant pool #" << CPI << " @ " + << (void*)MCE.getCurrentPCValue() << " '" << *ACPV << "'\n"; GlobalValue *GV = ACPV->getGV(); if (GV) { @@ -290,8 +290,8 @@ } else { Constant *CV = MCPE.Val.ConstVal; - DOUT << "\t** Constant pool #" << CPI << ", ' @ " - << (void*)MCE.getCurrentPCValue() << *CV << '\n'; + DOUT << "\t** Constant pool #" << CPI << " @ " + << (void*)MCE.getCurrentPCValue() << " '" << *CV << "'\n"; if (GlobalValue *GV = dyn_cast(CV)) { emitGlobalAddress(GV, ARM::reloc_arm_absolute, false); From alenhar2 at cs.uiuc.edu Fri Oct 31 14:17:04 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 31 Oct 2008 19:17:04 -0000 Subject: [llvm-commits] [poolalloc] r58530 - /poolalloc/trunk/lib/DSA/CallTargets.cpp Message-ID: <200810311917.m9VJH49a015405@zion.cs.uiuc.edu> Author: alenhar2 Date: Fri Oct 31 14:17:03 2008 New Revision: 58530 URL: http://llvm.org/viewvc/llvm-project?rev=58530&view=rev Log: add cast peering to CTF Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=58530&r1=58529&r2=58530&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/CallTargets.cpp (original) +++ poolalloc/trunk/lib/DSA/CallTargets.cpp Fri Oct 31 14:17:03 2008 @@ -50,7 +50,15 @@ if (isa(B) || isa(B)) { CallSite cs = CallSite::get(B); AllSites.push_back(cs); - if (!cs.getCalledFunction()) { + Function* CF = cs.getCalledFunction(); + // If the called function is casted from one function type to another, peer + // into the cast instruction and pull out the actual function being called. + if (ConstantExpr *CE = dyn_cast(cs.getCalledValue())) + if (CE->getOpcode() == Instruction::BitCast && + isa(CE->getOperand(0))) + CF = cast(CE->getOperand(0)); + + if (!CF) { if (isa(cs.getCalledValue())) { ++DirCall; CompleteSites.insert(cs); From edwintorok at gmail.com Fri Oct 31 14:20:39 2008 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Fri, 31 Oct 2008 21:20:39 +0200 Subject: [llvm-commits] [PATCH] make SCEV work in presence of llvm.dbg.* Message-ID: <490B5A87.8030404@gmail.com> Hi, The attached patch makes BasicAA respond NoModRef for llvm.dbg.* intrinsics. This allows GVN to work in presence of llvm.dbg.*, so that SCEV will still be able to compute trip counts at -O1. Actually the debug intrinsics don't access anything, but making the intrinsic IntrNoMem, or IntrReadArgMem causes them to be completely remove at -O1. A NoModRef answer doesn't cause them to be removed. The attached patch contains 2 testcases: - make sure tripcounts are computable for a simple case even with debug info - make sure debug info is preserved after -O1 OK to commit? While we're at it, I think llvm.readcyclecounter should be handled the same (we don't want it to be reordered, but we don't want it to inhibit optimizations either) Should I add that to BasicAA too? Another approach would be to introduce a new attribute that specifies that the intrinsic doesn't access memory at all, but it is not allowed to be reordered, and can only be removed if the BB is dead. Best regards, --Edwin -------------- next part -------------- A non-text attachment was scrubbed... Name: dbgaa.patch Type: text/x-diff Size: 14483 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/f28e4193/attachment.bin From criswell at uiuc.edu Fri Oct 31 14:44:53 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 31 Oct 2008 19:44:53 -0000 Subject: [llvm-commits] [poolalloc] r58531 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200810311944.m9VJirUE016358@zion.cs.uiuc.edu> Author: criswell Date: Fri Oct 31 14:44:53 2008 New Revision: 58531 URL: http://llvm.org/viewvc/llvm-project?rev=58531&view=rev Log: Modified call site visitor method to ignore calls to NULL function pointers. Added a global variable to control use of assert() when using bugpoint. Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=58531&r1=58530&r2=58531&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri Oct 31 14:44:53 2008 @@ -29,6 +29,15 @@ using namespace llvm; using namespace PA; +// +// Flag: UsingBugpoint +// +// Description: +// There are certain assertions that interfere with bugpoint's ability to +// reduce test cases. When using bugpoint, set this variable to true. +// +static bool UsingBugpoint = false; + namespace { /// FuncTransform - This class implements transformation required of pool /// allocated functions. @@ -552,6 +561,12 @@ return; } + // Ignore calls to NULL pointers. + if (isa(CS.getCalledValue())) { + std::cerr << "WARNING: Ignoring call using NULL function pointer.\n"; + return; + } + // If this function is one of the memory manipulating functions built into // libc, emulate it with pool calls as appropriate. if (CF && CF->isDeclaration()) { @@ -625,6 +640,7 @@ if (!CF) { DSGraph* dg = Graphs.getDSGraph(*OrigInst->getParent()->getParent()); DSNode* d = dg->getNodeForValue(OrigInst->getOperand(0)).getNode(); + assert (d && "No DSNode!\n"); std::vector g; d->addFullFunctionList(g); if (g.size()) { @@ -640,7 +656,13 @@ } } - assert (CF && "No call graph info"); + // + // Do an assert unless we're bugpointing something. + // + if (UsingBugpoint) + if (!CF) return; + else + assert (CF && "No call graph info"); // Get the common graph for the set of functions this call may invoke. CalleeGraph = Graphs.getDSGraph(*CF); From gohman at apple.com Fri Oct 31 14:55:00 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 31 Oct 2008 12:55:00 -0700 Subject: [llvm-commits] [PATCH] make SCEV work in presence of llvm.dbg.* In-Reply-To: <490B5A87.8030404@gmail.com> References: <490B5A87.8030404@gmail.com> Message-ID: Hi T?r?k, @llvm.dbg.stoppoint actually does read and write memory, in a sense. It's a point where a user could stop in a debugger, and use the debugger to both read and write memory. If the optimizers are allowed to reorder or delete memory operations, these intrinsics will become inconsistent with the actual program. If it's desirable to do optimizations and there are debug intrinsics preventing that, it would be preferable to modify or eliminate the debug intrinsics to get them out of the way, rather than leave them in place and letting them become inconsistent with the actual program state. This way, a debugger could correctly tell the user "this is optimized code, I don't know what's going on", which is fine, rather than presenting bogus information, which is something we'd like to avoid. I know several other people are thinking about how to do this; it might be a good thing to bring up on llvmdev. For llvm.readcyclecounter, I think it's fine to inhibit optimizations. It's hard to understand what it means if it doesn't :-). Do you have an example where being able to do optimizations would be useful? Dan On Oct 31, 2008, at 12:20 PM, T?r?k Edwin wrote: > Hi, > > The attached patch makes BasicAA respond NoModRef for llvm.dbg.* > intrinsics. > This allows GVN to work in presence of llvm.dbg.*, so that SCEV will > still be able to compute trip counts at -O1. > > Actually the debug intrinsics don't access anything, but making the > intrinsic IntrNoMem, or IntrReadArgMem causes them to be > completely remove at -O1. > A NoModRef answer doesn't cause them to be removed. The attached patch > contains 2 testcases: > - make sure tripcounts are computable for a simple case even with > debug info > - make sure debug info is preserved after -O1 > > OK to commit? > > While we're at it, I think llvm.readcyclecounter should be handled > the same > (we don't want it to be reordered, but we don't want it to inhibit > optimizations either) > Should I add that to BasicAA too? > > Another approach would be to introduce a new attribute that specifies > that the intrinsic doesn't access memory at all, > but it is not allowed to be reordered, and can only be removed if > the BB > is dead. > > Best regards, > --Edwin > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Fri Oct 31 14:55:13 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 19:55:13 -0000 Subject: [llvm-commits] [llvm] r58532 - in /llvm/trunk/lib/Target/ARM: ARMCodeEmitter.cpp ARMJITInfo.h Message-ID: <200810311955.m9VJtDGj016744@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 31 14:55:13 2008 New Revision: 58532 URL: http://llvm.org/viewvc/llvm-project?rev=58532&view=rev Log: Use better data structure for ConstPoolId2AddrMap. Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMJITInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=58532&r1=58531&r2=58532&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Oct 31 14:55:13 2008 @@ -43,16 +43,17 @@ const TargetData *TD; TargetMachine &TM; MachineCodeEmitter &MCE; - const MachineConstantPool *MCP; + const std::vector *MCPEs; + public: static char ID; explicit ARMCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce) : MachineFunctionPass(&ID), JTI(0), II(0), TD(0), TM(tm), - MCE(mce), MCP(0) {} + MCE(mce), MCPEs(0) {} ARMCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce, const ARMInstrInfo &ii, const TargetData &td) : MachineFunctionPass(&ID), JTI(0), II(&ii), TD(&td), TM(tm), - MCE(mce), MCP(0) {} + MCE(mce), MCPEs(0) {} bool runOnMachineFunction(MachineFunction &MF); @@ -153,7 +154,8 @@ II = ((ARMTargetMachine&)MF.getTarget()).getInstrInfo(); TD = ((ARMTargetMachine&)MF.getTarget()).getTargetData(); JTI = ((ARMTargetMachine&)MF.getTarget()).getJITInfo(); - MCP = MF.getConstantPool(); + MCPEs = &MF.getConstantPool()->getConstants(); + JTI->ResizeConstPoolMap(MCPEs->size()); do { DOUT << "JITTing function '" << MF.getFunction()->getName() << "'\n"; @@ -264,7 +266,7 @@ void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) { unsigned CPI = MI.getOperand(0).getImm(); unsigned CPIndex = MI.getOperand(1).getIndex(); - const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPIndex]; + const MachineConstantPoolEntry &MCPE = (*MCPEs)[CPIndex]; // Remember the CONSTPOOL_ENTRY address for later relocation. JTI->addConstantPoolEntryAddr(CPI, MCE.getCurrentPCValue()); Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.h?rev=58532&r1=58531&r2=58532&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.h Fri Oct 31 14:55:13 2008 @@ -15,7 +15,7 @@ #define ARMJITINFO_H #include "llvm/Target/TargetJITInfo.h" -#include +#include "llvm/ADT/SmallVector.h" namespace llvm { class ARMTargetMachine; @@ -25,7 +25,7 @@ // ConstPoolId2AddrMap - A map from constant pool ids to the corresponding // CONSTPOOL_ENTRY addresses. - std::map ConstPoolId2AddrMap; + SmallVector ConstPoolId2AddrMap; public: explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) { useGOT = false; } @@ -56,21 +56,24 @@ /// pool address resolution is handled by the target. virtual bool hasCustomConstantPool() const { return true; } + void ResizeConstPoolMap(unsigned Size) { + ConstPoolId2AddrMap.resize(Size); + } + /// getConstantPoolEntryAddr - The ARM target puts all constant /// pool entries into constant islands. Resolve the constant pool index /// into the address where the constant is stored. - virtual intptr_t getConstantPoolEntryAddr(unsigned CPID) const { - std::map::const_iterator I - = ConstPoolId2AddrMap.find(CPID); - assert(I != ConstPoolId2AddrMap.end() && "Missing constpool_entry?"); - return I->second; + intptr_t getConstantPoolEntryAddr(unsigned CPI) const { + assert(CPI < ConstPoolId2AddrMap.size()); + return ConstPoolId2AddrMap[CPI]; } - /// addConstantPoolEntryAddr - Map a Constant Pool Index (CPID) to the address + /// addConstantPoolEntryAddr - Map a Constant Pool Index (CPI) to the address /// where its associated value is stored. When relocations are processed, /// this value will be used to resolve references to the constant. - void addConstantPoolEntryAddr(unsigned CPID, intptr_t Addr) { - ConstPoolId2AddrMap[CPID] = Addr; + void addConstantPoolEntryAddr(unsigned CPI, intptr_t Addr) { + assert(CPI < ConstPoolId2AddrMap.size()); + ConstPoolId2AddrMap[CPI] = Addr; } }; } From evan.cheng at apple.com Fri Oct 31 14:56:03 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 31 Oct 2008 19:56:03 -0000 Subject: [llvm-commits] [llvm] r58533 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.h Message-ID: <200810311956.m9VJu34p016780@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 31 14:56:03 2008 New Revision: 58533 URL: http://llvm.org/viewvc/llvm-project?rev=58533&view=rev Log: Add comment. Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.h?rev=58533&r1=58532&r2=58533&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.h Fri Oct 31 14:56:03 2008 @@ -56,6 +56,8 @@ /// pool address resolution is handled by the target. virtual bool hasCustomConstantPool() const { return true; } + /// ResizeConstPoolMap - Resize constant pool ids to CONSTPOOL_ENTRY + /// addresses map. void ResizeConstPoolMap(unsigned Size) { ConstPoolId2AddrMap.resize(Size); } From criswell at uiuc.edu Fri Oct 31 15:03:17 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 31 Oct 2008 20:03:17 -0000 Subject: [llvm-commits] [poolalloc] r58534 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200810312003.m9VK3HKN017012@zion.cs.uiuc.edu> Author: criswell Date: Fri Oct 31 15:03:17 2008 New Revision: 58534 URL: http://llvm.org/viewvc/llvm-project?rev=58534&view=rev Log: Fix assertion. Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=58534&r1=58533&r2=58534&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri Oct 31 15:03:17 2008 @@ -659,10 +659,8 @@ // // Do an assert unless we're bugpointing something. // - if (UsingBugpoint) - if (!CF) return; - else - assert (CF && "No call graph info"); + if ((UsingBugpoint) && (!CF)) return; + assert (CF && "No call graph info"); // Get the common graph for the set of functions this call may invoke. CalleeGraph = Graphs.getDSGraph(*CF); From criswell at uiuc.edu Fri Oct 31 15:05:53 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 31 Oct 2008 20:05:53 -0000 Subject: [llvm-commits] [poolalloc] r58535 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200810312005.m9VK5rSJ017102@zion.cs.uiuc.edu> Author: criswell Date: Fri Oct 31 15:05:53 2008 New Revision: 58535 URL: http://llvm.org/viewvc/llvm-project?rev=58535&view=rev Log: Remove #include guardes that are no longer needed. Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=58535&r1=58534&r2=58535&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri Oct 31 15:05:53 2008 @@ -581,9 +581,7 @@ visitMemAlignCall(CS); return; } else if (CF->getName() == "strdup") { -#if 1 visitStrdupCall(CS); -#endif return; } else if (CF->getName() == "valloc") { std::cerr << "VALLOC USED BUT NOT HANDLED!\n"; From asl at math.spbu.ru Fri Oct 31 15:08:30 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 31 Oct 2008 20:08:30 -0000 Subject: [llvm-commits] [llvm] r58536 - /llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Message-ID: <200810312008.m9VK8UAR017225@zion.cs.uiuc.edu> Author: asl Date: Fri Oct 31 15:08:30 2008 New Revision: 58536 URL: http://llvm.org/viewvc/llvm-project?rev=58536&view=rev Log: Invalidate debug/eh/gc labels when unreachable MBB is deleted. Based on patch by Martin Nowack! Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp?rev=58536&r1=58535&r2=58536&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp (original) +++ llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Fri Oct 31 15:08:30 2008 @@ -27,6 +27,7 @@ #include "llvm/Pass.h" #include "llvm/Type.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" @@ -84,10 +85,10 @@ namespace { - class VISIBILITY_HIDDEN UnreachableMachineBlockElim : + class VISIBILITY_HIDDEN UnreachableMachineBlockElim : public MachineFunctionPass { virtual bool runOnMachineFunction(MachineFunction &F); - + MachineModuleInfo *MMI; public: static char ID; // Pass identification, replacement for typeid UnreachableMachineBlockElim() : MachineFunctionPass(&ID) {} @@ -104,6 +105,8 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) { SmallPtrSet Reachable; + MMI = getAnalysisToUpdate(); + // Mark all reachable blocks. for (df_ext_iterator > I = df_ext_begin(&F, Reachable), E = df_ext_end(&F, Reachable); @@ -115,14 +118,14 @@ std::vector DeadBlocks; for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) { MachineBasicBlock *BB = I; - + // Test for deadness. if (!Reachable.count(BB)) { DeadBlocks.push_back(BB); - + while (BB->succ_begin() != BB->succ_end()) { MachineBasicBlock* succ = *BB->succ_begin(); - + MachineBasicBlock::iterator start = succ->begin(); while (start != succ->end() && start->getOpcode() == TargetInstrInfo::PHI) { @@ -132,24 +135,36 @@ start->RemoveOperand(i); start->RemoveOperand(i-1); } - + start++; } - + BB->removeSuccessor(BB->succ_begin()); } } } // Actually remove the blocks now. - for (unsigned i = 0, e = DeadBlocks.size(); i != e; ++i) - DeadBlocks[i]->eraseFromParent(); + for (unsigned i = 0, e = DeadBlocks.size(); i != e; ++i) { + MachineBasicBlock *MBB = DeadBlocks[i]; + // If there are any labels in the basic block, unregister them from + // MachineModuleInfo. + if (MMI && !MBB->empty()) { + for (MachineBasicBlock::iterator I = MBB->begin(), + E = MBB->end(); I != E; ++I) { + if (I->isLabel()) + // The label ID # is always operand #0, an immediate. + MMI->InvalidateLabel(I->getOperand(0).getImm()); + } + } + MBB->eraseFromParent(); + } // Cleanup PHI nodes. for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) { MachineBasicBlock *BB = I; // Prune unneeded PHI entries. - SmallPtrSet preds(BB->pred_begin(), + SmallPtrSet preds(BB->pred_begin(), BB->pred_end()); MachineBasicBlock::iterator phi = BB->begin(); while (phi != BB->end() && @@ -159,7 +174,7 @@ phi->RemoveOperand(i); phi->RemoveOperand(i-1); } - + if (phi->getNumOperands() == 3) { unsigned Input = phi->getOperand(1).getReg(); unsigned Output = phi->getOperand(0).getReg(); @@ -173,7 +188,7 @@ continue; } - + ++phi; } } @@ -182,4 +197,3 @@ return DeadBlocks.size(); } - From asl at math.spbu.ru Fri Oct 31 15:10:49 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 31 Oct 2008 20:10:49 -0000 Subject: [llvm-commits] [llvm] r58537 - /llvm/trunk/test/DebugInfo/deaddebuglabel.ll Message-ID: <200810312010.m9VKAn0t017318@zion.cs.uiuc.edu> Author: asl Date: Fri Oct 31 15:10:49 2008 New Revision: 58537 URL: http://llvm.org/viewvc/llvm-project?rev=58537&view=rev Log: Testcase for PR2613 Added: llvm/trunk/test/DebugInfo/deaddebuglabel.ll Added: llvm/trunk/test/DebugInfo/deaddebuglabel.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/deaddebuglabel.ll?rev=58537&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/deaddebuglabel.ll (added) +++ llvm/trunk/test/DebugInfo/deaddebuglabel.ll Fri Oct 31 15:10:49 2008 @@ -0,0 +1,61 @@ +; PR2614 +; RUN: llvm-as < %s | llc | grep "label" | count 8 + +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-f80:32:32-v64:64:64-v128:128:128-a0:0:64" +target triple = "i686-pc-linux-gnu" + %llvm.dbg.anchor.type = type { i32, i32 } + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } + %llvm.dbg.compositetype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* } + %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* } + %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* } + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } + %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } + at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=0] + at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at .str = internal constant [17 x i8] c"deaddebuglabel.d\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1] + at .str1 = internal constant [50 x i8] c"/home/kamm/eigenes/projekte/llvmdc/llvmdc/mytests\00", section "llvm.metadata" ; <[50 x i8]*> [#uses=1] + at .str2 = internal constant [48 x i8] c"LLVMDC (http://www.dsource.org/projects/llvmdc)\00", section "llvm.metadata" ; <[48 x i8]*> [#uses=1] + at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { + i32 393233, + { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), + i32 2, + i8* getelementptr ([17 x i8]* @.str, i32 0, i32 0), + i8* getelementptr ([50 x i8]* @.str1, i32 0, i32 0), + i8* getelementptr ([48 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] + at .str5 = internal constant [20 x i8] c"deaddebuglabel.main\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1] + at .str6 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] + at llvm.dbg.subprogram7 = internal constant %llvm.dbg.subprogram.type { + i32 393262, + { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), + { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), + i8* getelementptr ([20 x i8]* @.str5, i32 0, i32 0), + i8* getelementptr ([20 x i8]* @.str5, i32 0, i32 0), + i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), + { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), + i32 3, + { }* null, + i1 false, + i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] + +declare void @llvm.dbg.func.start({ }*) nounwind + +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind + +declare void @llvm.dbg.region.end({ }*) nounwind + +define fastcc i32 @main() { +entry.main: + call void @llvm.dbg.func.start( { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*) ) + br i1 true, label %reachable, label %unreachable + +reachable: ; preds = %entry.main + call void @llvm.dbg.region.end( { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*) ) + ret i32 1 + +unreachable: ; preds = %entry.main + call void @llvm.dbg.stoppoint( i32 7, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) ) + call void @llvm.dbg.region.end( { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*) ) + ret i32 0 +} From clattner at apple.com Fri Oct 31 15:19:00 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 31 Oct 2008 13:19:00 -0700 Subject: [llvm-commits] [llvm] r58505 - /llvm/trunk/lib/VMCore/Type.cpp In-Reply-To: <200810311026.m9VAQKSc028696@zion.cs.uiuc.edu> References: <200810311026.m9VAQKSc028696@zion.cs.uiuc.edu> Message-ID: On Oct 31, 2008, at 3:26 AM, Sanjiv Gupta wrote: > Author: sgupta > Date: Fri Oct 31 05:26:20 2008 > New Revision: 58505 > > URL: http://llvm.org/viewvc/llvm-project?rev=58505&view=rev > Log: > For some targets pointer and int are 16-bits. Allow 16-bits as a > valid index > in such cases. Sanjiv, Are you planning to make changes to the bc reader/writer, docs, and other parts of the compiler to support this change? I'd strongly prefer to you produce a more holistic patch that makes this change instead of a couple individual places. I think this is the right way to go, but I don't want to get stuck with half of the change in the tree but it not working 100%. -Chris From pgurd at rapidmind.com Fri Oct 31 11:42:09 2008 From: pgurd at rapidmind.com (Preston Gurd) Date: Fri, 31 Oct 2008 12:42:09 -0400 Subject: [llvm-commits] patch: flush raw_ostream after AsmPrinting function Message-ID: <1225471329.28395.19.camel@Remington> When printing the generated assembly code for a function to a raw_ostream using the -print-emitted-asm option, flush the raw_ostream output to avoid the possibility of having the last partial buffer be separated from the rest of the generated code output by other output to the same device, but using a different output stream. Since I do not have permission to commit to the llvm trunk, could one of you please review and commit this (very small!) patch? Thanks! -------------- next part -------------- A non-text attachment was scrubbed... Name: flush.diff Type: text/x-patch Size: 1488 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/2094b894/attachment.bin From duncan.sands at math.u-psud.fr Fri Oct 31 15:45:49 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Fri, 31 Oct 2008 21:45:49 +0100 Subject: [llvm-commits] [llvm] r58426 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <72EC1520-8940-4078-A5A4-EB56EE12FF46@apple.com> References: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> <200810301038.25151.duncan.sands@math.u-psud.fr> <72EC1520-8940-4078-A5A4-EB56EE12FF46@apple.com> Message-ID: <200810312145.49488.duncan.sands@math.u-psud.fr> Hi Mon Ping, > So if we had vector of 3 elements and there is no valid 4 element > vector type, we should just split and not try the next power of 2 and > then split down to 4 operations. The rational that I see for going to > the power of 2 is that is more likely that the split logic (where we > split in 1/2) has a higher chance of finding the correct legal type. > The down side is that if we go to a power of 2, we might end up doing > work that doesn't benefit us. Given the example above of v10i32, if > we promote to v16i32, we will break it down to 4 v4i32 where one of > the v4i32 is not useful. the pointless v4i32 should be eliminated by the DAG combiner. It is similar to what happens for apints. Consider i129 on a 32 bit machine. This i129 is promoted to i256, which is then expanded successively, resulting in eight i32. Only the first five are needed to cover the 129 original bits. So doesn't the final code get littered with pointless operations on the last three i32? In fact it does not, they are eliminated by the combiner if they aren't being used for anything useful, typically because they have no users, or because they contain undef. I never actually saw pointless code due to this in the final assembler, not once. I expect it will be the same for vectors, and if it is not probably that means the combiner needs to be made a little smarter. So I think that widening v10i32 to v16i32 and then splitting would work well. In fact I think we should just give up on the idea of splitting non-power-of-two vectors, and always widen them instead. The reason is that there are several operations which are really hard to split for non-power-of-two vectors. LegalizeTypes handles more cases than LegalizeDAG but there are some where I just gave up and added an assertion. This is again similar to the situation with integers: why promote to a power of two size when you could do uneven expansion (expand into two unequal parts)? The answer is that expansion is harder than promotion, and some operations would be just too hard for uneven expansion. The promote-to-power- of-two then expand (maybe many times) logic sidesteps all that and works great. I expect it to work pretty well for vectors too. After all, integers are just a special case of vectors: vectors of i1, right :) Ciao, Duncan. From tonic at nondot.org Fri Oct 31 15:48:33 2008 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 31 Oct 2008 15:48:33 -0500 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200810312048.m9VKmXeI018773@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.164 -> 1.165 --- Log message: Update release schedule. --- Diffs of the changes: (+3 -3) www-index.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.164 llvm-www/www-index.html:1.165 --- llvm-www/www-index.html:1.164 Mon Oct 27 15:39:48 2008 +++ llvm-www/www-index.html Fri Oct 31 15:47:32 2008 @@ -110,9 +110,9 @@
  • Oct 6, 2008: Branch creation/Code Freeze (9PM PDT).
  • Oct 9, 2008: First round of pre-release testing begins.
  • Oct 19, 2008: Pre-release testing ends.
  • -
  • Oct 29, 2008: Second round of pre-release testing begins.
  • -
  • Nov 3, 2008: Pre-release testing ends.
  • -
  • Nov 5, 2008: 2.4 Released.
  • +
  • Oct 31, 2008: Second round of pre-release testing begins.
  • +
  • Nov 5, 2008: Pre-release testing ends.
  • +
  • Nov 6, 2008: 2.4 Released.
  • From gohman at apple.com Fri Oct 31 15:52:20 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 31 Oct 2008 13:52:20 -0700 Subject: [llvm-commits] patch: flush raw_ostream after AsmPrinting function In-Reply-To: <1225471329.28395.19.camel@Remington> References: <1225471329.28395.19.camel@Remington> Message-ID: The real bug here, in my opinion, is that the new raw_ostream version of stderr is buffered. Dan On Oct 31, 2008, at 9:42 AM, Preston Gurd wrote: > When printing the generated assembly code for a function to a > raw_ostream using the -print-emitted-asm option, flush the raw_ostream > output to avoid the possibility of having the last partial buffer be > separated from the rest of the generated code output by other output > to > the same device, but using a different output stream. > > Since I do not have permission to commit to the llvm trunk, could > one of > you please review and commit this (very small!) patch? Thanks! > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Fri Oct 31 16:26:10 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 31 Oct 2008 21:26:10 -0000 Subject: [llvm-commits] [llvm] r58539 - /llvm/trunk/lib/Target/TargetSelectionDAG.td Message-ID: <200810312126.m9VLQAc1020154@zion.cs.uiuc.edu> Author: void Date: Fri Oct 31 16:26:08 2008 New Revision: 58539 URL: http://llvm.org/viewvc/llvm-project?rev=58539&view=rev Log: Whitespace fixes. No functionality change. Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetSelectionDAG.td?rev=58539&r1=58538&r2=58539&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetSelectionDAG.td (original) +++ llvm/trunk/lib/Target/TargetSelectionDAG.td Fri Oct 31 16:26:08 2008 @@ -85,14 +85,14 @@ } // Builtin profiles. -def SDTIntLeaf: SDTypeProfile<1, 0, [SDTCisInt<0>]>; // for 'imm'. -def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>; // for 'fpimm'. -def SDTPtrLeaf: SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>; // for '&g'. +def SDTIntLeaf: SDTypeProfile<1, 0, [SDTCisInt<0>]>; // for 'imm'. +def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>; // for 'fpimm'. +def SDTPtrLeaf: SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>; // for '&g'. def SDTOther : SDTypeProfile<1, 0, [SDTCisVT<0, OtherVT>]>; // for 'vt'. -def SDTUNDEF : SDTypeProfile<1, 0, []>; // for 'undef'. -def SDTUnaryOp : SDTypeProfile<1, 1, []>; // bitconvert +def SDTUNDEF : SDTypeProfile<1, 0, []>; // for 'undef'. +def SDTUnaryOp : SDTypeProfile<1, 1, []>; // for bitconvert. -def SDTIntBinOp : SDTypeProfile<1, 2, [ // add, and, or, xor, udiv, etc. +def SDTIntBinOp : SDTypeProfile<1, 2, [ // add, and, or, xor, udiv, etc. SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0> ]>; def SDTIntShiftOp : SDTypeProfile<1, 2, [ // shl, sra, srl @@ -101,10 +101,10 @@ def SDTFPBinOp : SDTypeProfile<1, 2, [ // fadd, fmul, etc. SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisFP<0> ]>; -def SDTFPSignOp : SDTypeProfile<1, 2, [ // fcopysign. +def SDTFPSignOp : SDTypeProfile<1, 2, [ // fcopysign. SDTCisSameAs<0, 1>, SDTCisFP<0>, SDTCisFP<2> ]>; -def SDTFPTernaryOp : SDTypeProfile<1, 3, [ // fmadd, fnmsub, etc. +def SDTFPTernaryOp : SDTypeProfile<1, 3, [ // fmadd, fnmsub, etc. SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisFP<0> ]>; def SDTIntUnaryOp : SDTypeProfile<1, 1, [ // ctlz @@ -122,74 +122,74 @@ def SDTFPRoundOp : SDTypeProfile<1, 1, [ // fround SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<0, 1> ]>; -def SDTFPExtendOp : SDTypeProfile<1, 1, [ // fextend +def SDTFPExtendOp : SDTypeProfile<1, 1, [ // fextend SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<1, 0> ]>; -def SDTIntToFPOp : SDTypeProfile<1, 1, [ // [su]int_to_fp +def SDTIntToFPOp : SDTypeProfile<1, 1, [ // [su]int_to_fp SDTCisFP<0>, SDTCisInt<1> ]>; -def SDTFPToIntOp : SDTypeProfile<1, 1, [ // fp_to_[su]int +def SDTFPToIntOp : SDTypeProfile<1, 1, [ // fp_to_[su]int SDTCisInt<0>, SDTCisFP<1> ]>; -def SDTExtInreg : SDTypeProfile<1, 2, [ // sext_inreg +def SDTExtInreg : SDTypeProfile<1, 2, [ // sext_inreg SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisVT<2, OtherVT>, SDTCisVTSmallerThanOp<2, 1> ]>; -def SDTSetCC : SDTypeProfile<1, 3, [ // setcc +def SDTSetCC : SDTypeProfile<1, 3, [ // setcc SDTCisInt<0>, SDTCisSameAs<1, 2>, SDTCisVT<3, OtherVT> ]>; -def SDTSelect : SDTypeProfile<1, 3, [ // select +def SDTSelect : SDTypeProfile<1, 3, [ // select SDTCisInt<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3> ]>; -def SDTSelectCC : SDTypeProfile<1, 5, [ // select_cc +def SDTSelectCC : SDTypeProfile<1, 5, [ // select_cc SDTCisSameAs<1, 2>, SDTCisSameAs<3, 4>, SDTCisSameAs<0, 3>, SDTCisVT<5, OtherVT> ]>; -def SDTBr : SDTypeProfile<0, 1, [ // br +def SDTBr : SDTypeProfile<0, 1, [ // br SDTCisVT<0, OtherVT> ]>; -def SDTBrcond : SDTypeProfile<0, 2, [ // brcond +def SDTBrcond : SDTypeProfile<0, 2, [ // brcond SDTCisInt<0>, SDTCisVT<1, OtherVT> ]>; -def SDTBrind : SDTypeProfile<0, 1, [ // brind +def SDTBrind : SDTypeProfile<0, 1, [ // brind SDTCisPtrTy<0> ]>; -def SDTNone : SDTypeProfile<0, 0, []>; // ret, trap +def SDTNone : SDTypeProfile<0, 0, []>; // ret, trap -def SDTLoad : SDTypeProfile<1, 1, [ // load +def SDTLoad : SDTypeProfile<1, 1, [ // load SDTCisPtrTy<1> ]>; -def SDTStore : SDTypeProfile<0, 2, [ // store +def SDTStore : SDTypeProfile<0, 2, [ // store SDTCisPtrTy<1> ]>; -def SDTIStore : SDTypeProfile<1, 3, [ // indexed store +def SDTIStore : SDTypeProfile<1, 3, [ // indexed store SDTCisSameAs<0, 2>, SDTCisPtrTy<0>, SDTCisPtrTy<3> ]>; def SDTVecShuffle : SDTypeProfile<1, 3, [ SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisIntVectorOfSameSize<3, 0> ]>; -def SDTVecExtract : SDTypeProfile<1, 2, [ // vector extract +def SDTVecExtract : SDTypeProfile<1, 2, [ // vector extract SDTCisEltOfVec<0, 1>, SDTCisPtrTy<2> ]>; -def SDTVecInsert : SDTypeProfile<1, 3, [ // vector insert +def SDTVecInsert : SDTypeProfile<1, 3, [ // vector insert SDTCisEltOfVec<2, 1>, SDTCisSameAs<0, 1>, SDTCisPtrTy<3> ]>; -def STDPrefetch : SDTypeProfile<0, 3, [ // prefetch +def STDPrefetch : SDTypeProfile<0, 3, [ // prefetch SDTCisPtrTy<0>, SDTCisSameAs<1, 2>, SDTCisInt<1> ]>; -def STDMemBarrier : SDTypeProfile<0, 5, [ // memory barier +def STDMemBarrier : SDTypeProfile<0, 5, [ // memory barier SDTCisSameAs<0,1>, SDTCisSameAs<0,2>, SDTCisSameAs<0,3>, SDTCisSameAs<0,4>, SDTCisInt<0> ]>; @@ -240,7 +240,7 @@ def srcvalue; def imm : SDNode<"ISD::Constant" , SDTIntLeaf , [], "ConstantSDNode">; -def timm : SDNode<"ISD::TargetConstant", SDTIntLeaf , [], "ConstantSDNode">; +def timm : SDNode<"ISD::TargetConstant",SDTIntLeaf, [], "ConstantSDNode">; def fpimm : SDNode<"ISD::ConstantFP", SDTFPLeaf , [], "ConstantFPSDNode">; def vt : SDNode<"ISD::VALUETYPE" , SDTOther , [], "VTSDNode">; def bb : SDNode<"ISD::BasicBlock", SDTOther , [], "BasicBlockSDNode">; From isanbard at gmail.com Fri Oct 31 17:13:05 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 31 Oct 2008 22:13:05 -0000 Subject: [llvm-commits] [llvm] r58540 - /llvm/tags/Apple/llvmCore-2078/ Message-ID: <200810312213.m9VMD5I0021905@zion.cs.uiuc.edu> Author: void Date: Fri Oct 31 17:13:05 2008 New Revision: 58540 URL: http://llvm.org/viewvc/llvm-project?rev=58540&view=rev Log: Creating llvmCore-2078 branch Added: llvm/tags/Apple/llvmCore-2078/ - copied from r58539, llvm/trunk/ From isanbard at gmail.com Fri Oct 31 17:13:13 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 31 Oct 2008 22:13:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58541 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2078/ Message-ID: <200810312213.m9VMDDof021920@zion.cs.uiuc.edu> Author: void Date: Fri Oct 31 17:13:12 2008 New Revision: 58541 URL: http://llvm.org/viewvc/llvm-project?rev=58541&view=rev Log: Creating llvmgcc42-2078 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2078/ - copied from r58540, llvm-gcc-4.2/trunk/ From clattner at apple.com Fri Oct 31 18:33:07 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 31 Oct 2008 16:33:07 -0700 Subject: [llvm-commits] patch: flush raw_ostream after AsmPrinting function In-Reply-To: References: <1225471329.28395.19.camel@Remington> Message-ID: On Oct 31, 2008, at 1:52 PM, Dan Gohman wrote: > The real bug here, in my opinion, is that the new raw_ostream > version of stderr is buffered. Patches, as they say, are welcome :). If you can figure out a way to not affect the perf of the buffered case, I would really really like this. -Chris From gohman at apple.com Fri Oct 31 20:18:06 2008 From: gohman at apple.com (Dan Gohman) Date: Sat, 01 Nov 2008 01:18:06 -0000 Subject: [llvm-commits] [test-suite] r58543 - in /test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha: sha.c sha.h Message-ID: <200811010118.mA11I6gj027789@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 31 20:18:06 2008 New Revision: 58543 URL: http://llvm.org/viewvc/llvm-project?rev=58543&view=rev Log: Fix a printf format specifier mismatch. This caused spurious failures on LP64 targets. Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.c test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.h Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.c?rev=58543&r1=58542&r2=58543&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.c Fri Oct 31 20:18:06 2008 @@ -204,7 +204,8 @@ void sha_print(SHA_INFO *sha_info) { - printf("%08lx %08lx %08lx %08lx %08lx\n", + printf("%08" PRIx32 " %08" PRIx32 " %08" PRIx32 + " %08" PRIx32 " %08" PRIx32 "\n", sha_info->digest[0], sha_info->digest[1], sha_info->digest[2], sha_info->digest[3], sha_info->digest[4]); } Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.h?rev=58543&r1=58542&r2=58543&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/sha.h Fri Oct 31 20:18:06 2008 @@ -6,8 +6,10 @@ /* Useful defines & typedefs */ +#include + typedef unsigned char BYTE; -typedef unsigned int LONG; +typedef uint32_t LONG; #define SHA_BLOCKSIZE 64 #define SHA_DIGESTSIZE 20 From wangmp at apple.com Fri Oct 31 21:56:18 2008 From: wangmp at apple.com (Mon Ping Wang) Date: Fri, 31 Oct 2008 19:56:18 -0700 Subject: [llvm-commits] Patch: generalize vector shuffle In-Reply-To: <7C812DE7-E002-4767-A0AE-192738C25237@apple.com> References: <7C812DE7-E002-4767-A0AE-192738C25237@apple.com> Message-ID: <00BEE636-9DBF-40CE-A322-1A50F2D6BEE3@apple.com> Here is an update of the patch with some syntax changes, another test, an update of the LangRef, and some junk that I didn't mean to checkin. -- Mon Ping On Oct 31, 2008, at 2:38 AM, Mon Ping Wang wrote: Hi, This is a patch that implements changing the shuffle vector definition to = shufflevector > , > , ; yields > As discussed in llvmdev, the reason for this change is to help maintain the incoming vector structure of the user code instead of converting to insert and extract. During the SelectionDAG, we normalize the shuffle vector such that the vectors and mask are the same size and then we legalize the shuffle vectors. The normalization process tries to retain the structure of the vector shuffle by trying to convert it to a series of concat vectors, extract subvector, and vector shuffles. If it can't, it falls back to using insert/extracts. This implementation normalizes during DAG construction while in a earlier implementation normalized during the Legalize phase. The pros of doing this way is that after DAG construction, none of the DAG passes would have to worry about non- normalized shuffles, we might be able to optimize the normalized shuffles, and in LegalizeTypes, we wouldn't have to do a pass to normalize the vector shuffles. (We could probably do normalization when we iterate the DAG to build the worklist in LegalizeTypes). The downside is no DAG optimization can generate a non-normalized shufflevector and there may be cases where after normalization, we may obscure the what the original structure is. Here is the patch. I've a few more test cases that I didn't include in the patch. Thanks, -- Mon Ping -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/e159b58a/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: genshuffle3.patch Type: application/octet-stream Size: 62983 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/e159b58a/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081031/e159b58a/attachment-0001.html From sanjiv.gupta at microchip.com Sat Nov 1 05:50:55 2008 From: sanjiv.gupta at microchip.com (sanjiv gupta) Date: Sat, 01 Nov 2008 16:20:55 +0530 Subject: [llvm-commits] [llvm] r58505 - /llvm/trunk/lib/VMCore/Type.cpp In-Reply-To: References: <200810311026.m9VAQKSc028696@zion.cs.uiuc.edu> Message-ID: <1225536655.7995.2.camel@idc-lt-i00171.microchip.com> On Fri, 2008-10-31 at 13:19 -0700, Chris Lattner wrote: > On Oct 31, 2008, at 3:26 AM, Sanjiv Gupta wrote: > > > Author: sgupta > > Date: Fri Oct 31 05:26:20 2008 > > New Revision: 58505 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=58505&view=rev > > Log: > > For some targets pointer and int are 16-bits. Allow 16-bits as a > > valid index > > in such cases. > > Sanjiv, > > Are you planning to make changes to the bc reader/writer, docs, and > other parts of the compiler to support this change? I'd strongly > prefer to you produce a more holistic patch that makes this change > instead of a couple individual places. > > I think this is the right way to go, but I don't want to get stuck > with half of the change in the tree but it not working 100%. > > -Chris > Agree. I will revert this back and make changes when everything is ready. - Sanjiv > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sanjiv.gupta at microchip.com Sat Nov 1 05:57:14 2008 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Sat, 01 Nov 2008 10:57:14 -0000 Subject: [llvm-commits] [llvm] r58547 - /llvm/trunk/lib/VMCore/Type.cpp Message-ID: <200811011057.mA1AvEPF024125@zion.cs.uiuc.edu> Author: sgupta Date: Sat Nov 1 05:57:12 2008 New Revision: 58547 URL: http://llvm.org/viewvc/llvm-project?rev=58547&view=rev Log: Reverting back 58505. Will commit it once I have the bc reader/writer/docs ready. Modified: llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=58547&r1=58546&r2=58547&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Sat Nov 1 05:57:12 2008 @@ -1516,8 +1516,7 @@ bool SequentialType::indexValid(const Value *V) const { if (const IntegerType *IT = dyn_cast(V->getType())) - return IT->getBitWidth() == 16 || - IT->getBitWidth() == 32 || IT->getBitWidth() == 64; + return IT->getBitWidth() == 32 || IT->getBitWidth() == 64; return false; } From nicolas.geoffray at lip6.fr Sat Nov 1 11:35:40 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 01 Nov 2008 17:35:40 +0100 Subject: [llvm-commits] [llvm] r58407 - /llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp In-Reply-To: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> References: <200810292354.m9TNsknj007366@zion.cs.uiuc.edu> Message-ID: <490C855C.3020601@lip6.fr> Hi Evan, Evan Cheng wrote: > Author: evancheng > Date: Wed Oct 29 18:54:46 2008 > New Revision: 58407 > > URL: http://llvm.org/viewvc/llvm-project?rev=58407&view=rev > Log: > Let target resolve some relocation results. > > Modified: > llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp > > Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58407&r1=58406&r2=58407&view=diff > > ============================================================================== > --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) > +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Wed Oct 29 18:54:46 2008 > @@ -876,30 +876,32 @@ > for (unsigned i = 0, e = Relocations.size(); i != e; ++i) { > MachineRelocation &MR = Relocations[i]; > void *ResultPtr; > JITEmitter.cpp:878: warning: ?ResultPtr? may be used uninitialized in this function :) From wangmp at apple.com Sat Nov 1 15:24:55 2008 From: wangmp at apple.com (Mon P Wang) Date: Sat, 01 Nov 2008 20:24:55 -0000 Subject: [llvm-commits] [llvm] r58548 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200811012024.mA1KOtg9008712@zion.cs.uiuc.edu> Author: wangmp Date: Sat Nov 1 15:24:53 2008 New Revision: 58548 URL: http://llvm.org/viewvc/llvm-project?rev=58548&view=rev Log: Added interface to allow clients to create a MemIntrinsicNode for target intrinsics that touches memory Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=58548&r1=58547&r2=58548&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Sat Nov 1 15:24:53 2008 @@ -24,6 +24,7 @@ #include "llvm/Constants.h" #include "llvm/InlineAsm.h" +#include "llvm/Instructions.h" #include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/RuntimeLibcalls.h" #include "llvm/ADT/APFloat.h" @@ -263,7 +264,27 @@ MVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const; - + + /// getTgtMemIntrinsic: Given an intrinsic, checks if on the target the + /// intrinsic will need to map to a MemIntrinsicNode (touches memory). If + /// this is the case, it returns true and store the intrinsic + /// information into the IntrinsicInfo that was passed to the function. + typedef struct IntrinsicInfo { + unsigned opc; // target opcode + MVT memVT; // memory VT + const Value* ptrVal; // value representing memory location + int offset; // offset off of ptrVal + unsigned align; // alignment + bool vol; // is volatile? + bool readMem; // reads memory? + bool writeMem; // writes memory? + } IntrinisicInfo; + + virtual bool getTgtMemIntrinsic(IntrinsicInfo& Info, + CallInst &I, unsigned Intrinsic) { + return false; + } + /// getWidenVectorType: given a vector type, returns the type to widen to /// (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself. /// If there is no vector type that we want to widen to, returns MVT::Other Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=58548&r1=58547&r2=58548&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Sat Nov 1 15:24:53 2008 @@ -2577,9 +2577,14 @@ Ops.push_back(getRoot()); } } - - // Add the intrinsic ID as an integer operand. - Ops.push_back(DAG.getConstant(Intrinsic, TLI.getPointerTy())); + + // Info is set by getTgtMemInstrinsic + TargetLowering::IntrinsicInfo Info; + bool IsTgtIntrinsic = TLI.getTgtMemIntrinsic(Info, I, Intrinsic); + + // Add the intrinsic ID as an integer operand if it's not a target intrinsic. + if (!IsTgtIntrinsic) + Ops.push_back(DAG.getConstant(Intrinsic, TLI.getPointerTy())); // Add all operands of the call to the operand list. for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i) { @@ -2610,7 +2615,15 @@ // Create the node. SDValue Result; - if (!HasChain) + if (IsTgtIntrinsic) { + // This is target intrinsic that touches memory + Result = DAG.getMemIntrinsicNode(Info.opc, VTList, VTs.size(), + &Ops[0], Ops.size(), + Info.memVT, Info.ptrVal, Info.offset, + Info.align, Info.vol, + Info.readMem, Info.writeMem); + } + else if (!HasChain) Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, VTList, VTs.size(), &Ops[0], Ops.size()); else if (I.getType() != Type::VoidTy) From wangmp at apple.com Sat Nov 1 15:43:23 2008 From: wangmp at apple.com (Mon Ping Wang) Date: Sat, 1 Nov 2008 13:43:23 -0700 Subject: [llvm-commits] [llvm] r58426 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h In-Reply-To: <200810312145.49488.duncan.sands@math.u-psud.fr> References: <200810300801.m9U81lkS017674@zion.cs.uiuc.edu> <200810301038.25151.duncan.sands@math.u-psud.fr> <72EC1520-8940-4078-A5A4-EB56EE12FF46@apple.com> <200810312145.49488.duncan.sands@math.u-psud.fr> Message-ID: <8B410525-287D-424D-8474-70243CD07DEF@apple.com> Hi Duncan, You bring up several good points. With the DAG Combiner removing the unused values and since most machines uses a power of 2 vector length, the strategy of widening to a power of 2s when there is no legal wider vector size make sense and should generate superior results. The widening code uses a similar strategy to chop up a vector to store it. I'll make this change to how widening works. -- Mon Ping On Oct 31, 2008, at 1:45 PM, Duncan Sands wrote: > Hi Mon Ping, > >> So if we had vector of 3 elements and there is no valid 4 element >> vector type, we should just split and not try the next power of 2 and >> then split down to 4 operations. The rational that I see for going >> to >> the power of 2 is that is more likely that the split logic (where we >> split in 1/2) has a higher chance of finding the correct legal type. >> The down side is that if we go to a power of 2, we might end up doing >> work that doesn't benefit us. Given the example above of v10i32, if >> we promote to v16i32, we will break it down to 4 v4i32 where one of >> the v4i32 is not useful. > > the pointless v4i32 should be eliminated by the DAG combiner. It is > similar to what happens for apints. Consider i129 on a 32 bit > machine. > This i129 is promoted to i256, which is then expanded successively, > resulting in eight i32. Only the first five are needed to cover the > 129 original bits. So doesn't the final code get littered with > pointless operations on the last three i32? In fact it does not, they > are eliminated by the combiner if they aren't being used for anything > useful, typically because they have no users, or because they contain > undef. I never actually saw pointless code due to this in the final > assembler, not once. I expect it will be the same for vectors, and > if it is not probably that means the combiner needs to be made a > little > smarter. > > So I think that widening v10i32 to v16i32 and then splitting would > work well. In fact I think we should just give up on the idea of > splitting non-power-of-two vectors, and always widen them instead. > The reason is that there are several operations which are really > hard to split for non-power-of-two vectors. LegalizeTypes handles > more cases than LegalizeDAG but there are some where I just gave > up and added an assertion. This is again similar to the situation > with integers: why promote to a power of two size when you could > do uneven expansion (expand into two unequal parts)? The answer > is that expansion is harder than promotion, and some operations > would be just too hard for uneven expansion. The promote-to-power- > of-two then expand (maybe many times) logic sidesteps all that and > works great. I expect it to work pretty well for vectors too. > After all, integers are just a special case of vectors: vectors of > i1, right :) > > Ciao, > > Duncan. From gohman at apple.com Sat Nov 1 19:17:36 2008 From: gohman at apple.com (Dan Gohman) Date: Sun, 02 Nov 2008 00:17:36 -0000 Subject: [llvm-commits] [llvm] r58549 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/pr2996.ll Message-ID: <200811020017.mA20HbT1015613@zion.cs.uiuc.edu> Author: djg Date: Sat Nov 1 19:17:33 2008 New Revision: 58549 URL: http://llvm.org/viewvc/llvm-project?rev=58549&view=rev Log: Fix this recently moved code to use the correct type. CI is now a ConstantInt, and SI is the original cast instruction. This fixes PR2996. Added: llvm/trunk/test/Transforms/InstCombine/pr2996.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=58549&r1=58548&r2=58549&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sat Nov 1 19:17:33 2008 @@ -8551,8 +8551,8 @@ In = InsertNewInstBefore(BinaryOperator::CreateAShr(In, Sh, In->getName()+".lobit"), *ICI); - if (In->getType() != CI->getType()) - In = CastInst::CreateIntegerCast(In, CI->getType(), + if (In->getType() != SI.getType()) + In = CastInst::CreateIntegerCast(In, SI.getType(), true/*SExt*/, "tmp", ICI); if (Pred == ICmpInst::ICMP_SGT) Added: llvm/trunk/test/Transforms/InstCombine/pr2996.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pr2996.ll?rev=58549&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/pr2996.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/pr2996.ll Sat Nov 1 19:17:33 2008 @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | opt -instcombine +; PR2996 + +define void @func_53(i16 signext %p_56) nounwind { +entry: + %0 = icmp sgt i16 %p_56, -1 ; [#uses=1] + %iftmp.0.0 = select i1 %0, i32 -1, i32 0 ; [#uses=1] + %1 = call i32 (...)* @func_4(i32 %iftmp.0.0) nounwind ; [#uses=0] + ret void +} + +declare i32 @func_4(...) From nicholas at mxc.ca Sat Nov 1 21:41:51 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 02 Nov 2008 02:41:51 -0000 Subject: [llvm-commits] [llvm] r58555 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll Message-ID: <200811020241.mA22fqdX020301@zion.cs.uiuc.edu> Author: nicholas Date: Sat Nov 1 21:41:50 2008 New Revision: 58555 URL: http://llvm.org/viewvc/llvm-project?rev=58555&view=rev Log: Fix demanded bits analysis with srem by negative number. Based on a patch by Richard Osborne. Added: llvm/trunk/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=58555&r1=58554&r2=58555&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sat Nov 1 21:41:50 2008 @@ -1274,12 +1274,12 @@ break; case Instruction::SRem: if (ConstantInt *Rem = dyn_cast(I->getOperand(1))) { - APInt RA = Rem->getValue(); - if (RA.isPowerOf2() || (-RA).isPowerOf2()) { + APInt RA = Rem->getValue().abs(); + if (RA.isPowerOf2()) { if (DemandedMask.ule(RA)) // srem won't affect demanded bits return UpdateValueUsesWith(I, I->getOperand(0)); - APInt LowBits = RA.isStrictlyPositive() ? (RA - 1) : ~RA; + APInt LowBits = RA - 1; APInt Mask2 = LowBits | APInt::getSignBit(BitWidth); if (SimplifyDemandedBits(I->getOperand(0), Mask2, LHSKnownZero, LHSKnownOne, Depth+1)) Added: llvm/trunk/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll?rev=58555&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll Sat Nov 1 21:41:50 2008 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true} +; PR2993 + +define i1 @foo(i32 %x) { + %1 = srem i32 %x, -1 + %2 = icmp eq i32 %1, 0 + ret i1 %2 +} From nicholas at mxc.ca Sun Nov 2 00:52:51 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 02 Nov 2008 05:52:51 -0000 Subject: [llvm-commits] [llvm] r58557 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Transforms/IPO.h lib/Transforms/IPO/MergeFunctions.cpp test/Transforms/MergeFunc/ test/Transforms/MergeFunc/Output/ test/Transforms/MergeFunc/dg.exp test/Transforms/MergeFunc/phi-speculation1.ll test/Transforms/MergeFunc/phi-speculation2.ll Message-ID: <200811020552.mA25qpbD025782@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 2 00:52:50 2008 New Revision: 58557 URL: http://llvm.org/viewvc/llvm-project?rev=58557&view=rev Log: Add a new MergeFunctions pass. It finds identical functions and merges them. This triggers only 60 times in llvm-test (look at .llvm.bc, not .linked.rbc) and so it probably wont be turned on by default. Also, may of those are likely to go away when PR2973 is fixed. Added: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp llvm/trunk/test/Transforms/MergeFunc/ (with props) llvm/trunk/test/Transforms/MergeFunc/Output/ llvm/trunk/test/Transforms/MergeFunc/dg.exp llvm/trunk/test/Transforms/MergeFunc/phi-speculation1.ll llvm/trunk/test/Transforms/MergeFunc/phi-speculation2.ll Modified: llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Transforms/IPO.h Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=58557&r1=58556&r2=58557&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Sun Nov 2 00:52:50 2008 @@ -121,6 +121,7 @@ (void) llvm::createInstructionNamerPass(); (void) llvm::createPartialSpecializationPass(); (void) llvm::createAddReadAttrsPass(); + (void) llvm::createMergeFunctionsPass(); (void) llvm::createPrintModulePass(0); (void) llvm::createPrintFunctionPass("", 0); Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=58557&r1=58556&r2=58557&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Sun Nov 2 00:52:50 2008 @@ -38,7 +38,7 @@ /// to invoke/unwind instructions. This should really be part of the C/C++ /// front-end, but it's so much easier to write transformations in LLVM proper. /// -ModulePass* createLowerSetJmpPass(); +ModulePass *createLowerSetJmpPass(); //===----------------------------------------------------------------------===// /// createConstantMergePass - This function returns a new pass that merges @@ -186,13 +186,19 @@ /// createPartialSpecializationPass - This pass specializes functions for /// constant arguments. /// -ModulePass* createPartialSpecializationPass(); +ModulePass *createPartialSpecializationPass(); //===----------------------------------------------------------------------===// /// createAddReadAttrsPass - This pass discovers functions that do not access /// memory, or only read memory, and gives them the readnone/readonly attribute. /// -Pass* createAddReadAttrsPass(); +Pass *createAddReadAttrsPass(); + +//===----------------------------------------------------------------------===// +/// createMergeFunctionsPass - This pass discovers identical functions and +/// collapses them. +/// +ModulePass *createMergeFunctionsPass(); } // End llvm namespace Added: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=58557&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (added) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Sun Nov 2 00:52:50 2008 @@ -0,0 +1,358 @@ +//===- MergeFunctions.cpp - Merge identical functions ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass looks for equivalent functions that are mergable and folds them. +// +// A Function will not be analyzed if: +// * it is overridable at runtime (except for weak linkage), or +// * it is used by anything other than the callee parameter of a call/invoke +// +// A hash is computed from the function, based on its type and number of +// basic blocks. +// +// Once all hashes are computed, we perform an expensive equality comparison +// on each function pair. This takes n^2/2 comparisons per bucket, so it's +// important that the hash function be high quality. The equality comparison +// iterates through each instruction in each basic block. +// +// When a match is found, the functions are folded. We can only fold two +// functions when we know that the definition of one of them is not +// overridable. +// * fold a function marked internal by replacing all of its users. +// * fold extern or weak functions by replacing them with a global alias +// +//===----------------------------------------------------------------------===// +// +// Future work: +// +// * fold vector::push_back and vector::push_back. +// +// These two functions have different types, but in a way that doesn't matter +// to us. As long as we never see an S or T itself, using S* and S** is the +// same as using a T* and T**. +// +// * virtual functions. +// +// Many functions have their address taken by the virtual function table for +// the object they belong to. However, as long as it's only used for a lookup +// and call, this is irrelevant, and we'd like to fold such implementations. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "mergefunc" +#include "llvm/Transforms/IPO.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Constants.h" +#include "llvm/InlineAsm.h" +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" +#include +#include +using namespace llvm; + +STATISTIC(NumFunctionsMerged, "Number of functions merged"); +STATISTIC(NumMergeFails, "Number of identical function pairings not merged"); + +namespace { + struct VISIBILITY_HIDDEN MergeFunctions : public ModulePass { + static char ID; // Pass identification, replacement for typeid + MergeFunctions() : ModulePass((intptr_t)&ID) {} + + bool runOnModule(Module &M); + }; +} + +char MergeFunctions::ID = 0; +static RegisterPass +X("mergefunc", "Merge Functions"); + +ModulePass *llvm::createMergeFunctionsPass() { + return new MergeFunctions(); +} + +static unsigned hash(const Function *F) { + return F->size() ^ reinterpret_cast(F->getType()); + //return F->size() ^ F->arg_size() ^ F->getReturnType(); +} + +static bool compare(const Value *V, const Value *U) { + assert(!isa(V) && !isa(U) && + "Must not compare basic blocks."); + + assert(V->getType() == U->getType() && + "Two of the same operation have operands of different type."); + + // TODO: If the constant is an expression of F, we should accept that it's + // equal to the same expression in terms of G. + if (isa(V)) + return V == U; + + // The caller has ensured that ValueMap[V] != U. Since Arguments are + // pre-loaded into the ValueMap, and Instructions are added as we go, we know + // that this can only be a mis-match. + if (isa(V) || isa(V)) + return false; + + if (isa(V) && isa(U)) { + const InlineAsm *IAF = cast(V); + const InlineAsm *IAG = cast(U); + return IAF->getAsmString() == IAG->getAsmString() && + IAF->getConstraintString() == IAG->getConstraintString(); + } + + return false; +} + +static bool equals(const BasicBlock *BB1, const BasicBlock *BB2, + DenseMap &ValueMap, + DenseMap &SpeculationMap) { + // Specutively add it anyways. If it's false, we'll notice a difference later, and + // this won't matter. + ValueMap[BB1] = BB2; + + BasicBlock::const_iterator FI = BB1->begin(), FE = BB1->end(); + BasicBlock::const_iterator GI = BB2->begin(), GE = BB2->end(); + + do { + if (!FI->isSameOperationAs(const_cast(&*GI))) + return false; + + if (FI->getNumOperands() != GI->getNumOperands()) + return false; + + if (ValueMap[FI] == GI) { + ++FI, ++GI; + continue; + } + + if (ValueMap[FI] != NULL) + return false; + + for (unsigned i = 0, e = FI->getNumOperands(); i != e; ++i) { + Value *OpF = FI->getOperand(i); + Value *OpG = GI->getOperand(i); + + if (ValueMap[OpF] == OpG) + continue; + + if (ValueMap[OpF] != NULL) + return false; + + assert(OpF->getType() == OpG->getType() && + "Two of the same operation has operands of different type."); + + if (OpF->getValueID() != OpG->getValueID()) + return false; + + if (isa(FI)) { + if (SpeculationMap[OpF] == NULL) + SpeculationMap[OpF] = OpG; + else if (SpeculationMap[OpF] != OpG) + return false; + continue; + } else if (isa(OpF)) { + assert(isa(FI) && + "BasicBlock referenced by non-Terminator non-PHI"); + // This call changes the ValueMap, hence we can't use + // Value *& = ValueMap[...] + if (!equals(cast(OpF), cast(OpG), ValueMap, + SpeculationMap)) + return false; + } else { + if (!compare(OpF, OpG)) + return false; + } + + ValueMap[OpF] = OpG; + } + + ValueMap[FI] = GI; + ++FI, ++GI; + } while (FI != FE && GI != GE); + + return FI == FE && GI == GE; +} + +static bool equals(const Function *F, const Function *G) { + // We need to recheck everything, but check the things that weren't included + // in the hash first. + + if (F->getAttributes() != G->getAttributes()) + return false; + + if (F->hasGC() != G->hasGC()) + return false; + + if (F->hasGC() && F->getGC() != G->getGC()) + return false; + + if (F->hasSection() != G->hasSection()) + return false; + + if (F->hasSection() && F->getSection() != G->getSection()) + return false; + + // TODO: if it's internal and only used in direct calls, we could handle this + // case too. + if (F->getCallingConv() != G->getCallingConv()) + return false; + + // TODO: We want to permit cases where two functions take T* and S* but + // only load or store them into T** and S**. + if (F->getType() != G->getType()) + return false; + + DenseMap ValueMap; + DenseMap SpeculationMap; + ValueMap[F] = G; + + assert(F->arg_size() == G->arg_size() && + "Identical functions have a different number of args."); + + for (Function::const_arg_iterator fi = F->arg_begin(), gi = G->arg_begin(), + fe = F->arg_end(); fi != fe; ++fi, ++gi) + ValueMap[fi] = gi; + + if (!equals(&F->getEntryBlock(), &G->getEntryBlock(), ValueMap, + SpeculationMap)) + return false; + + for (DenseMap::iterator + I = SpeculationMap.begin(), E = SpeculationMap.end(); I != E; ++I) { + if (ValueMap[I->first] != I->second) + return false; + } + + return true; +} + +static bool fold(std::vector &FnVec, unsigned i, unsigned j) { + if (FnVec[i]->mayBeOverridden() && !FnVec[j]->mayBeOverridden()) + std::swap(FnVec[i], FnVec[j]); + + Function *F = FnVec[i]; + Function *G = FnVec[j]; + + if (!F->mayBeOverridden()) { + if (G->hasInternalLinkage()) { + F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); + G->replaceAllUsesWith(F); + G->eraseFromParent(); + ++NumFunctionsMerged; + return true; + } + + if (G->hasExternalLinkage() || G->hasWeakLinkage()) { + GlobalAlias *GA = new GlobalAlias(G->getType(), G->getLinkage(), "", + F, G->getParent()); + F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); + GA->takeName(G); + GA->setVisibility(G->getVisibility()); + G->replaceAllUsesWith(GA); + G->eraseFromParent(); + ++NumFunctionsMerged; + return true; + } + } + + DOUT << "Failed on " << F->getName() << " and " << G->getName() << "\n"; + + ++NumMergeFails; + return false; +} + +static bool hasAddressTaken(User *U) { + for (User::use_iterator I = U->use_begin(), E = U->use_end(); I != E; ++I) { + User *Use = *I; + + // 'call (bitcast @F to ...)' happens a lot. + while (isa(Use) && Use->hasOneUse()) { + Use = *Use->use_begin(); + } + + if (isa(Use)) { + if (hasAddressTaken(Use)) + return true; + } + + if (!isa(Use) && !isa(Use)) + return true; + + // Make sure we aren't passing U as a parameter to call instead of the + // callee. getOperand(0) is the callee for both CallInst and InvokeInst. + // Check the other operands to see if any of them is F. + for (User::op_iterator OI = I->op_begin() + 1, OE = I->op_end(); OI != OE; + ++OI) { + if (*OI == U) + return true; + } + } + + return false; +} + +bool MergeFunctions::runOnModule(Module &M) { + bool Changed = false; + + std::map > FnMap; + + for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { + if (F->isDeclaration() || F->isIntrinsic()) + continue; + + if (F->hasLinkOnceLinkage() || F->hasCommonLinkage() || + F->hasDLLImportLinkage() || F->hasDLLExportLinkage()) + continue; + + if (hasAddressTaken(F)) + continue; + + FnMap[hash(F)].push_back(F); + } + + // TODO: instead of running in a loop, we could also fold functions in callgraph + // order. Constructing the CFG probably isn't cheaper than just running in a loop. + + bool LocalChanged; + do { + LocalChanged = false; + for (std::map >::iterator I = FnMap.begin(), + E = FnMap.end(); I != E; ++I) { + DOUT << "size: " << FnMap.size() << "\n"; + std::vector &FnVec = I->second; + DOUT << "hash (" << I->first << "): " << FnVec.size() << "\n"; + + for (int i = 0, e = FnVec.size(); i != e; ++i) { + for (int j = i + 1; j != e; ++j) { + bool isEqual = equals(FnVec[i], FnVec[j]); + + DOUT << " " << FnVec[i]->getName() + << (isEqual ? " == " : " != ") + << FnVec[j]->getName() << "\n"; + + if (isEqual) { + if (fold(FnVec, i, j)) { + LocalChanged = true; + FnVec.erase(FnVec.begin() + j); + --j, --e; + } + } + } + } + + } + Changed |= LocalChanged; + } while (LocalChanged); + + return Changed; +} Propchange: llvm/trunk/test/Transforms/MergeFunc/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Sun Nov 2 00:52:50 2008 @@ -0,0 +1,3 @@ +Output +*.log +*.sum Added: llvm/trunk/test/Transforms/MergeFunc/dg.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/dg.exp?rev=58557&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MergeFunc/dg.exp (added) +++ llvm/trunk/test/Transforms/MergeFunc/dg.exp Sun Nov 2 00:52:50 2008 @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] Added: llvm/trunk/test/Transforms/MergeFunc/phi-speculation1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/phi-speculation1.ll?rev=58557&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MergeFunc/phi-speculation1.ll (added) +++ llvm/trunk/test/Transforms/MergeFunc/phi-speculation1.ll Sun Nov 2 00:52:50 2008 @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | opt -mergefunc -stats | not grep {functions merged} + +define i32 @foo1(i32 %x) { +entry: + %A = add i32 %x, 1 + %B = call i32 @foo1(i32 %A) + br label %loop +loop: + %C = phi i32 [%B, %entry], [%D, %loop] + %D = add i32 %x, 2 + %E = icmp ugt i32 %D, 10000 + br i1 %E, label %loopexit, label %loop +loopexit: + ret i32 %D +} + +define i32 @foo2(i32 %x) { +entry: + %0 = add i32 %x, 1 + %1 = call i32 @foo2(i32 %0) + br label %loop +loop: + %2 = phi i32 [%1, %entry], [%3, %loop] + %3 = add i32 %2, 2 + %4 = icmp ugt i32 %3, 10000 + br i1 %4, label %loopexit, label %loop +loopexit: + ret i32 %3 +} Added: llvm/trunk/test/Transforms/MergeFunc/phi-speculation2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/phi-speculation2.ll?rev=58557&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MergeFunc/phi-speculation2.ll (added) +++ llvm/trunk/test/Transforms/MergeFunc/phi-speculation2.ll Sun Nov 2 00:52:50 2008 @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | opt -mergefunc -stats |& grep {functions merged} + +define i32 @foo1(i32 %x) { +entry: + %A = add i32 %x, 1 + %B = call i32 @foo1(i32 %A) + br label %loop +loop: + %C = phi i32 [%B, %entry], [%D, %loop] + %D = add i32 %C, 2 + %E = icmp ugt i32 %D, 10000 + br i1 %E, label %loopexit, label %loop +loopexit: + ret i32 %D +} + +define i32 @foo2(i32 %x) { +entry: + %0 = add i32 %x, 1 + %1 = call i32 @foo2(i32 %0) + br label %loop +loop: + %2 = phi i32 [%1, %entry], [%3, %loop] + %3 = add i32 %2, 2 + %4 = icmp ugt i32 %3, 10000 + br i1 %4, label %loopexit, label %loop +loopexit: + ret i32 %3 +} From nicholas at mxc.ca Sun Nov 2 00:53:37 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 02 Nov 2008 05:53:37 -0000 Subject: [llvm-commits] [llvm] r58558 - /llvm/trunk/test/Transforms/MergeFunc/Output/ Message-ID: <200811020553.mA25rbVa025812@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 2 00:53:37 2008 New Revision: 58558 URL: http://llvm.org/viewvc/llvm-project?rev=58558&view=rev Log: Whoops! Remove test Output/ directory. Removed: llvm/trunk/test/Transforms/MergeFunc/Output/ From ofv at wanadoo.es Sun Nov 2 01:01:39 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Sun, 02 Nov 2008 06:01:39 -0000 Subject: [llvm-commits] [llvm] r58559 - /llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Message-ID: <200811020601.mA261dj5026039@zion.cs.uiuc.edu> Author: ofv Date: Sun Nov 2 01:01:39 2008 New Revision: 58559 URL: http://llvm.org/viewvc/llvm-project?rev=58559&view=rev Log: CMake: added a source file. Modified: llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Modified: llvm/trunk/lib/Transforms/IPO/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CMakeLists.txt?rev=58559&r1=58558&r2=58559&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Sun Nov 2 01:01:39 2008 @@ -15,6 +15,7 @@ IPConstantPropagation.cpp LoopExtractor.cpp LowerSetJmp.cpp + MergeFunctions.cpp PartialSpecialization.cpp PruneEH.cpp RaiseAllocations.cpp From daniel at zuster.org Sun Nov 2 02:07:35 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Sun, 2 Nov 2008 01:07:35 -0700 Subject: [llvm-commits] patch: flush raw_ostream after AsmPrinting function In-Reply-To: References: <1225471329.28395.19.camel@Remington> Message-ID: <6a8523d60811020107v619688f4v8bc19ae71bea91b7@mail.gmail.com> I agree with Dan, this is unfortunate. Is an extra branch in the write routine really a performance issue here? - Daniel On Fri, Oct 31, 2008 at 4:33 PM, Chris Lattner wrote: > > On Oct 31, 2008, at 1:52 PM, Dan Gohman wrote: > > > The real bug here, in my opinion, is that the new raw_ostream > > version of stderr is buffered. > > Patches, as they say, are welcome :). If you can figure out a way to > not affect the perf of the buffered case, I would really really like > this. > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081102/30c11b3b/attachment.html From resistor at mac.com Sun Nov 2 02:08:19 2008 From: resistor at mac.com (Owen Anderson) Date: Sun, 02 Nov 2008 08:08:19 -0000 Subject: [llvm-commits] [llvm] r58560 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Message-ID: <200811020808.mA288J8f029337@zion.cs.uiuc.edu> Author: resistor Date: Sun Nov 2 02:08:18 2008 New Revision: 58560 URL: http://llvm.org/viewvc/llvm-project?rev=58560&view=rev Log: Don't do pre-splitting if doing so would create a value join that did not exist before. Updating the live intervals in that care is tricky in the general case. Evan, if you see a tighter guard condition for this, let me know. Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58560&r1=58559&r2=58560&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sun Nov 2 02:08:18 2008 @@ -89,6 +89,8 @@ AU.addPreservedID(StrongPHIEliminationID); else AU.addPreservedID(PHIEliminationID); + AU.addRequired(); + AU.addPreserved(); MachineFunctionPass::getAnalysisUsage(AU); } @@ -633,6 +635,14 @@ assert(0 && "Val# is defined by a dead def?"); abort(); } + + // Pre-splitting a vreg that does not have a PHI kill across a barrier + // that is within a loop can potentially create a join that was not + // present before, which would make updating the live intervals very + // difficult. Bailout instead. + MachineLoopInfo& MLI = getAnalysis(); + if (!ValNo->hasPHIKill && MLI.getLoopFor(BarrierMBB)) + return false; // FIXME: For now, if definition is rematerializable, do not split. MachineInstr *DefMI = (ValNo->def != ~0U) From duncan.sands at math.u-psud.fr Sun Nov 2 02:21:51 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Sun, 2 Nov 2008 09:21:51 +0100 Subject: [llvm-commits] [llvm] r58557 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Transforms/IPO.h lib/Transforms/IPO/MergeFunctions.cpp test/Transforms/MergeFunc/ test/Transforms/MergeFunc/Output/ test/Transforms/MergeFunc/dg.exp test/Transforms/MergeFunc/phi-speculation1.ll test/Transforms/MergeFunc/phi-speculation2.ll In-Reply-To: <200811020552.mA25qpbD025782@zion.cs.uiuc.edu> References: <200811020552.mA25qpbD025782@zion.cs.uiuc.edu> Message-ID: <200811020921.52308.duncan.sands@math.u-psud.fr> Hi, > +static bool fold(std::vector &FnVec, unsigned i, unsigned j) { > + if (FnVec[i]->mayBeOverridden() && !FnVec[j]->mayBeOverridden()) > + std::swap(FnVec[i], FnVec[j]); > + > + Function *F = FnVec[i]; > + Function *G = FnVec[j]; > + > + if (!F->mayBeOverridden()) { If they can both be overridden, then they could still be merged by creating a new merged function and two aliases, one for each. May not be worth it, in which case it is worth a comment :) > + // Make sure we aren't passing U as a parameter to call instead of the > + // callee. getOperand(0) is the callee for both CallInst and > InvokeInst. + // Check the other operands to see if any of them is F. > + for (User::op_iterator OI = I->op_begin() + 1, OE = I->op_end(); OI != > OE; + ++OI) { > + if (*OI == U) > + return true; > + } CallSite has a hasArgument method that can be used for this. > + if (F->hasLinkOnceLinkage() || F->hasCommonLinkage() || > + F->hasDLLImportLinkage() || F->hasDLLExportLinkage()) > + continue; Rather than listing linkage types that are not ok, it would be safer to list linkage types that are ok. That way, when new linkage types are added the code will continue to be conservatively correct. Ciao, Duncan. From baldrick at free.fr Sun Nov 2 03:00:34 2008 From: baldrick at free.fr (Duncan Sands) Date: Sun, 02 Nov 2008 09:00:34 -0000 Subject: [llvm-commits] [llvm] r58561 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <200811020900.mA290Y0k005688@zion.cs.uiuc.edu> Author: baldrick Date: Sun Nov 2 03:00:33 2008 New Revision: 58561 URL: http://llvm.org/viewvc/llvm-project?rev=58561&view=rev Log: Get this building on 64 bit machines (error: cast from ?const llvm::PointerType*? to ?unsigned int? loses precision). Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=58561&r1=58560&r2=58561&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Sun Nov 2 03:00:33 2008 @@ -80,8 +80,8 @@ return new MergeFunctions(); } -static unsigned hash(const Function *F) { - return F->size() ^ reinterpret_cast(F->getType()); +static unsigned long hash(const Function *F) { + return F->size() ^ reinterpret_cast(F->getType()); //return F->size() ^ F->arg_size() ^ F->getReturnType(); } @@ -304,7 +304,7 @@ bool MergeFunctions::runOnModule(Module &M) { bool Changed = false; - std::map > FnMap; + std::map > FnMap; for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { if (F->isDeclaration() || F->isIntrinsic()) @@ -326,8 +326,8 @@ bool LocalChanged; do { LocalChanged = false; - for (std::map >::iterator I = FnMap.begin(), - E = FnMap.end(); I != E; ++I) { + for (std::map >::iterator + I = FnMap.begin(), E = FnMap.end(); I != E; ++I) { DOUT << "size: " << FnMap.size() << "\n"; std::vector &FnVec = I->second; DOUT << "hash (" << I->first << "): " << FnVec.size() << "\n"; From asl at math.spbu.ru Sun Nov 2 05:47:13 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 02 Nov 2008 11:47:13 -0000 Subject: [llvm-commits] [llvm] r58563 - /llvm/trunk/lib/System/Win32/Host.inc Message-ID: <200811021147.mA2BlEaJ004661@zion.cs.uiuc.edu> Author: asl Date: Sun Nov 2 05:47:11 2008 New Revision: 58563 URL: http://llvm.org/viewvc/llvm-project?rev=58563&view=rev Log: Silence a warning Modified: llvm/trunk/lib/System/Win32/Host.inc Modified: llvm/trunk/lib/System/Win32/Host.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Host.inc?rev=58563&r1=58562&r2=58563&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Host.inc (original) +++ llvm/trunk/lib/System/Win32/Host.inc Sun Nov 2 05:47:11 2008 @@ -22,14 +22,16 @@ } std::string sys::osVersion() { - OSVERSIONINFO osvi = { 0 }; + OSVERSIONINFO osvi; + + memset(&osvi, 0, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx(&osvi)) return ""; - + char buf[64]; - sprintf(buf, "%d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); + sprintf(buf, "%d.%d", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion); - return buf; + return buf; } From asl at math.spbu.ru Sun Nov 2 10:46:19 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 02 Nov 2008 16:46:19 -0000 Subject: [llvm-commits] [llvm] r58567 - /llvm/trunk/test/FrontendC/2008-11-02-WeakAlias.c Message-ID: <200811021646.mA2GkJ7m013846@zion.cs.uiuc.edu> Author: asl Date: Sun Nov 2 10:46:17 2008 New Revision: 58567 URL: http://llvm.org/viewvc/llvm-project?rev=58567&view=rev Log: Testcase for PR2691 Added: llvm/trunk/test/FrontendC/2008-11-02-WeakAlias.c Added: llvm/trunk/test/FrontendC/2008-11-02-WeakAlias.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2008-11-02-WeakAlias.c?rev=58567&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2008-11-02-WeakAlias.c (added) +++ llvm/trunk/test/FrontendC/2008-11-02-WeakAlias.c Sun Nov 2 10:46:17 2008 @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S -emit-llvm -o - %s | grep weak +// PR2691 + +void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ"))); +void native_init_IRQ(void) {} \ No newline at end of file From nicholas at mxc.ca Sun Nov 2 10:46:26 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 02 Nov 2008 16:46:26 -0000 Subject: [llvm-commits] [llvm] r58568 - in /llvm/trunk: lib/Transforms/IPO/MergeFunctions.cpp test/Transforms/MergeFunc/fold-weak.ll Message-ID: <200811021646.mA2GkRqU013863@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 2 10:46:26 2008 New Revision: 58568 URL: http://llvm.org/viewvc/llvm-project?rev=58568&view=rev Log: Changes from Duncan's review: * merge two weak functions by making them both alias a third non-weak fn * don't reimplement CallSite::hasArgument * whitelist the safe linkage types Added: llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=58568&r1=58567&r2=58568&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Sun Nov 2 10:46:26 2008 @@ -54,6 +54,7 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Pass.h" +#include "llvm/Support/CallSite.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include @@ -265,6 +266,28 @@ } } + if (F->hasWeakLinkage() && G->hasWeakLinkage()) { + GlobalAlias *GA_F = new GlobalAlias(F->getType(), F->getLinkage(), "", + 0, F->getParent()); + GA_F->takeName(F); + GA_F->setVisibility(F->getVisibility()); + F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); + F->replaceAllUsesWith(GA_F); + F->setName("folded." + GA_F->getName()); + F->setLinkage(GlobalValue::ExternalLinkage); + GA_F->setAliasee(F); + + GlobalAlias *GA_G = new GlobalAlias(G->getType(), G->getLinkage(), "", + F, G->getParent()); + GA_G->takeName(G); + GA_G->setVisibility(G->getVisibility()); + G->replaceAllUsesWith(GA_G); + G->eraseFromParent(); + + ++NumFunctionsMerged; + return true; + } + DOUT << "Failed on " << F->getName() << " and " << G->getName() << "\n"; ++NumMergeFails; @@ -289,13 +312,9 @@ return true; // Make sure we aren't passing U as a parameter to call instead of the - // callee. getOperand(0) is the callee for both CallInst and InvokeInst. - // Check the other operands to see if any of them is F. - for (User::op_iterator OI = I->op_begin() + 1, OE = I->op_end(); OI != OE; - ++OI) { - if (*OI == U) - return true; - } + // callee. + if (CallSite(cast(Use)).hasArgument(U)) + return true; } return false; @@ -310,8 +329,8 @@ if (F->isDeclaration() || F->isIntrinsic()) continue; - if (F->hasLinkOnceLinkage() || F->hasCommonLinkage() || - F->hasDLLImportLinkage() || F->hasDLLExportLinkage()) + if (!F->hasInternalLinkage() && !F->hasExternalLinkage() && + !F->hasWeakLinkage()) continue; if (hasAddressTaken(F)) Added: llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll?rev=58568&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll (added) +++ llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll Sun Nov 2 10:46:26 2008 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | opt -mergefunc | llvm-dis | grep {alias weak} | count 2 + +define weak i32 @sum(i32 %x, i32 %y) { + %sum = add i32 %x, %y + ret i32 %sum +} + +define weak i32 @add(i32 %x, i32 %y) { + %sum = add i32 %x, %y + ret i32 %sum +} From asl at math.spbu.ru Sun Nov 2 10:46:46 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 02 Nov 2008 16:46:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58569 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200811021646.mA2Gkknk013883@zion.cs.uiuc.edu> Author: asl Date: Sun Nov 2 10:46:46 2008 New Revision: 58569 URL: http://llvm.org/viewvc/llvm-project?rev=58569&view=rev Log: Weak alias does not have DECL_EXTERNAL bit set, but we still need to emit weak linkage in this case. This fixes PR2691. Patch by T?r?k Edwin! Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=58569&r1=58568&r2=58569&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sun Nov 2 10:46:46 2008 @@ -807,14 +807,14 @@ error ("%J%qD aliased to undefined symbol %qs", decl, decl, AliaseeName); timevar_pop(TV_LLVM_GLOBALS); return; - } + } } } - + GlobalValue::LinkageTypes Linkage; - // Check for external weak linkage - if (DECL_EXTERNAL(decl) && DECL_WEAK(decl)) + // A weak alias has TREE_PUBLIC set but not the other bits. + if (DECL_WEAK(decl)) Linkage = GlobalValue::WeakLinkage; else if (!TREE_PUBLIC(decl)) Linkage = GlobalValue::InternalLinkage; From isanbard at gmail.com Sun Nov 2 19:15:34 2008 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 2 Nov 2008 17:15:34 -0800 Subject: [llvm-commits] [llvm] r58560 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp In-Reply-To: <200811020808.mA288J8f029337@zion.cs.uiuc.edu> References: <200811020808.mA288J8f029337@zion.cs.uiuc.edu> Message-ID: <18A2B7BB-F32A-437B-958A-53A8EB577655@gmail.com> Owen, This is causing tests to fail: FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ CodeGen/X86/pre-split3.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/ Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/pre- split3.ll | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& / usr/bin/grep {pre-alloc-split} | /usr/bin/grep {Number of intervals split} | /usr/bin/grep 1 child process exited abnormally FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ CodeGen/X86/pre-split4.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/ Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/pre- split4.ll | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& / usr/bin/grep {pre-alloc-split} | /usr/bin/grep {Number of intervals split} | /usr/bin/grep 4 child process exited abnormally FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ CodeGen/X86/pre-split8.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/ Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/pre- split8.ll | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& / usr/bin/grep {pre-alloc-split} | /usr/bin/grep {Number of intervals split} | /usr/bin/grep 1 child process exited abnormally FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/ CodeGen/X86/pre-split9.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/ Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/pre- split9.ll | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& / usr/bin/grep {pre-alloc-split} | /usr/bin/grep {Number of intervals split} | /usr/bin/grep 1 child process exited abnormally Please investigate and XFAIL/adjust as appropriate. Thanks! -bw On Nov 2, 2008, at 1:08 AM, Owen Anderson wrote: > Author: resistor > Date: Sun Nov 2 02:08:18 2008 > New Revision: 58560 > > URL: http://llvm.org/viewvc/llvm-project?rev=58560&view=rev > Log: > Don't do pre-splitting if doing so would create a value join that > did not > exist before. Updating the live intervals in that care is tricky in > the general > case. > > Evan, if you see a tighter guard condition for this, let me know. > > Modified: > llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp > > Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58560&r1=58559&r2=58560&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) > +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sun Nov 2 02:08:18 > 2008 > @@ -89,6 +89,8 @@ > AU.addPreservedID(StrongPHIEliminationID); > else > AU.addPreservedID(PHIEliminationID); > + AU.addRequired(); > + AU.addPreserved(); > MachineFunctionPass::getAnalysisUsage(AU); > } > > @@ -633,6 +635,14 @@ > assert(0 && "Val# is defined by a dead def?"); > abort(); > } > + > + // Pre-splitting a vreg that does not have a PHI kill across a > barrier > + // that is within a loop can potentially create a join that was not > + // present before, which would make updating the live intervals > very > + // difficult. Bailout instead. > + MachineLoopInfo& MLI = getAnalysis(); > + if (!ValNo->hasPHIKill && MLI.getLoopFor(BarrierMBB)) > + return false; > > // FIXME: For now, if definition is rematerializable, do not split. > MachineInstr *DefMI = (ValNo->def != ~0U) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Sun Nov 2 19:24:46 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:24:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58571 - in /llvm-gcc-4.2/trunk: gcc/ggc-common.c gcc/ggc.h gcc/toplev.c include/libiberty.h libiberty/physmem.c Message-ID: <200811030124.mA31Okav029712@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:24:44 2008 New Revision: 58571 URL: http://llvm.org/viewvc/llvm-project?rev=58571&view=rev Log: Retune the GC parameters. Do not issue any deprecated warning in a function that itself is deprecated. Modified: llvm-gcc-4.2/trunk/gcc/ggc-common.c llvm-gcc-4.2/trunk/gcc/ggc.h llvm-gcc-4.2/trunk/gcc/toplev.c llvm-gcc-4.2/trunk/include/libiberty.h llvm-gcc-4.2/trunk/libiberty/physmem.c Modified: llvm-gcc-4.2/trunk/gcc/ggc-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ggc-common.c?rev=58571&r1=58570&r2=58571&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ggc-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/ggc-common.c Sun Nov 2 19:24:44 2008 @@ -716,10 +716,12 @@ min_expand = ggc_rlimit_bound (min_expand); /* The heuristic is a percentage equal to 30% + 70%*(RAM/1GB), yielding - a lower bound of 30% and an upper bound of 100% (when RAM >= 1GB). */ + APPLE LOCAL retune gc params 6124839 + a lower bound of 30% and an upper bound of 150% (when RAM >= 1.7GB). */ min_expand /= 1024*1024*1024; min_expand *= 70; - min_expand = MIN (min_expand, 70); + /* APPLE LOCAL retune gc params 6124839 */ + min_expand = MIN (min_expand, 120); min_expand += 30; return min_expand; @@ -727,7 +729,8 @@ /* Heuristic to set a default for GGC_MIN_HEAPSIZE. */ int -ggc_min_heapsize_heuristic (void) +/* APPLE LOCAL retune gc params 6124839 */ +ggc_min_heapsize_heuristic (bool optimize) { double phys_kbytes = physmem_total(); double limit_kbytes = ggc_rlimit_bound (phys_kbytes * 2); @@ -739,6 +742,13 @@ bound of 128M (when RAM >= 1GB). */ phys_kbytes /= 8; + /* APPLE LOCAL begin retune gc params 6124839 */ + + /* Additionally, on a multicore machine, we assume that we share the + memory with others reasonably equally. */ + phys_kbytes /= (double)ncpu_available() / (2 - optimize); + /* APPLE LOCAL end retune gc params 6124839 */ + #if defined(HAVE_GETRLIMIT) && defined (RLIMIT_RSS) /* Try not to overrun the RSS limit while doing garbage collection. The RSS limit is only advisory, so no margin is subtracted. */ @@ -765,11 +775,13 @@ } void -init_ggc_heuristics (void) +/* APPLE LOCAL retune gc params 6124839 */ +init_ggc_heuristics (bool optimize ATTRIBUTE_UNUSED) { #if !defined ENABLE_GC_CHECKING && !defined ENABLE_GC_ALWAYS_COLLECT set_param_value ("ggc-min-expand", ggc_min_expand_heuristic()); - set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic()); + /* APPLE LOCAL retune gc params 6124839 */ + set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic(optimize)); #endif } Modified: llvm-gcc-4.2/trunk/gcc/ggc.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ggc.h?rev=58571&r1=58570&r2=58571&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ggc.h (original) +++ llvm-gcc-4.2/trunk/gcc/ggc.h Sun Nov 2 19:24:44 2008 @@ -290,8 +290,10 @@ /* Heuristics. */ extern int ggc_min_expand_heuristic (void); -extern int ggc_min_heapsize_heuristic (void); -extern void init_ggc_heuristics (void); +/* APPLE LOCAL begin retune gc params 6124839 */ +extern int ggc_min_heapsize_heuristic (bool); +extern void init_ggc_heuristics (bool); +/* APPLE LOCAL end retune gc params 6124839 */ /* Zone collection. */ #if defined (GGC_ZONE) && !defined (GENERATOR_FILE) Modified: llvm-gcc-4.2/trunk/gcc/toplev.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/toplev.c?rev=58571&r1=58570&r2=58571&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/toplev.c (original) +++ llvm-gcc-4.2/trunk/gcc/toplev.c Sun Nov 2 19:24:44 2008 @@ -938,6 +938,11 @@ if (node == 0 || !warn_deprecated_decl) return; + /* APPLE LOCAL begin radar 4746503 */ + if (current_function_decl && TREE_DEPRECATED (current_function_decl)) + return; + /* APPLE LOCAL end radar 4746503 */ + if (DECL_P (node)) { expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node)); @@ -1713,8 +1718,19 @@ /* Register the language-independent parameters. */ add_params (lang_independent_params, LAST_PARAM); - /* This must be done after add_params but before argument processing. */ - init_ggc_heuristics(); + /* APPLE LOCAL begin retune gc params 6124839 */ + { int i = 0; + bool opt = false; + while (save_argv[++i]) + { + if (strncmp (save_argv[i], "-O", 2) == 0 + && strcmp (save_argv[i], "-O0") != 0) + opt = true; + } + /* This must be done after add_params but before argument processing. */ + init_ggc_heuristics(opt); + } + /* APPLE LOCAL end retune gc params 6124839 */ init_optimization_passes (); } Modified: llvm-gcc-4.2/trunk/include/libiberty.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/include/libiberty.h?rev=58571&r1=58570&r2=58571&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/include/libiberty.h (original) +++ llvm-gcc-4.2/trunk/include/libiberty.h Sun Nov 2 19:24:44 2008 @@ -296,6 +296,10 @@ extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC; +/* APPLE LOCAL begin retune gc params 6124839 */ +extern unsigned int ncpu_available (void); +/* APPLE LOCAL end retune gc params 6124839 */ + /* Physical memory routines. Return values are in BYTES. */ extern double physmem_total (void); extern double physmem_available (void); Modified: llvm-gcc-4.2/trunk/libiberty/physmem.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/physmem.c?rev=58571&r1=58570&r2=58571&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/libiberty/physmem.c (original) +++ llvm-gcc-4.2/trunk/libiberty/physmem.c Sun Nov 2 19:24:44 2008 @@ -182,6 +182,36 @@ return 0; } +/* APPLE LOCAL begin retune gc params 6124839 */ +unsigned int +ncpu_available (void) +{ +#if HAVE_SYSCTL && defined HW_AVAILCPU + { /* This works on *bsd and darwin. */ + unsigned int ncpu; + size_t len = sizeof ncpu; + static int mib[2] = { CTL_HW, HW_AVAILCPU }; + + if (sysctl (mib, ARRAY_SIZE (mib), &ncpu, &len, NULL, 0) == 0 + && len == sizeof (ncpu)) + return ncpu; + } +#endif +#if HAVE_SYSCTL && defined HW_NCPU + { /* This works on *bsd and darwin. */ + unsigned int ncpu; + size_t len = sizeof ncpu; + static int mib[2] = { CTL_HW, HW_NCPU }; + + if (sysctl (mib, ARRAY_SIZE (mib), &ncpu, &len, NULL, 0) == 0 + && len == sizeof (ncpu)) + return ncpu; + } +#endif + return 1; +} +/* APPLE LOCAL end retune gc params 6124839 */ + /* Return the amount of physical memory available. */ double physmem_available (void) From isanbard at gmail.com Sun Nov 2 19:25:37 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:25:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58572 - /llvm-gcc-4.2/trunk/configure.in Message-ID: <200811030125.mA31PbKU029746@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:25:37 2008 New Revision: 58572 URL: http://llvm.org/viewvc/llvm-project?rev=58572&view=rev Log: Add comment Modified: llvm-gcc-4.2/trunk/configure.in Modified: llvm-gcc-4.2/trunk/configure.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure.in?rev=58572&r1=58571&r2=58572&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure.in (original) +++ llvm-gcc-4.2/trunk/configure.in Sun Nov 2 19:25:37 2008 @@ -988,6 +988,7 @@ # APPLE LOCAL begin dynamic-no-pic i[[3456789]]86-*-darwin*) host_makefile_frag="config/mh-x86-darwin" + # gcc can default to x86_64 code generation, avoid that CC="${CC-gcc} -m32" CXX="${CXX-g++} -m32" ;; From isanbard at gmail.com Sun Nov 2 19:26:11 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:26:11 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58573 - /llvm-gcc-4.2/trunk/config/mh-x86-darwin Message-ID: <200811030126.mA31QB4q029782@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:26:11 2008 New Revision: 58573 URL: http://llvm.org/viewvc/llvm-project?rev=58573&view=rev Log: Whitespace fixup Modified: llvm-gcc-4.2/trunk/config/mh-x86-darwin Modified: llvm-gcc-4.2/trunk/config/mh-x86-darwin URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/config/mh-x86-darwin?rev=58573&r1=58572&r2=58573&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/config/mh-x86-darwin (original) +++ llvm-gcc-4.2/trunk/config/mh-x86-darwin Sun Nov 2 19:26:11 2008 @@ -3,4 +3,3 @@ # position-independent-code -- the usual default on Darwin. BOOT_CFLAGS=-g -O2 -mdynamic-no-pic - From isanbard at gmail.com Sun Nov 2 19:28:42 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:28:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58574 - /llvm-gcc-4.2/trunk/gcc/c-lex.c Message-ID: <200811030128.mA31SggS029858@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:28:42 2008 New Revision: 58574 URL: http://llvm.org/viewvc/llvm-project?rev=58574&view=rev Log: If errors are deferred, they don't count as errors yet. Modified: llvm-gcc-4.2/trunk/gcc/c-lex.c Modified: llvm-gcc-4.2/trunk/gcc/c-lex.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-lex.c?rev=58574&r1=58573&r2=58574&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-lex.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-lex.c Sun Nov 2 19:28:42 2008 @@ -481,7 +481,11 @@ case CPP_N_INVALID: /* cpplib has issued an error. */ *value = error_mark_node; - errorcount++; + /* APPLE LOCAL begin CW asm blocks 6276214 */ + /* If errors are deferred, they don't count as errors yet. */ + if (!flag_ms_asms) + errorcount++; + /* APPLE LOCAL end CW asm blocks 6276214 */ break; case CPP_N_INTEGER: From isanbard at gmail.com Sun Nov 2 19:32:04 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:32:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58575 - /llvm-gcc-4.2/trunk/gcc/config/i386/sse.md Message-ID: <200811030132.mA31W4kk029968@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:32:04 2008 New Revision: 58575 URL: http://llvm.org/viewvc/llvm-project?rev=58575&view=rev Log: Drop '*' so that these are visible. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/sse.md Modified: llvm-gcc-4.2/trunk/gcc/config/i386/sse.md URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/sse.md?rev=58575&r1=58574&r2=58575&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/sse.md (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/sse.md Sun Nov 2 19:32:04 2008 @@ -3178,7 +3178,7 @@ }) ;; APPLE LOCAL begin 5612787 mainline sse4 -(define_insn "*sse4_1_smax3" +(define_insn "sse4_1_smax3" [(set (match_operand:SSEMODE14 0 "register_operand" "=x") (smax:SSEMODE14 (match_operand:SSEMODE14 1 "nonimmediate_operand" "%0") @@ -3189,7 +3189,7 @@ (set_attr "prefix_extra" "1") (set_attr "mode" "TI")]) -(define_insn "*sse4_1_umax3" +(define_insn "sse4_1_umax3" [(set (match_operand:SSEMODE24 0 "register_operand" "=x") (umax:SSEMODE24 (match_operand:SSEMODE24 1 "nonimmediate_operand" "%0") @@ -3446,7 +3446,7 @@ (set_attr "mode" "TI")]) ;; APPLE LOCAL begin 5612787 mainline sse4 -(define_insn "*sse4_1_smin3" +(define_insn "sse4_1_smin3" [(set (match_operand:SSEMODE14 0 "register_operand" "=x") (smin:SSEMODE14 (match_operand:SSEMODE14 1 "nonimmediate_operand" "%0") @@ -3457,7 +3457,7 @@ (set_attr "prefix_extra" "1") (set_attr "mode" "TI")]) -(define_insn "*sse4_1_umin3" +(define_insn "sse4_1_umin3" [(set (match_operand:SSEMODE24 0 "register_operand" "=x") (umin:SSEMODE24 (match_operand:SSEMODE24 1 "nonimmediate_operand" "%0") From isanbard at gmail.com Sun Nov 2 19:39:05 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:39:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58576 - in /llvm-gcc-4.2/trunk/gcc: cgraph.h cgraphunit.c cp/semantics.c tree-gimple.h tree-nested.c Message-ID: <200811030139.mA31d5mV030173@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:39:05 2008 New Revision: 58576 URL: http://llvm.org/viewvc/llvm-project?rev=58576&view=rev Log: Lower nested functions to the structors. Reference to 'this' in a block must be looked up. Modified: llvm-gcc-4.2/trunk/gcc/cgraph.h llvm-gcc-4.2/trunk/gcc/cgraphunit.c llvm-gcc-4.2/trunk/gcc/cp/semantics.c llvm-gcc-4.2/trunk/gcc/tree-gimple.h llvm-gcc-4.2/trunk/gcc/tree-nested.c Modified: llvm-gcc-4.2/trunk/gcc/cgraph.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cgraph.h?rev=58576&r1=58575&r2=58576&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cgraph.h (original) +++ llvm-gcc-4.2/trunk/gcc/cgraph.h Sun Nov 2 19:39:05 2008 @@ -302,6 +302,8 @@ void cgraph_add_new_function (tree); /* In cgraphunit.c */ +/* APPLE LOCAL radar 6305545 */ +void lower_if_nested_functions (tree); bool cgraph_assemble_pending_functions (void); bool cgraph_varpool_assemble_pending_decls (void); void cgraph_finalize_function (tree, bool); Modified: llvm-gcc-4.2/trunk/gcc/cgraphunit.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cgraphunit.c?rev=58576&r1=58575&r2=58576&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cgraphunit.c (original) +++ llvm-gcc-4.2/trunk/gcc/cgraphunit.c Sun Nov 2 19:39:05 2008 @@ -473,6 +473,19 @@ node->lowered = true; } +/* APPLE LOCAL begin radar 6305545 */ +/** lower_if_nested_functions - This routine is called from cplus side only. + Its purpose is to lower block helper (or any other nested function) + which may have been nested in a constructor or destructor. We have to + do this because structors are cloned and are not lowered themselves (which + is the only way to lower the nested functions). */ +void +lower_if_nested_functions (tree decl) +{ + lower_nested_functions (decl, true); +} +/* APPLE LOCAL end radar 6305545 */ + /* DECL has been parsed. Take it, queue it, compile it at the whim of the logic in effect. If NESTED is true, then our caller cannot stand to have the garbage collector run at the moment. We would need to either create @@ -497,7 +510,8 @@ node->local.finalized = true; node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL; if (node->nested) - lower_nested_functions (decl); + /* APPLE LOCAL radar 6305545 */ + lower_nested_functions (decl, false); gcc_assert (!node->nested); /* If not unit at a time, then we need to create the call graph Modified: llvm-gcc-4.2/trunk/gcc/cp/semantics.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/semantics.c?rev=58576&r1=58575&r2=58576&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/semantics.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/semantics.c Sun Nov 2 19:39:05 2008 @@ -1930,6 +1930,18 @@ error ("% is unavailable for static member functions"); result = error_mark_node; } + /* APPLE LOCAL begin radar 6275956 */ + else if (cur_block && current_function_decl + && BLOCK_SYNTHESIZED_FUNC (current_function_decl)) + { + result = lookup_name (this_identifier); + if (!result) + { + error ("invalid use of % in a block"); + result = error_mark_node; + } + } + /* APPLE LOCAL end radar 6275956 */ else { if (current_function_decl) @@ -2988,7 +3000,7 @@ /* What we have is an expression which is of type struct __Block_byref_X. Must get to the value of the variable embedded in this structure. It is at: - __Block_byref_X.forwarding->x */ + __Block_byref_X.__forwarding->x */ decl = build_byref_local_var_access (decl, DECL_NAME (orig_decl)); } @@ -3271,6 +3283,11 @@ it. */ if (maybe_clone_body (fn)) { + /* APPLE LOCAL begin radar 6305545 */ + /* Must lower the nested functions which could be, among other + things, block helper functions. */ + lower_if_nested_functions (fn); + /* APPLE LOCAL end radar 6305545 */ /* We don't want to process FN again, so pretend we've written it out, even though we haven't. */ TREE_ASM_WRITTEN (fn) = 1; Modified: llvm-gcc-4.2/trunk/gcc/tree-gimple.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-gimple.h?rev=58576&r1=58575&r2=58576&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree-gimple.h (original) +++ llvm-gcc-4.2/trunk/gcc/tree-gimple.h Sun Nov 2 19:39:05 2008 @@ -140,7 +140,8 @@ extern tree omp_reduction_init (tree, tree); /* In tree-nested.c. */ -extern void lower_nested_functions (tree); +/* APPLE LOCAL radar 6305545 */ +extern void lower_nested_functions (tree, bool); extern void insert_field_into_struct (tree, tree); /* Convenience routines to walk all statements of a gimple function. Modified: llvm-gcc-4.2/trunk/gcc/tree-nested.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-nested.c?rev=58576&r1=58575&r2=58576&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree-nested.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree-nested.c Sun Nov 2 19:39:05 2008 @@ -2221,7 +2221,8 @@ subroutines and turn them into something less tightly bound. */ void -lower_nested_functions (tree fndecl) +/* APPLE LOCAL radar 6305545 */ +lower_nested_functions (tree fndecl, bool skip_outermost_fndecl) { struct cgraph_node *cgn; @@ -2236,6 +2237,13 @@ #endif /* LLVM LOCAL end */ root = create_nesting_tree (cgn); + /* APPLE LOCAL begin radar 6305545 */ + /* If skip_outermost_fndecl is true, we are lowering nested functions of + a constructor/destructor which are cloned and thrown away. But we + still have to lower their nested functions, but not the outermost function. */ + if (skip_outermost_fndecl) + root = root->inner; + /* APPLE LOCAL end radar 6305545 */ walk_all_functions (convert_nonlocal_reference, root); walk_all_functions (convert_local_reference, root); walk_all_functions (convert_nl_goto_reference, root); From isanbard at gmail.com Sun Nov 2 19:42:08 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:42:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58577 - /llvm-gcc-4.2/trunk/gcc/stmt.c Message-ID: <200811030142.mA31g9QG030271@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:42:08 2008 New Revision: 58577 URL: http://llvm.org/viewvc/llvm-project?rev=58577&view=rev Log: Disallow for TARGET_THUMB && TARGET_LONG_CALLS. Modified: llvm-gcc-4.2/trunk/gcc/stmt.c Modified: llvm-gcc-4.2/trunk/gcc/stmt.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/stmt.c?rev=58577&r1=58576&r2=58577&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/stmt.c (original) +++ llvm-gcc-4.2/trunk/gcc/stmt.c Sun Nov 2 19:42:08 2008 @@ -2387,6 +2387,8 @@ /* Label to jump to if no case matches. */ tree default_label_decl; + /* APPLE LOCAL ARM switch tables 6288519 */ + bool have_casesi; /* The switch body is lowered in gimplify.c, we should never have switches with a non-NULL SWITCH_BODY here. */ gcc_assert (!SWITCH_BODY (exp)); @@ -2481,6 +2483,8 @@ /* Compute span of values. */ range = fold_build2 (MINUS_EXPR, index_type, maxval, minval); + /* APPLE LOCAL ARM switch tables 6288519 */ + have_casesi = HAVE_casesi; /* Try implementing this switch statement by a short sequence of bit-wise comparisons. However, we let the binary-tree case below handle constant index expressions. */ @@ -2526,7 +2530,8 @@ || TREE_CONSTANT (index_expr) /* If neither casesi or tablejump is available, we can only go this way. */ - || (!HAVE_casesi && !HAVE_tablejump)) + /* APPLE LOCAL ARM switch tables 6288519 */ + || (!have_casesi && !HAVE_tablejump)) { index = expand_normal (index_expr); From isanbard at gmail.com Sun Nov 2 19:42:42 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:42:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58578 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.md Message-ID: <200811030142.mA31gg2K030299@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:42:42 2008 New Revision: 58578 URL: http://llvm.org/viewvc/llvm-project?rev=58578&view=rev Log: Update Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.md Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.md URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.md?rev=58578&r1=58577&r2=58578&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.md (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.md Sun Nov 2 19:42:42 2008 @@ -8585,7 +8585,7 @@ (match_operand:SI 3 "" "") ; table label (match_operand:SI 4 "" "")] ; Out of range label ;; APPLE LOCAL compact switch tables - "TARGET_EITHER" + "TARGET_ARM || TARGET_COMPACT_SWITCH_TABLES" " { rtx reg; @@ -8667,7 +8667,7 @@ (clobber (reg:SI IP_REGNUM)) (use (reg:SI 0)) (use (label_ref (match_dup 2)))])] - "TARGET_THUMB" + "TARGET_COMPACT_SWITCH_TABLES" "* { rtx body = PATTERN (next_real_insn (insn)); From isanbard at gmail.com Sun Nov 2 19:43:31 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:43:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58579 - /llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h Message-ID: <200811030143.mA31hVpD030330@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:43:31 2008 New Revision: 58579 URL: http://llvm.org/viewvc/llvm-project?rev=58579&view=rev Log: Have -mkernel and -fapple-kext imply -mlong-branch. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h?rev=58579&r1=58578&r2=58579&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h Sun Nov 2 19:43:31 2008 @@ -258,6 +258,9 @@ darwin_stubs = true; \ if (profile_flag) \ error ("function profiling not supported on this target"); \ + /* Use -mlongcalls for kexts */ \ + if (flag_mkernel || flag_apple_kext) \ + target_flags |= MASK_LONG_CALLS; \ } \ } while(0) From isanbard at gmail.com Sun Nov 2 19:44:11 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:44:11 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58580 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Message-ID: <200811030144.mA31iBuZ030354@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:44:11 2008 New Revision: 58580 URL: http://llvm.org/viewvc/llvm-project?rev=58580&view=rev Log: Define TARGET_COMPACT_SWITCH_TABLES Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=58580&r1=58579&r2=58580&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Sun Nov 2 19:44:11 2008 @@ -205,6 +205,12 @@ #define TARGET_HARD_TP (target_thread_pointer == TP_CP15) #define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT) +/* APPLE LOCAL begin ARM compact switch tables */ +/* Use compact switch tables with libgcc handlers. */ +#define TARGET_COMPACT_SWITCH_TABLES \ + (TARGET_THUMB && !TARGET_LONG_CALLS) +/* APPLE LOCAL end ARM compact switch tables */ + /* True iff the full BPABI is being used. If TARGET_BPABI is true, then TARGET_AAPCS_BASED must be true -- but the converse does not hold. TARGET_BPABI implies the use of the BPABI runtime library, @@ -2094,6 +2100,7 @@ #define CASE_VECTOR_SHORTEN_MODE(MIN_OFFSET, MAX_OFFSET, BODY) \ (TARGET_ARM ? SImode \ + : !TARGET_COMPACT_SWITCH_TABLES ? SImode \ : (MIN_OFFSET) >= -256 && (MAX_OFFSET) <= 254 \ ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, QImode) \ : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 510 \ @@ -2134,7 +2141,7 @@ in final_scan_insn. */ \ targetm.asm_out.internal_label (file, "L", base_label_no); \ /* Default is not included in output count */ \ - if (TARGET_THUMB) \ + if (TARGET_COMPACT_SWITCH_TABLES) \ asm_fprintf (file, "\t%s\t%d @ size\n", directive, vlen - 1); \ for (idx = 0; idx < vlen; idx++) \ { \ @@ -2153,13 +2160,16 @@ else if (!TARGET_THUMB) \ asm_fprintf (file, "\tb\tL%d\n", \ CODE_LABEL_NUMBER (target_label)); \ - else \ + else if (TARGET_COMPACT_SWITCH_TABLES || flag_pic) \ /* Let the assembler do the computation here; one case that \ uses is this is when there are asm's, which makes \ compile time computations unreliable. */ \ asm_fprintf (file, "\t%s\tL%d-L%d\n", \ directive, \ CODE_LABEL_NUMBER (target_label), base_label_no); \ + else \ + asm_fprintf (file, "\t%s\tL%d\n", directive, \ + CODE_LABEL_NUMBER (target_label)); \ } \ /* Pad to instruction boundary. */ \ vlen = (vlen + 1/*count*/) * size; \ From isanbard at gmail.com Sun Nov 2 19:44:52 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:44:52 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58581 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Message-ID: <200811030144.mA31iqn9030380@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:44:52 2008 New Revision: 58581 URL: http://llvm.org/viewvc/llvm-project?rev=58581&view=rev Log: Declare is_jump_table function. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=58581&r1=58580&r2=58581&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Sun Nov 2 19:44:52 2008 @@ -84,6 +84,7 @@ static const char *fp_const_from_val (REAL_VALUE_TYPE *); static arm_cc get_arm_condition_code (rtx); static HOST_WIDE_INT int_log2 (HOST_WIDE_INT); +static rtx is_jump_table (rtx); static const char *output_multi_immediate (rtx *, const char *, const char *, int, HOST_WIDE_INT); static const char *shift_op (rtx, HOST_WIDE_INT *); From isanbard at gmail.com Sun Nov 2 19:47:12 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:47:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58582 - /llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h Message-ID: <200811030147.mA31lCCH030475@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:47:12 2008 New Revision: 58582 URL: http://llvm.org/viewvc/llvm-project?rev=58582&view=rev Log: Add appropriate APPLE LOCAL tags. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h?rev=58582&r1=58581&r2=58582&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h Sun Nov 2 19:47:12 2008 @@ -1476,8 +1476,10 @@ return ((__m128i)__builtin_ia32_pslldqi128 (__A, __B * 8)); } #else -#define _mm_srli_si128 (__m128i)__builtin_ia32_psrldqi128_byteshift -#define _mm_slli_si128 (__m128i)__builtin_ia32_pslldqi128_byteshift +/* APPLE LOCAL begin 5919583 */ +#define _mm_srli_si128 (__m128i)__builtin_ia32_psrldqi128_byteshift +#define _mm_slli_si128 (__m128i)__builtin_ia32_pslldqi128_byteshift +/* APPLE LOCAL end 5919583 */ #endif #if 0 From isanbard at gmail.com Sun Nov 2 19:51:51 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:51:51 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58583 - /llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-ivopts.c Message-ID: <200811030151.mA31ppb3030610@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:51:51 2008 New Revision: 58583 URL: http://llvm.org/viewvc/llvm-project?rev=58583&view=rev Log: Treat (vector)scalar like (aggregate)scalar. Modified: llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-ivopts.c Modified: llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-ivopts.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-ivopts.c?rev=58583&r1=58582&r2=58583&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-ivopts.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-ivopts.c Sun Nov 2 19:51:51 2008 @@ -1489,8 +1489,12 @@ and make them look addressable. After some processing the non-addressability may be uncovered again, causing ADDR_EXPRs of inappropriate objects to be built. */ - return AGGREGATE_TYPE_P (TREE_TYPE (expr)) - && !AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))); + /* APPLE LOCAL begin 6187262 */ + return ((AGGREGATE_TYPE_P (TREE_TYPE (expr)) + || TREE_CODE (TREE_TYPE (expr)) == VECTOR_TYPE) + && !(AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))) + || TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == VECTOR_TYPE)); + /* APPLE LOCAL end 6187262 */ default: break; From isanbard at gmail.com Sun Nov 2 19:55:51 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:55:51 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58584 - /llvm-gcc-4.2/trunk/gcc/cfgbuild.c Message-ID: <200811030155.mA31tp4F030720@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:55:51 2008 New Revision: 58584 URL: http://llvm.org/viewvc/llvm-project?rev=58584&view=rev Log: Treat unconditional TRAP like any conditional TRAP. Modified: llvm-gcc-4.2/trunk/gcc/cfgbuild.c Modified: llvm-gcc-4.2/trunk/gcc/cfgbuild.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cfgbuild.c?rev=58584&r1=58583&r2=58584&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cfgbuild.c (original) +++ llvm-gcc-4.2/trunk/gcc/cfgbuild.c Sun Nov 2 19:55:51 2008 @@ -120,11 +120,8 @@ || can_throw_internal (insn)); case INSN: - /* Treat trap instructions like noreturn calls (same provision). */ - if (GET_CODE (PATTERN (insn)) == TRAP_IF - && XEXP (PATTERN (insn), 0) == const1_rtx) - return true; - + /* APPLE LOCAL begin deletion 6258941 */ + /* APPLE LOCAL end deletion 6258941 */ return (flag_non_call_exceptions && can_throw_internal (insn)); case BARRIER: From isanbard at gmail.com Sun Nov 2 19:57:08 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:57:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58585 - /llvm-gcc-4.2/trunk/gcc/doc/invoke.texi Message-ID: <200811030157.mA31v8il030762@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:57:07 2008 New Revision: 58585 URL: http://llvm.org/viewvc/llvm-project?rev=58585&view=rev Log: Update to Apple GCC mainline. Modified: llvm-gcc-4.2/trunk/gcc/doc/invoke.texi Modified: llvm-gcc-4.2/trunk/gcc/doc/invoke.texi URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/invoke.texi?rev=58585&r1=58584&r2=58585&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/doc/invoke.texi (original) +++ llvm-gcc-4.2/trunk/gcc/doc/invoke.texi Sun Nov 2 19:57:07 2008 @@ -287,6 +287,8 @@ -Wno-format-extra-args -Wformat-nonliteral @gol @c APPLE LOCAL default to Wformat-security 5764921 -Wno-format-security -Wformat-y2k @gol + at c APPLE LOCAL Wglobal-constructors 6324584 +-Wglobal-constructors @gol -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol -Wimport -Wno-import -Winit-self -Winline @gol -Wno-int-to-pointer-cast @gol @@ -295,6 +297,8 @@ -Wmain -Wmissing-braces -Wmissing-field-initializers @gol -Wmissing-format-attribute -Wmissing-include-dirs @gol -Wmissing-noreturn @gol + at c APPLE LOCAL warn missing prototype 6261539 +-Wmissing-prototypes @gol @c APPLE LOCAL -Wmost -Wmost (APPLE ONLY) @gol -Wno-multichar -Wnonnull -Wno-overflow @gol @@ -315,7 +319,8 @@ @c APPLE LOCAL begin -Wdiscard-qual 4086969 @item C-only Warning Options @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol --Wmissing-prototypes -Wnested-externs -Wold-style-definition @gol + at c APPLE LOCAL warn missing prototype 6261539 +-Wnested-externs -Wold-style-definition @gol -Wstrict-prototypes -Wtraditional @gol -Wdeclaration-after-statement -Wno-discard-qual -Wno-pointer-sign} @c APPLE LOCAL end -Wdiscard-qual 4086969 @@ -906,7 +911,10 @@ -fargument-alias -fargument-noalias @gol -fargument-noalias-global -fargument-noalias-anything -fleading-underscore -ftls-model=@var{model} @gol --ftrapv -fwrapv -fbounds-check @gol + at c APPLE LOCAL begin prune man page 5547358 + at c -ftrapv +-fwrapv -fbounds-check @gol + at c APPLE LOCAL end prune man page -fvisibility} @end table @@ -2854,6 +2862,15 @@ @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It can be disabled with the @option{-Wno-nonnull} option. + at c APPLE LOCAL begin Wglobal-constructors 6324584 + at item -Wglobal-constructors + at opindex Wglobal-constructors +Warn about namespace scope data that requires construction or +destruction, or functions that use the constructor attribute or the +destructor attribute. Additionally warn if the Objective-C GNU +runtime is used to initialize various metadata. + at c APPLE LOCAL end Wglobal-constructors 6324584 + @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} @opindex Winit-self Warn about uninitialized variables which are initialized with themselves. @@ -3696,7 +3713,8 @@ Warn if an old-style function definition is used. A warning is given even if there is a previous prototype. - at item -Wmissing-prototypes @r{(C only)} + at c APPLE LOCAL warn missing prototype 6261539 + at item -Wmissing-prototypes @opindex Wmissing-prototypes Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself @@ -8975,12 +8993,16 @@ @option{-fno-exceptions}, @option{-fno-non-call-exceptions}, @option{-fno-asynchronous-unwind-tables}, @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where applicable. This mode also sets @option{-mno-altivec}, - at c APPLE LOCAL begin 5731065 - at option{-msoft-float} and @option{-mlong-branch} for PowerPC targets -and @option{-mno-red-zone} on x86_64. Of these, only -msoft-float can -be changed which is useful in a kext that wishes to use the hardware -floating point unit. - at c APPLE LOCAL end 5731065 + at c APPLE LOCAL begin 5731065 6268204 + at option{-msoft-float} and @option{-mlong-branch} for PowerPC targets, + at option{-mno-red-zone} on x86_64, and @option{-mlong-branch} for ARM +targets. Of these, only -msoft-float can be changed which is useful in +a kext that wishes to use the hardware floating point unit. + at c APPLE LOCAL end 5731065 6268204 + at c APPLE LOCAL begin kext weak_import 5935650 + at option{-dynamic} can be used to override the effects of -static on +the assembler to enable the use of weak_import. + at c APPLE LOCAL end kext weak_import 5935650 @item -mone-byte-bool @opindex mone-byte-bool @@ -14212,10 +14234,14 @@ currently only supported by the Java and Fortran front-ends, where this option defaults to true and false respectively. + at c APPLE LOCAL prune man page 5547358 + at ignore @item -ftrapv @opindex ftrapv This option generates traps for signed overflow on addition, subtraction, multiplication operations. + at c APPLE LOCAL prune man page 5547358 + at end ignore @item -fwrapv @opindex fwrapv From isanbard at gmail.com Sun Nov 2 19:59:13 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:59:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58586 - /llvm-gcc-4.2/trunk/gcc/builtins.c Message-ID: <200811030159.mA31xDS4030826@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:59:13 2008 New Revision: 58586 URL: http://llvm.org/viewvc/llvm-project?rev=58586&view=rev Log: Tolerate enums where INTEGER_TYPE is expected. Modified: llvm-gcc-4.2/trunk/gcc/builtins.c Modified: llvm-gcc-4.2/trunk/gcc/builtins.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/builtins.c?rev=58586&r1=58585&r2=58586&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/builtins.c (original) +++ llvm-gcc-4.2/trunk/gcc/builtins.c Sun Nov 2 19:59:13 2008 @@ -9440,6 +9440,12 @@ if (! POINTER_TYPE_P (TREE_TYPE (TREE_VALUE (arglist)))) goto end; } + /* APPLE LOCAL begin 5813921 */ + else if (code == INTEGER_TYPE + && (TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) + == ENUMERAL_TYPE)) + /* Allow ENUMERAL_TYPE to match INTEGER_TYPE. */ ; + /* APPLE LOCAL end 5813921 */ else if (code != TREE_CODE (TREE_TYPE (TREE_VALUE (arglist)))) goto end; break; From isanbard at gmail.com Sun Nov 2 19:59:34 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 01:59:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58587 - /llvm-gcc-4.2/trunk/gcc/fold-const.c Message-ID: <200811030159.mA31xY2t030850@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 19:59:34 2008 New Revision: 58587 URL: http://llvm.org/viewvc/llvm-project?rev=58587&view=rev Log: Update APPLE LOCAL markers. Modified: llvm-gcc-4.2/trunk/gcc/fold-const.c Modified: llvm-gcc-4.2/trunk/gcc/fold-const.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/fold-const.c?rev=58587&r1=58586&r2=58587&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/fold-const.c (original) +++ llvm-gcc-4.2/trunk/gcc/fold-const.c Sun Nov 2 19:59:34 2008 @@ -10571,11 +10571,13 @@ /* bool_var != 1 becomes !bool_var. */ if (TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE && integer_onep (arg1) && code == NE_EXPR) + /* APPLE LOCAL file radar 6286881 */ return fold_build1 (TRUTH_NOT_EXPR, type, fold_convert (type, arg0)); /* bool_var == 0 becomes !bool_var. */ if (TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE && integer_zerop (arg1) && code == EQ_EXPR) + /* APPLE LOCAL file radar 6286881 */ return fold_build1 (TRUTH_NOT_EXPR, type, fold_convert (type, arg0)); /* ~a != C becomes a != ~C where C is a constant. Likewise for ==. */ From isanbard at gmail.com Sun Nov 2 20:01:32 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 02:01:32 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58588 - in /llvm-gcc-4.2/trunk/gcc/config: i386/darwin.h rs6000/darwin.h Message-ID: <200811030201.mA321Wkn030930@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 20:01:32 2008 New Revision: 58588 URL: http://llvm.org/viewvc/llvm-project?rev=58588&view=rev Log: Turn Wformat-security on by default internally. Don't do it here. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h?rev=58588&r1=58587&r2=58588&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h Sun Nov 2 20:01:32 2008 @@ -101,13 +101,6 @@ %{!mmacosx-version-min=*: %{!miphoneos-version-min=*: %(darwin_cc1_minversion)}} \ "/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */"\ % Author: void Date: Sun Nov 2 20:04:09 2008 New Revision: 58589 URL: http://llvm.org/viewvc/llvm-project?rev=58589&view=rev Log: Implement Wglobal-constructors. Warn about missing prototypes for C++. Modified: llvm-gcc-4.2/trunk/gcc/c.opt llvm-gcc-4.2/trunk/gcc/cp/decl2.c Modified: llvm-gcc-4.2/trunk/gcc/c.opt URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c.opt?rev=58589&r1=58588&r2=58589&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c.opt (original) +++ llvm-gcc-4.2/trunk/gcc/c.opt Sun Nov 2 20:04:09 2008 @@ -238,7 +238,7 @@ ; APPLE LOCAL begin default to Wformat-security 5764921 Wformat-security -C ObjC C++ ObjC++ Var(warn_format_security) Init(0) +C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warn about possible security problems with format functions ; APPLE LOCAL end default to Wformat-security 5764921 @@ -261,6 +261,15 @@ Warn about multicharacter constants containing exactly four characters ; APPLE LOCAL end -Wfour-char-constants +; APPLE LOCAL begin Wglobal-constructors 6324584 +Wglobal-constructors +C ObjC C++ ObjC++ Var(warn_global_constructors) +Warn when global (namespace scope) objects require runtime +construction or destruction or when functions that use attribute +constructor or destructor are used. This is useful to help maintain +fast program startup and end times. +; APPLE LOCAL end Wglobal-constructors 6324584 + Winit-self C ObjC C++ ObjC++ Var(warn_init_self) Warn about variables which are initialized to themselves @@ -320,9 +329,11 @@ C ObjC C++ ObjC++ Warn about user-specified include directories that do not exist +; APPLE LOCAL begin warn missing prototype 6261539 Wmissing-prototypes -C ObjC Var(warn_missing_prototypes) +C ObjC C++ Objc++ Var(warn_missing_prototypes) Warn about global functions without prototypes +; APPLE LOCAL end warn missing prototype 6261539 ; APPLE LOCAL begin -Wmost Wmost Modified: llvm-gcc-4.2/trunk/gcc/cp/decl2.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl2.c?rev=58589&r1=58588&r2=58589&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/decl2.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/decl2.c Sun Nov 2 20:04:09 2008 @@ -2781,6 +2781,20 @@ } /* APPLE LOCAL end elide global inits 3814991 */ +/* APPLE LOCAL begin Wglobal-constructors 6324584 */ +static void +warn_init (tree decl) +{ + warning (OPT_Wglobal_constructors, "%J%qD requires global construction", decl, decl); +} + +static void +warn_deinit (tree decl) +{ + warning (OPT_Wglobal_constructors, "%J%qD requires global destruction", decl, decl); +} +/* APPLE LOCAL end Wglobal-constructors 6324584 */ + /* Set up to handle the initialization or destruction of DECL. If INITP is nonzero, we are initializing the variable. Otherwise, we are destroying it. */ @@ -2839,9 +2853,17 @@ /* APPLE LOCAL begin elide global inits 5642351 */ /* We can't avoid running the guard code. */ if (initp) - pi->initializations_p = 1; + { + pi->initializations_p = 1; + /* APPLE LOCAL Wglobal-constructors 6324584 */ + warn_init (decl); + } else - pi->destructions_p = 1; + { + pi->destructions_p = 1; + /* APPLE LOCAL Wglobal-constructors 6324584 */ + warn_deinit (decl); + } /* APPLE LOCAL end elide global inits 5642351 */ /* When using __cxa_atexit, we just check the GUARD as we would @@ -2894,6 +2916,8 @@ if (!does_nothing_p (init)) { pi->initializations_p = 1; + /* APPLE LOCAL Wglobal-constructors 6324584 */ + if (!guard) warn_init (decl); finish_expr_stmt (init); } } @@ -2905,6 +2929,11 @@ /* APPLE LOCAL begin elide global inits 5642351 */ { pi->initializations_p = 1; + /* APPLE LOCAL begin Wglobal-constructors 6324584 */ + if (!guard + && !TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl))) + warn_deinit (decl); + /* APPLE LOCAL end Wglobal-constructors 6324584 */ finish_expr_stmt (register_dtor_fn (decl)); } /* APPLE LOCAL end global inits 5642351 */ @@ -2913,6 +2942,8 @@ /* APPLE LOCAL begin elide global inits 5642351 */ { pi->destructions_p = 1; + /* APPLE LOCAL Wglobal-constructors 6324584 */ + if (!guard) warn_deinit (decl); finish_expr_stmt (build_cleanup (decl)); } /* APPLE LOCAL end global inits 5642351 */ @@ -3124,6 +3155,10 @@ { body = start_objects (function_key, priority); static_ctors = objc_generate_static_init_call (static_ctors); + /* APPLE LOCAL begin Wglobal-constructors 6324584 */ + warning (OPT_Wglobal_constructors, + "GNU Objective-C runtime requires global initialization"); + /* APPLE LOCAL end Wglobal-constructors 6324584 */ } /* Call the static storage duration function with appropriate @@ -3159,6 +3194,13 @@ { fndecl = TREE_VALUE (fns); + /* APPLE LOCAL begin Wglobal-constructors 6324584 */ + if (constructor_p) + warn_init (fndecl); + else + warn_deinit (fndecl); + /* APPLE LOCAL end Wglobal-constructors 6324584 */ + /* Calls to pure/const functions will expand to nothing. */ if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE))) { From isanbard at gmail.com Sun Nov 2 20:05:45 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 03 Nov 2008 02:05:45 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r58590 - in /llvm-gcc-4.2/trunk: ChangeLog.apple gcc/ChangeLog.apple gcc/cp/ChangeLog.apple gcc/objc/ChangeLog.apple Message-ID: <200811030205.mA325kgT031073@zion.cs.uiuc.edu> Author: void Date: Sun Nov 2 20:05:45 2008 New Revision: 58590 URL: http://llvm.org/viewvc/llvm-project?rev=58590&view=rev Log: Update Modified: llvm-gcc-4.2/trunk/ChangeLog.apple llvm-gcc-4.2/trunk/gcc/ChangeLog.apple llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple Modified: llvm-gcc-4.2/trunk/ChangeLog.apple URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/ChangeLog.apple?rev=58590&r1=58589&r2=58590&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/ChangeLog.apple (original) +++ llvm-gcc-4.2/trunk/ChangeLog.apple Sun Nov 2 20:05:45 2008 @@ -1,3 +1,9 @@ +2008-10-09 Devang Patel + + Radar 6184418 + * driverdriver.c (get_arch_name): Enable 64 bit by default in x86. + (main): Check -m32 and -m64 on command line. Select default -arch. + 2008-09-05 Josh Conner Radar 6177003 Modified: llvm-gcc-4.2/trunk/gcc/ChangeLog.apple URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ChangeLog.apple?rev=58590&r1=58589&r2=58590&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ChangeLog.apple (original) +++ llvm-gcc-4.2/trunk/gcc/ChangeLog.apple Sun Nov 2 20:05:45 2008 @@ -1,3 +1,444 @@ +2008-10-31 Stuart Hastings + + Radar 5813921 + * builtins.c (validate_arglist): Tolerate enums where + INTEGER_TYPE is expected. + +2008-10-31 Fariborz Jahanian + + Radar 6175959 + * stub-objc.c (block_requires_copying): Object pointers with + NSObject attribute also require copy/release API. + * c-parser.c (synth_copy_helper_block_func): Use the new API + _Block_object_assign for ObjC object copying. + (block_object_dispose): New + (synth_destroy_helper_block_func): Call block_object_dispose + to use new _Block_object_dispose API for ObjC object release. + +2008-10-30 Stuart Hastings + + Radar 5834718 + * coverage.c (prg_ctr_mask, prg_n_ctrs, fn_ctr_mask, + fn_n_ctrs, fn_b_ctrs): Added GTY(()) markers. + +2008-10-29 Fariborz Jahanian + + Radar 6329245 + * c-decl.c (build_block_descriptor_type): Remove + "FuncPtr" field decl. + * c-typeck.c (build_block_call): Block call is + now same as old ABI. + * c-parser.c (build_generic_block_struct_type): Primary block + type is now reverted to old ABI in its first 4 fields. + (build_block_struct_type): Ditto. + (build_block_struct_initlist): Primary block initializer + list is now reverted to old ABI somewhat. + +2008-10-28 Fariborz Jahanian + + Radar 6243961 + * varasm.c (build_constant_desc): With -fwritable-string + prefix normal string constants with "lC". + (output_constant_def): Turn off -fwritable-string + for cf-strings. + +2008-10-28 Stuart Hastings + + * ggc-common.c (init_ggc_heuristics): Add ATTRIBUTE_UNUSED. + +2008-10-27 Fariborz Jahanian + + Radar 6231433 + * c-typeck.c (objc_compare_types, objc_have_common_type): + Take an extra argument for better diagnostics. + * c-common.c (objc_compare_types, objc_have_common_type): + Take extra argument. + * stub-objc.c: Ditto + +2008-10-27 Fariborz Jahanian + + Radar 6302949 + * c-parser.c (c_parser_objc_property_attrlist): Warn on missing + ',' separator for property attribute list. + +2008-10-24 Fariborz Jahanian + + Radar 6305545 + * cgraph.h (lower_if_nested_functions): New decl. + * tree-gimple.h (lower_nested_functions): Takes one more arg. + * cgraphunit.c (lower_if_nested_functions): New + * tree-nested.c (lower_nested_functions): Skip structors. + +2008-10-24 Stuart Hastings + + Radar 308664 6310728 6311054 6311100 + * config/i386/i386.c (legitimate_pic_address_disp_p): Local + labels should not be affected by -mfix-and-continue. + +2008-10-24 Fariborz Jahanian + + Radar 5847213 (minor tweak) + * c-decl.c (build_block_descriptor_type): + Make descriptor_ptr_type and descriptor_ptr_type_with_copydispose + visible to pch. + +2008-10-24 Josh Conner + + Radar 6305331 + * config/arm/arm.h (TARGET_COMPACT_SWITCH_TABLES): Define... + (CASE_VECTOR_SHORTEN_MODE): ...use. + (ASM_OUTPUT_ADDDR_DIFF_VEC): ...use. + * config/arm/arm.md (casesi): ...use. + (thumb_casesi_internal): ...use. + +2008-10-23 Fariborz Jahanian + + Radar 6307941 + * config/darwin.h (OBJC2_ABI_DISPATCH): New macro. + +2008-10-23 Caroline Tice + + Radar 6300081 + * tree.c(build_block_pointer_type): Add call to + build_generic_block_struct_type to initialize + generic_block_literal_struct_type if necessary. + * cp/parser.c (build_generic_block_struct_type): Update comments. + (build_block_struct_type): Remove call to + build_generic_block_struct_type. + (make_block_pointer_declarator): Likewise. + * c-decl.c (make_block_pointer_declarator): Likewise. + * c-parser.c (build_block_struct_type): Likewise. + (build_generic_block_struct_type): Update comments. + +2008-10-22 Caroline Tice + + Radar 6300081 + * c-parser.c (build_generic_block_struct_type): Add comments. + * cp/parser.c (build_generic_block_struct_type): Add comments. + +2008-10-22 Caroline Tice + + Radar 6300081 & Radar 6163705 + * tree.h (generic_block_literal_struct_type): Extern global variable + decl. + (build_generic_block_struct_type): New extern function decl. + * cp/parser (build_generic_block_struct_type): New function. + (build_block_struct_type): Call build_generic_block_struct_type + to initialize generic_block_literal_struct_type. + (make_block_pointer_declarator): Likewise. + (declare_block_prologue_local_vars): Temporarily set input_location + to 1 before the start of the block function; re-set input_location at + the end of this function. + * dwarf2out.c (add_type_attribute): If the type is a + BLOCK_POINTER_TYPE, assign it to be a pointer to a + generic_block_literal_struct_type. + * c-decl.c (make_block_pointer_declarator): Call + build_generic_block_struct_type to initialize + generic_block_literal_struct_type. + * c-common.c (generic_block_literal_struct_type): New global variable. + * c-parser.c (build_generic_block_struct_type): New function. + (build_block_struct_type): Call build_generic_block_struct_type + to initialize generic_block_literal_struct_type. + * testsuite/gcc.apple/block-debug-1.c: Fix test to work with new + compiler modifications. + * testsuite/gcc.apple/block-debug-2.c: Likewise. + * testsuite/g++.apple/block-debug-1.C: Likewise. + * testsuite/g++.apple/block-debug-2.C: Likewise. + +2008-10-22 Fariborz Jahanian + + Radar 6310599 + * dwarf2out.c: forwarding is now __forwarding + * c-decl.c: All internal field names in block internal types + have '__' prefix. + * c-typeck.c: Ditto + * c-common.c: Ditto + * c-parser.c: Ditto + +2008-10-21 Stuart Hastings + + Radar 6187262 + * tree-ssa-loop-ivopts.c (may_be_nonaddressable): Treat + "(vector)scalar" like "(aggregate)scalar". + +2008-10-21 Fariborz Jahanian + + Radar 4746503 + * toplev.c (warn_deprecated_use): Do not issue + any deprecated warning in a function that itself + is deprecated. + +2008-10-20 Stuart Hastings + + Radar 6222167 + * sse.md (sse_4_1_smax3, sse_4_1_umax3, + sse_4_1_smin3, sse_4_1_umin3): Drop '*' so these + are visible... + * i386.c (__builtin_ia32_pmaxsb128, __builtin_ia32_pmaxsd128, + __builtin_ia32_pmaxud128, __builtin_ia32_pmaxuw128, + __builtin_ia32_pminsb128, __builtin_ia32_pminsd128, + __builtin_ia32_pminud128, __builtin_ia32_pminuw128): + ...here. Use CODE_FOR_sse4_1_XX codes. + +2008-10-20 Stuart Hastings + + Radar 6227434 + * config/i386/i386.c (legitimate_pic_addres_disp_p): Use #if + TARGET_MACHO for Linux portability. + +2008-10-20 Fariborz Jahanian + + Radar 6255595 + * config/darwin.c (output_objc_section_asm_op): Add two new section names. + (objc_internal_variable_name): New routine. + (machopic_select_section): Call objc_internal_variable_name. + * config/darwin-sections.def: Define two new kinds of + __DATA section. + +2008-10-17 Fariborz Jahanian + + Radar 6289031 + * c-parser.c: Removed all code related to + radar 6083129 (byref escapes). + * c-common.h: Removed all declarations + related to radar 6083129 (byref escapes). + * c-typeck.c: Removed all code related to + radar 6083129 (byref escapes). + * c-decl.c: Removed all code related to + radar 6083129 (byref escapes). + (finish_decl): Add code to cleanup a + __block declared variable. + (build_block_byref_decl): Add code to cleanup a + __block declared variable. + +2008-10-15 Stuart Hastings + + Radar 6255801 + * objc/objc-act.c (objc_set_global_decl_fields): Set + DECL_USER_ALIGN on OBJC metadata to keep only word + alignment. + +2008-10-17 Stuart Hastings + + Radar 6227434 + * config/i386/i386.c (legitimate_pic_address_disp_p): All + static variables are addressed as global under -m64 + -mfix-and-continue, except Objective-C metadata. + +2008-10-17 Caroline Tice + + Radar 6292557 + * dwarf2out.c (add_inlined_section_entry): If the + function does not have any debug info, don't try + to add it to the dwarf inlined section. + * testsuite/gcc.apple/r6292557.c: New testcase. + +2008-10-16 Fariborz Jahanian + + Radar 6276695 + + (Removed all references to __byref and removed '|' syntax for byref decls.) + * cp/decl.c: Modifed + * cp/parser.c: Modifed + * c-decl.c: Modifed + * c-typeck.c: Modifed + * c-common.c: Modifed + * c-common.h: Modifed + * c-parser.c: Modifed + * config/darwin-c.c: Modified + +2008-10-16 Josh Conner + + Radar 6288519 + * config/arm/arm.md (casesi): Disallow for TARGET_THUMB && + TARGET_LONG_CALLS. + (thumb_casesi_internal): Likewise. + +2008-10-14 Fariborz Jahanian + + Radar 6286881 + * fold-const.c (fold_binary): Type of operands to + TRUTH_NOT_EXPR must match. + +2008-10-10 Fariborz Jahanian + + Radar 5847213 - New Block ABI + * dwarf2out.c (add_type_attribute): Unusuable code + for radar 5811943 is removed. + * c-decl.c (build_block_byref_decl): Removed unneeded + build of block_original_byref_decl_list. + (build_block_internal_types): Removed. + (build_block_descriptor_type): New routine to build the descriptor type. + (make_block_pointer_declarator): Unused code is removed. + * c-typeck.c (build_block_call): New code gen for block calls. + * c-common.c (invoke_impl_ptr_type): Removed. + * c-common.h (block_original_byref_decl_list, build_block_internal_types): Removed + (build_block_descriptor_type, BLOCK_HAS_DESCRIPTOR): Decls added. + * c-parser.c (build_block_struct_type): Block literal expression internal type + is redeclared into its new layout. + (build_block_struct_initlist): Initializer list for above type is redone. + (build_descriptor_block_decl): New routine to declare the descriptor variable + (build_block_literal_tmp): Modified for the new type and initiazation. + +2008-10-10 Stuart Hastings + + Radar 6107012 + * ipa-type-escape.c (parent_type_p_pset): New. + (check_cast_type): Initialize it. (parent_type_p): Use it. + +2008-10-10 Stuart Hastings + + Radar 6227434 + * config/i386/i386.c (legitimate_pic_address_disp_p): All + static variables are addressed as global under -m64 + -mfix-and-continue. + +2008-10-10 Caroline Tice a + + Radar 6275985 + * dwarf2out.c (debug_inlined_section): New global variable. + (struct indirect_string_node): Add new field, is_fn_name. + (inlined_ref): New typedef. + (struct inlined_entry_struct): New global type. + (DWARF_INLINED_HEADER_SIZE): New constant. + (debug_inlined_table): New global variable. + (size_of_inlined): New function. + (add_inlined_section_entry): New function. + (output_debug_inlined_section): New function. + (add_AT_string): set new field, is_fn_name, to true if the + string is a function name. + (AT_string_form): Force the form to always be a string pointer + if the string is a function name. + (has_AT): New function. + (add_abstract_origin_attribute): Make sure any function that + gets inlined as the DW_AT_inline attribute. + (get_inlined_subroutine_die): Call add_inlined_section_entry, to + add it to the new section. + (dwarf2init): Allocate the new debug_inlined_table; initialize + debug_inlined_section if DEBUG_INLINED_SECTION is defined. + (prune_unused_types): Make sure function names always go into + the debug_str_hash table. + (dwarf2out_finish): if DEBUG_INLINED_SECTION is defined, + switch to the debug_inlined_section and call + output_debug_inlined_section. + * config/darwin.h: define DEBUG_INLINED_SECTION. + * config/darwin.c (darwin_file_start): Add DEBUG_INLINED_SECTION + to list of debug sections. + +2008-10-09 Fariborz Jahanian + + Radar 6269491 + * config/darwin.h (darwin_ms_struct): Remove addition + of -Wno-non-lvalue-assign when -fobjc-gc is specified. + +2008-10-09 Caroline Tice + + Radar 6163705 (again) + * function.c (find_block_prologue_insns): Don't worry about + other insns before the prologue insns, if the optimization level + is zero. + +2008-10-07 Stuart Hastings + + Radar 6258941 + gcc/cfgbuild.c (control_flow_insn_p): Treat unconditional TRAP + like any conditional TRAP. + +2008-10-06 Fariborz Jahanian + + Radar 6268817 + * c-decl.c (check_for_loop_decls): Block helper function + is OK if declared in a for-loop main statement block. + +2008-10-03 Josh Conner + + Radar 6268204 + * doc/invoke.texi (-mkernel): Document that -mlong-branch + is set for ARM. + * config/arm/darwin.h (SUBTARGET_OVERRIDE_OPTIONS): Have -mkernel + and -fapple-kext imply -mlong-branch. + +2008-10-02 Fariborz Jahanian + + Radar 6246527 + * attribs.c (decl_attributes): Added support for adding attributes + on block pointer variable declarations. + * c-common.c (block_delta_format_args): Add + (any_recognized_block_attribute): Add + * c-common.h (any_recognized_block_attribute): New decl. + * c-parser.c (c_parser_block_literal_expr): Call to do the delta + on printf attribute. + +2008-10-02 Stuart Hastings + + Radar 5919583 + * config/i386/emmintin.h (_mm_srli_si128, _mm_srli_si128): + Revise to invoke __builtin_ia32_pslldqi128_byteshift and + __builtin_ia32_psrldqi128_byteshift, remove parameters and + move multiplication by 8 from here... + * config/i386/i386.c (ix86_expand_builtin): ...to here. Add + support for IX86_BUILTIN_PSLLDQI128_BYTESHIFT and + IX86_BUILTIN_PSRLDQI128_BYTESHIFT. + (IX86_BUILTIN_PSLLDQI128_BYTESHIFT, + IX86_BUILTIN_PSRLDQI128_BYTESHIFT, + __builtin_ia32_pslldqi128_byteshift, + __builtin_ia32_psrldqi128_byteshift): New. + +2008-10-01 Fariborz Jahanian + + Radar 6252174 + * config/darwin.c (machopic_select_section): Send objc_msgSendSuper* + symbol to msgrefs section. + +2008-09-30 Fariborz Jahanian + + Radar 6261552 + * gimplify (gimplify_return_expr): code to check for + cur_block is removed. + +2008-09-30 Fariborz Jahanian + + Radar 6230297 + * c-parser.c (build_block_struct_initlist): 'trivial' + block temporary can be static as well. + (build_block_literal_tmp): Accomodate 'trivial' block + literal temporary variable as static. + +2008-09-30 Fariborz Jahanian + + Radar 6225809 + * c-decl.c (build_block_byref_decl): Add __block vaiables + to intervening blocks. + +2008-09-30 Stuart Hastings + + Radar 5919583 + Revert 2008-09-26 patch. + +2008-09-30 Caroline Tice + + Radars 6237086 & 6237616 + * dwarf2out.c (find_block_byref_var_real_type): Fix to work whether + TYPE_NAME (block_struct) is an IDENTIFIER_NODE or a TYPE_DECL. + (block_fixup_location_description): New function. + (build_byref_var_location_expression): Add call to + block_fixup_location_description. + (add_block_byref_var_location_attribute): Fix to work whether + TYPE_NAME (block_struct) is an IDENTIFIER_NODE or a TYPE_DECL. + (gen_variable_die): Ditto, when handling block byref variables. + +2008-09-28 Caroline Tice + + Radar 6163705 + * function.c (append_insn_list): Remove function. + (find_and_extract_block_prologue_insns): Renamed (see next entry). + (find_block_prologue_insns): Renamed from + find_and_extract_block_prologue_insns; instead of extracting a + list of prologue insns, it now only finds the prologue insns and + determines if it's safe to move the end-of-prologue note to just + past the last prologue insn; if so it returns the last prologue insn, + otherwise just returns null. + 2008-09-26 Stuart Hastings Radar 5919583 Modified: llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple?rev=58590&r1=58589&r2=58590&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple (original) +++ llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple Sun Nov 2 20:05:45 2008 @@ -1,3 +1,131 @@ +2008-10-31 Fariborz Jahanian + + Radar 6175959 + * parser.c (synth_copy_helper_block_func): Use the new API + _Block_object_assign for ObjC object copying. + (block_object_dispose): New + (synth_destroy_helper_block_func): Call block_object_dispose + to use new _Block_object_dispose API for ObjC object release. + +2008-10-29 Fariborz Jahanian + + Radar 6329245 + * typeck.c (build_block_call): Block call is reverted back + to old ABI. + (build_block_descriptor_type): Removed "FuncPtr" field. + (build_generic_block_struct_type): This struct is partially reverted + to define a layout matching old ABI. + (build_block_struct_type): Ditto + (build_block_struct_initlist): Initializer list reflects the new + primary block layout. + +2008-10-28 Fariborz Jahanian + + Radar 6261630 + * parser.c (cp_parser_objc_typename): Parse trailing attribute + in method type. + +2008-10-27 Fariborz Jahanian + + Radar 6231433 + * typeck.c (objc_compare_types, objc_have_common_type): + Take an extra argument for better diagnostics. + * call.c: Ditto + +2008-10-27 Fariborz Jahanian + + Radar 6302949 + * parser.c (objc_cp_parser_at_property): Warn on missing + ',' separator for property attribute list. + +2008-10-24 Fariborz Jahanian + + Radar 6305545 + * semantics.c (expand_or_defer_fn): Lower nested function + of the structors. + +2008-10-24 Fariborz Jahanian + + Radar 5847213 (minor tweak) + * parser.c (build_block_descriptor_type): + Make descriptor_ptr_type and descriptor_ptr_type_with_copydispose + visible to pch. + +2008-10-22 Fariborz Jahanian + + Radar 6310599 + * typeck.c.c: All internal field names in block internal types + have '__' prefix. + * decl.c: Ditto + * semantics.c: Ditto + * pafrser.c: Ditto + +2008-10-17 Fariborz Jahanian + + Radar 6289031 + * decl.c: Removed all code related to + radar 6083129 (byref escapes). + +2008-10-15 Fariborz Jahanian + + Radar 6271728 + * parser.c (cp_parser_objc_method_definition_list): Method + definition always start with '{', or it is error. + +2008-10-14 Fariborz Jahanian + + Radar 6275956 + * semantics.c (finish_this_expr): Reference to "this" in a block + must be looked up. + +2008-10-10 Fariborz Jahanian + + Radar 5847213 - New Block ABI + + * typeck.c (build_block_call): New code gen for block call. + * parser.c (build_descriptor_block_decl) New + (build_block_struct_type): New block literal type. + (build_block_struct_initlist): New block literal initializers. + (build_block_literal_tmp): New block literal variable initialization. + (synth_copy_helper_block_func): Fixed a minor bug (unrelated to this radar). + (build_block_internal_types): Removed. + (build_block_descriptor_type): New routine to build build descriptor type. + (make_block_pointer_declarator): Unnecessary code is removed. + +2008-10-02 Fariborz Jahanian + + Radar 6246527 + * parser.c (cp_parser_block_literal_expr): Call to do the delta + on printf attribute. + +2008-09-30 Fariborz Jahanian + + Radar 6230297 + * parser.c (build_block_struct_initlist): 'trivial' + block temporary can be static as well. + (build_block_literal_tmp): Accomodate 'trivial' block + literal temporary variable as static. + +2008-09-30 Fariborz Jahanian + + Radar 6225809 + * parser.c (build_block_byref_decl): Add __block vaiables + to intervening blocks. + +2008-09-29 Fariborz Jahanian + + Radar 6154598 + tree.c (maybe_dummy_object): Build expression for + copied in "this" in the block. + +2008-09-26 Fariborz Jahanian + + Radar 6243400 + * parser.c (build_block_struct_type): Mostly rewritten + to use C++'s API for building block's main struct so structors + for those data members requiring them are synthesized and + used. + 2008-09-25 Fariborz Jahanian Radar 6244520 Modified: llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple?rev=58590&r1=58589&r2=58590&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple (original) +++ llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple Sun Nov 2 20:05:45 2008 @@ -1,3 +1,68 @@ +2008-10-27 Fariborz Jahanian + + Radar 6231433 + * objc-act.c (objc_compare_types, objc_have_common_type): + Take an extra argument for better diagnostics. + +2008-10-23 Fariborz Jahanian + + Radar 6307941 + * objc-act.c (build_objc_method_call, build_v2_build_objc_method_call, + get_arg_type_list): Take selector name as new argument. + (objc_init): Remove check for flag_objc_legacy_dispatch. + (objc_legacy_dispatched_selector_p): New + (objc_finish_message_expr): Call objc_legacy_dispatched_selector_p + to check on legacy dispatch message or objc2 abi. + +2008-10-16 Fariborz Jahanian + + Radar 6017984 + * objc-act.c (objc_merge_protocol_methods): New + (finish_class): Call objc_merge_protocol_methods for + anonymous categories. + +2008-10-16 Fariborz Jahanian + + Radar 6285794 (tweak) + * objc-act.c: Replace all build_int_cst (NULL_TREE, 0) + with integer_zero_node. + +2008-10-15 Fariborz Jahanian + + Radar 6285794 + * objc-act.c: All 0 initializers are converted to + pointer type of the initialized field, to suit + llvm-gcc restriction. + +2008-10-13 Fariborz Jahanian + + Radar 6255913 + * objc-act.c (build_protocollist_translation_table): Generate a + coalessable name for protocol meta-data reference with "l_OBJC" prefix. + (build_v2_protocol_reference): declare a 'weak' 'extern hidden' + symbol for protocol meta-data. + +2008-10-03 Fariborz Jahanian + + Radar 6267049 + * objc-act.c (objc_get_protocol_qualified_type): Issue error on bogus + protocol qualified syntax. + +2008-10-03 Fariborz Jahanian + + Radar 6264448 + * objc-act.c (objc_build_compound_setter_call): Do the default conversion + on temporary after it is passed to the setter call. + +2008-10-01 Fariborz Jahanian + + Radar 6255671 + * objc-act.c (managed_objc_object_pointer): block pointer + is also an ObjC pointer for property purposes. + (objc_add_property_variable): Issue hard error when + property of block pointer type is defaulted to + 'assign' attribute. + 2008-09-23 Fariborz Jahanian Radar 6230701 From resistor at mac.com Sun Nov 2 20:33:28 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 03 Nov 2008 02:33:28 -0000 Subject: [llvm-commits] [llvm] r58591 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Message-ID: <200811030233.mA32XSLO031832@zion.cs.uiuc.edu> Author: resistor Date: Sun Nov 2 20:33:28 2008 New Revision: 58591 URL: http://llvm.org/viewvc/llvm-project?rev=58591&view=rev Log: Revert my last patch until I consult with Evan about it. Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=58591&r1=58590&r2=58591&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sun Nov 2 20:33:28 2008 @@ -89,8 +89,6 @@ AU.addPreservedID(StrongPHIEliminationID); else AU.addPreservedID(PHIEliminationID); - AU.addRequired(); - AU.addPreserved(); MachineFunctionPass::getAnalysisUsage(AU); } @@ -635,14 +633,6 @@ assert(0 && "Val# is defined by a dead def?"); abort(); } - - // Pre-splitting a vreg that does not have a PHI kill across a barrier - // that is within a loop can potentially create a join that was not - // present before, which would make updating the live intervals very - // difficult. Bailout instead. - MachineLoopInfo& MLI = getAnalysis(); - if (!ValNo->hasPHIKill && MLI.getLoopFor(BarrierMBB)) - return false; // FIXME: For now, if definition is rematerializable, do not split. MachineInstr *DefMI = (ValNo->def != ~0U) From nicholas at mxc.ca Sun Nov 2 20:43:49 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 03 Nov 2008 02:43:49 -0000 Subject: [llvm-commits] [llvm] r58592 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll Message-ID: <200811030243.mA32hoIo032090@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 2 20:43:49 2008 New Revision: 58592 URL: http://llvm.org/viewvc/llvm-project?rev=58592&view=rev Log: Don't crash analyzing certain quadratics (addrec of {X,+,Y,+,1}). We're still waiting on code that actually analyzes them properly. Added: llvm/trunk/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=58592&r1=58591&r2=58592&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Nov 2 20:43:49 2008 @@ -2604,6 +2604,11 @@ // The divisions must be performed as signed divisions. APInt NegB(-B); APInt TwoA( A << 1 ); + if (TwoA.isMinValue()) { + SCEV *CNC = new SCEVCouldNotCompute(); + return std::make_pair(CNC, CNC); + } + ConstantInt *Solution1 = ConstantInt::get((NegB + SqrtVal).sdiv(TwoA)); ConstantInt *Solution2 = ConstantInt::get((NegB - SqrtVal).sdiv(TwoA)); Added: llvm/trunk/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll?rev=58592&view=auto ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll (added) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll Sun Nov 2 20:43:49 2008 @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution +; PR1827 + +declare void @use(i32) + +define void @foo() { +entry: + br label %loop_1 + +loop_1: ; preds = %loop_1, %entry + %a = phi i32 [ 2, %entry ], [ %b, %loop_1 ] ; [#uses=2] + %c = phi i32 [ 5, %entry ], [ %d, %loop_1 ] ; [#uses=1] + %b = add i32 %a, 1 ; [#uses=1] + %d = add i32 %c, %a ; [#uses=3] + %A = icmp ult i32 %d, 50 ; [#uses=1] + br i1 %A, label %loop_1, label %endloop + +endloop: ; preds = %loop_1 + call void @use(i32 %d) + ret void +} From nicholas at mxc.ca Sun Nov 2 21:49:14 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 03 Nov 2008 03:49:14 -0000 Subject: [llvm-commits] [llvm] r58593 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200811030349.mA33nErG001556@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 2 21:49:14 2008 New Revision: 58593 URL: http://llvm.org/viewvc/llvm-project?rev=58593&view=rev Log: Replace explicit loop with utility function. Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=58593&r1=58592&r2=58593&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Sun Nov 2 21:49:14 2008 @@ -1638,10 +1638,8 @@ } else if (isa(*UI) || isa(*UI)) { // Make sure we are calling the function, not passing the address. CallSite CS = CallSite::get(cast(*UI)); - for (CallSite::arg_iterator AI = CS.arg_begin(), - E = CS.arg_end(); AI != E; ++AI) - if (*AI == GV) - return true; + if (CS.hasArgument(GV)) + return true; } else if (LoadInst *LI = dyn_cast(*UI)) { if (LI->isVolatile()) return true; From nicholas at mxc.ca Sun Nov 2 21:50:40 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 03 Nov 2008 03:50:40 -0000 Subject: [llvm-commits] [llvm] r58594 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h Message-ID: <200811030350.mA33oeS7001623@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 2 21:50:40 2008 New Revision: 58594 URL: http://llvm.org/viewvc/llvm-project?rev=58594&view=rev Log: Typo Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=58594&r1=58593&r2=58594&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Sun Nov 2 21:50:40 2008 @@ -558,7 +558,7 @@ return Balance(Left(T), Value(T), Add_internal(V,Right(T))); } - /// Remove_interal - Creates a new tree that includes all the data + /// Remove_internal - Creates a new tree that includes all the data /// from the original tree except the specified data. If the /// specified data did not exist in the original tree, the original /// tree is returned.