From isanbard at gmail.com Mon Jul 7 00:42:27 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 07 Jul 2008 05:42:27 -0000 Subject: [llvm-commits] [llvm] r53166 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp Message-ID: <200807070542.m675gRKc002356@zion.cs.uiuc.edu> Author: void Date: Mon Jul 7 00:42:27 2008 New Revision: 53166 URL: http://llvm.org/viewvc/llvm-project?rev=53166&view=rev Log: Prevent option name conflict. Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=53166&r1=53165&r2=53166&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Mon Jul 7 00:42:27 2008 @@ -154,7 +154,7 @@ char MachineLICM::ID = 0; static RegisterPass -X("machine-licm", "Machine Loop Invariant Code Motion"); +X("machinelicm", "Machine Loop Invariant Code Motion"); FunctionPass *llvm::createMachineLICMPass() { return new MachineLICM(); } From nicholas at mxc.ca Mon Jul 7 01:15:50 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 07 Jul 2008 06:15:50 -0000 Subject: [llvm-commits] [llvm] r53167 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200807070615.m676FoKg003319@zion.cs.uiuc.edu> Author: nicholas Date: Mon Jul 7 01:15:49 2008 New Revision: 53167 URL: http://llvm.org/viewvc/llvm-project?rev=53167&view=rev Log: Handle 'lshr' instruction with SCEVUDiv object. Comment the xor %x, -1 case. 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=53167&r1=53166&r2=53167&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jul 7 01:15:49 2008 @@ -1742,12 +1742,14 @@ } break; case Instruction::Xor: - // If the RHS of the xor is a signbit, then this is just an add. - // Instcombine turns add of signbit into xor as a strength reduction step. if (ConstantInt *CI = dyn_cast(U->getOperand(1))) { + // If the RHS of the xor is a signbit, then this is just an add. + // Instcombine turns add of signbit into xor as a strength reduction step. if (CI->getValue().isSignBit()) return SE.getAddExpr(getSCEV(U->getOperand(0)), getSCEV(U->getOperand(1))); + + // If the RHS of xor is -1, then this is a not operation. else if (CI->isAllOnesValue()) return SE.getNotSCEV(getSCEV(U->getOperand(0))); } @@ -1763,6 +1765,16 @@ } break; + case Instruction::LShr: + // Turn logical shift right of a constant into a unsigned divide. + if (ConstantInt *SA = dyn_cast(U->getOperand(1))) { + uint32_t BitWidth = cast(V->getType())->getBitWidth(); + Constant *X = ConstantInt::get( + APInt(BitWidth, 1).shl(SA->getLimitedValue(BitWidth))); + return SE.getUDivExpr(getSCEV(U->getOperand(0)), getSCEV(X)); + } + break; + case Instruction::Trunc: return SE.getTruncateExpr(getSCEV(U->getOperand(0)), U->getType()); From evan.cheng at apple.com Mon Jul 7 02:18:09 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 07 Jul 2008 07:18:09 -0000 Subject: [llvm-commits] [llvm] r53169 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200807070718.m677I9iq005572@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 7 02:18:09 2008 New Revision: 53169 URL: http://llvm.org/viewvc/llvm-project?rev=53169&view=rev Log: LegalizeSetCCOperands should legalize the result of ExpandLibCall. Patch by Richard Osborne. 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=53169&r1=53168&r2=53169&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jul 7 02:18:09 2008 @@ -4743,7 +4743,7 @@ Tmp1 = DAG.getNode(ISD::OR, Tmp1.getValueType(), Tmp1, Tmp2); Tmp2 = SDOperand(); } - LHS = Tmp1; + LHS = LegalizeOp(Tmp1); RHS = Tmp2; return; } From baldrick at free.fr Mon Jul 7 02:44:29 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 7 Jul 2008 09:44:29 +0200 Subject: [llvm-commits] [llvm] r53166 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <200807070542.m675gRKc002356@zion.cs.uiuc.edu> References: <200807070542.m675gRKc002356@zion.cs.uiuc.edu> Message-ID: <200807070944.30374.baldrick@free.fr> Hi Bill, > Prevent option name conflict. is it possible to have the options machinery catch this kind of thing automatically? Ciao, Duncan. From isanbard at gmail.com Mon Jul 7 03:29:31 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 7 Jul 2008 01:29:31 -0700 Subject: [llvm-commits] [llvm] r53166 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <200807070944.30374.baldrick@free.fr> References: <200807070542.m675gRKc002356@zion.cs.uiuc.edu> <200807070944.30374.baldrick@free.fr> Message-ID: On Jul 7, 2008, at 12:44 AM, Duncan Sands wrote: > Hi Bill, > >> Prevent option name conflict. > > is it possible to have the options machinery catch > this kind of thing automatically? > I've never looked at it, so can't say. I'd suspect that there would be a way, though. -bw From duncan.sands at math.u-psud.fr Mon Jul 7 05:05:36 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Mon, 7 Jul 2008 12:05:36 +0200 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r53035_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_include/llvm/CodeGen/SelectionDAG=2Eh=09lib/CodeGen/Se?= =?iso-8859-1?q?lectionDAG/LegalizeDAG=2Ecpp_lib/CodeGen/SelectionDAG/Sele?= =?iso-8859-1?q?ctionDAG=2Ecpp_lib/CodeGen/SelectionDAG/SelectionDAGISel?= =?iso-8859-1?q?=2Ecpp_lib/Target/ARM/ARMISelLowering=2Ecpp=09lib/Target/C?= =?iso-8859-1?q?ellSPU/SPUISelLowering=2Ecpp_lib/Target/PowerPC/PPCISelLow?= =?iso-8859-1?q?ering=2Ecpp=09lib/Target/Sparc/SparcISelLowering=2Ecpp_lib?= =?iso-8859-1?q?/Target/X86/X86ISelLowering=2Ecpp?= In-Reply-To: <12DE7596-F9DA-4A63-9825-F6778882F33E@apple.com> References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <200807042041.02925.duncan.sands@math.u-psud.fr> <12DE7596-F9DA-4A63-9825-F6778882F33E@apple.com> Message-ID: <200807071205.36771.duncan.sands@math.u-psud.fr> Hi Mon Ping, > I ran into the problem when I was playing with "widening*" vector > types. It is something I haven't submitted a patch for so my test > case will not work for you at this point. What problem do you think > will occur in LegalizeTypes? If you can let me know, I can do a quick > look into it. in LegalizeTypes.cpp you can find DAGTypeLegalizer::CreateStackStoreLoad. It seems to me that the created stack object should have the best alignment of the two types, in order to avoid unaligned loads/stores. I think the right thing to do is to audit every use of CreateStackTemporary looking for similar problems. Ciao, Duncan. From kremenek at apple.com Mon Jul 7 11:20:55 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 07 Jul 2008 16:20:55 -0000 Subject: [llvm-commits] [llvm] r53171 - /llvm/trunk/include/llvm/ADT/ImmutableMap.h Message-ID: <200807071620.m67GKu1o001033@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jul 7 11:20:55 2008 New Revision: 53171 URL: http://llvm.org/viewvc/llvm-project?rev=53171&view=rev Log: Removed ImmutableMap::SlimFind and replaced it with ImmutableMap::lookup. The new method does the same thing, except that it returns a pointer to the mapped data type, and not to an internal tree node. Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableMap.h?rev=53171&r1=53170&r2=53171&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Mon Jul 7 11:20:55 2008 @@ -194,17 +194,15 @@ iterator begin() const { return iterator(Root); } iterator end() const { return iterator(); } - TreeTy* SlimFind(key_type_ref K) const { + data_type* lookup(key_type_ref K) const { if (Root) { TreeTy* T = Root->find(K); - if (T) return T; + if (T) return &T->getValue().second; } - return NULL; + return 0; } - // FIXME: Add 'find' that returns an iterator instead of a TreeTy*. - //===--------------------------------------------------===// // Utility methods. //===--------------------------------------------------===// From evan.cheng at apple.com Mon Jul 7 12:19:41 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 7 Jul 2008 10:19:41 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> Message-ID: <549A4A0A-7767-4A93-988F-FDF2CE0FEF85@apple.com> It would be nice if someone with configure foo can help with this. Perhaps Eric? Thanks, Evan On Jul 4, 2008, at 7:12 PM, Devang Patel wrote: > > On Jul 4, 2008, at 12:01 AM, Evan Cheng wrote: > >> Hi Devang, >> >> Does this work for older Mac OS X ld? That is, would older ld >> silently >> ignore the options? > > > GCC drive does not know about ld versions. The older linker will > complain and fail. This is a debugging aid for compiler folks. Feel > free to add configure test to check whether linker supports this flag > or not. I think, that is unnecessary but I'll not stop anyone :) > - > Devang > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Mon Jul 7 12:46:23 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 17:46:23 -0000 Subject: [llvm-commits] [llvm] r53177 - in /llvm/trunk: include/llvm/ADT/DenseMap.h include/llvm/ADT/DenseSet.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/ScheduleDAG.cpp lib/Linker/LinkModules.cpp lib/Target/X86/X86InstrInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200807071746.m67HkOWv003793@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 12:46:23 2008 New Revision: 53177 URL: http://llvm.org/viewvc/llvm-project?rev=53177&view=rev Log: Make DenseMap's insert return a pair, to more closely resemble std::map. Modified: llvm/trunk/include/llvm/ADT/DenseMap.h llvm/trunk/include/llvm/ADT/DenseSet.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp llvm/trunk/lib/Linker/LinkModules.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=53177&r1=53176&r2=53177&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Mon Jul 7 12:46:23 2008 @@ -147,14 +147,16 @@ return end(); } - bool insert(const std::pair &KV) { + std::pair insert(const std::pair &KV) { BucketT *TheBucket; if (LookupBucketFor(KV.first, TheBucket)) - return false; // Already in map. + return std::make_pair(iterator(TheBucket, Buckets+NumBuckets), + false); // Already in map. // Otherwise, insert the new element. - InsertIntoBucket(KV.first, KV.second, TheBucket); - return true; + TheBucket = InsertIntoBucket(KV.first, KV.second, TheBucket); + return std::make_pair(iterator(TheBucket, Buckets+NumBuckets), + true); } bool erase(const KeyT &Val) { Modified: llvm/trunk/include/llvm/ADT/DenseSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseSet.h?rev=53177&r1=53176&r2=53177&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseSet.h (original) +++ llvm/trunk/include/llvm/ADT/DenseSet.h Mon Jul 7 12:46:23 2008 @@ -41,10 +41,6 @@ return TheMap.count(V); } - bool insert(const ValueT &V) { - return TheMap.insert(std::make_pair(V, 0)); - } - void erase(const ValueT &V) { TheMap.erase(V); } @@ -90,6 +86,10 @@ const_iterator begin() const { return ConstIterator(TheMap.begin()); } const_iterator end() const { return ConstIterator(TheMap.end()); } + + std::pair insert(const ValueT &V) { + return TheMap.insert(std::make_pair(V, 0)); + } }; } // end namespace llvm Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53177&r1=53176&r2=53177&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jul 7 12:46:23 2008 @@ -115,7 +115,7 @@ LegalizedNodes.insert(std::make_pair(To, To)); } void AddPromotedOperand(SDOperand From, SDOperand To) { - bool isNew = PromotedNodes.insert(std::make_pair(From, To)); + bool isNew = PromotedNodes.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)); @@ -6734,7 +6734,8 @@ } // Remember in a map if the values will be reused later. - bool isNew = ExpandedNodes.insert(std::make_pair(Op, std::make_pair(Lo, Hi))); + bool isNew = + ExpandedNodes.insert(std::make_pair(Op, std::make_pair(Lo, Hi))).second; assert(isNew && "Value already expanded?!?"); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=53177&r1=53176&r2=53177&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Mon Jul 7 12:46:23 2008 @@ -413,9 +413,10 @@ unsigned VRBase = 0; if (TargetRegisterInfo::isVirtualRegister(SrcReg)) { // Just use the input register directly! + SDOperand Op(Node, ResNo); if (IsClone) - VRBaseMap.erase(SDOperand(Node, ResNo)); - bool isNew = VRBaseMap.insert(std::make_pair(SDOperand(Node,ResNo),SrcReg)); + VRBaseMap.erase(Op); + bool isNew = VRBaseMap.insert(std::make_pair(Op, SrcReg)).second; isNew = isNew; // Silence compiler warning. assert(isNew && "Node emitted out of order - early"); return; @@ -472,9 +473,10 @@ TII->copyRegToReg(*BB, BB->end(), VRBase, SrcReg, DstRC, SrcRC); } + SDOperand Op(Node, ResNo); if (IsClone) - VRBaseMap.erase(SDOperand(Node, ResNo)); - bool isNew = VRBaseMap.insert(std::make_pair(SDOperand(Node,ResNo), VRBase)); + VRBaseMap.erase(Op); + bool isNew = VRBaseMap.insert(std::make_pair(Op, VRBase)).second; isNew = isNew; // Silence compiler warning. assert(isNew && "Node emitted out of order - early"); } @@ -532,7 +534,8 @@ MI->addOperand(MachineOperand::CreateReg(VRBase, true)); } - bool isNew = VRBaseMap.insert(std::make_pair(SDOperand(Node,i), VRBase)); + SDOperand Op(Node, i); + bool isNew = VRBaseMap.insert(std::make_pair(Op, VRBase)).second; isNew = isNew; // Silence compiler warning. assert(isNew && "Node emitted out of order - early"); } @@ -786,7 +789,8 @@ } else assert(0 && "Node is not insert_subreg, extract_subreg, or subreg_to_reg"); - bool isNew = VRBaseMap.insert(std::make_pair(SDOperand(Node,0), VRBase)); + SDOperand Op(Node, 0); + bool isNew = VRBaseMap.insert(std::make_pair(Op, VRBase)).second; isNew = isNew; // Silence compiler warning. assert(isNew && "Node emitted out of order - early"); } @@ -992,7 +996,7 @@ // Copy from physical register. assert(I->Reg && "Unknown physical register!"); unsigned VRBase = MRI.createVirtualRegister(SU->CopyDstRC); - bool isNew = VRBaseMap.insert(std::make_pair(SU, VRBase)); + bool isNew = VRBaseMap.insert(std::make_pair(SU, VRBase)).second; isNew = isNew; // Silence compiler warning. assert(isNew && "Node emitted out of order - early"); TII->copyRegToReg(*BB, BB->end(), VRBase, I->Reg, Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=53177&r1=53176&r2=53177&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Jul 7 12:46:23 2008 @@ -114,7 +114,7 @@ /// insert - This returns true if the pointer was new to the set, false if it /// was already in the set. bool insert(const Type *Src, const Type *Dst) { - if (!TheMap.insert(std::make_pair(Src, PATypeHolder(Dst)))) + if (!TheMap.insert(std::make_pair(Src, PATypeHolder(Dst))).second) return false; // Already in map. if (Src->isAbstract()) Src->addAbstractTypeUser(this); Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=53177&r1=53176&r2=53177&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Jul 7 12:46:23 2008 @@ -209,11 +209,13 @@ for (unsigned i = 0, e = array_lengthof(OpTbl2Addr); i != e; ++i) { unsigned RegOp = OpTbl2Addr[i][0]; unsigned MemOp = OpTbl2Addr[i][1]; - if (!RegOp2MemOpTable2Addr.insert(std::make_pair((unsigned*)RegOp, MemOp))) + if (!RegOp2MemOpTable2Addr.insert(std::make_pair((unsigned*)RegOp, + MemOp)).second) assert(false && "Duplicated entries?"); unsigned AuxInfo = 0 | (1 << 4) | (1 << 5); // Index 0,folded load and store if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, - std::make_pair(RegOp, AuxInfo)))) + std::make_pair(RegOp, + AuxInfo))).second) AmbEntries.push_back(MemOp); } @@ -297,14 +299,15 @@ for (unsigned i = 0, e = array_lengthof(OpTbl0); i != e; ++i) { unsigned RegOp = OpTbl0[i][0]; unsigned MemOp = OpTbl0[i][1]; - if (!RegOp2MemOpTable0.insert(std::make_pair((unsigned*)RegOp, MemOp))) + if (!RegOp2MemOpTable0.insert(std::make_pair((unsigned*)RegOp, + MemOp)).second) assert(false && "Duplicated entries?"); unsigned FoldedLoad = OpTbl0[i][2]; // Index 0, folded load or store. unsigned AuxInfo = 0 | (FoldedLoad << 4) | ((FoldedLoad^1) << 5); if (RegOp != X86::FsMOVAPDrr && RegOp != X86::FsMOVAPSrr) if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, - std::make_pair(RegOp, AuxInfo)))) + std::make_pair(RegOp, AuxInfo))).second) AmbEntries.push_back(MemOp); } @@ -423,12 +426,13 @@ for (unsigned i = 0, e = array_lengthof(OpTbl1); i != e; ++i) { unsigned RegOp = OpTbl1[i][0]; unsigned MemOp = OpTbl1[i][1]; - if (!RegOp2MemOpTable1.insert(std::make_pair((unsigned*)RegOp, MemOp))) + if (!RegOp2MemOpTable1.insert(std::make_pair((unsigned*)RegOp, + MemOp)).second) assert(false && "Duplicated entries?"); unsigned AuxInfo = 1 | (1 << 4); // Index 1, folded load if (RegOp != X86::FsMOVAPDrr && RegOp != X86::FsMOVAPSrr) if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, - std::make_pair(RegOp, AuxInfo)))) + std::make_pair(RegOp, AuxInfo))).second) AmbEntries.push_back(MemOp); } @@ -629,11 +633,12 @@ for (unsigned i = 0, e = array_lengthof(OpTbl2); i != e; ++i) { unsigned RegOp = OpTbl2[i][0]; unsigned MemOp = OpTbl2[i][1]; - if (!RegOp2MemOpTable2.insert(std::make_pair((unsigned*)RegOp, MemOp))) + if (!RegOp2MemOpTable2.insert(std::make_pair((unsigned*)RegOp, + MemOp)).second) assert(false && "Duplicated entries?"); unsigned AuxInfo = 2 | (1 << 4); // Index 1, folded load if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, - std::make_pair(RegOp, AuxInfo)))) + std::make_pair(RegOp, AuxInfo))).second) AmbEntries.push_back(MemOp); } Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=53177&r1=53176&r2=53177&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jul 7 12:46:23 2008 @@ -85,7 +85,7 @@ /// AddToWorkList - Add the specified instruction to the worklist if it /// isn't already in it. void AddToWorkList(Instruction *I) { - if (WorklistMap.insert(std::make_pair(I, Worklist.size()))) + if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) Worklist.push_back(I); } From echristo at apple.com Mon Jul 7 12:48:02 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 7 Jul 2008 10:48:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: <549A4A0A-7767-4A93-988F-FDF2CE0FEF85@apple.com> References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> <549A4A0A-7767-4A93-988F-FDF2CE0FEF85@apple.com> Message-ID: <8C608FC2-A280-4141-A0BB-0C9D163E89B4@apple.com> On Jul 7, 2008, at 10:19 AM, Evan Cheng wrote: > It would be nice if someone with configure foo can help with this. > Perhaps Eric? Sure. There are a few ways you can go about this: a) add a configure specific flag --enable-llvm-lto or something that will be off by default or something of that sort. or (icky) b) basically check for a version number of ld that will support the flag. there are some examples in gcc/configure.ac that show how to do this for gnu ld or (preferred) c) add support to ld to print out the command line options it recognizes (--help maybe? -h?) and then use something simple like: # Check if linker supports -mllvm if $gcc_cv_ld --help 2>/dev/null | grep mllvm > /dev/null; then gcc_cv_ld_llvm=yes fi You'll need a little more wrapper around that, but this last is the easiest way to go if someone bugs Nick to put option listing support in. -eric From gohman at apple.com Mon Jul 7 12:52:43 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 17:52:43 -0000 Subject: [llvm-commits] [llvm] r53178 - /llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Message-ID: <200807071752.m67Hqhqv004018@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 12:52:43 2008 New Revision: 53178 URL: http://llvm.org/viewvc/llvm-project?rev=53178&view=rev Log: Use empty() instead of size(). Modified: llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp?rev=53178&r1=53177&r2=53178&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Mon Jul 7 12:52:43 2008 @@ -59,7 +59,7 @@ // Package up features to be passed to target/subtarget std::string FeaturesStr; - if (MCPU.size() || MAttrs.size()) { + if (!MCPU.empty() || !MAttrs.empty()) { SubtargetFeatures Features; Features.setCPU(MCPU); for (unsigned i = 0; i != MAttrs.size(); ++i) From gohman at apple.com Mon Jul 7 13:00:38 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:00:38 -0000 Subject: [llvm-commits] [llvm] r53179 - in /llvm/trunk: include/llvm/ADT/ include/llvm/Analysis/ include/llvm/Support/ include/llvm/Transforms/Utils/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/VMCore/ utils/TableGen/ Message-ID: <200807071800.m67I0c2M004282@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:00:37 2008 New Revision: 53179 URL: http://llvm.org/viewvc/llvm-project?rev=53179&view=rev Log: Add explicit keywords. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h llvm/trunk/include/llvm/Analysis/LoopInfo.h llvm/trunk/include/llvm/Support/Timer.h llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.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/VMCore/LeakDetector.cpp llvm/trunk/lib/VMCore/Type.cpp llvm/trunk/utils/TableGen/Record.h Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Mon Jul 7 13:00:37 2008 @@ -317,7 +317,7 @@ template class FoldingSetIterator : public FoldingSetIteratorImpl { public: - FoldingSetIterator(void **Bucket) : FoldingSetIteratorImpl(Bucket) {} + explicit FoldingSetIterator(void **Bucket) : FoldingSetIteratorImpl(Bucket) {} T &operator*() const { return *static_cast(NodePtr); @@ -345,7 +345,7 @@ protected: void *Ptr; - FoldingSetBucketIteratorImpl(void **Bucket); + explicit FoldingSetBucketIteratorImpl(void **Bucket); FoldingSetBucketIteratorImpl(void **Bucket, bool) : Ptr(reinterpret_cast(Bucket)) {} @@ -369,7 +369,7 @@ template class FoldingSetBucketIterator : public FoldingSetBucketIteratorImpl { public: - FoldingSetBucketIterator(void **Bucket) : + explicit FoldingSetBucketIterator(void **Bucket) : FoldingSetBucketIteratorImpl(Bucket) {} FoldingSetBucketIterator(void **Bucket, bool) : @@ -394,7 +394,7 @@ class FoldingSetNodeWrapper : public FoldingSetNode { T data; public: - FoldingSetNodeWrapper(const T& x) : data(x) {} + explicit FoldingSetNodeWrapper(const T& x) : data(x) {} virtual ~FoldingSetNodeWrapper() {} template Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Mon Jul 7 13:00:37 2008 @@ -611,7 +611,7 @@ private: friend class LoopInfoBase; - LoopBase(BlockT *BB) : ParentLoop(0) { + explicit LoopBase(BlockT *BB) : ParentLoop(0) { Blocks.push_back(BB); } }; Modified: llvm/trunk/include/llvm/Support/Timer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Timer.h?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Timer.h (original) +++ llvm/trunk/include/llvm/Support/Timer.h Mon Jul 7 13:00:37 2008 @@ -44,7 +44,7 @@ bool Started; // Has this time variable ever been started? TimerGroup *TG; // The TimerGroup this Timer is in. public: - Timer(const std::string &N); + explicit Timer(const std::string &N); Timer(const std::string &N, TimerGroup &tg); Timer(const Timer &T); ~Timer(); @@ -116,7 +116,7 @@ Timer &T; TimeRegion(const TimeRegion &); // DO NOT IMPLEMENT public: - TimeRegion(Timer &t) : T(t) { + explicit TimeRegion(Timer &t) : T(t) { T.startTimer(); } ~TimeRegion() { @@ -131,7 +131,7 @@ /// is primarily used for debugging and for hunting performance problems. /// struct NamedRegionTimer : public TimeRegion { - NamedRegionTimer(const std::string &Name); + explicit NamedRegionTimer(const std::string &Name); }; @@ -145,7 +145,7 @@ unsigned NumTimers; std::vector TimersToPrint; public: - TimerGroup(const std::string &name) : Name(name), NumTimers(0) {} + explicit TimerGroup(const std::string &name) : Name(name), NumTimers(0) {} ~TimerGroup() { assert(NumTimers == 0 && "TimerGroup destroyed before all contained timers!"); Modified: llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h Mon Jul 7 13:00:37 2008 @@ -30,7 +30,7 @@ class BasicInliner { public: - BasicInliner(TargetData *T = NULL); + explicit BasicInliner(TargetData *T = NULL); ~BasicInliner(); /// addFunction - Add function into the list of functions to process. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jul 7 13:00:37 2008 @@ -122,8 +122,7 @@ } public: - - SelectionDAGLegalize(SelectionDAG &DAG); + explicit SelectionDAGLegalize(SelectionDAG &DAG); /// getTypeAction - Return how we should legalize values of this type, either /// it is already legal or we need to expand it into multiple registers of Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Jul 7 13:00:37 2008 @@ -284,7 +284,7 @@ public SelectionDAG::DAGUpdateListener { DAGTypeLegalizer &DTL; public: - NodeUpdateListener(DAGTypeLegalizer &dtl) : DTL(dtl) {} + explicit NodeUpdateListener(DAGTypeLegalizer &dtl) : DTL(dtl) {} virtual void NodeDeleted(SDNode *N, SDNode *E) { assert(N->getNodeId() != DAGTypeLegalizer::Processed && Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jul 7 13:00:37 2008 @@ -44,7 +44,7 @@ const ARMSubtarget *Subtarget; public: - ARMDAGToDAGISel(ARMTargetMachine &TM) + explicit ARMDAGToDAGISel(ARMTargetMachine &TM) : SelectionDAGISel(Lowering), Lowering(TM), Subtarget(&TM.getSubtarget()) { } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Mon Jul 7 13:00:37 2008 @@ -227,7 +227,7 @@ unsigned GlobalBaseReg; public: - SPUDAGToDAGISel(SPUTargetMachine &tm) : + explicit SPUDAGToDAGISel(SPUTargetMachine &tm) : SelectionDAGISel(*tm.getTargetLowering()), TM(tm), SPUtli(*tm.getTargetLowering()) Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Mon Jul 7 13:00:37 2008 @@ -40,7 +40,7 @@ IA64TargetLowering IA64Lowering; unsigned GlobalBaseReg; public: - IA64DAGToDAGISel(IA64TargetMachine &TM) + explicit IA64DAGToDAGISel(IA64TargetMachine &TM) : SelectionDAGISel(IA64Lowering), IA64Lowering(*TM.getTargetLowering()) {} virtual bool runOnFunction(Function &Fn) { Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Mon Jul 7 13:00:37 2008 @@ -61,7 +61,8 @@ const MipsSubtarget &Subtarget; public: - MipsDAGToDAGISel(MipsTargetMachine &tm) : SelectionDAGISel(MipsLowering), + explicit MipsDAGToDAGISel(MipsTargetMachine &tm) : + SelectionDAGISel(MipsLowering), TM(tm), MipsLowering(*TM.getTargetLowering()), Subtarget(tm.getSubtarget()) {} Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp Mon Jul 7 13:00:37 2008 @@ -57,7 +57,7 @@ PIC16TargetLowering PIC16Lowering; public: - PIC16DAGToDAGISel(PIC16TargetMachine &tm) : + explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) : SelectionDAGISel(PIC16Lowering), TM(tm), PIC16Lowering(*TM.getTargetLowering()) {} Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Jul 7 13:00:37 2008 @@ -45,7 +45,7 @@ const PPCSubtarget &PPCSubTarget; unsigned GlobalBaseReg; public: - PPCDAGToDAGISel(PPCTargetMachine &tm) + explicit PPCDAGToDAGISel(PPCTargetMachine &tm) : SelectionDAGISel(PPCLowering), TM(tm), PPCLowering(*TM.getTargetLowering()), PPCSubTarget(*TM.getSubtargetImpl()) {} Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Mon Jul 7 13:00:37 2008 @@ -35,7 +35,7 @@ /// make the right decision when generating code for different targets. const SparcSubtarget &Subtarget; public: - SparcDAGToDAGISel(TargetMachine &TM) + explicit SparcDAGToDAGISel(TargetMachine &TM) : SelectionDAGISel(Lowering), Lowering(TM), Subtarget(TM.getSubtarget()) { } Modified: llvm/trunk/lib/VMCore/LeakDetector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LeakDetector.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LeakDetector.cpp (original) +++ llvm/trunk/lib/VMCore/LeakDetector.cpp Mon Jul 7 13:00:37 2008 @@ -31,7 +31,7 @@ template struct VISIBILITY_HIDDEN LeakDetectorImpl { - LeakDetectorImpl(const char* const name) : Cache(0), Name(name) { } + explicit LeakDetectorImpl(const char* const name) : Cache(0), Name(name) { } // Because the most common usage pattern, by far, is to add a // garbage object, then remove it immediately, we optimize this Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Mon Jul 7 13:00:37 2008 @@ -431,7 +431,7 @@ namespace { struct BuiltinIntegerType : public IntegerType { - BuiltinIntegerType(unsigned W) : IntegerType(W) {} + explicit BuiltinIntegerType(unsigned W) : IntegerType(W) {} }; } const IntegerType *Type::Int1Ty = new BuiltinIntegerType(1); Modified: llvm/trunk/utils/TableGen/Record.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=53179&r1=53178&r2=53179&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.h (original) +++ llvm/trunk/utils/TableGen/Record.h Mon Jul 7 13:00:37 2008 @@ -151,7 +151,7 @@ class BitsRecTy : public RecTy { unsigned Size; public: - BitsRecTy(unsigned Sz) : Size(Sz) {} + explicit BitsRecTy(unsigned Sz) : Size(Sz) {} unsigned getNumBits() const { return Size; } @@ -268,7 +268,7 @@ class ListRecTy : public RecTy { RecTy *Ty; public: - ListRecTy(RecTy *T) : Ty(T) {} + explicit ListRecTy(RecTy *T) : Ty(T) {} RecTy *getElementType() const { return Ty; } @@ -381,7 +381,7 @@ class RecordRecTy : public RecTy { Record *Rec; public: - RecordRecTy(Record *R) : Rec(R) {} + explicit RecordRecTy(Record *R) : Rec(R) {} Record *getRecord() const { return Rec; } @@ -966,7 +966,7 @@ std::vector SuperClasses; public: - Record(const std::string &N) : Name(N) {} + explicit Record(const std::string &N) : Name(N) {} ~Record() {} const std::string &getName() const { return Name; } From echristo at apple.com Mon Jul 7 13:04:58 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 7 Jul 2008 11:04:58 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53147 - in /llvm-gcc-4.2/trunk: config.sub gcc/Makefile.in gcc/config.gcc gcc/config/mips/mips.c gcc/config/mips/mips.h gcc/config/mips/psp.h gcc/config/mips/t-allegrex In-Reply-To: <200807051908.m65J8V42001510@zion.cs.uiuc.edu> References: <200807051908.m65J8V42001510@zion.cs.uiuc.edu> Message-ID: <5384A761-7705-4D56-8260-033365FAFBEA@apple.com> On Jul 5, 2008, at 12:08 PM, Bruno Cardoso Lopes wrote: > Added: > llvm-gcc-4.2/trunk/gcc/config/mips/psp.h > llvm-gcc-4.2/trunk/gcc/config/mips/t-allegrex > Modified: > llvm-gcc-4.2/trunk/config.sub > llvm-gcc-4.2/trunk/gcc/Makefile.in > llvm-gcc-4.2/trunk/gcc/config.gcc > llvm-gcc-4.2/trunk/gcc/config/mips/mips.c > llvm-gcc-4.2/trunk/gcc/config/mips/mips.h This looks good Bruno. Thanks! -eric From gohman at apple.com Mon Jul 7 13:07:36 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:07:36 -0000 Subject: [llvm-commits] [llvm] r53180 - /llvm/trunk/include/llvm/ADT/FoldingSet.h Message-ID: <200807071807.m67I7aCS004538@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:07:36 2008 New Revision: 53180 URL: http://llvm.org/viewvc/llvm-project?rev=53180&view=rev Log: Remove an unnecessary reinterpret_cast. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=53180&r1=53179&r2=53180&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Mon Jul 7 13:07:36 2008 @@ -348,7 +348,7 @@ explicit FoldingSetBucketIteratorImpl(void **Bucket); FoldingSetBucketIteratorImpl(void **Bucket, bool) - : Ptr(reinterpret_cast(Bucket)) {} + : Ptr(Bucket) {} void advance() { void *Probe = static_cast(Ptr)->getNextInBucket(); From gohman at apple.com Mon Jul 7 13:08:20 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:08:20 -0000 Subject: [llvm-commits] [llvm] r53181 - /llvm/trunk/include/llvm/ADT/SmallVector.h Message-ID: <200807071808.m67I8KMK004572@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:08:20 2008 New Revision: 53181 URL: http://llvm.org/viewvc/llvm-project?rev=53181&view=rev Log: Remove unnecessary static_casts. Modified: llvm/trunk/include/llvm/ADT/SmallVector.h Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=53181&r1=53180&r2=53181&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon Jul 7 13:08:20 2008 @@ -86,7 +86,7 @@ // If this wasn't grown from the inline copy, deallocate the old space. if (!isSmall()) - operator delete(static_cast(Begin)); + operator delete(Begin); } typedef size_t size_type; @@ -362,7 +362,7 @@ // If this wasn't grown from the inline copy, deallocate the old space. if (!isSmall()) - operator delete(static_cast(Begin)); + operator delete(Begin); Begin = NewElts; End = NewElts+CurSize; From gohman at apple.com Mon Jul 7 13:14:29 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:14:29 -0000 Subject: [llvm-commits] [llvm] r53182 - in /llvm/trunk/include/llvm: CodeGen/RegisterCoalescer.h Support/Casting.h Support/GraphWriter.h Message-ID: <200807071814.m67IETZI004789@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:14:29 2008 New Revision: 53182 URL: http://llvm.org/viewvc/llvm-project?rev=53182&view=rev Log: Remove uses of "llvm/Support/Debug.h" from LLVM include files, which all happened be unnecessary. Modified: llvm/trunk/include/llvm/CodeGen/RegisterCoalescer.h llvm/trunk/include/llvm/Support/Casting.h llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/CodeGen/RegisterCoalescer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterCoalescer.h?rev=53182&r1=53181&r2=53182&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RegisterCoalescer.h (original) +++ llvm/trunk/include/llvm/CodeGen/RegisterCoalescer.h Mon Jul 7 13:14:29 2008 @@ -17,7 +17,6 @@ #include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/LiveVariables.h" #include "llvm/Target/TargetRegisterInfo.h" -#include "llvm/Support/Debug.h" #ifndef LLVM_CODEGEN_REGISTER_COALESCER_H #define LLVM_CODEGEN_REGISTER_COALESCER_H Modified: llvm/trunk/include/llvm/Support/Casting.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Casting.h?rev=53182&r1=53181&r2=53182&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Casting.h (original) +++ llvm/trunk/include/llvm/Support/Casting.h Mon Jul 7 13:14:29 2008 @@ -235,7 +235,7 @@ #ifdef DEBUG_CAST_OPERATORS -#include "llvm/Support/Debug.h" +#include "llvm/Support/Streams.h" struct bar { bar() {} Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=53182&r1=53181&r2=53182&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Jul 7 13:14:29 2008 @@ -23,8 +23,8 @@ #ifndef LLVM_SUPPORT_GRAPHWRITER_H #define LLVM_SUPPORT_GRAPHWRITER_H -#include "llvm/Support/Debug.h" #include "llvm/Support/DOTGraphTraits.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/System/Path.h" #include From gohman at apple.com Mon Jul 7 13:26:30 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:26:30 -0000 Subject: [llvm-commits] [llvm] r53183 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807071826.m67IQUBF005163@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:26:29 2008 New Revision: 53183 URL: http://llvm.org/viewvc/llvm-project?rev=53183&view=rev Log: Remove most of the uses of SDOperandPtr, usually replacing it with a simple const SDOperand*, which is what's usually needed. For AddNodeIDOperands, which is small, just duplicate the function to accept an SDUse*. For SelectionDAG::getNode - Add an overload that accepts SDUse* that copies the operands into a temporary SDOperand array, but also has special-case checks for 0 through 3 operands to avoid the copy in the common cases. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53183&r1=53182&r2=53183&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Jul 7 13:26:29 2008 @@ -306,11 +306,14 @@ SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4, SDOperand N5); - SDOperand getNode(unsigned Opcode, MVT VT, SDOperandPtr Ops, unsigned NumOps); + SDOperand getNode(unsigned Opcode, MVT VT, + const SDOperand *Ops, unsigned NumOps); + SDOperand getNode(unsigned Opcode, MVT VT, + const SDUse *Ops, unsigned NumOps); SDOperand getNode(unsigned Opcode, std::vector &ResultTys, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDOperand getNode(unsigned Opcode, const MVT *VTs, unsigned NumVTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDOperand getNode(unsigned Opcode, SDVTList VTs); SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N); SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N1, SDOperand N2); @@ -322,7 +325,7 @@ SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4, SDOperand N5); SDOperand getNode(unsigned Opcode, SDVTList VTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDOperand getMemcpy(SDOperand Chain, SDOperand Dst, SDOperand Src, SDOperand Size, unsigned Align, @@ -383,13 +386,13 @@ /// getMergeValues - Create a MERGE_VALUES node from the given operands. /// Allowed to return something different (and simpler) if Simplify is true. - SDOperand getMergeValues(SDOperandPtr Ops, unsigned NumOps, + SDOperand getMergeValues(const SDOperand *Ops, unsigned NumOps, bool Simplify = true); /// getMergeValues - Create a MERGE_VALUES node from the given types and ops. /// Allowed to return something different (and simpler) if Simplify is true. /// May be faster than the above version if VTs is known and NumOps is large. - SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned NumOps, + SDOperand getMergeValues(SDVTList VTs, const SDOperand *Ops, unsigned NumOps, bool Simplify = true) { if (Simplify && NumOps == 1) return Ops[0]; @@ -446,7 +449,8 @@ SDOperand Op3, SDOperand Op4); SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2, SDOperand Op3, SDOperand Op4, SDOperand Op5); - SDOperand UpdateNodeOperands(SDOperand N, SDOperandPtr Ops, unsigned NumOps); + SDOperand UpdateNodeOperands(SDOperand N, + const SDOperand *Ops, unsigned NumOps); /// SelectNodeTo - These are used for target selectors to *mutate* the /// specified node to have the specified return type, Target opcode, and @@ -460,12 +464,12 @@ SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, - MVT VT2, SDOperandPtr Ops, unsigned NumOps); + MVT VT2, const SDOperand *Ops, unsigned NumOps); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, - MVT VT2, MVT VT3, SDOperandPtr Ops, unsigned NumOps); + MVT VT2, MVT VT3, const SDOperand *Ops, unsigned NumOps); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, @@ -473,7 +477,7 @@ SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); /// getTargetNode - These are used for target selectors to create a new node @@ -488,7 +492,7 @@ SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *getTargetNode(unsigned Opcode, MVT VT, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, SDOperand Op1); SDNode *getTargetNode(unsigned Opcode, MVT VT1, @@ -496,22 +500,22 @@ SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDOperand Op1, SDOperand Op2); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, MVT VT4, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, std::vector &ResultTys, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); /// getNodeIfExists - Get the specified node if it's already available, or /// else return NULL. SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); /// DAGUpdateListener - Clients of various APIs that cause global effects on /// the DAG can optionally implement this interface. This allows the clients @@ -546,7 +550,7 @@ DAGUpdateListener *UpdateListener = 0); void ReplaceAllUsesWith(SDNode *From, SDNode *To, DAGUpdateListener *UpdateListener = 0); - void ReplaceAllUsesWith(SDNode *From, SDOperandPtr To, + void ReplaceAllUsesWith(SDNode *From, const SDOperand *To, DAGUpdateListener *UpdateListener = 0); /// ReplaceAllUsesOfValueWith - Replace any uses of From with To, leaving @@ -638,7 +642,7 @@ SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op, void *&InsertPos); SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op1, SDOperand Op2, void *&InsertPos); - SDNode *FindModifiedNodeSlot(SDNode *N, SDOperandPtr Ops, unsigned NumOps, + SDNode *FindModifiedNodeSlot(SDNode *N, const SDOperand *Ops, unsigned NumOps, void *&InsertPos); void DeleteNodeNotInCSEMaps(SDNode *N); Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=53183&r1=53182&r2=53183&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Jul 7 13:26:29 2008 @@ -1271,7 +1271,7 @@ Prev = 0; Next = 0; } - SDNode(unsigned Opc, SDVTList VTs, SDOperandPtr Ops, unsigned NumOps) + SDNode(unsigned Opc, SDVTList VTs, const SDUse *Ops, unsigned NumOps) : NodeType(Opc), NodeId(-1), UsesSize(0), Uses(NULL) { OperandsNeedDelete = true; NumOperands = NumOps; @@ -1280,8 +1280,8 @@ for (unsigned i = 0; i != NumOps; ++i) { OperandList[i] = Ops[i]; OperandList[i].setUser(this); - Ops[i].Val->addUse(OperandList[i]); - ++Ops[i].Val->UsesSize; + Ops[i].getSDOperand().Val->addUse(OperandList[i]); + ++Ops[i].getSDOperand().Val->UsesSize; } ValueList = VTs.VTs; @@ -1320,7 +1320,7 @@ /// opcode, types, and operands to the specified value. This should only be /// used by the SelectionDAG class. void MorphNodeTo(unsigned Opc, SDVTList L, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); void addUser(unsigned i, SDNode *User) { assert(User->OperandList[i].getUser() && "Node without parent"); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53183&r1=53182&r2=53183&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jul 7 13:26:29 2008 @@ -323,16 +323,26 @@ /// AddNodeIDOperands - Various routines for adding operands to the NodeID data. /// static void AddNodeIDOperands(FoldingSetNodeID &ID, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { for (; NumOps; --NumOps, ++Ops) { ID.AddPointer(Ops->Val); ID.AddInteger(Ops->ResNo); } } +/// AddNodeIDOperands - Various routines for adding operands to the NodeID data. +/// +static void AddNodeIDOperands(FoldingSetNodeID &ID, + const SDUse *Ops, unsigned NumOps) { + for (; NumOps; --NumOps, ++Ops) { + ID.AddPointer(Ops->getSDOperand().Val); + ID.AddInteger(Ops->getSDOperand().ResNo); + } +} + static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC, SDVTList VTList, - SDOperandPtr OpList, unsigned N) { + const SDOperand *OpList, unsigned N) { AddNodeIDOpcode(ID, OpC); AddNodeIDValueTypes(ID, VTList); AddNodeIDOperands(ID, OpList, N); @@ -693,7 +703,7 @@ /// return null, otherwise return a pointer to the slot it would take. If a /// node already exists with these operands, the slot will be non-null. SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N, - SDOperandPtr Ops,unsigned NumOps, + const SDOperand *Ops,unsigned NumOps, void *&InsertPos) { if (N->getOpcode() == ISD::HANDLENODE || N->getValueType(0) == MVT::Flag) return 0; // Never add these nodes. @@ -759,7 +769,7 @@ unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(EltVT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opc, getVTList(EltVT), 0, 0); ID.Add(Val); void *IP = 0; SDNode *N = NULL; @@ -797,7 +807,7 @@ // we don't have issues with SNANs. unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(EltVT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opc, getVTList(EltVT), 0, 0); ID.Add(V); void *IP = 0; SDNode *N = NULL; @@ -846,7 +856,7 @@ Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(VT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0); ID.AddPointer(GV); ID.AddInteger(Offset); void *IP = 0; @@ -861,7 +871,7 @@ SDOperand SelectionDAG::getFrameIndex(int FI, MVT VT, bool isTarget) { unsigned Opc = isTarget ? ISD::TargetFrameIndex : ISD::FrameIndex; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(VT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0); ID.AddInteger(FI); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -875,7 +885,7 @@ SDOperand SelectionDAG::getJumpTable(int JTI, MVT VT, bool isTarget){ unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(VT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0); ID.AddInteger(JTI); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -891,7 +901,7 @@ bool isTarget) { unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(VT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0); ID.AddInteger(Alignment); ID.AddInteger(Offset); ID.AddPointer(C); @@ -910,7 +920,7 @@ bool isTarget) { unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(VT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0); ID.AddInteger(Alignment); ID.AddInteger(Offset); C->AddSelectionDAGCSEId(ID); @@ -926,7 +936,7 @@ SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) { FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::BasicBlock, getVTList(MVT::Other), (SDOperand*)0, 0); + AddNodeIDNode(ID, ISD::BasicBlock, getVTList(MVT::Other), 0, 0); ID.AddPointer(MBB); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -939,7 +949,7 @@ SDOperand SelectionDAG::getArgFlags(ISD::ArgFlagsTy Flags) { FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::ARG_FLAGS, getVTList(MVT::Other), (SDOperand*)0, 0); + AddNodeIDNode(ID, ISD::ARG_FLAGS, getVTList(MVT::Other), 0, 0); ID.AddInteger(Flags.getRawBits()); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -992,7 +1002,7 @@ SDOperand SelectionDAG::getRegister(unsigned RegNo, MVT VT) { FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::Register, getVTList(VT), (SDOperand*)0, 0); + AddNodeIDNode(ID, ISD::Register, getVTList(VT), 0, 0); ID.AddInteger(RegNo); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -1042,7 +1052,7 @@ "SrcValue is not a pointer?"); FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::SRCVALUE, getVTList(MVT::Other), (SDOperand*)0, 0); + AddNodeIDNode(ID, ISD::SRCVALUE, getVTList(MVT::Other), 0, 0); ID.AddPointer(V); void *IP = 0; @@ -1061,7 +1071,7 @@ "SrcValue is not a pointer?"); FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::MEMOPERAND, getVTList(MVT::Other), (SDOperand*)0, 0); + AddNodeIDNode(ID, ISD::MEMOPERAND, getVTList(MVT::Other), 0, 0); ID.AddPointer(v); ID.AddInteger(MO.getFlags()); ID.AddInteger(MO.getOffset()); @@ -1920,7 +1930,7 @@ /// SDOperand SelectionDAG::getNode(unsigned Opcode, MVT VT) { FoldingSetNodeID ID; - AddNodeIDNode(ID, Opcode, getVTList(VT), (SDOperand*)0, 0); + AddNodeIDNode(ID, Opcode, getVTList(VT), 0, 0); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -3076,7 +3086,7 @@ /// getMergeValues - Create a MERGE_VALUES node from the given operands. /// Allowed to return something different (and simpler) if Simplify is true. -SDOperand SelectionDAG::getMergeValues(SDOperandPtr Ops, unsigned NumOps, +SDOperand SelectionDAG::getMergeValues(const SDOperand *Ops, unsigned NumOps, bool Simplify) { if (Simplify && NumOps == 1) return Ops[0]; @@ -3296,7 +3306,28 @@ } SDOperand SelectionDAG::getNode(unsigned Opcode, MVT VT, - SDOperandPtr Ops, unsigned NumOps) { + const SDUse *Ops, unsigned NumOps) { + switch (NumOps) { + case 0: return getNode(Opcode, VT); + case 1: return getNode(Opcode, VT, Ops[0].getSDOperand()); + case 2: return getNode(Opcode, VT, Ops[0].getSDOperand(), + Ops[1].getSDOperand()); + case 3: return getNode(Opcode, VT, Ops[0].getSDOperand(), + Ops[1].getSDOperand(), Ops[2].getSDOperand()); + default: break; + } + + // Copy from an SDUse array into an SDOperand array for use with + // the regular getNode logic. + SmallVector NewOps; + NewOps.reserve(NumOps); + for (unsigned i = 0; i != NumOps; ++i) + NewOps.push_back(Ops[i].getSDOperand()); + return getNode(Opcode, VT, Ops, NumOps); +} + +SDOperand SelectionDAG::getNode(unsigned Opcode, MVT VT, + const SDOperand *Ops, unsigned NumOps) { switch (NumOps) { case 0: return getNode(Opcode, VT); case 1: return getNode(Opcode, VT, Ops[0]); @@ -3345,21 +3376,21 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, std::vector &ResultTys, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { return getNode(Opcode, getNodeValueTypes(ResultTys), ResultTys.size(), Ops, NumOps); } SDOperand SelectionDAG::getNode(unsigned Opcode, const MVT *VTs, unsigned NumVTs, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { if (NumVTs == 1) return getNode(Opcode, VTs[0], Ops, NumOps); return getNode(Opcode, makeVTList(VTs, NumVTs), Ops, NumOps); } SDOperand SelectionDAG::getNode(unsigned Opcode, SDVTList VTList, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { if (VTList.NumVTs == 1) return getNode(Opcode, VTList.VTs[0], Ops, NumOps); @@ -3418,7 +3449,7 @@ } SDOperand SelectionDAG::getNode(unsigned Opcode, SDVTList VTList) { - return getNode(Opcode, VTList, (SDOperand*)0, 0); + return getNode(Opcode, VTList, 0, 0); } SDOperand SelectionDAG::getNode(unsigned Opcode, SDVTList VTList, @@ -3605,7 +3636,7 @@ } SDOperand SelectionDAG:: -UpdateNodeOperands(SDOperand InN, SDOperandPtr Ops, unsigned NumOps) { +UpdateNodeOperands(SDOperand InN, const SDOperand *Ops, unsigned NumOps) { SDNode *N = InN.Val; assert(N->getNumOperands() == NumOps && "Update with wrong number of operands"); @@ -3650,7 +3681,7 @@ /// opcode, types, and operands to the specified value. This should only be /// used by the SelectionDAG class. void SDNode::MorphNodeTo(unsigned Opc, SDVTList L, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { NodeType = Opc; ValueList = L.VTs; NumValues = L.NumVTs; @@ -3693,7 +3724,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT) { SDVTList VTs = getVTList(VT); - return SelectNodeTo(N, TargetOpc, VTs, (SDOperand*)0, 0); + return SelectNodeTo(N, TargetOpc, VTs, 0, 0); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, @@ -3720,14 +3751,14 @@ } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT VT, SDOperandPtr Ops, + MVT VT, const SDOperand *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT); return SelectNodeTo(N, TargetOpc, VTs, Ops, NumOps); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT VT1, MVT VT2, SDOperandPtr Ops, + MVT VT1, MVT VT2, const SDOperand *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2); return SelectNodeTo(N, TargetOpc, VTs, Ops, NumOps); @@ -3740,8 +3771,8 @@ } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT VT1, MVT VT2, MVT VT3, SDOperandPtr Ops, - unsigned NumOps) { + MVT VT1, MVT VT2, MVT VT3, + const SDOperand *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2, VT3); return SelectNodeTo(N, TargetOpc, VTs, Ops, NumOps); } @@ -3772,7 +3803,7 @@ } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - SDVTList VTs, SDOperandPtr Ops, + SDVTList VTs, const SDOperand *Ops, unsigned NumOps) { // If an identical node already exists, use it. FoldingSetNodeID ID; @@ -3811,7 +3842,7 @@ return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1, Op2, Op3).Val; } SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT VT, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Ops, NumOps).Val; } SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT VT1, MVT VT2) { @@ -3839,7 +3870,7 @@ return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, 2, Ops, 3).Val; } SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { const MVT *VTs = getNodeValueTypes(VT1, VT2); return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, 2, Ops, NumOps).Val; } @@ -3857,13 +3888,13 @@ return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, 3, Ops, 3).Val; } SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { const MVT *VTs = getNodeValueTypes(VT1, VT2, VT3); return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, 3, Ops, NumOps).Val; } SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, MVT VT4, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { std::vector VTList; VTList.push_back(VT1); VTList.push_back(VT2); @@ -3874,7 +3905,7 @@ } SDNode *SelectionDAG::getTargetNode(unsigned Opcode, std::vector &ResultTys, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { const MVT *VTs = getNodeValueTypes(ResultTys); return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, ResultTys.size(), Ops, NumOps).Val; @@ -3883,7 +3914,7 @@ /// getNodeIfExists - Get the specified node if it's already available, or /// else return NULL. SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList, - SDOperandPtr Ops, unsigned NumOps) { + const SDOperand *Ops, unsigned NumOps) { if (VTList.VTs[VTList.NumVTs-1] != MVT::Flag) { FoldingSetNodeID ID; AddNodeIDNode(ID, Opcode, VTList, Ops, NumOps); @@ -3993,7 +4024,7 @@ /// This version can replace From with any result values. To must match the /// number and types of values returned by From. void SelectionDAG::ReplaceAllUsesWith(SDNode *From, - SDOperandPtr To, + const SDOperand *To, DAGUpdateListener *UpdateListener) { if (From->getNumValues() == 1) // Handle the simple case efficiently. return ReplaceAllUsesWith(SDOperand(From, 0), To[0], UpdateListener); @@ -4220,7 +4251,7 @@ HandleSDNode::~HandleSDNode() { SDVTList VTs = { 0, 0 }; - MorphNodeTo(ISD::HANDLENODE, VTs, SDOperandPtr(), 0); // Drops operand uses. + MorphNodeTo(ISD::HANDLENODE, VTs, 0, 0); // Drops operand uses. } GlobalAddressSDNode::GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, From kremenek at apple.com Mon Jul 7 13:32:18 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 07 Jul 2008 18:32:18 -0000 Subject: [llvm-commits] [llvm] r53185 - /llvm/tags/checker/checker-58/ Message-ID: <200807071832.m67IWIAD005354@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jul 7 13:32:18 2008 New Revision: 53185 URL: http://llvm.org/viewvc/llvm-project?rev=53185&view=rev Log: Tagging checker-58. Added: llvm/tags/checker/checker-58/ - copied from r53184, llvm/trunk/ From gohman at apple.com Mon Jul 7 13:34:27 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:34:27 -0000 Subject: [llvm-commits] [llvm] r53187 - /llvm/trunk/include/llvm/Support/Allocator.h Message-ID: <200807071834.m67IYREK005433@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:34:27 2008 New Revision: 53187 URL: http://llvm.org/viewvc/llvm-project?rev=53187&view=rev Log: Add a space between * and /* to help simple-minded lexers. Modified: llvm/trunk/include/llvm/Support/Allocator.h Modified: llvm/trunk/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=53187&r1=53186&r2=53187&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Allocator.h (original) +++ llvm/trunk/include/llvm/Support/Allocator.h Mon Jul 7 13:34:27 2008 @@ -55,7 +55,7 @@ return static_cast(Allocate(sizeof(T),AlignOf::Alignment)); } - void Deallocate(void */*Ptr*/) {} + void Deallocate(void * /*Ptr*/) {} void PrintStats() const; }; From gohman at apple.com Mon Jul 7 13:38:14 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:38:14 -0000 Subject: [llvm-commits] [llvm] r53188 - /llvm/trunk/include/llvm/Support/Allocator.h Message-ID: <200807071838.m67IcEDh005544@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:38:14 2008 New Revision: 53188 URL: http://llvm.org/viewvc/llvm-project?rev=53188&view=rev Log: Make BumpPtrAllocator noncopyable. Modified: llvm/trunk/include/llvm/Support/Allocator.h Modified: llvm/trunk/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=53188&r1=53187&r2=53188&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Allocator.h (original) +++ llvm/trunk/include/llvm/Support/Allocator.h Mon Jul 7 13:38:14 2008 @@ -41,6 +41,9 @@ /// allocating memory, and never deletes it until the entire block is dead. This /// makes allocation speedy, but must only be used when the trade-off is ok. class BumpPtrAllocator { + BumpPtrAllocator(const BumpPtrAllocator &); // do not implement + void operator=(const BumpPtrAllocator &); // do not implement + void *TheMemory; public: BumpPtrAllocator(); From gohman at apple.com Mon Jul 7 13:39:33 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:39:33 -0000 Subject: [llvm-commits] [llvm] r53189 - /llvm/trunk/include/llvm/ADT/STLExtras.h Message-ID: <200807071839.m67IdXpB005598@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:39:33 2008 New Revision: 53189 URL: http://llvm.org/viewvc/llvm-project?rev=53189&view=rev Log: Don't use std::advance just to increment or decrement by one. Modified: llvm/trunk/include/llvm/ADT/STLExtras.h Modified: llvm/trunk/include/llvm/ADT/STLExtras.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=53189&r1=53188&r2=53189&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/STLExtras.h (original) +++ llvm/trunk/include/llvm/ADT/STLExtras.h Mon Jul 7 13:39:33 2008 @@ -137,8 +137,7 @@ template inline ItTy next(ItTy it) { - std::advance(it, 1); - return it; + return ++it; } template @@ -151,8 +150,7 @@ template inline ItTy prior(ItTy it) { - std::advance(it, -1); - return it; + return --it; } //===----------------------------------------------------------------------===// From gohman at apple.com Mon Jul 7 13:43:32 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 18:43:32 -0000 Subject: [llvm-commits] [llvm] r53190 - /llvm/trunk/include/llvm/ADT/ilist.h Message-ID: <200807071843.m67IhW1d005713@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 13:43:32 2008 New Revision: 53190 URL: http://llvm.org/viewvc/llvm-project?rev=53190&view=rev Log: Make ilist noncopyable too. Modified: llvm/trunk/include/llvm/ADT/ilist.h Modified: llvm/trunk/include/llvm/ADT/ilist.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=53190&r1=53189&r2=53190&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ilist.h (original) +++ llvm/trunk/include/llvm/ADT/ilist.h Mon Jul 7 13:43:32 2008 @@ -256,6 +256,12 @@ static bool op_less(NodeTy &L, NodeTy &R) { return L < R; } static bool op_equal(NodeTy &L, NodeTy &R) { return L == R; } + + // No fundamental reason why iplist can't by copyable, but the default + // copy/copy-assign won't do. + iplist(const iplist &); // do not implement + void operator=(const iplist &); // do not implement + public: typedef NodeTy *pointer; typedef const NodeTy *const_pointer; From bruno.cardoso at gmail.com Mon Jul 7 14:11:25 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 07 Jul 2008 19:11:25 -0000 Subject: [llvm-commits] [llvm] r53192 - in /llvm/trunk/lib/Target/Mips: MipsISelLowering.cpp MipsInstrFPU.td Message-ID: <200807071911.m67JBQDO006732@zion.cs.uiuc.edu> Author: bruno Date: Mon Jul 7 14:11:24 2008 New Revision: 53192 URL: http://llvm.org/viewvc/llvm-project?rev=53192&view=rev Log: fixed 32-bit fp_to_sint pattern Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsInstrFPU.td Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=53192&r1=53191&r2=53192&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Jul 7 14:11:24 2008 @@ -82,20 +82,24 @@ setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); setOperationAction(ISD::SELECT_CC, MVT::f32, Custom); - if (Subtarget->isSingleFloat()) - setOperationAction(ISD::SELECT_CC, MVT::f64, Expand); - // Load extented operations for i1 types must be promoted setLoadXAction(ISD::EXTLOAD, MVT::i1, Promote); setLoadXAction(ISD::ZEXTLOAD, MVT::i1, Promote); setLoadXAction(ISD::SEXTLOAD, MVT::i1, Promote); // Mips does not have these NodeTypes below. - setOperationAction(ISD::BR_JT, MVT::Other, Expand); - setOperationAction(ISD::BR_CC, MVT::Other, Expand); - setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); - setOperationAction(ISD::SELECT, MVT::i32, Expand); - setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand); + setConvertAction(MVT::f64, MVT::f32, Expand); + + setOperationAction(ISD::BR_JT, MVT::Other, Expand); + setOperationAction(ISD::BR_CC, MVT::Other, Expand); + setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); + setOperationAction(ISD::SELECT, MVT::i32, Expand); + setOperationAction(ISD::UINT_TO_FP, MVT::i32, Expand); + setOperationAction(ISD::FP_TO_UINT, MVT::i32, Expand); + setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand); + + if (Subtarget->isSingleFloat()) + setOperationAction(ISD::SELECT_CC, MVT::f64, Expand); if (!Subtarget->isAllegrex()) { setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i8, Expand); Modified: llvm/trunk/lib/Target/Mips/MipsInstrFPU.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrFPU.td?rev=53192&r1=53191&r2=53192&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrFPU.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrFPU.td Mon Jul 7 14:11:24 2008 @@ -291,6 +291,6 @@ //===----------------------------------------------------------------------===// def : Pat<(f32 (sint_to_fp CPURegs:$src)), (CVTS_W32 (MTC1 CPURegs:$src))>; def : Pat<(f64 (sint_to_fp CPURegs:$src)), (CVTD_W32 (MTC1 CPURegs:$src))>; -def : Pat<(i32 (fp_to_sint FGR32:$src)), (MFC1 (CVTW_SO32 FGR32:$src))>; -def : Pat<(i32 (fp_to_sint AFGR32:$src)), (MFC1 (CVTW_AS32 AFGR32:$src))>; +def : Pat<(i32 (fp_to_sint FGR32:$src)), (MFC1 (TRUNC_W_SO32 FGR32:$src))>; +def : Pat<(i32 (fp_to_sint AFGR32:$src)), (MFC1 (TRUNC_W_AS32 AFGR32:$src))>; From evan.cheng at apple.com Mon Jul 7 14:51:48 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 07 Jul 2008 19:51:48 -0000 Subject: [llvm-commits] [llvm] r53193 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/CodeGen/X86/2008-07-07-DanglingDeadInsts.ll Message-ID: <200807071951.m67JprCS008169@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 7 14:51:32 2008 New Revision: 53193 URL: http://llvm.org/viewvc/llvm-project?rev=53193&view=rev Log: Fix two serious LSR bugs. 1. LSR runOnLoop is always returning false regardless if any transformation is made. 2. AddUsersIfInteresting can create new instructions that are added to DeadInsts. But there is a later early exit which prevents them from being freed. Added: llvm/trunk/test/CodeGen/X86/2008-07-07-DanglingDeadInsts.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=53193&r1=53192&r2=53193&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Jul 7 14:51:32 2008 @@ -1737,6 +1737,7 @@ // live ranges for the IV correctly. CondUse->Offset = SE->getMinusSCEV(CondUse->Offset, *CondStride); CondUse->isUseOfPostIncrementedValue = true; + Changed = true; } bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) { @@ -1754,49 +1755,48 @@ for (BasicBlock::iterator I = L->getHeader()->begin(); isa(I); ++I) AddUsersIfInteresting(I, L, Processed); - // If we have nothing to do, return. - if (IVUsesByStride.empty()) return false; - - // Optimize induction variables. Some indvar uses can be transformed to use - // strides that will be needed for other purposes. A common example of this - // is the exit test for the loop, which can often be rewritten to use the - // computation of some other indvar to decide when to terminate the loop. - OptimizeIndvars(L); - - - // FIXME: We can widen subreg IV's here for RISC targets. e.g. instead of - // doing computation in byte values, promote to 32-bit values if safe. - - // FIXME: Attempt to reuse values across multiple IV's. In particular, we - // could have something like "for(i) { foo(i*8); bar(i*16) }", which should be - // codegened as "for (j = 0;; j+=8) { foo(j); bar(j+j); }" on X86/PPC. Need - // to be careful that IV's are all the same type. Only works for intptr_t - // indvars. - - // If we only have one stride, we can more aggressively eliminate some things. - bool HasOneStride = IVUsesByStride.size() == 1; + if (!IVUsesByStride.empty()) { + // Optimize induction variables. Some indvar uses can be transformed to use + // strides that will be needed for other purposes. A common example of this + // is the exit test for the loop, which can often be rewritten to use the + // computation of some other indvar to decide when to terminate the loop. + OptimizeIndvars(L); + + // FIXME: We can widen subreg IV's here for RISC targets. e.g. instead of + // doing computation in byte values, promote to 32-bit values if safe. + + // FIXME: Attempt to reuse values across multiple IV's. In particular, we + // could have something like "for(i) { foo(i*8); bar(i*16) }", which should + // be codegened as "for (j = 0;; j+=8) { foo(j); bar(j+j); }" on X86/PPC. + // Need to be careful that IV's are all the same type. Only works for + // intptr_t indvars. + + // If we only have one stride, we can more aggressively eliminate some + // things. + bool HasOneStride = IVUsesByStride.size() == 1; #ifndef NDEBUG - DOUT << "\nLSR on "; - DEBUG(L->dump()); + DOUT << "\nLSR on "; + DEBUG(L->dump()); #endif - // IVsByStride keeps IVs for one particular loop. - assert(IVsByStride.empty() && "Stale entries in IVsByStride?"); + // IVsByStride keeps IVs for one particular loop. + assert(IVsByStride.empty() && "Stale entries in IVsByStride?"); - // Sort the StrideOrder so we process larger strides first. - std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); + // Sort the StrideOrder so we process larger strides first. + std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); - // Note: this processes each stride/type pair individually. All users passed - // into StrengthReduceStridedIVUsers have the same type AND stride. Also, - // note that we iterate over IVUsesByStride indirectly by using StrideOrder. - // This extra layer of indirection makes the ordering of strides deterministic - // - not dependent on map order. - for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; ++Stride) { - std::map::iterator SI = - IVUsesByStride.find(StrideOrder[Stride]); - assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); - StrengthReduceStridedIVUsers(SI->first, SI->second, L, HasOneStride); + // Note: this processes each stride/type pair individually. All users + // passed into StrengthReduceStridedIVUsers have the same type AND stride. + // Also, note that we iterate over IVUsesByStride indirectly by using + // StrideOrder. This extra layer of indirection makes the ordering of + // strides deterministic - not dependent on map order. + for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; ++Stride) { + std::map::iterator SI = + IVUsesByStride.find(StrideOrder[Stride]); + assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); + StrengthReduceStridedIVUsers(SI->first, SI->second, L, HasOneStride); + } } // We're done analyzing this loop; release all the state we built up for it. @@ -1839,5 +1839,5 @@ DeleteTriviallyDeadInstructions(DeadInsts); } - return false; + return Changed; } Added: llvm/trunk/test/CodeGen/X86/2008-07-07-DanglingDeadInsts.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-07-07-DanglingDeadInsts.ll?rev=53193&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-07-07-DanglingDeadInsts.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-07-07-DanglingDeadInsts.ll Mon Jul 7 14:51:32 2008 @@ -0,0 +1,99 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin9 + + %struct.ogg_stream_state = type { i8*, i32, i32, i32, i32*, i64*, i32, i32, i32, i32, [282 x i8], i32, i32, i32, i32, i32, i64, i64 } + %struct.res_state = type { i32, i32, i32, i32, float*, float*, i32, i32 } + %struct.vorbis_comment = type { i8**, i32*, i32, i8* } + +declare i32 @strlen(i8*) nounwind readonly + +define i32 @res_init(%struct.res_state* %state, i32 %channels, i32 %outfreq, i32 %infreq, i32 %op1, ...) nounwind { +entry: + br i1 false, label %bb95, label %bb + +bb: ; preds = %entry + br i1 false, label %bb95, label %bb24 + +bb24: ; preds = %bb + br i1 false, label %bb40.preheader, label %bb26 + +bb26: ; preds = %bb24 + ret i32 -1 + +bb40.preheader: ; preds = %bb24 + br i1 false, label %bb39, label %bb49.outer + +bb39: ; preds = %bb39, %bb40.preheader + shl i32 0, 1 ; :0 [#uses=0] + br i1 false, label %bb39, label %bb49.outer + +bb49.outer: ; preds = %bb39, %bb40.preheader + getelementptr %struct.res_state* %state, i32 0, i32 3 ; :1 [#uses=0] + getelementptr %struct.res_state* %state, i32 0, i32 7 ; :2 [#uses=0] + %base10.1 = select i1 false, float* null, float* null ; [#uses=1] + br label %bb74 + +bb69: ; preds = %bb74 + br label %bb71 + +bb71: ; preds = %bb74, %bb69 + store float 0.000000e+00, float* null, align 4 + add i32 0, 1 ; :3 [#uses=1] + %indvar.next137 = add i32 %indvar136, 1 ; [#uses=1] + br i1 false, label %bb74, label %bb73 + +bb73: ; preds = %bb71 + %.rec = add i32 %base10.2.ph.rec, 1 ; [#uses=2] + getelementptr float* %base10.1, i32 %.rec ; :4 [#uses=1] + br label %bb74 + +bb74: ; preds = %bb73, %bb71, %bb49.outer + %N13.1.ph = phi i32 [ 0, %bb49.outer ], [ 0, %bb73 ], [ %N13.1.ph, %bb71 ] ; [#uses=1] + %dest12.2.ph = phi float* [ null, %bb49.outer ], [ %4, %bb73 ], [ %dest12.2.ph, %bb71 ] ; [#uses=1] + %x8.0.ph = phi i32 [ 0, %bb49.outer ], [ %3, %bb73 ], [ %x8.0.ph, %bb71 ] ; [#uses=1] + %base10.2.ph.rec = phi i32 [ 0, %bb49.outer ], [ %.rec, %bb73 ], [ %base10.2.ph.rec, %bb71 ] ; [#uses=2] + %indvar136 = phi i32 [ %indvar.next137, %bb71 ], [ 0, %bb73 ], [ 0, %bb49.outer ] ; [#uses=1] + br i1 false, label %bb71, label %bb69 + +bb95: ; preds = %bb, %entry + ret i32 -1 +} + +define i32 @read_resampled(i8* %d, float** %buffer, i32 %samples) nounwind { +entry: + br i1 false, label %bb17.preheader, label %bb30 + +bb17.preheader: ; preds = %entry + load i32* null, align 4 ; :0 [#uses=0] + br label %bb16 + +bb16: ; preds = %bb16, %bb17.preheader + %i1.036 = phi i32 [ 0, %bb17.preheader ], [ %1, %bb16 ] ; [#uses=1] + add i32 %i1.036, 1 ; :1 [#uses=2] + icmp ult i32 %1, 0 ; :2 [#uses=0] + br label %bb16 + +bb30: ; preds = %entry + ret i32 0 +} + +define i32 @ogg_stream_reset_serialno(%struct.ogg_stream_state* %os, i32 %serialno) nounwind { +entry: + unreachable +} + +define void @vorbis_lsp_to_curve(float* %curve, i32* %map, i32 %n, i32 %ln, float* %lsp, i32 %m, float %amp, float %ampoffset) nounwind { +entry: + unreachable +} + +define i32 @vorbis_comment_query_count(%struct.vorbis_comment* %vc, i8* %tag) nounwind { +entry: + %strlen = call i32 @strlen( i8* null ) ; [#uses=1] + %endptr = getelementptr i8* null, i32 %strlen ; [#uses=0] + unreachable +} + +define fastcc i32 @push(%struct.res_state* %state, float* %pool, i32* %poolfill, i32* %offset, float* %dest, i32 %dststep, float* %source, i32 %srcstep, i32 %srclen) nounwind { +entry: + unreachable +} From gohman at apple.com Mon Jul 7 14:55:48 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 19:55:48 -0000 Subject: [llvm-commits] [llvm] r53194 - /llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Message-ID: <200807071955.m67JtoY3008342@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 14:55:35 2008 New Revision: 53194 URL: http://llvm.org/viewvc/llvm-project?rev=53194&view=rev Log: Assert that all MachineInstrs update PhysRegUseDefLists in their cleanup code. Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=53194&r1=53193&r2=53194&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Mon Jul 7 14:55:35 2008 @@ -27,6 +27,9 @@ #ifndef NDEBUG for (unsigned i = 0, e = VRegInfo.size(); i != e; ++i) assert(VRegInfo[i].second == 0 && "Vreg use list non-empty still?"); + for (unsigned i = 0, e = UsedPhysRegs.size(); i != e; ++i) + assert(!PhysRegUseDefLists[i] && + "PhysRegUseDefLists has entries after all instructions are deleted"); #endif delete [] PhysRegUseDefLists; } From gohman at apple.com Mon Jul 7 15:05:19 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 20:05:19 -0000 Subject: [llvm-commits] [llvm] r53195 - /llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Message-ID: <200807072005.m67K5JO9008649@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 15:05:04 2008 New Revision: 53195 URL: http://llvm.org/viewvc/llvm-project?rev=53195&view=rev Log: Shrink MachineMemOperand by storing the alignment in log form and rearranging the fields. Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h?rev=53195&r1=53194&r2=53195&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Mon Jul 7 15:05:04 2008 @@ -16,6 +16,8 @@ #ifndef LLVM_CODEGEN_MEMOPERAND_H #define LLVM_CODEGEN_MEMOPERAND_H +#include "llvm/Support/MathExtras.h" + namespace llvm { class Value; @@ -29,11 +31,10 @@ /// that aren't explicit in the regular LLVM IR. /// class MachineMemOperand { - const Value *V; - unsigned int Flags; int64_t Offset; uint64_t Size; - unsigned int Alignment; + const Value *V; + unsigned int Flags; public: /// Flags values. These may be or'd together. @@ -50,7 +51,7 @@ /// specified address Value, flags, offset, size, and alignment. MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s, unsigned int a) - : V(v), Flags(f), Offset(o), Size(s), Alignment(a) {} + : Offset(o), Size(s), V(v), Flags((f & 7) | ((Log2_32(a) + 1) << 3)) {} /// getValue - Return the base address of the memory access. /// Special values are PseudoSourceValue::FPRel, PseudoSourceValue::SPRel, @@ -59,7 +60,7 @@ const Value *getValue() const { return V; } /// getFlags - Return the raw flags of the source value, \see MemOperandFlags. - unsigned int getFlags() const { return Flags; } + unsigned int getFlags() const { return Flags & 7; } /// getOffset - For normal values, this is a byte offset added to the base /// address. For PseudoSourceValue::FPRel values, this is the FrameIndex @@ -71,7 +72,7 @@ /// getAlignment - Return the minimum known alignment in bytes of the /// memory reference. - unsigned int getAlignment() const { return Alignment; } + unsigned int getAlignment() const { return (1u << (Flags >> 3)) >> 1; } bool isLoad() const { return Flags & MOLoad; } bool isStore() const { return Flags & MOStore; } From gohman at apple.com Mon Jul 7 15:06:07 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 20:06:07 -0000 Subject: [llvm-commits] [llvm] r53196 - in /llvm/trunk/lib: CodeGen/RegisterScavenging.cpp Target/ARM/ARMAsmPrinter.cpp Message-ID: <200807072006.m67K67Fb008684@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 15:06:06 2008 New Revision: 53196 URL: http://llvm.org/viewvc/llvm-project?rev=53196&view=rev Log: Minor const-correctness fixes. Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=53196&r1=53195&r2=53196&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Mon Jul 7 15:06:06 2008 @@ -81,7 +81,7 @@ } void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) { - const MachineFunction &MF = *mbb->getParent(); + MachineFunction &MF = *mbb->getParent(); const TargetMachine &TM = MF.getTarget(); TII = TM.getInstrInfo(); TRI = TM.getRegisterInfo(); Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=53196&r1=53195&r2=53196&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Mon Jul 7 15:06:06 2008 @@ -694,7 +694,7 @@ JTEntryDirective = TAI->getData32bitsDirective(); const MachineFunction *MF = MI->getParent()->getParent(); - MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); + const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); const std::vector &JT = MJTI->getJumpTables(); const std::vector &JTBBs = JT[JTI].MBBs; bool UseSet= TAI->getSetDirective() && TM.getRelocationModel() == Reloc::PIC_; From gohman at apple.com Mon Jul 7 15:08:07 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 20:08:07 -0000 Subject: [llvm-commits] [llvm] r53197 - /llvm/trunk/lib/CodeGen/Collector.cpp Message-ID: <200807072008.m67K8A7B008756@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 15:08:05 2008 New Revision: 53197 URL: http://llvm.org/viewvc/llvm-project?rev=53197&view=rev Log: Use of operator* is redundant and confusing here. Modified: llvm/trunk/lib/CodeGen/Collector.cpp Modified: llvm/trunk/lib/CodeGen/Collector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Collector.cpp?rev=53197&r1=53196&r2=53197&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/Collector.cpp (original) +++ llvm/trunk/lib/CodeGen/Collector.cpp Mon Jul 7 15:08:05 2008 @@ -360,7 +360,7 @@ for (MachineBasicBlock::iterator MI = BBI->begin(), ME = BBI->end(); MI != ME; ++MI) if (MI->getDesc().isCall()) - VisitCallPoint(*MI); + VisitCallPoint(MI); } void MachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) { From gohman at apple.com Mon Jul 7 15:09:12 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jul 2008 20:09:12 -0000 Subject: [llvm-commits] [llvm] r53198 - /llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Message-ID: <200807072009.m67K9Dr0008822@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 7 15:09:12 2008 New Revision: 53198 URL: http://llvm.org/viewvc/llvm-project?rev=53198&view=rev Log: Simplify this use of BuildMI. This is also in preparation for pool-allocating MachineInstrs. Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=53198&r1=53197&r2=53198&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Mon Jul 7 15:09:12 2008 @@ -409,7 +409,6 @@ if (PerformTailCallOpt && I->getOpcode() == PPC::ADJCALLSTACKUP) { // Add (actually substract) back the amount the callee popped on return. if (int CalleeAmt = I->getOperand(1).getImm()) { - MachineInstr * New = NULL; bool is64Bit = Subtarget.isPPC64(); CalleeAmt *= -1; unsigned StackReg = is64Bit ? PPC::X1 : PPC::R1; @@ -420,9 +419,8 @@ unsigned ORIInstr = is64Bit ? PPC::ORI8 : PPC::ORI; if (isInt16(CalleeAmt)) { - New = BuildMI(TII.get(ADDIInstr), StackReg).addReg(StackReg). + BuildMI(MBB, I, TII.get(ADDIInstr), StackReg).addReg(StackReg). addImm(CalleeAmt); - MBB.insert(I, New); } else { MachineBasicBlock::iterator MBBI = I; BuildMI(MBB, MBBI, TII.get(LISInstr), TmpReg) From clattner at apple.com Mon Jul 7 15:10:25 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 7 Jul 2008 13:10:25 -0700 Subject: [llvm-commits] [llvm] r53195 - /llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h In-Reply-To: <200807072005.m67K5JO9008649@zion.cs.uiuc.edu> References: <200807072005.m67K5JO9008649@zion.cs.uiuc.edu> Message-ID: <1ED3DCDE-E0C0-40CD-B3E5-3763191E6BC2@apple.com> On Jul 7, 2008, at 1:05 PM, Dan Gohman wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=53195&view=rev > Log: > Shrink MachineMemOperand by storing the alignment in log form > and rearranging the fields. > > +#include "llvm/Support/MathExtras.h" Hey Dan, Would it be reasonable to move the ctor out of line to avoid the #include? -Chris From clattner at apple.com Mon Jul 7 15:12:27 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 7 Jul 2008 13:12:27 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: <8C608FC2-A280-4141-A0BB-0C9D163E89B4@apple.com> References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> <549A4A0A-7767-4A93-988F-FDF2CE0FEF85@apple.com> <8C608FC2-A280-4141-A0BB-0C9D163E89B4@apple.com> Message-ID: <5A3E16AB-09EC-48A5-A238-AA34835C4897@apple.com> On Jul 7, 2008, at 10:48 AM, Eric Christopher wrote: > > On Jul 7, 2008, at 10:19 AM, Evan Cheng wrote: > >> It would be nice if someone with configure foo can help with this. >> Perhaps Eric? > > Sure. There are a few ways you can go about this: What fix is required here? I don't understand the problem. If a user invokes 'llvm-gcc -mllvm -foo x.o' and the linker doesn't support llvm LTO options, why does it matter if llvm-gcc or ld rejects them? -Chris From clattner at apple.com Mon Jul 7 15:13:31 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 7 Jul 2008 13:13:31 -0700 Subject: [llvm-commits] [llvm] r53177 - in /llvm/trunk: include/llvm/ADT/DenseMap.h include/llvm/ADT/DenseSet.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/ScheduleDAG.cpp lib/Linker/LinkModules.cpp lib/Target/X86/X86InstrInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200807071746.m67HkOWv003793@zion.cs.uiuc.edu> References: <200807071746.m67HkOWv003793@zion.cs.uiuc.edu> Message-ID: On Jul 7, 2008, at 10:46 AM, Dan Gohman wrote: > Author: djg > Date: Mon Jul 7 12:46:23 2008 > New Revision: 53177 > > URL: http://llvm.org/viewvc/llvm-project?rev=53177&view=rev > Log: > Make DenseMap's insert return a pair, to more closely resemble > std::map. This is fine, but be careful: it is far easier to invalidate a densemap iterator than an std::map iterator. -Chris From echristo at apple.com Mon Jul 7 15:14:22 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 7 Jul 2008 13:14:22 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: <5A3E16AB-09EC-48A5-A238-AA34835C4897@apple.com> References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> <549A4A0A-7767-4A93-988F-FDF2CE0FEF85@apple.com> <8C608FC2-A280-4141-A0BB-0C9D163E89B4@apple.com> <5A3E16AB-09EC-48A5-A238-AA34835C4897@apple.com> Message-ID: On Jul 7, 2008, at 1:12 PM, Chris Lattner wrote: > > On Jul 7, 2008, at 10:48 AM, Eric Christopher wrote: > >> >> On Jul 7, 2008, at 10:19 AM, Evan Cheng wrote: >> >>> It would be nice if someone with configure foo can help with this. >>> Perhaps Eric? >> >> Sure. There are a few ways you can go about this: > > What fix is required here? I don't understand the problem. > > If a user invokes 'llvm-gcc -mllvm -foo x.o' and the linker doesn't > support llvm LTO options, why does it matter if llvm-gcc or ld rejects > them? I was under the impression that llvm-gcc was automatically inserting the option whether or not it was passed on the command line? If it's going to be a command line option to llvm-gcc it should probably be documented - otherwise it should go under -Wl,