From isanbard at gmail.com Mon Mar 9 00:04:40 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 09 Mar 2009 05:04:40 -0000 Subject: [llvm-commits] [llvm] r66396 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DbgInfoPrinter.cpp lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200903090504.n2954fx1007032@zion.cs.uiuc.edu> Author: void Date: Mon Mar 9 00:04:40 2009 New Revision: 66396 URL: http://llvm.org/viewvc/llvm-project?rev=66396&view=rev Log: Pass in a std::string when getting the names of debugging things. This cuts down on the number of times a std::string is created and copied. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Mar 9 00:04:40 2009 @@ -40,7 +40,7 @@ /// not, the debug info is corrupt and we ignore it. DIDescriptor(GlobalVariable *GV, unsigned RequiredTag); - std::string getStringField(unsigned Elt) const; + const std::string &getStringField(unsigned Elt, std::string &Result) const; unsigned getUnsignedField(unsigned Elt) const { return (unsigned)getUInt64Field(Elt); } @@ -106,9 +106,15 @@ explicit DICompileUnit(GlobalVariable *GV = 0); unsigned getLanguage() const { return getUnsignedField(2); } - std::string getFilename() const { return getStringField(3); } - std::string getDirectory() const { return getStringField(4); } - std::string getProducer() const { return getStringField(5); } + const std::string &getFilename(std::string &F) const { + return getStringField(3, F); + } + const std::string &getDirectory(std::string &F) const { + return getStringField(4, F); + } + const std::string &getProducer(std::string &F) const { + return getStringField(5, F); + } /// isMain - Each input file is encoded as a separate compile unit in LLVM /// debugging information output. However, many target specific tool chains @@ -121,7 +127,9 @@ bool isMain() const { return getUnsignedField(6); } bool isOptimized() const { return getUnsignedField(7); } - std::string getFlags() const { return getStringField(8); } + const std::string &getFlags(std::string &F) const { + return getStringField(8, F); + } unsigned getRunTimeVersion() const { return getUnsignedField(9); } /// Verify - Verify that a compile unit is well formed. @@ -138,7 +146,9 @@ public: explicit DIEnumerator(GlobalVariable *GV = 0); - std::string getName() const { return getStringField(1); } + const std::string &getName(std::string &F) const { + return getStringField(1, F); + } uint64_t getEnumValue() const { return getUInt64Field(2); } }; @@ -182,7 +192,9 @@ virtual ~DIType() {} DIDescriptor getContext() const { return getDescriptorField(1); } - std::string getName() const { return getStringField(2); } + const std::string &getName(std::string &F) const { + return getStringField(2, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs(3); } unsigned getLineNumber() const { return getUnsignedField(4); } uint64_t getSizeInBits() const { return getUInt64Field(5); } @@ -264,9 +276,15 @@ virtual ~DIGlobal() {} DIDescriptor getContext() const { return getDescriptorField(2); } - std::string getName() const { return getStringField(3); } - std::string getDisplayName() const { return getStringField(4); } - std::string getLinkageName() const { return getStringField(5); } + const std::string &getName(std::string &F) const { + return getStringField(3, F); + } + const std::string &getDisplayName(std::string &F) const { + return getStringField(4, F); + } + const std::string &getLinkageName(std::string &F) const { + return getStringField(5, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs(6); } unsigned getLineNumber() const { return getUnsignedField(7); } DIType getType() const { return getFieldAs(8); } @@ -313,7 +331,9 @@ explicit DIVariable(GlobalVariable *GV = 0); DIDescriptor getContext() const { return getDescriptorField(1); } - std::string getName() const { return getStringField(2); } + const std::string &getName(std::string &F) const { + return getStringField(2, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs(3); } unsigned getLineNumber() const { return getUnsignedField(4); } DIType getType() const { return getFieldAs(5); } Modified: llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp (original) +++ llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp Mon Mar 9 00:04:40 2009 @@ -59,8 +59,9 @@ { if(const DbgDeclareInst* DDI = findDbgDeclare(V)) { DIVariable Var(cast(DDI->getVariable())); - Out << "; variable " << Var.getName() - << " of type " << Var.getType().getName() + std::string Res1, Res2; + Out << "; variable " << Var.getName(Res1) + << " of type " << Var.getType().getName(Res2) << " at line " << Var.getLineNumber() << "\n"; } } @@ -83,8 +84,9 @@ void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) { DISubprogram Subprogram(cast(FS->getSubprogram())); - Out << ";fully qualified function name: " << Subprogram.getDisplayName() - << " return type: " << Subprogram.getType().getName() + std::string Res1, Res2; + Out << ";fully qualified function name: " << Subprogram.getDisplayName(Res1) + << " return type: " << Subprogram.getType().getName(Res2) << " at line " << Subprogram.getLineNumber() << "\n\n"; } Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Mar 9 00:04:40 2009 @@ -35,17 +35,23 @@ GV = 0; } +const std::string & +DIDescriptor::getStringField(unsigned Elt, std::string &Result) const { + if (GV == 0) { + Result.clear(); + return Result; + } -std::string DIDescriptor::getStringField(unsigned Elt) const { - if (GV == 0) return ""; Constant *C = GV->getInitializer(); - if (C == 0 || Elt >= C->getNumOperands()) - return ""; + if (C == 0 || Elt >= C->getNumOperands()) { + Result.clear(); + return Result; + } - std::string Result; // Fills in the string if it succeeds if (!GetConstantStringInfo(C->getOperand(Elt), Result)) Result.clear(); + return Result; } @@ -59,7 +65,6 @@ return 0; } - DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const { if (GV == 0) return DIDescriptor(); Constant *C = GV->getInitializer(); @@ -185,7 +190,8 @@ bool DICompileUnit::Verify() const { if (isNull()) return false; - if (getFilename().empty()) + std::string Res; + if (getFilename(Res).empty()) return false; // It is possible that directory and produce string is empty. return true; @@ -864,16 +870,22 @@ void DICompileUnit::dump() const { if (getLanguage()) cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; - cerr << " [" << getDirectory() << "/" << getFilename() << " ]"; + + std::string Res1, Res2; + cerr << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]"; } /// dump - print type. void DIType::dump() const { if (isNull()) return; - if (!getName().empty()) - cerr << " [" << getName() << "] "; + + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + unsigned Tag = getTag(); cerr << " [" << dwarf::TagString(Tag) << "] "; + // TODO : Print context getCompileUnit().dump(); cerr << " [" @@ -882,10 +894,12 @@ << getAlignInBits() << ", " << getOffsetInBits() << "] "; + if (isPrivate()) cerr << " [private] "; else if (isProtected()) cerr << " [protected] "; + if (isForwardDecl()) cerr << " [fwd] "; @@ -899,6 +913,7 @@ cerr << "Invalid DIType\n"; return; } + cerr << "\n"; } @@ -923,16 +938,20 @@ /// dump - print global. void DIGlobal::dump() const { + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; - if (!getName().empty()) - cerr << " [" << getName() << "] "; unsigned Tag = getTag(); cerr << " [" << dwarf::TagString(Tag) << "] "; + // TODO : Print context getCompileUnit().dump(); cerr << " [" << getLineNumber() << "] "; + if (isLocalToUnit()) cerr << " [local] "; + if (isDefinition()) cerr << " [def] "; @@ -954,8 +973,10 @@ /// dump - print variable. void DIVariable::dump() const { - if (!getName().empty()) - cerr << " [" << getName() << "] "; + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + getCompileUnit().dump(); cerr << " [" << getLineNumber() << "] "; getType().dump(); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Mar 9 00:04:40 2009 @@ -1622,7 +1622,8 @@ DIBasicType BTy) { // Get core information. - const std::string &Name = BTy.getName(); + std::string Name; + BTy.getName(Name); Buffer.setTag(DW_TAG_base_type); AddUInt(&Buffer, DW_AT_encoding, DW_FORM_data1, BTy.getEncoding()); // Add name if not anonymous or intermediate type. @@ -1637,13 +1638,16 @@ DIDerivedType DTy) { // Get core information. - const std::string &Name = DTy.getName(); + std::string Name; + DTy.getName(Name); uint64_t Size = DTy.getSizeInBits() >> 3; unsigned Tag = DTy.getTag(); + // FIXME - Workaround for templates. if (Tag == DW_TAG_inheritance) Tag = DW_TAG_reference_type; Buffer.setTag(Tag); + // Map to main type, void will not have a type. DIType FromTy = DTy.getTypeDerivedFrom(); AddType(DW_Unit, &Buffer, FromTy); @@ -1665,12 +1669,14 @@ /// ConstructTypeDIE - Construct type DIE from DICompositeType. void ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer, DICompositeType CTy) { - // Get core information. - const std::string &Name = CTy.getName(); + std::string Name; + CTy.getName(Name); + uint64_t Size = CTy.getSizeInBits() >> 3; unsigned Tag = CTy.getTag(); Buffer.setTag(Tag); + switch (Tag) { case DW_TAG_vector_type: case DW_TAG_array_type: @@ -1806,7 +1812,8 @@ DIE *ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) { DIE *Enumerator = new DIE(DW_TAG_enumerator); - const std::string &Name = ETy->getName(); + std::string Name; + ETy->getName(Name); AddString(Enumerator, DW_AT_name, DW_FORM_string, Name); int64_t Value = ETy->getEnumValue(); AddSInt(Enumerator, DW_AT_const_value, DW_FORM_sdata, Value); @@ -1817,9 +1824,11 @@ DIE *CreateGlobalVariableDIE(CompileUnit *DW_Unit, const DIGlobalVariable &GV) { DIE *GVDie = new DIE(DW_TAG_variable); - const std::string &Name = GV.getDisplayName(); + std::string Name; + GV.getDisplayName(Name); AddString(GVDie, DW_AT_name, DW_FORM_string, Name); - const std::string &LinkageName = GV.getLinkageName(); + std::string LinkageName; + GV.getLinkageName(LinkageName); if (!LinkageName.empty()) AddString(GVDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); AddType(DW_Unit, GVDie, GV.getType()); @@ -1832,7 +1841,8 @@ /// CreateMemberDIE - Create new member DIE. DIE *CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT) { DIE *MemberDie = new DIE(DT.getTag()); - const std::string &Name = DT.getName(); + std::string Name; + DT.getName(Name); if (!Name.empty()) AddString(MemberDie, DW_AT_name, DW_FORM_string, Name); @@ -1876,9 +1886,11 @@ const DISubprogram &SP, bool IsConstructor = false) { DIE *SPDie = new DIE(DW_TAG_subprogram); - const std::string &Name = SP.getName(); + std::string Name; + SP.getName(Name); AddString(SPDie, DW_AT_name, DW_FORM_string, Name); - const std::string &LinkageName = SP.getLinkageName(); + std::string LinkageName; + SP.getLinkageName(LinkageName); if (!LinkageName.empty()) AddString(SPDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); @@ -1945,7 +1957,8 @@ // Define variable debug information entry. DIE *VariableDie = new DIE(Tag); - const std::string &Name = VD.getName(); + std::string Name; + VD.getName(Name); AddString(VariableDie, DW_AT_name, DW_FORM_string, Name); // Add source line info if available. @@ -2769,21 +2782,23 @@ void ConstructCompileUnit(GlobalVariable *GV) { DICompileUnit DIUnit(GV); - unsigned ID = getOrCreateSourceID(DIUnit.getDirectory(), - DIUnit.getFilename()); + std::string Dir, FN, Prod; + unsigned ID = getOrCreateSourceID(DIUnit.getDirectory(Dir), + DIUnit.getFilename(FN)); DIE *Die = new DIE(DW_TAG_compile_unit); AddSectionOffset(Die, DW_AT_stmt_list, DW_FORM_data4, DWLabel("section_line", 0), DWLabel("section_line", 0), false); - AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer()); + AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer(Prod)); AddUInt(Die, DW_AT_language, DW_FORM_data1, DIUnit.getLanguage()); - AddString(Die, DW_AT_name, DW_FORM_string, DIUnit.getFilename()); - if (!DIUnit.getDirectory().empty()) - AddString(Die, DW_AT_comp_dir, DW_FORM_string, DIUnit.getDirectory()); + AddString(Die, DW_AT_name, DW_FORM_string, FN); + if (!Dir.empty()) + AddString(Die, DW_AT_comp_dir, DW_FORM_string, Dir); if (DIUnit.isOptimized()) AddUInt(Die, DW_AT_APPLE_optimized, DW_FORM_flag, 1); - const std::string &Flags = DIUnit.getFlags(); + std::string Flags; + DIUnit.getFlags(Flags); if (!Flags.empty()) AddString(Die, DW_AT_APPLE_flags, DW_FORM_string, Flags); unsigned RVer = DIUnit.getRunTimeVersion(); @@ -2843,7 +2858,8 @@ // Add to context owner. DW_Unit->getDie()->AddChild(VariableDie); // Expose as global. FIXME - need to check external flag. - DW_Unit->AddGlobal(DI_GV.getName(), VariableDie); + std::string Name; + DW_Unit->AddGlobal(DI_GV.getName(Name), VariableDie); return true; } @@ -2895,7 +2911,8 @@ // Add to context owner. Unit->getDie()->AddChild(SubprogramDie); // Expose as global. - Unit->AddGlobal(SP.getName(), SubprogramDie); + std::string Name; + Unit->AddGlobal(SP.getName(Name), SubprogramDie); return true; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Mar 9 00:04:40 2009 @@ -319,8 +319,9 @@ DbgStopPointInst *SPI = cast(I); if (DW && DW->ValidDebugInfo(SPI->getContext())) { DICompileUnit CU(cast(SPI->getContext())); - unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned Line = SPI->getLine(); unsigned Col = SPI->getColumn(); unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile); @@ -361,8 +362,9 @@ // (most?) gdb expects. DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(), - CompileUnit.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir), + CompileUnit.getFilename(FN)); // Record the source line but does not create a label for the normal // function start. It will be emitted at asm emission time. However, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Mar 9 00:04:40 2009 @@ -1287,8 +1287,9 @@ GlobalVariable *CU_GV = cast(DSP->getCompileUnit()); if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) { DICompileUnit CU(cast(DSP->getCompileUnit())); - unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned Line = DSP->getLine(); unsigned Col = DSP->getColumn(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Mar 9 00:04:40 2009 @@ -335,8 +335,9 @@ if (DW && DW->ValidDebugInfo(SPI->getContext())) { DICompileUnit CU(cast(SPI->getContext())); - unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned idx = MF->getOrCreateDebugLocID(SrcFile, SPI->getLine(), SPI->getColumn()); @@ -354,8 +355,9 @@ if (DW->ValidDebugInfo(SP)) { DISubprogram Subprogram(cast(SP)); DICompileUnit CU(Subprogram.getCompileUnit()); - unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned Line = Subprogram.getLineNumber(); DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0)); } @@ -3902,8 +3904,9 @@ SPI.getColumn(), SPI.getContext())); DICompileUnit CU(cast(SPI.getContext())); - unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned idx = MF.getOrCreateDebugLocID(SrcFile, SPI.getLine(), SPI.getColumn()); setCurDebugLoc(DebugLoc::get(idx)); @@ -3947,8 +3950,9 @@ MachineFunction &MF = DAG.getMachineFunction(); DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(), - CompileUnit.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir), + CompileUnit.getFilename(FN)); // Record the source line but does not create a label for the normal // function start. It will be emitted at asm emission time. However, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=66396&r1=66395&r2=66396&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Mar 9 00:04:40 2009 @@ -179,7 +179,8 @@ } } else if (const DbgStopPointSDNode *D = dyn_cast(Node)) { DICompileUnit CU(cast(D->getCompileUnit())); - Op += ": " + CU.getFilename(); + std::string FN; + Op += ": " + CU.getFilename(FN); Op += ":" + utostr(D->getLine()); if (D->getColumn() != 0) Op += ":" + utostr(D->getColumn()); From sabre at nondot.org Mon Mar 9 00:10:08 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 05:10:08 -0000 Subject: [llvm-commits] [llvm] r66397 - /llvm/trunk/include/llvm/Assembly/Writer.h Message-ID: <200903090510.n295A8X0007320@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 00:10:08 2009 New Revision: 66397 URL: http://llvm.org/viewvc/llvm-project?rev=66397&view=rev Log: add a #include to improve portability to windows, as requested by someone on llvmdev. Modified: llvm/trunk/include/llvm/Assembly/Writer.h Modified: llvm/trunk/include/llvm/Assembly/Writer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=66397&r1=66396&r2=66397&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Writer.h (original) +++ llvm/trunk/include/llvm/Assembly/Writer.h Mon Mar 9 00:10:08 2009 @@ -18,6 +18,7 @@ #define LLVM_ASSEMBLY_WRITER_H #include +#include namespace llvm { From sabre at nondot.org Mon Mar 9 00:11:09 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 05:11:09 -0000 Subject: [llvm-commits] [llvm] r66398 - in /llvm/trunk: include/llvm/Analysis/AliasSetTracker.h lib/Analysis/AliasSetTracker.cpp lib/Transforms/Scalar/LICM.cpp Message-ID: <200903090511.n295B9XX007374@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 00:11:09 2009 New Revision: 66398 URL: http://llvm.org/viewvc/llvm-project?rev=66398&view=rev Log: reimplement AliasSetTracker in terms of DenseMap instead of hash_map, hopefully no functionality change. Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h llvm/trunk/lib/Analysis/AliasSetTracker.cpp llvm/trunk/lib/Transforms/Scalar/LICM.cpp Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasSetTracker.h?rev=66398&r1=66397&r2=66398&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original) +++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Mon Mar 9 00:11:09 2009 @@ -19,10 +19,11 @@ #include "llvm/Support/CallSite.h" #include "llvm/Support/Streams.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/iterator.h" -#include "llvm/ADT/hash_map.h" #include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" +#include namespace llvm { @@ -37,20 +38,21 @@ class AliasSet : public ilist_node { friend class AliasSetTracker; - class PointerRec; - typedef std::pair HashNodePair; - class PointerRec { - HashNodePair **PrevInList, *NextInList; + Value *Val; // The pointer this record corresponds to. + PointerRec **PrevInList, *NextInList; AliasSet *AS; unsigned Size; public: - PointerRec() : PrevInList(0), NextInList(0), AS(0), Size(0) {} + PointerRec(Value *V) + : Val(V), PrevInList(0), NextInList(0), AS(0), Size(0) {} - HashNodePair *getNext() const { return NextInList; } + Value *getValue() const { return Val; } + + PointerRec *getNext() const { return NextInList; } bool hasAliasSet() const { return AS != 0; } - HashNodePair** setPrevInList(HashNodePair **PIL) { + PointerRec** setPrevInList(PointerRec **PIL) { PrevInList = PIL; return &NextInList; } @@ -77,21 +79,22 @@ AS = as; } - void removeFromList() { - if (NextInList) NextInList->second.PrevInList = PrevInList; + void eraseFromList() { + if (NextInList) NextInList->PrevInList = PrevInList; *PrevInList = NextInList; if (AS->PtrListEnd == &NextInList) { AS->PtrListEnd = PrevInList; assert(*AS->PtrListEnd == 0 && "List not terminated right!"); } + delete this; } }; - HashNodePair *PtrList, **PtrListEnd; // Doubly linked list of nodes - AliasSet *Forward; // Forwarding pointer - AliasSet *Next, *Prev; // Doubly linked list of AliasSets + PointerRec *PtrList, **PtrListEnd; // Doubly linked list of nodes. + AliasSet *Forward; // Forwarding pointer. + AliasSet *Next, *Prev; // Doubly linked list of AliasSets. - std::vector CallSites; // All calls & invokes in this node + std::vector CallSites; // All calls & invokes in this alias set. // RefCount - Number of nodes pointing to this AliasSet plus the number of // AliasSets forwarding to it. @@ -157,10 +160,10 @@ void dump() const; /// Define an iterator for alias sets... this is just a forward iterator. - class iterator : public forward_iterator { - HashNodePair *CurNode; + class iterator : public forward_iterator { + PointerRec *CurNode; public: - explicit iterator(HashNodePair *CN = 0) : CurNode(CN) {} + explicit iterator(PointerRec *CN = 0) : CurNode(CN) {} bool operator==(const iterator& x) const { return CurNode == x.CurNode; @@ -178,12 +181,12 @@ } value_type *operator->() const { return &operator*(); } - Value *getPointer() const { return CurNode->first; } - unsigned getSize() const { return CurNode->second.getSize(); } + Value *getPointer() const { return CurNode->getValue(); } + unsigned getSize() const { return CurNode->getSize(); } iterator& operator++() { // Preincrement assert(CurNode && "Advancing past AliasSet.end()!"); - CurNode = CurNode->second.getNext(); + CurNode = CurNode->getNext(); return *this; } iterator operator++(int) { // Postincrement @@ -202,7 +205,7 @@ AliasSet(const AliasSet &AS); // do not implement void operator=(const AliasSet &AS); // do not implement - HashNodePair *getSomePointer() const { + PointerRec *getSomePointer() const { return PtrList; } @@ -223,7 +226,7 @@ void removeFromTracker(AliasSetTracker &AST); - void addPointer(AliasSetTracker &AST, HashNodePair &Entry, unsigned Size, + void addPointer(AliasSetTracker &AST, PointerRec &Entry, unsigned Size, bool KnownMustAlias = false); void addCallSite(CallSite CS, AliasAnalysis &AA); void removeCallSite(CallSite CS) { @@ -253,7 +256,7 @@ ilist AliasSets; // Map from pointers to their node - hash_map PointerMap; + DenseMap PointerMap; public: /// AliasSetTracker ctor - Create an empty collection of AliasSets, and use /// the specified alias analysis object to disambiguate load and store @@ -299,10 +302,7 @@ bool remove(Instruction *I); void remove(AliasSet &AS); - void clear() { - PointerMap.clear(); - AliasSets.clear(); - } + void clear(); /// getAliasSets - Return the alias sets that are active. /// @@ -362,11 +362,13 @@ friend class AliasSet; void removeAliasSet(AliasSet *AS); - AliasSet::HashNodePair &getEntryFor(Value *V) { - // Standard operator[], except that it returns the whole pair, not just - // ->second. - return *PointerMap.insert(AliasSet::HashNodePair(V, - AliasSet::PointerRec())).first; + // getEntryFor - Just like operator[] on the map, except that it creates an + // entry for the pointer if it doesn't already exist. + AliasSet::PointerRec &getEntryFor(Value *V) { + AliasSet::PointerRec *&Entry = PointerMap[V]; + if (Entry == 0) + Entry = new AliasSet::PointerRec(V); + return *Entry; } AliasSet &addPointer(Value *P, unsigned Size, AliasSet::AccessType E, Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=66398&r1=66397&r2=66398&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original) +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Mon Mar 9 00:11:09 2009 @@ -39,11 +39,11 @@ // used to be must-alias sets, we can just check any pointer from each set // for aliasing. AliasAnalysis &AA = AST.getAliasAnalysis(); - HashNodePair *L = getSomePointer(); - HashNodePair *R = AS.getSomePointer(); + PointerRec *L = getSomePointer(); + PointerRec *R = AS.getSomePointer(); // If the pointers are not a must-alias pair, this set becomes a may alias. - if (AA.alias(L->first, L->second.getSize(), R->first, R->second.getSize()) + if (AA.alias(L->getValue(), L->getSize(), R->getValue(), R->getSize()) != AliasAnalysis::MustAlias) AliasTy = MayAlias; } @@ -62,7 +62,7 @@ // Merge the list of constituent pointers... if (AS.PtrList) { *PtrListEnd = AS.PtrList; - AS.PtrList->second.setPrevInList(PtrListEnd); + AS.PtrList->setPrevInList(PtrListEnd); PtrListEnd = AS.PtrListEnd; AS.PtrList = 0; @@ -84,30 +84,30 @@ AST.removeAliasSet(this); } -void AliasSet::addPointer(AliasSetTracker &AST, HashNodePair &Entry, +void AliasSet::addPointer(AliasSetTracker &AST, PointerRec &Entry, unsigned Size, bool KnownMustAlias) { - assert(!Entry.second.hasAliasSet() && "Entry already in set!"); + assert(!Entry.hasAliasSet() && "Entry already in set!"); // Check to see if we have to downgrade to _may_ alias. if (isMustAlias() && !KnownMustAlias) - if (HashNodePair *P = getSomePointer()) { + if (PointerRec *P = getSomePointer()) { AliasAnalysis &AA = AST.getAliasAnalysis(); AliasAnalysis::AliasResult Result = - AA.alias(P->first, P->second.getSize(), Entry.first, Size); + AA.alias(P->getValue(), P->getSize(), Entry.getValue(), Size); if (Result == AliasAnalysis::MayAlias) AliasTy = MayAlias; else // First entry of must alias must have maximum size! - P->second.updateSize(Size); + P->updateSize(Size); assert(Result != AliasAnalysis::NoAlias && "Cannot be part of must set!"); } - Entry.second.setAliasSet(this); - Entry.second.updateSize(Size); + Entry.setAliasSet(this); + Entry.updateSize(Size); // Add it to the end of the list... assert(*PtrListEnd == 0 && "End of list is not null?"); *PtrListEnd = &Entry; - PtrListEnd = Entry.second.setPrevInList(PtrListEnd); + PtrListEnd = Entry.setPrevInList(PtrListEnd); assert(*PtrListEnd == 0 && "End of list is not null?"); addRef(); // Entry points to alias set... } @@ -139,9 +139,9 @@ // If this is a set of MustAliases, only check to see if the pointer aliases // SOME value in the set... - HashNodePair *SomePtr = getSomePointer(); + PointerRec *SomePtr = getSomePointer(); assert(SomePtr && "Empty must-alias set??"); - return AA.alias(SomePtr->first, SomePtr->second.getSize(), Ptr, Size); + return AA.alias(SomePtr->getValue(), SomePtr->getSize(), Ptr, Size); } // If this is a may-alias set, we have to check all of the pointers in the set @@ -184,6 +184,18 @@ return false; } +void AliasSetTracker::clear() { + // Delete all the PointerRec entries. + for (DenseMap::iterator I = PointerMap.begin(), + E = PointerMap.end(); I != E; ++I) + I->second->eraseFromList(); + + PointerMap.clear(); + + // The alias sets should all be clear now. + AliasSets.clear(); +} + /// findAliasSetForPointer - Given a pointer, find the one alias set to put the /// instruction referring to the pointer into. If there are multiple alias sets @@ -234,16 +246,16 @@ /// getAliasSetForPointer - Return the alias set that the specified pointer -/// lives in... +/// lives in. AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, unsigned Size, bool *New) { - AliasSet::HashNodePair &Entry = getEntryFor(Pointer); + AliasSet::PointerRec &Entry = getEntryFor(Pointer); // Check to see if the pointer is already known... - if (Entry.second.hasAliasSet()) { - Entry.second.updateSize(Size); + if (Entry.hasAliasSet()) { + Entry.updateSize(Size); // Return the set! - return *Entry.second.getAliasSet(*this)->getForwardedTarget(*this); + return *Entry.getAliasSet(*this)->getForwardedTarget(*this); } else if (AliasSet *AS = findAliasSetForPointer(Pointer, Size)) { // Add it to the alias set it aliases... AS->addPointer(*this, Entry, Size); @@ -371,17 +383,18 @@ // Clear the alias set. unsigned NumRefs = 0; while (!AS.empty()) { - AliasSet::HashNodePair *P = AS.PtrList; + AliasSet::PointerRec *P = AS.PtrList; + + Value *ValToRemove = P->getValue(); - // Unlink from the list of values. - P->second.removeFromList(); + // Unlink and delete entry from the list of values. + P->eraseFromList(); // Remember how many references need to be dropped. ++NumRefs; // Finally, remove the entry. - Value *Remove = P->first; // Take a copy because it is invalid to pass - PointerMap.erase(Remove); // a reference to the data being erased. + PointerMap.erase(ValToRemove); } // Stop using the alias set, removing it. @@ -472,17 +485,19 @@ AS->removeCallSite(CS); // First, look up the PointerRec for this pointer. - hash_map::iterator I = PointerMap.find(PtrVal); + DenseMap::iterator I = PointerMap.find(PtrVal); if (I == PointerMap.end()) return; // Noop // If we found one, remove the pointer from the alias set it is in. - AliasSet::HashNodePair &PtrValEnt = *I; - AliasSet *AS = PtrValEnt.second.getAliasSet(*this); + AliasSet::PointerRec *PtrValEnt = I->second; + AliasSet *AS = PtrValEnt->getAliasSet(*this); - // Unlink from the list of values... - PtrValEnt.second.removeFromList(); - // Stop using the alias set + // Unlink and delete from the list of values. + PtrValEnt->eraseFromList(); + + // Stop using the alias set. AS->dropRef(*this); + PointerMap.erase(I); } @@ -496,16 +511,17 @@ AA.copyValue(From, To); // First, look up the PointerRec for this pointer. - hash_map::iterator I = PointerMap.find(From); - if (I == PointerMap.end() || !I->second.hasAliasSet()) + DenseMap::iterator I = PointerMap.find(From); + if (I == PointerMap.end()) return; // Noop + assert(I->second->hasAliasSet() && "Dead entry?"); - AliasSet::HashNodePair &Entry = getEntryFor(To); - if (Entry.second.hasAliasSet()) return; // Already in the tracker! + AliasSet::PointerRec &Entry = getEntryFor(To); + if (Entry.hasAliasSet()) return; // Already in the tracker! // Add it to the alias set it aliases... - AliasSet *AS = I->second.getAliasSet(*this); - AS->addPointer(*this, Entry, I->second.getSize(), true); + AliasSet *AS = I->second->getAliasSet(*this); + AS->addPointer(*this, Entry, I->second->getSize(), true); } Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=66398&r1=66397&r2=66398&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Mon Mar 9 00:11:09 2009 @@ -62,9 +62,9 @@ DisablePromotion("disable-licm-promotion", cl::Hidden, cl::desc("Disable memory promotion in LICM pass")); -// This feature is currently disabled by default because CodeGen is not yet capable -// of rematerializing these constants in PIC mode, so it can lead to degraded -// performance. Compile test/CodeGen/X86/remat-constant.ll with +// This feature is currently disabled by default because CodeGen is not yet +// capable of rematerializing these constants in PIC mode, so it can lead to +// degraded performance. Compile test/CodeGen/X86/remat-constant.ll with // -relocation-model=pic to see an example of this. static cl::opt EnableLICMConstantMotion("enable-licm-constant-variables", cl::Hidden, @@ -793,12 +793,12 @@ // set, if the pointer is loop invariant, and if we are not eliminating any // volatile loads or stores. if (AS.isForwardingAliasSet() || !AS.isMod() || !AS.isMustAlias() || - AS.isVolatile() || !CurLoop->isLoopInvariant(AS.begin()->first)) + AS.isVolatile() || !CurLoop->isLoopInvariant(AS.begin()->getValue())) continue; assert(!AS.empty() && "Must alias set should have at least one pointer element in it!"); - Value *V = AS.begin()->first; + Value *V = AS.begin()->getValue(); // Check that all of the pointers in the alias set have the same type. We // cannot (yet) promote a memory location that is loaded and stored in @@ -806,7 +806,7 @@ { bool PointerOk = true; for (AliasSet::iterator I = AS.begin(), E = AS.end(); I != E; ++I) - if (V->getType() != I->first->getType()) { + if (V->getType() != I->getValue()->getType()) { PointerOk = false; break; } @@ -859,7 +859,7 @@ CurAST->copyValue(V, AI); for (AliasSet::iterator I = AS.begin(), E = AS.end(); I != E; ++I) - ValueToAllocaMap.insert(std::make_pair(I->first, AI)); + ValueToAllocaMap.insert(std::make_pair(I->getValue(), AI)); DOUT << "LICM: Promoting value: " << *V << "\n"; } From resistor at mac.com Mon Mar 9 00:12:38 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 09 Mar 2009 05:12:38 -0000 Subject: [llvm-commits] [llvm] r66399 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Message-ID: <200903090512.n295Cc0F007505@zion.cs.uiuc.edu> Author: resistor Date: Mon Mar 9 00:12:38 2009 New Revision: 66399 URL: http://llvm.org/viewvc/llvm-project?rev=66399&view=rev Log: Ignore debug intrinsics when computing dependences. Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=66399&r1=66398&r2=66399&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Mon Mar 9 00:12:38 2009 @@ -18,6 +18,7 @@ #include "llvm/Analysis/MemoryDependenceAnalysis.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Function.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/ADT/Statistic.h" @@ -121,6 +122,8 @@ // FreeInsts erase the entire structure PointerSize = ~0ULL; } else if (isa(Inst) || isa(Inst)) { + // Debug intrinsics don't cause dependences. + if (isa(Inst)) break; CallSite InstCS = CallSite::get(Inst); // If these two calls do not interfere, look past it. switch (AA->getModRefInfo(CS, InstCS)) { @@ -175,6 +178,9 @@ while (ScanIt != BB->begin()) { Instruction *Inst = --ScanIt; + // Debug intrinsics don't cause dependences. + if (isa(Inst)) continue; + // Values depend on loads if the pointers are must aliased. This means that // a load depends on another must aliased load from the same value. if (LoadInst *LI = dyn_cast(Inst)) { From sabre at nondot.org Mon Mar 9 00:20:45 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 05:20:45 -0000 Subject: [llvm-commits] [llvm] r66400 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200903090520.n295Kjtn008251@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 00:20:45 2009 New Revision: 66400 URL: http://llvm.org/viewvc/llvm-project?rev=66400&view=rev Log: don't allow hash_map or hash_set. Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=66400&r1=66399&r2=66400&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Mon Mar 9 00:20:45 2009 @@ -1187,21 +1187,16 @@

The STL provides several other options, such as std::multiset and the various -"hash_set" like containers (whether from C++ TR1 or from the SGI library).

+"hash_set" like containers (whether from C++ TR1 or from the SGI library). We +never use hash_set and unordered_set because they are generally very expensive +(each insertion requires a malloc) and very non-portable. +

std::multiset is useful if you're not interested in elimination of duplicates, but has all the drawbacks of std::set. A sorted vector (where you don't delete duplicate entries) or some other approach is almost always better.

-

The various hash_set implementations (exposed portably by -"llvm/ADT/hash_set") is a simple chained hashtable. This algorithm is as malloc -intensive as std::set (performing an allocation for each element inserted, -thus having really high constant factors) but (usually) provides O(1) -insertion/deletion of elements. This can be useful if your elements are large -(thus making the constant-factor cost relatively low) or if comparisons are -expensive. Element iteration does not visit elements in a useful order.

- @@ -1340,20 +1335,14 @@

The STL provides several other options, such as std::multimap and the various -"hash_map" like containers (whether from C++ TR1 or from the SGI library).

+"hash_map" like containers (whether from C++ TR1 or from the SGI library). We +never use hash_set and unordered_set because they are generally very expensive +(each insertion requires a malloc) and very non-portable.

std::multimap is useful if you want to map a key to multiple values, but has all the drawbacks of std::map. A sorted vector or some other approach is almost always better.

-

The various hash_map implementations (exposed portably by -"llvm/ADT/hash_map") are simple chained hash tables. This algorithm is as -malloc intensive as std::map (performing an allocation for each element -inserted, thus having really high constant factors) but (usually) provides O(1) -insertion/deletion of elements. This can be useful if your elements are large -(thus making the constant-factor cost relatively low) or if comparisons are -expensive. Element iteration does not visit elements in a useful order.

- From sabre at nondot.org Mon Mar 9 00:45:00 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 05:45:00 -0000 Subject: [llvm-commits] [llvm] r66401 - /llvm/trunk/test/FrontendC/2009-03-08-ZeroEltStructCrash.c Message-ID: <200903090545.n295j0IW009419@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 00:44:59 2009 New Revision: 66401 URL: http://llvm.org/viewvc/llvm-project?rev=66401&view=rev Log: testcase for PR3744 Added: llvm/trunk/test/FrontendC/2009-03-08-ZeroEltStructCrash.c Added: llvm/trunk/test/FrontendC/2009-03-08-ZeroEltStructCrash.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-03-08-ZeroEltStructCrash.c?rev=66401&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2009-03-08-ZeroEltStructCrash.c (added) +++ llvm/trunk/test/FrontendC/2009-03-08-ZeroEltStructCrash.c Mon Mar 9 00:44:59 2009 @@ -0,0 +1,14 @@ +// RUN: %llvmgcc -S %s -o - +// PR3744 +struct Empty {}; +struct Union { + union { + int zero_arr[0]; + } contents; +}; +static inline void Foo(struct Union *u) { + int *array = u->contents.zero_arr; +} +static void Bar(struct Union *u) { + Foo(u); +} From sabre at nondot.org Mon Mar 9 00:45:28 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 05:45:28 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r66402 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200903090545.n295jSB0009444@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 00:45:27 2009 New Revision: 66402 URL: http://llvm.org/viewvc/llvm-project?rev=66402&view=rev Log: Fix PR3744 - Crash on index into zero element struct. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=66402&r1=66401&r2=66402&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Mar 9 00:45:27 2009 @@ -5992,9 +5992,15 @@ // If this is a normal field at a fixed offset from the start, handle it. if (TREE_CODE(field_offset) == INTEGER_CST) { unsigned int MemberIndex = GetFieldIndex(FieldDecl); - assert(MemberIndex < StructTy->getNumContainedTypes() && - "Field Idx out of range!"); - FieldPtr = Builder.CreateStructGEP(StructAddrLV.Ptr, MemberIndex); + + // If the LLVM struct has zero field, don't try to index into it, just use + // the current pointer. + FieldPtr = StructAddrLV.Ptr; + if (StructTy->getNumContainedTypes() != 0) { + assert(MemberIndex < StructTy->getNumContainedTypes() && + "Field Idx out of range!"); + FieldPtr = Builder.CreateStructGEP(FieldPtr, MemberIndex); + } // Now that we did an offset from the start of the struct, subtract off // the offset from BitStart. From sabre at nondot.org Mon Mar 9 00:50:45 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 05:50:45 -0000 Subject: [llvm-commits] [llvm] r66403 - in /llvm/trunk: include/llvm/GlobalValue.h lib/VMCore/Globals.cpp Message-ID: <200903090550.n295oj64009690@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 00:50:45 2009 New Revision: 66403 URL: http://llvm.org/viewvc/llvm-project?rev=66403&view=rev Log: make GlobalValue::removeDeadConstantUsers() const. Modified: llvm/trunk/include/llvm/GlobalValue.h llvm/trunk/lib/VMCore/Globals.cpp Modified: llvm/trunk/include/llvm/GlobalValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=66403&r1=66402&r2=66403&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalValue.h (original) +++ llvm/trunk/include/llvm/GlobalValue.h Mon Mar 9 00:50:45 2009 @@ -205,7 +205,7 @@ /// off of this global value, remove them. This method is useful for clients /// that want to check to see if a global is unused, but don't want to deal /// with potentially dead constants hanging off of the globals. - void removeDeadConstantUsers(); + void removeDeadConstantUsers() const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GlobalValue *) { return true; } Modified: llvm/trunk/lib/VMCore/Globals.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=66403&r1=66402&r2=66403&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Globals.cpp (original) +++ llvm/trunk/lib/VMCore/Globals.cpp Mon Mar 9 00:50:45 2009 @@ -28,17 +28,17 @@ /// removeDeadUsersOfConstant - If the specified constantexpr is dead, remove /// it. This involves recursively eliminating any dead users of the /// constantexpr. -static bool removeDeadUsersOfConstant(Constant *C) { +static bool removeDeadUsersOfConstant(const Constant *C) { if (isa(C)) return false; // Cannot remove this while (!C->use_empty()) { - Constant *User = dyn_cast(C->use_back()); + const Constant *User = dyn_cast(C->use_back()); if (!User) return false; // Non-constant usage; if (!removeDeadUsersOfConstant(User)) return false; // Constant wasn't dead } - C->destroyConstant(); + const_cast(C)->destroyConstant(); return true; } @@ -46,11 +46,11 @@ /// off of this global value, remove them. This method is useful for clients /// that want to check to see if a global is unused, but don't want to deal /// with potentially dead constants hanging off of the globals. -void GlobalValue::removeDeadConstantUsers() { - Value::use_iterator I = use_begin(), E = use_end(); - Value::use_iterator LastNonDeadUser = E; +void GlobalValue::removeDeadConstantUsers() const { + Value::use_const_iterator I = use_begin(), E = use_end(); + Value::use_const_iterator LastNonDeadUser = E; while (I != E) { - if (Constant *User = dyn_cast(*I)) { + if (const Constant *User = dyn_cast(*I)) { if (!removeDeadUsersOfConstant(User)) { // If the constant wasn't dead, remember that this was the last live use // and move on to the next constant. From sabre at nondot.org Mon Mar 9 00:52:15 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 05:52:15 -0000 Subject: [llvm-commits] [llvm] r66404 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <200903090552.n295qFSO009741@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 00:52:15 2009 New Revision: 66404 URL: http://llvm.org/viewvc/llvm-project?rev=66404&view=rev Log: Make the code generator rip of dead constant expr uses before deciding whether a global is dead or not. This should fix PR3749 - linker adds spurious use to appending globals. I can't reasonably add a testcase for this, because the bc writer/reader strip dead constant users. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=66404&r1=66403&r2=66404&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Mar 9 00:52:15 2009 @@ -418,18 +418,24 @@ const TargetData *TD = TM.getTargetData(); unsigned Align = Log2_32(TD->getPointerPrefAlignment()); - if (GV->getName() == "llvm.global_ctors" && GV->use_empty()) { - SwitchToDataSection(TAI->getStaticCtorsSection()); - EmitAlignment(Align, 0); - EmitXXStructorList(GV->getInitializer()); - return true; + if (GV->getName() == "llvm.global_ctors") { + GV->removeDeadConstantUsers(); + if (GV->use_empty()) { + SwitchToDataSection(TAI->getStaticCtorsSection()); + EmitAlignment(Align, 0); + EmitXXStructorList(GV->getInitializer()); + return true; + } } - if (GV->getName() == "llvm.global_dtors" && GV->use_empty()) { - SwitchToDataSection(TAI->getStaticDtorsSection()); - EmitAlignment(Align, 0); - EmitXXStructorList(GV->getInitializer()); - return true; + if (GV->getName() == "llvm.global_dtors") { + GV->removeDeadConstantUsers(); + if (GV->use_empty()) { + SwitchToDataSection(TAI->getStaticDtorsSection()); + EmitAlignment(Align, 0); + EmitXXStructorList(GV->getInitializer()); + return true; + } } return false; From isanbard at gmail.com Mon Mar 9 01:02:28 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 09 Mar 2009 06:02:28 -0000 Subject: [llvm-commits] [llvm] r66405 - in /llvm/branches/Apple/Dib: include/llvm/Analysis/DebugInfo.h lib/Analysis/DbgInfoPrinter.cpp lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200903090602.n2962SRH010171@zion.cs.uiuc.edu> Author: void Date: Mon Mar 9 01:02:27 2009 New Revision: 66405 URL: http://llvm.org/viewvc/llvm-project?rev=66405&view=rev Log: Merge r 66396 into Dib: Pass in a std::string when getting the names of debugging things. This cuts down on the number of times a std::string is created and copied. Modified: llvm/branches/Apple/Dib/include/llvm/Analysis/DebugInfo.h llvm/branches/Apple/Dib/lib/Analysis/DbgInfoPrinter.cpp llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/branches/Apple/Dib/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Analysis/DebugInfo.h?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/branches/Apple/Dib/include/llvm/Analysis/DebugInfo.h Mon Mar 9 01:02:27 2009 @@ -40,7 +40,7 @@ /// not, the debug info is corrupt and we ignore it. DIDescriptor(GlobalVariable *GV, unsigned RequiredTag); - std::string getStringField(unsigned Elt) const; + const std::string &getStringField(unsigned Elt, std::string &Result) const; unsigned getUnsignedField(unsigned Elt) const { return (unsigned)getUInt64Field(Elt); } @@ -106,9 +106,15 @@ explicit DICompileUnit(GlobalVariable *GV = 0); unsigned getLanguage() const { return getUnsignedField(2); } - std::string getFilename() const { return getStringField(3); } - std::string getDirectory() const { return getStringField(4); } - std::string getProducer() const { return getStringField(5); } + const std::string &getFilename(std::string &F) const { + return getStringField(3, F); + } + const std::string &getDirectory(std::string &F) const { + return getStringField(4, F); + } + const std::string &getProducer(std::string &F) const { + return getStringField(5, F); + } /// isMain - Each input file is encoded as a separate compile unit in LLVM /// debugging information output. However, many target specific tool chains @@ -121,7 +127,9 @@ bool isMain() const { return getUnsignedField(6); } bool isOptimized() const { return getUnsignedField(7); } - std::string getFlags() const { return getStringField(8); } + const std::string &getFlags(std::string &F) const { + return getStringField(8, F); + } unsigned getRunTimeVersion() const { return getUnsignedField(9); } /// Verify - Verify that a compile unit is well formed. @@ -138,7 +146,9 @@ public: explicit DIEnumerator(GlobalVariable *GV = 0); - std::string getName() const { return getStringField(1); } + const std::string &getName(std::string &F) const { + return getStringField(1, F); + } uint64_t getEnumValue() const { return getUInt64Field(2); } }; @@ -182,7 +192,9 @@ virtual ~DIType() {} DIDescriptor getContext() const { return getDescriptorField(1); } - std::string getName() const { return getStringField(2); } + const std::string &getName(std::string &F) const { + return getStringField(2, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs(3); } unsigned getLineNumber() const { return getUnsignedField(4); } uint64_t getSizeInBits() const { return getUInt64Field(5); } @@ -264,9 +276,15 @@ virtual ~DIGlobal() {} DIDescriptor getContext() const { return getDescriptorField(2); } - std::string getName() const { return getStringField(3); } - std::string getDisplayName() const { return getStringField(4); } - std::string getLinkageName() const { return getStringField(5); } + const std::string &getName(std::string &F) const { + return getStringField(3, F); + } + const std::string &getDisplayName(std::string &F) const { + return getStringField(4, F); + } + const std::string &getLinkageName(std::string &F) const { + return getStringField(5, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs(6); } unsigned getLineNumber() const { return getUnsignedField(7); } DIType getType() const { return getFieldAs(8); } @@ -313,7 +331,9 @@ explicit DIVariable(GlobalVariable *GV = 0); DIDescriptor getContext() const { return getDescriptorField(1); } - std::string getName() const { return getStringField(2); } + const std::string &getName(std::string &F) const { + return getStringField(2, F); + } DICompileUnit getCompileUnit() const{ return getFieldAs(3); } unsigned getLineNumber() const { return getUnsignedField(4); } DIType getType() const { return getFieldAs(5); } Modified: llvm/branches/Apple/Dib/lib/Analysis/DbgInfoPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Analysis/DbgInfoPrinter.cpp?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Analysis/DbgInfoPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Analysis/DbgInfoPrinter.cpp Mon Mar 9 01:02:27 2009 @@ -59,8 +59,9 @@ { if(const DbgDeclareInst* DDI = findDbgDeclare(V)) { DIVariable Var(cast(DDI->getVariable())); - Out << "; variable " << Var.getName() - << " of type " << Var.getType().getName() + std::string Res1, Res2; + Out << "; variable " << Var.getName(Res1) + << " of type " << Var.getType().getName(Res2) << " at line " << Var.getLineNumber() << "\n"; } } @@ -83,8 +84,9 @@ void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) { DISubprogram Subprogram(cast(FS->getSubprogram())); - Out << ";fully qualified function name: " << Subprogram.getDisplayName() - << " return type: " << Subprogram.getType().getName() + std::string Res1, Res2; + Out << ";fully qualified function name: " << Subprogram.getDisplayName(Res1) + << " return type: " << Subprogram.getType().getName(Res2) << " at line " << Subprogram.getLineNumber() << "\n\n"; } Modified: llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp (original) +++ llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp Mon Mar 9 01:02:27 2009 @@ -35,17 +35,23 @@ GV = 0; } +const std::string & +DIDescriptor::getStringField(unsigned Elt, std::string &Result) const { + if (GV == 0) { + Result.clear(); + return Result; + } -std::string DIDescriptor::getStringField(unsigned Elt) const { - if (GV == 0) return ""; Constant *C = GV->getInitializer(); - if (C == 0 || Elt >= C->getNumOperands()) - return ""; + if (C == 0 || Elt >= C->getNumOperands()) { + Result.clear(); + return Result; + } - std::string Result; // Fills in the string if it succeeds if (!GetConstantStringInfo(C->getOperand(Elt), Result)) Result.clear(); + return Result; } @@ -59,7 +65,6 @@ return 0; } - DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const { if (GV == 0) return DIDescriptor(); Constant *C = GV->getInitializer(); @@ -185,7 +190,8 @@ bool DICompileUnit::Verify() const { if (isNull()) return false; - if (getFilename().empty()) + std::string Res; + if (getFilename(Res).empty()) return false; // It is possible that directory and produce string is empty. return true; @@ -864,16 +870,22 @@ void DICompileUnit::dump() const { if (getLanguage()) cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; - cerr << " [" << getDirectory() << "/" << getFilename() << " ]"; + + std::string Res1, Res2; + cerr << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]"; } /// dump - print type. void DIType::dump() const { if (isNull()) return; - if (!getName().empty()) - cerr << " [" << getName() << "] "; + + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + unsigned Tag = getTag(); cerr << " [" << dwarf::TagString(Tag) << "] "; + // TODO : Print context getCompileUnit().dump(); cerr << " [" @@ -882,10 +894,12 @@ << getAlignInBits() << ", " << getOffsetInBits() << "] "; + if (isPrivate()) cerr << " [private] "; else if (isProtected()) cerr << " [protected] "; + if (isForwardDecl()) cerr << " [fwd] "; @@ -899,6 +913,7 @@ cerr << "Invalid DIType\n"; return; } + cerr << "\n"; } @@ -923,16 +938,20 @@ /// dump - print global. void DIGlobal::dump() const { + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; - if (!getName().empty()) - cerr << " [" << getName() << "] "; unsigned Tag = getTag(); cerr << " [" << dwarf::TagString(Tag) << "] "; + // TODO : Print context getCompileUnit().dump(); cerr << " [" << getLineNumber() << "] "; + if (isLocalToUnit()) cerr << " [local] "; + if (isDefinition()) cerr << " [def] "; @@ -954,8 +973,10 @@ /// dump - print variable. void DIVariable::dump() const { - if (!getName().empty()) - cerr << " [" << getName() << "] "; + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + getCompileUnit().dump(); cerr << " [" << getLineNumber() << "] "; getType().dump(); Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Mar 9 01:02:27 2009 @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/DwarfWriter.cpp - Dwarf Framework ----------*- C++ -*-===// +//===-- llvm/CodeGen/DwarfWriter.cpp - Dwarf Framework --------------------===// // // The LLVM Compiler Infrastructure // @@ -1661,7 +1661,8 @@ DIBasicType BTy) { // Get core information. - const std::string &Name = BTy.getName(); + std::string Name; + BTy.getName(Name); Buffer.setTag(DW_TAG_base_type); AddUInt(&Buffer, DW_AT_encoding, DW_FORM_data1, BTy.getEncoding()); // Add name if not anonymous or intermediate type. @@ -1676,13 +1677,16 @@ DIDerivedType DTy) { // Get core information. - const std::string &Name = DTy.getName(); + std::string Name; + DTy.getName(Name); uint64_t Size = DTy.getSizeInBits() >> 3; unsigned Tag = DTy.getTag(); + // FIXME - Workaround for templates. if (Tag == DW_TAG_inheritance) Tag = DW_TAG_reference_type; Buffer.setTag(Tag); + // Map to main type, void will not have a type. DIType FromTy = DTy.getTypeDerivedFrom(); AddType(DW_Unit, &Buffer, FromTy); @@ -1703,12 +1707,14 @@ /// ConstructTypeDIE - Construct type DIE from DICompositeType. void ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer, DICompositeType CTy) { - // Get core information. - const std::string &Name = CTy.getName(); + std::string Name; + CTy.getName(Name); + uint64_t Size = CTy.getSizeInBits() >> 3; unsigned Tag = CTy.getTag(); Buffer.setTag(Tag); + switch (Tag) { case DW_TAG_vector_type: case DW_TAG_array_type: @@ -1843,7 +1849,8 @@ DIE *ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) { DIE *Enumerator = new DIE(DW_TAG_enumerator); - AddString(Enumerator, DW_AT_name, DW_FORM_string, ETy->getName()); + std::string Name; + AddString(Enumerator, DW_AT_name, DW_FORM_string, ETy->getName(Name)); int64_t Value = ETy->getEnumValue(); AddSInt(Enumerator, DW_AT_const_value, DW_FORM_sdata, Value); return Enumerator; @@ -1853,9 +1860,11 @@ DIE *CreateGlobalVariableDIE(CompileUnit *DW_Unit, const DIGlobalVariable &GV) { DIE *GVDie = new DIE(DW_TAG_variable); - const std::string &Name = GV.getDisplayName(); + std::string Name; + GV.getDisplayName(Name); AddString(GVDie, DW_AT_name, DW_FORM_string, Name); - const std::string &LinkageName = GV.getLinkageName(); + std::string LinkageName; + GV.getLinkageName(LinkageName); if (!LinkageName.empty()) AddString(GVDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); AddType(DW_Unit, GVDie, GV.getType()); @@ -1868,7 +1877,8 @@ /// CreateMemberDIE - Create new member DIE. DIE *CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT) { DIE *MemberDie = new DIE(DT.getTag()); - std::string Name = DT.getName(); + std::string Name; + DT.getName(Name); if (!Name.empty()) AddString(MemberDie, DW_AT_name, DW_FORM_string, Name); @@ -1912,8 +1922,10 @@ const DISubprogram &SP, bool IsConstructor = false) { DIE *SPDie = new DIE(DW_TAG_subprogram); - AddString(SPDie, DW_AT_name, DW_FORM_string, SP.getName()); - const std::string &LinkageName = SP.getLinkageName(); + std::string Name; + AddString(SPDie, DW_AT_name, DW_FORM_string, SP.getName(Name)); + std::string LinkageName; + SP.getLinkageName(LinkageName); if (!LinkageName.empty()) AddString(SPDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); @@ -1976,7 +1988,8 @@ // Define variable debug information entry. DIE *VariableDie = new DIE(Tag); - AddString(VariableDie, DW_AT_name, DW_FORM_string, VD.getName()); + std::string Name; + AddString(VariableDie, DW_AT_name, DW_FORM_string, VD.getName(Name)); // Add source line info if available. AddSourceLine(VariableDie, &VD); @@ -2126,7 +2139,8 @@ E = Result.end(); I != E; ++I) { DISubprogram SPD(*I); - if (SPD.getName() == MF->getFunction()->getName()) { + std::string Name; + if (SPD.getName(Name) == MF->getFunction()->getName()) { // Get the compile unit context. CompileUnit *Unit = MainCU; if (!Unit) @@ -2798,21 +2812,24 @@ for (std::vector::iterator RI = Result.begin(), RE = Result.end(); RI != RE; ++RI) { DICompileUnit DIUnit(*RI); - unsigned ID = RecordSource(DIUnit.getDirectory(), - DIUnit.getFilename()); + std::string Dir, FN; + unsigned ID = RecordSource(DIUnit.getDirectory(Dir), + DIUnit.getFilename(FN)); DIE *Die = new DIE(DW_TAG_compile_unit); AddSectionOffset(Die, DW_AT_stmt_list, DW_FORM_data4, DWLabel("section_line", 0), DWLabel("section_line", 0), false); - AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer()); + std::string Prod; + AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer(Prod)); AddUInt(Die, DW_AT_language, DW_FORM_data1, DIUnit.getLanguage()); - AddString(Die, DW_AT_name, DW_FORM_string, DIUnit.getFilename()); - if (!DIUnit.getDirectory().empty()) - AddString(Die, DW_AT_comp_dir, DW_FORM_string, DIUnit.getDirectory()); + AddString(Die, DW_AT_name, DW_FORM_string, FN); + if (!Dir.empty()) + AddString(Die, DW_AT_comp_dir, DW_FORM_string, Dir); if (DIUnit.isOptimized()) AddUInt(Die, DW_AT_APPLE_optimized, DW_FORM_flag, 1); - const std::string &Flags = DIUnit.getFlags(); + std::string Flags; + DIUnit.getFlags(Flags); if (!Flags.empty()) AddString(Die, DW_AT_APPLE_flags, DW_FORM_string, Flags); unsigned RVer = DIUnit.getRunTimeVersion(); @@ -2861,7 +2878,8 @@ //Add to context owner. DW_Unit->getDie()->AddChild(VariableDie); //Expose as global. FIXME - need to check external flag. - DW_Unit->AddGlobal(DI_GV.getName(), VariableDie); + std::string Name; + DW_Unit->AddGlobal(DI_GV.getName(Name), VariableDie); if (!result) result = true; @@ -2900,7 +2918,8 @@ //Add to context owner. Unit->getDie()->AddChild(SubprogramDie); //Expose as global. - Unit->AddGlobal(SP.getName(), SubprogramDie); + std::string Name; + Unit->AddGlobal(SP.getName(Name), SubprogramDie); if (!result) result = true; Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Mar 9 01:02:27 2009 @@ -319,8 +319,9 @@ DbgStopPointInst *SPI = cast(I); if (DW && DW->ValidDebugInfo(SPI->getContext())) { DICompileUnit CU(cast(SPI->getContext())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->RecordSource(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned Line = SPI->getLine(); unsigned Col = SPI->getColumn(); unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile); @@ -361,8 +362,9 @@ // (most?) gdb expects. DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned SrcFile = DW->RecordSource(CompileUnit.getDirectory(), - CompileUnit.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->RecordSource(CompileUnit.getDirectory(Dir), + CompileUnit.getFilename(FN)); // Record the source line but does not create a label for the normal // function start. It will be emitted at asm emission time. However, Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Mar 9 01:02:27 2009 @@ -1288,9 +1288,10 @@ GlobalVariable *CU_GV = cast(DSP->getCompileUnit()); if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) { DICompileUnit CU(cast(DSP->getCompileUnit())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); - + std::string Dir, FN; + unsigned SrcFile = DW->RecordSource(CU.getDirectory(Dir), + CU.getFilename(FN)); + unsigned Line = DSP->getLine(); unsigned Col = DSP->getColumn(); Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Mar 9 01:02:27 2009 @@ -335,8 +335,9 @@ if (DW && DW->ValidDebugInfo(SPI->getContext())) { DICompileUnit CU(cast(SPI->getContext())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->RecordSource(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned idx = MF->getOrCreateDebugLocID(SrcFile, SPI->getLine(), SPI->getColumn()); @@ -354,8 +355,9 @@ if (DW->ValidDebugInfo(SP)) { DISubprogram Subprogram(cast(SP)); DICompileUnit CU(Subprogram.getCompileUnit()); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->RecordSource(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned Line = Subprogram.getLineNumber(); DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0)); } @@ -3901,7 +3903,9 @@ SPI.getColumn(), SPI.getContext())); DICompileUnit CU(cast(SPI.getContext())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), CU.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->RecordSource(CU.getDirectory(Dir), + CU.getFilename(FN)); unsigned idx = DAG.getMachineFunction(). getOrCreateDebugLocID(SrcFile, SPI.getLine(), @@ -3946,8 +3950,9 @@ // what (most?) gdb expects. DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned SrcFile = DW->RecordSource(CompileUnit.getDirectory(), - CompileUnit.getFilename()); + std::string Dir, FN; + unsigned SrcFile = DW->RecordSource(CompileUnit.getDirectory(Dir), + CompileUnit.getFilename(FN)); // Record the source line but does not create a label for the normal // function start. It will be emitted at asm emission time. However, Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=66405&r1=66404&r2=66405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Mar 9 01:02:27 2009 @@ -179,7 +179,8 @@ } } else if (const DbgStopPointSDNode *D = dyn_cast(Node)) { DICompileUnit CU(cast(D->getCompileUnit())); - Op += ": " + CU.getFilename(); + std::string FN; + Op += ": " + CU.getFilename(FN); Op += ":" + utostr(D->getLine()); if (D->getColumn() != 0) Op += ":" + utostr(D->getColumn()); From nicholas at mxc.ca Mon Mar 9 01:16:26 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 09 Mar 2009 06:16:26 -0000 Subject: [llvm-commits] [llvm] r66406 - in /llvm/trunk: Makefile autoconf/configure.ac autoconf/m4/cxx_hash_map.m4 autoconf/m4/cxx_hash_set.m4 cmake/config-ix.cmake cmake/modules/CheckCxxHashmap.cmake cmake/modules/CheckCxxHashset.cmake include/llvm/ADT/HashExtras.h include/llvm/ADT/hash_map.cmake include/llvm/ADT/hash_map.h.in include/llvm/ADT/hash_set.cmake include/llvm/ADT/hash_set.h.in Message-ID: <200903090616.n296GQdW010655@zion.cs.uiuc.edu> Author: nicholas Date: Mon Mar 9 01:16:26 2009 New Revision: 66406 URL: http://llvm.org/viewvc/llvm-project?rev=66406&view=rev Log: Remove configurey-fu to autodetect hash_map and hash_set now that they are no longer used in LLVM. Removed: llvm/trunk/autoconf/m4/cxx_hash_map.m4 llvm/trunk/autoconf/m4/cxx_hash_set.m4 llvm/trunk/cmake/modules/CheckCxxHashmap.cmake llvm/trunk/cmake/modules/CheckCxxHashset.cmake llvm/trunk/include/llvm/ADT/hash_map.cmake llvm/trunk/include/llvm/ADT/hash_map.h.in llvm/trunk/include/llvm/ADT/hash_set.cmake llvm/trunk/include/llvm/ADT/hash_set.h.in Modified: llvm/trunk/Makefile llvm/trunk/autoconf/configure.ac llvm/trunk/cmake/config-ix.cmake llvm/trunk/include/llvm/ADT/HashExtras.h Modified: llvm/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile?rev=66406&r1=66405&r2=66406&view=diff ============================================================================== --- llvm/trunk/Makefile (original) +++ llvm/trunk/Makefile Mon Mar 9 01:16:26 2009 @@ -117,8 +117,6 @@ dist-hook:: $(Echo) Eliminating files constructed by configure $(Verb) $(RM) -f \ - $(TopDistDir)/include/llvm/ADT/hash_map.h \ - $(TopDistDir)/include/llvm/ADT/hash_set.h \ $(TopDistDir)/include/llvm/ADT/iterator.h \ $(TopDistDir)/include/llvm/Config/config.h \ $(TopDistDir)/include/llvm/Support/DataTypes.h \ @@ -137,8 +135,6 @@ FilesToConfig := \ include/llvm/Config/config.h \ include/llvm/Support/DataTypes.h \ - include/llvm/ADT/hash_map.h \ - include/llvm/ADT/hash_set.h \ include/llvm/ADT/iterator.h FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig)) Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=66406&r1=66405&r2=66406&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Mon Mar 9 01:16:26 2009 @@ -842,8 +842,6 @@ dnl Check for variations in the Standard C++ library and STL. These macros are dnl provided by LLVM in the autoconf/m4 directory. -AC_CXX_HAVE_HASH_MAP -AC_CXX_HAVE_HASH_SET AC_CXX_HAVE_STD_ITERATOR AC_CXX_HAVE_BI_ITERATOR AC_CXX_HAVE_FWD_ITERATOR @@ -1048,8 +1046,6 @@ dnl files can be updated automatically when their *.in sources change. AC_CONFIG_HEADERS([include/llvm/Config/config.h]) AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) -AC_CONFIG_HEADERS([include/llvm/ADT/hash_map.h]) -AC_CONFIG_HEADERS([include/llvm/ADT/hash_set.h]) AC_CONFIG_HEADERS([include/llvm/ADT/iterator.h]) dnl Configure the makefile's configuration data Removed: llvm/trunk/autoconf/m4/cxx_hash_map.m4 URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/m4/cxx_hash_map.m4?rev=66405&view=auto ============================================================================== --- llvm/trunk/autoconf/m4/cxx_hash_map.m4 (original) +++ llvm/trunk/autoconf/m4/cxx_hash_map.m4 (removed) @@ -1,59 +0,0 @@ -# Check for hash_map extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html -AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_MAP], -[AC_CACHE_CHECK([whether the compiler has defining template class std::hash_map], - ac_cv_cxx_have_std_ext_hash_map, - [AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif]], [[hash_map t;]])],[ac_cv_cxx_have_std_ext_hash_map=yes],[ac_cv_cxx_have_std_ext_hash_map=no]) - AC_LANG_POP([C++])]) - if test "$ac_cv_cxx_have_std_ext_hash_map" = yes - then - AC_DEFINE(HAVE_STD_EXT_HASH_MAP,1,[Have ext/hash_map>]) - else - AC_DEFINE(HAVE_STD_EXT_HASH_MAP,0,[Does not have ext/hash_map>]) - fi - ]) - -AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_MAP], -[AC_CACHE_CHECK([whether the compiler has defining template class __gnu_cxx::hash_map], - ac_cv_cxx_have_gnu_ext_hash_map, - [AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif]], [[hash_map t; ]])],[ac_cv_cxx_have_gnu_ext_hash_map=yes],[ac_cv_cxx_have_gnu_ext_hash_map=no]) - AC_LANG_POP([C++])]) - if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes - then - AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,1,[Have ext/hash_map]) - else - AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,0,[Does not have ext/hash_map]) - fi - ]) - -AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_MAP], -[AC_CACHE_CHECK([whether the compiler has defining template class ::hash_map], - ac_cv_cxx_have_global_hash_map, - [AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[hash_map t; ]])],[ac_cv_cxx_have_global_hash_map=yes],[ac_cv_cxx_have_global_hash_map=no]) - AC_LANG_POP([C++])]) - if test "$ac_cv_cxx_have_global_hash_map" = yes - then - AC_DEFINE(HAVE_GLOBAL_HASH_MAP,1,[Have ]) - else - AC_DEFINE(HAVE_GLOBAL_HASH_MAP,0,[Does not have ]) - fi - ]) - -AC_DEFUN([AC_CXX_HAVE_HASH_MAP], -[AC_CXX_HAVE_STD_EXT_HASH_MAP - AC_CXX_HAVE_GNU_EXT_HASH_MAP - AC_CXX_HAVE_GLOBAL_HASH_MAP]) - - Removed: llvm/trunk/autoconf/m4/cxx_hash_set.m4 URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/m4/cxx_hash_set.m4?rev=66405&view=auto ============================================================================== --- llvm/trunk/autoconf/m4/cxx_hash_set.m4 (original) +++ llvm/trunk/autoconf/m4/cxx_hash_set.m4 (removed) @@ -1,60 +0,0 @@ -# Check for hash_set extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_SET], -[AC_CACHE_CHECK([whether the compiler has defining template class std::hash_set], - ac_cv_cxx_have_std_ext_hash_set, - [AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif]], [[hash_set t; ]])],[ac_cv_cxx_have_std_ext_hash_set=yes],[ac_cv_cxx_have_std_ext_hash_set=no]) - AC_LANG_POP([C++])]) - if test "$ac_cv_cxx_have_std_ext_hash_set" = yes - then - AC_DEFINE(HAVE_STD_EXT_HASH_SET,1,[Have hash_set in std namespace]) - else - AC_DEFINE(HAVE_STD_EXT_HASH_SET,0,[Does not have hash_set in std namespace]) - fi - ]) - -AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_SET], -[AC_CACHE_CHECK( - [whether the compiler has defining template class __gnu_cxx::hash_set], - ac_cv_cxx_have_gnu_ext_hash_set, - [AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif]], [[hash_set t; ]])],[ac_cv_cxx_have_gnu_ext_hash_set=yes],[ac_cv_cxx_have_gnu_ext_hash_set=no]) - AC_LANG_POP([C++])]) - if test "$ac_cv_cxx_have_gnu_ext_hash_set" = yes - then - AC_DEFINE(HAVE_GNU_EXT_HASH_SET,1,[Have hash_set in gnu namespace]) - else - AC_DEFINE(HAVE_GNU_EXT_HASH_SET,0,[Does not have hash_set in gnu namespace]) - fi - ]) - -AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_SET], -[AC_CACHE_CHECK([whether the compiler has defining template class ::hash_set], - ac_cv_cxx_have_global_hash_set, - [AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[hash_set t; return 0;]])],[ac_cv_cxx_have_global_hash_set=yes],[ac_cv_cxx_have_global_hash_set=no]) - AC_LANG_POP([C++])]) - if test "$ac_cv_cxx_have_global_hash_set" = yes - then - AC_DEFINE(HAVE_GLOBAL_HASH_SET,1,[Have hash_set in global namespace]) - else - AC_DEFINE(HAVE_GLOBAL_HASH_SET,0,[Does not have hash_set in global namespace]) - fi - ]) - -AC_DEFUN([AC_CXX_HAVE_HASH_SET], -[AC_CXX_HAVE_STD_EXT_HASH_SET - AC_CXX_HAVE_GNU_EXT_HASH_SET - AC_CXX_HAVE_GLOBAL_HASH_SET]) - - Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=66406&r1=66405&r2=66406&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Mon Mar 9 01:16:26 2009 @@ -86,14 +86,6 @@ set(LTDL_DLOPEN_DEPLIBS 0) # TODO endif( MSVC ) -if( NOT MSVC ) - # hash_map.h.in and hash_set.h.in contain a special case for MSVC - include(CheckCxxHashmap) - include(CheckCxxHashset) - check_hashmap() - check_hashset() -endif( NOT MSVC ) - # FIXME: Signal handler return type, currently hardcoded to 'void' set(RETSIGTYPE void) @@ -124,12 +116,3 @@ ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h ) -configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/hash_map.cmake - ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_map.h - ) - -configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/hash_set.cmake - ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_set.h - ) Removed: llvm/trunk/cmake/modules/CheckCxxHashmap.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckCxxHashmap.cmake?rev=66405&view=auto ============================================================================== --- llvm/trunk/cmake/modules/CheckCxxHashmap.cmake (original) +++ llvm/trunk/cmake/modules/CheckCxxHashmap.cmake (removed) @@ -1,53 +0,0 @@ -# - Check if for hash_map. -# CHECK_HASHMAP () -# - -include(CheckCXXSourceCompiles) - -macro(CHECK_HASHMAP) - message(STATUS "Checking for C++ hash_map implementation...") - check_cxx_source_compiles(" - #include - int main() { - __gnu_cxx::hash_map t; - } -" - HAVE_GNU_EXT_HASH_MAP - ) - if(HAVE_GNU_EXT_HASH_MAP) - message(STATUS "C++ hash_map found in 'ext' dir in namespace __gnu_cxx::") - endif(HAVE_GNU_EXT_HASH_MAP) - - check_cxx_source_compiles(" - #include - int main() { - std::hash_map t; - } -" - HAVE_STD_EXT_HASH_MAP - ) - if(HAVE_STD_EXT_HASH_MAP) - message(STATUS "C++ hash_map found in 'ext' dir in namespace std::") - endif(HAVE_STD_EXT_HASH_MAP) - - check_cxx_source_compiles(" - #include - int main() { - hash_map t; - } -" - HAVE_GLOBAL_HASH_MAP - ) - if(HAVE_GLOBAL_HASH_MAP) - message(STATUS "C++ hash_map found in global namespace") - endif(HAVE_GLOBAL_HASH_MAP) - - if(NOT HAVE_GNU_EXT_HASH_MAP) - if(NOT HAVE_STD_EXT_HASH_MAP) - if(NOT HAVE_GLOBAL_HASH_MAP) - message(STATUS "C++ hash_map not found") - endif(NOT HAVE_GLOBAL_HASH_MAP) - endif(NOT HAVE_STD_EXT_HASH_MAP) - endif(NOT HAVE_GNU_EXT_HASH_MAP) - -endmacro(CHECK_HASHMAP) Removed: llvm/trunk/cmake/modules/CheckCxxHashset.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckCxxHashset.cmake?rev=66405&view=auto ============================================================================== --- llvm/trunk/cmake/modules/CheckCxxHashset.cmake (original) +++ llvm/trunk/cmake/modules/CheckCxxHashset.cmake (removed) @@ -1,52 +0,0 @@ -# - Check if for hash_set. -# CHECK_HASHSET () -# - -include(CheckCXXSourceCompiles) - -macro(CHECK_HASHSET) - message(STATUS "Checking for C++ hash_set implementation...") - check_cxx_source_compiles(" - #include - int main() { - __gnu_cxx::hash_set t; - } -" - HAVE_GNU_EXT_HASH_SET - ) - if(HAVE_GNU_EXT_HASH_SET) - message(STATUS "C++ hash_set found in 'ext' dir in namespace __gnu_cxx::") - endif(HAVE_GNU_EXT_HASH_SET) - - check_cxx_source_compiles(" - #include - int main() { - std::hash_set t; - } -" - HAVE_STD_EXT_HASH_SET - ) - if(HAVE_STD_EXT_HASH_SET) - message(STATUS "C++ hash_set found in 'ext' dir in namespace std::") - endif(HAVE_STD_EXT_HASH_SET) - - check_cxx_source_compiles(" - #include - int main() { - hash_set t; - } -" - HAVE_GLOBAL_HASH_SET - ) - if(HAVE_GLOBAL_HASH_SET) - message(STATUS "C++ hash_set found in global namespace") - endif(HAVE_GLOBAL_HASH_SET) - - if(NOT HAVE_GNU_EXT_HASH_SET) - if(NOT HAVE_STD_EXT_HASH_SET) - if(NOT HAVE_GLOBAL_HASH_SET) - message(STATUS "C++ hash_set not found") - endif(NOT HAVE_GLOBAL_HASH_SET) - endif(NOT HAVE_STD_EXT_HASH_SET) - endif(NOT HAVE_GNU_EXT_HASH_SET) -endmacro(CHECK_HASHSET) Modified: llvm/trunk/include/llvm/ADT/HashExtras.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/HashExtras.h?rev=66406&r1=66405&r2=66406&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/HashExtras.h (original) +++ llvm/trunk/include/llvm/ADT/HashExtras.h Mon Mar 9 01:16:26 2009 @@ -17,7 +17,6 @@ #ifndef LLVM_ADT_HASHEXTRAS_H #define LLVM_ADT_HASHEXTRAS_H -#include "llvm/ADT/hash_map.h" #include // Cannot specialize hash template from outside of the std namespace. Removed: llvm/trunk/include/llvm/ADT/hash_map.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/hash_map.cmake?rev=66405&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/hash_map.cmake (original) +++ llvm/trunk/include/llvm/ADT/hash_map.cmake (removed) @@ -1,150 +0,0 @@ -//===-- llvm/ADT/hash_map - "Portable" wrapper around hash_map --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file provides a wrapper around the mysterious header file -// that seems to move around between GCC releases into and out of namespaces at -// will. #including this header will cause hash_map to be available in the -// global namespace. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_HASH_MAP -#define LLVM_ADT_HASH_MAP - -// Compiler Support Matrix -// -// Version Namespace Header File -// 2.95.x :: hash_map -// 3.0.4 std ext/hash_map -// 3.1 __gnu_cxx ext/hash_map -// HP aCC6 std stdex/rw/hashm*ap.h -// MS VC++ stdext hash_map - -#cmakedefine HAVE_GNU_EXT_HASH_MAP -#cmakedefine HAVE_STD_EXT_HASH_MAP -#cmakedefine HAVE_GLOBAL_HASH_MAP -#cmakedefine HAVE_RW_STDEX_HASH_MAP_H - -#if defined(HAVE_GNU_EXT_HASH_MAP) -// This is for GCC-3.1+ which puts hash in ext/hash_map -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE __gnu_cxx -# endif - -// GCC 3.0.x puts hash_map in and in the std namespace. -#elif defined(HAVE_STD_EXT_HASH_MAP) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Older compilers such as GCC before version 3.0 do not keep -// extensions in the `ext' directory, and ignore the `std' namespace. -#elif defined(HAVE_GLOBAL_HASH_MAP) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// HP aCC doesn't include an SGI-like hash_map. For this platform (or -// any others using Rogue Wave Software's Tools.h++ library), we wrap -// around them in std:: -#elif defined(HAVE_RW_STDEX_HASH_MAP_H) -# include -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Support Microsoft VC++. -#elif defined(_MSC_VER) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE stdext - using std::_Distance; -# endif - -// Give a warning if we couldn't find it, instead of (or in addition to) -// randomly doing something dumb. -#else -# warning "Autoconfiguration failed to find the hash_map header file." -#endif - -// we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here: -#ifdef HAVE_RW_STDEX_HASH_MAP_H -namespace HASH_NAMESPACE { - -template struct hash { - unsigned int operator()(const unsigned int& x) const { - return x; - } -}; - -template , - class _EqualKey = equal_to, - class _A = allocator > -class hash_map : public rw_hashmap { -}; - -template , - class _EqualKey = equal_to, - class _A = allocator > -class hash_multimap : public rw_hashmultimap { -}; - -} // end HASH_NAMESPACE; -#endif - -// Include vector because ext/hash_map includes stl_vector.h and leaves -// out specializations like stl_bvector.h, causing link conflicts. -#include - -#ifdef _MSC_VER - -// GCC and VC++ have differing ways of implementing hash_maps. As it's not -// standardized, that's to be expected. This adapter class allows VC++ -// hash_map to use GCC's hash classes. -namespace stdext { - template struct hash; - - // Provide a hash function for unsigned ints... - template<> struct hash { - inline size_t operator()(unsigned int Val) const { - return Val; - } - }; - - template class hash_compare > { - std::less comp; - public: - enum { bucket_size = 4 }; - enum { min_buckets = 8 }; - hash_compare() {} - hash_compare(std::less pred) : comp(pred) {} - size_t operator()(const Key& key) const { return hash()(key); } - bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); } - }; -} - -#endif - -using HASH_NAMESPACE::hash_map; -using HASH_NAMESPACE::hash_multimap; -using HASH_NAMESPACE::hash; - -#include "llvm/ADT/HashExtras.h" - -#endif Removed: llvm/trunk/include/llvm/ADT/hash_map.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/hash_map.h.in?rev=66405&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/hash_map.h.in (original) +++ llvm/trunk/include/llvm/ADT/hash_map.h.in (removed) @@ -1,150 +0,0 @@ -//==-- llvm/ADT/hash_map.h - "Portable" wrapper around hash_map --*- C++ -*-==// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file provides a wrapper around the mysterious header file -// that seems to move around between GCC releases into and out of namespaces at -// will. #including this header will cause hash_map to be available in the -// global namespace. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_HASH_MAP_H -#define LLVM_ADT_HASH_MAP_H - -// Compiler Support Matrix -// -// Version Namespace Header File -// 2.95.x :: hash_map -// 3.0.4 std ext/hash_map -// 3.1 __gnu_cxx ext/hash_map -// HP aCC6 std stdex/rw/hashm*ap.h -// MS VC++ stdext hash_map - -#undef HAVE_GNU_EXT_HASH_MAP -#undef HAVE_STD_EXT_HASH_MAP -#undef HAVE_GLOBAL_HASH_MAP -#undef HAVE_RW_STDEX_HASH_MAP_H - -#if HAVE_GNU_EXT_HASH_MAP -// This is for GCC-3.1+ which puts hash in ext/hash_map -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE __gnu_cxx -# endif - -// GCC 3.0.x puts hash_map in and in the std namespace. -#elif HAVE_STD_EXT_HASH_MAP -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Older compilers such as GCC before version 3.0 do not keep -// extensions in the `ext' directory, and ignore the `std' namespace. -#elif HAVE_GLOBAL_HASH_MAP -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// HP aCC doesn't include an SGI-like hash_map. For this platform (or -// any others using Rogue Wave Software's Tools.h++ library), we wrap -// around them in std:: -#elif HAVE_RW_STDEX_HASH_MAP_H -# include -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Support Microsoft VC++. -#elif defined(_MSC_VER) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE stdext - using std::_Distance; -# endif - -// Give a warning if we couldn't find it, instead of (or in addition to) -// randomly doing something dumb. -#else -# warning "Autoconfiguration failed to find the hash_map header file." -#endif - -// we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here: -#ifdef HAVE_RW_STDEX_HASH_MAP_H -namespace HASH_NAMESPACE { - -template struct hash { - unsigned int operator()(const unsigned int& x) const { - return x; - } -}; - -template , - class _EqualKey = equal_to, - class _A = allocator > -class hash_map : public rw_hashmap { -}; - -template , - class _EqualKey = equal_to, - class _A = allocator > -class hash_multimap : public rw_hashmultimap { -}; - -} // end HASH_NAMESPACE; -#endif - -// Include vector because ext/hash_map includes stl_vector.h and leaves -// out specializations like stl_bvector.h, causing link conflicts. -#include - -#ifdef _MSC_VER - -// GCC and VC++ have differing ways of implementing hash_maps. As it's not -// standardized, that's to be expected. This adapter class allows VC++ -// hash_map to use GCC's hash classes. -namespace stdext { - template struct hash; - - // Provide a hash function for unsigned ints... - template<> struct hash { - inline size_t operator()(unsigned int Val) const { - return Val; - } - }; - - template class hash_compare > { - std::less comp; - public: - enum { bucket_size = 4 }; - enum { min_buckets = 8 }; - hash_compare() {} - hash_compare(std::less pred) : comp(pred) {} - size_t operator()(const Key& key) const { return hash()(key); } - bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); } - }; -} - -#endif - -using HASH_NAMESPACE::hash_map; -using HASH_NAMESPACE::hash_multimap; -using HASH_NAMESPACE::hash; - -#include "llvm/ADT/HashExtras.h" - -#endif // LLVM_ADT_HASH_MAP_H Removed: llvm/trunk/include/llvm/ADT/hash_set.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/hash_set.cmake?rev=66405&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/hash_set.cmake (original) +++ llvm/trunk/include/llvm/ADT/hash_set.cmake (removed) @@ -1,111 +0,0 @@ -//===-- llvm/ADT/hash_set - "Portable" wrapper around hash_set --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// vim:ft=cpp -// -// This file provides a wrapper around the mysterious header file -// that seems to move around between GCC releases into and out of namespaces at -// will. #including this header will cause hash_set to be available in the -// global namespace. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_HASH_SET -#define LLVM_ADT_HASH_SET - -// Compiler Support Matrix -// -// Version Namespace Header File -// 2.95.x :: hash_set -// 3.0.4 std ext/hash_set -// 3.1 __gnu_cxx ext/hash_set -// HP aCC6 std stdex/rw/hashset.h -// MS VC++ stdext hash_set - -#cmakedefine HAVE_GNU_EXT_HASH_SET -#cmakedefine HAVE_STD_EXT_HASH_SET -#cmakedefine HAVE_GLOBAL_HASH_SET -#cmakedefine HAVE_RW_STDEX_HASH_SET_H - -// GCC versions 3.1 and later put hash_set in and in -// the __gnu_cxx namespace. -#if defined(HAVE_GNU_EXT_HASH_SET) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE __gnu_cxx -# endif - -// GCC 3.0.x puts hash_set in and in the std namespace. -#elif defined(HAVE_STD_EXT_HASH_SET) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Older compilers such as GCC before version 3.0 do not keep -// extensions in the `ext' directory, and ignore the `std' namespace. -#elif defined(HAVE_GLOBAL_HASH_SET) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// HP aCC doesn't include an SGI-like hash_set. For this platform (or -// any others using Rogue Wave Software's Tools.h++ library), we wrap -// around them in std:: -#elif defined(HAVE_RW_STDEX_HASH_SET_H) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Support Microsoft VC++. -#elif defined(_MSC_VER) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE stdext -# endif - -// Give a warning if we couldn't find it, instead of (or in addition to) -// randomly doing something dumb. -#else -# warning "Autoconfiguration failed to find the hash_set header file." -#endif - -// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here: -#ifdef HAVE_RW_STDEX_HASH_SET_H -namespace HASH_NAMESPACE { - -/* -template struct hash { - unsigned int operator()(const unsigned int& x) const { - return x; - } -}; -*/ - -template , - class _EqualKey = equal_to, - class _A = allocator > -class hash_set : - public rw_hashset { -}; - -} // end HASH_NAMESPACE; -#endif - -using HASH_NAMESPACE::hash_set; - -// Include vector because ext/hash_set includes stl_vector.h and leaves -// out specializations like stl_bvector.h, causing link conflicts. -#include - -#include "llvm/ADT/HashExtras.h" - -#endif Removed: llvm/trunk/include/llvm/ADT/hash_set.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/hash_set.h.in?rev=66405&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/hash_set.h.in (original) +++ llvm/trunk/include/llvm/ADT/hash_set.h.in (removed) @@ -1,111 +0,0 @@ -//==-- llvm/ADT/hash_set.h - "Portable" wrapper around hash_set --*- C++ -*-==// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// vim:ft=cpp -// -// This file provides a wrapper around the mysterious header file -// that seems to move around between GCC releases into and out of namespaces at -// will. #including this header will cause hash_set to be available in the -// global namespace. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_HASH_SET_H -#define LLVM_ADT_HASH_SET_H - -// Compiler Support Matrix -// -// Version Namespace Header File -// 2.95.x :: hash_set -// 3.0.4 std ext/hash_set -// 3.1 __gnu_cxx ext/hash_set -// HP aCC6 std stdex/rw/hashset.h -// MS VC++ stdext hash_set - -#undef HAVE_GNU_EXT_HASH_SET -#undef HAVE_STD_EXT_HASH_SET -#undef HAVE_GLOBAL_HASH_SET -#undef HAVE_RW_STDEX_HASH_SET_H - -// GCC versions 3.1 and later put hash_set in and in -// the __gnu_cxx namespace. -#if HAVE_GNU_EXT_HASH_SET -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE __gnu_cxx -# endif - -// GCC 3.0.x puts hash_set in and in the std namespace. -#elif HAVE_STD_EXT_HASH_SET -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Older compilers such as GCC before version 3.0 do not keep -// extensions in the `ext' directory, and ignore the `std' namespace. -#elif HAVE_GLOBAL_HASH_SET -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// HP aCC doesn't include an SGI-like hash_set. For this platform (or -// any others using Rogue Wave Software's Tools.h++ library), we wrap -// around them in std:: -#elif HAVE_RW_STDEX_HASH_SET_H -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE std -# endif - -// Support Microsoft VC++. -#elif defined(_MSC_VER) -# include -# ifndef HASH_NAMESPACE -# define HASH_NAMESPACE stdext -# endif - -// Give a warning if we couldn't find it, instead of (or in addition to) -// randomly doing something dumb. -#else -# warning "Autoconfiguration failed to find the hash_set header file." -#endif - -// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here: -#ifdef HAVE_RW_STDEX_HASH_SET_H -namespace HASH_NAMESPACE { - -/* -template struct hash { - unsigned int operator()(const unsigned int& x) const { - return x; - } -}; -*/ - -template , - class _EqualKey = equal_to, - class _A = allocator > -class hash_set : - public rw_hashset { -}; - -} // end HASH_NAMESPACE; -#endif - -using HASH_NAMESPACE::hash_set; - -// Include vector because ext/hash_set includes stl_vector.h and leaves -// out specializations like stl_bvector.h, causing link conflicts. -#include - -#include "llvm/ADT/HashExtras.h" - -#endif // LLVM_ADT_HASH_SET_H From nicholas at mxc.ca Mon Mar 9 01:16:46 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 09 Mar 2009 06:16:46 -0000 Subject: [llvm-commits] [llvm] r66407 - in /llvm/trunk: configure include/llvm/Config/config.h.in Message-ID: <200903090616.n296GlDH010683@zion.cs.uiuc.edu> Author: nicholas Date: Mon Mar 9 01:16:46 2009 New Revision: 66407 URL: http://llvm.org/viewvc/llvm-project?rev=66407&view=rev Log: Regenerate. Modified: llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.in Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=66407&r1=66406&r2=66407&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon Mar 9 01:16:46 2009 @@ -32039,582 +32039,6 @@ fi -{ echo "$as_me:$LINENO: checking whether the compiler has defining template class std::hash_map" >&5 -echo $ECHO_N "checking whether the compiler has defining template class std::hash_map... $ECHO_C" >&6; } -if test "${ac_cv_cxx_have_std_ext_hash_map+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif -int -main () -{ -hash_map t; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_cxx_have_std_ext_hash_map=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_cxx_have_std_ext_hash_map=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_have_std_ext_hash_map" >&5 -echo "${ECHO_T}$ac_cv_cxx_have_std_ext_hash_map" >&6; } - if test "$ac_cv_cxx_have_std_ext_hash_map" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STD_EXT_HASH_MAP 1 -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STD_EXT_HASH_MAP 0 -_ACEOF - - fi - - { echo "$as_me:$LINENO: checking whether the compiler has defining template class __gnu_cxx::hash_map" >&5 -echo $ECHO_N "checking whether the compiler has defining template class __gnu_cxx::hash_map... $ECHO_C" >&6; } -if test "${ac_cv_cxx_have_gnu_ext_hash_map+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif -int -main () -{ -hash_map t; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_cxx_have_gnu_ext_hash_map=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_cxx_have_gnu_ext_hash_map=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_have_gnu_ext_hash_map" >&5 -echo "${ECHO_T}$ac_cv_cxx_have_gnu_ext_hash_map" >&6; } - if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GNU_EXT_HASH_MAP 1 -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GNU_EXT_HASH_MAP 0 -_ACEOF - - fi - - { echo "$as_me:$LINENO: checking whether the compiler has defining template class ::hash_map" >&5 -echo $ECHO_N "checking whether the compiler has defining template class ::hash_map... $ECHO_C" >&6; } -if test "${ac_cv_cxx_have_global_hash_map+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -hash_map t; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_cxx_have_global_hash_map=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_cxx_have_global_hash_map=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_have_global_hash_map" >&5 -echo "${ECHO_T}$ac_cv_cxx_have_global_hash_map" >&6; } - if test "$ac_cv_cxx_have_global_hash_map" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GLOBAL_HASH_MAP 1 -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GLOBAL_HASH_MAP 0 -_ACEOF - - fi - -{ echo "$as_me:$LINENO: checking whether the compiler has defining template class std::hash_set" >&5 -echo $ECHO_N "checking whether the compiler has defining template class std::hash_set... $ECHO_C" >&6; } -if test "${ac_cv_cxx_have_std_ext_hash_set+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif -int -main () -{ -hash_set t; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_cxx_have_std_ext_hash_set=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_cxx_have_std_ext_hash_set=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_have_std_ext_hash_set" >&5 -echo "${ECHO_T}$ac_cv_cxx_have_std_ext_hash_set" >&6; } - if test "$ac_cv_cxx_have_std_ext_hash_set" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STD_EXT_HASH_SET 1 -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STD_EXT_HASH_SET 0 -_ACEOF - - fi - - { echo "$as_me:$LINENO: checking whether the compiler has defining template class __gnu_cxx::hash_set" >&5 -echo $ECHO_N "checking whether the compiler has defining template class __gnu_cxx::hash_set... $ECHO_C" >&6; } -if test "${ac_cv_cxx_have_gnu_ext_hash_set+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif -int -main () -{ -hash_set t; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_cxx_have_gnu_ext_hash_set=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_cxx_have_gnu_ext_hash_set=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_have_gnu_ext_hash_set" >&5 -echo "${ECHO_T}$ac_cv_cxx_have_gnu_ext_hash_set" >&6; } - if test "$ac_cv_cxx_have_gnu_ext_hash_set" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GNU_EXT_HASH_SET 1 -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GNU_EXT_HASH_SET 0 -_ACEOF - - fi - - { echo "$as_me:$LINENO: checking whether the compiler has defining template class ::hash_set" >&5 -echo $ECHO_N "checking whether the compiler has defining template class ::hash_set... $ECHO_C" >&6; } -if test "${ac_cv_cxx_have_global_hash_set+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -hash_set t; return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_cxx_have_global_hash_set=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_cxx_have_global_hash_set=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_have_global_hash_set" >&5 -echo "${ECHO_T}$ac_cv_cxx_have_global_hash_set" >&6; } - if test "$ac_cv_cxx_have_global_hash_set" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GLOBAL_HASH_SET 1 -_ACEOF - - else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GLOBAL_HASH_SET 0 -_ACEOF - - fi - { echo "$as_me:$LINENO: checking whether the compiler has the standard iterator" >&5 echo $ECHO_N "checking whether the compiler has the standard iterator... $ECHO_C" >&6; } if test "${ac_cv_cxx_have_std_iterator+set}" = set; then @@ -34532,10 +33956,6 @@ ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h" -ac_config_headers="$ac_config_headers include/llvm/ADT/hash_map.h" - -ac_config_headers="$ac_config_headers include/llvm/ADT/hash_set.h" - ac_config_headers="$ac_config_headers include/llvm/ADT/iterator.h" @@ -35158,8 +34578,6 @@ case $ac_config_target in "include/llvm/Config/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Config/config.h" ;; "include/llvm/Support/DataTypes.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;; - "include/llvm/ADT/hash_map.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_map.h" ;; - "include/llvm/ADT/hash_set.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_set.h" ;; "include/llvm/ADT/iterator.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/iterator.h" ;; "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; "llvm.spec") CONFIG_FILES="$CONFIG_FILES llvm.spec" ;; Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=66407&r1=66406&r2=66407&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Mon Mar 9 01:16:46 2009 @@ -142,18 +142,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Does not have */ -#undef HAVE_GLOBAL_HASH_MAP - -/* Does not have hash_set in global namespace */ -#undef HAVE_GLOBAL_HASH_SET - -/* Does not have ext/hash_map */ -#undef HAVE_GNU_EXT_HASH_MAP - -/* Does not have hash_set in gnu namespace */ -#undef HAVE_GNU_EXT_HASH_SET - /* Define if the Graphviz program is available */ #undef HAVE_GRAPHVIZ @@ -348,12 +336,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H -/* Does not have ext/hash_map> */ -#undef HAVE_STD_EXT_HASH_MAP - -/* Does not have hash_set in std namespace */ -#undef HAVE_STD_EXT_HASH_SET - /* Set to 1 if the std::isinf function is found in */ #undef HAVE_STD_ISINF_IN_CMATH From clattner at apple.com Mon Mar 9 01:35:20 2009 From: clattner at apple.com (Chris Lattner) Date: Sun, 8 Mar 2009 23:35:20 -0700 Subject: [llvm-commits] [llvm] r66366 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll test/Transforms/ScalarRepl/vector_memcpy.ll In-Reply-To: References: <200903080404.n2844MKo007667@zion.cs.uiuc.edu> <65912812-E63C-45C1-8708-437E819F42C9@mac.com> <200903082048.37146.baldrick@free.fr> <17EA8EB0-EB98-400A-9DFA-D814CC7DBEC8@apple.com> Message-ID: <59F44F2D-7FFD-433B-AD85-2EDD08FF8B0B@apple.com> On Mar 8, 2009, at 1:09 PM, Eli Friedman wrote: > On Sun, Mar 8, 2009 at 11:54 AM, Chris Lattner > wrote: >> Do you have an example that would illustrate this problem? > > Compile the following with "clang -S -O2 -mattr=-sse". > > #include > #include > __attribute__((noinline)) void a(float* x, float* y) { > float z; > memcpy(&z, y, 4); > memcpy(x, &z, 4); > } > > int main() { > unsigned x = 2139095041, y; > a((float*)&y,(float*)&x); > if (y != 2139095041) { > printf("y corrupted!\n"); > return 1; > } > return 0; > } Ok, this is pretty insane, and I'm sure that there are cases where SROA would get this "wrong" before too. I think that the only reasonable course of action is to make the IR well defined w.r.t. load and store and treat this as an x86 backend bug. Note that this has already been recognized to be a real performance issue (PR3560) as well. -Chris From isanbard at gmail.com Mon Mar 9 01:58:31 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 09 Mar 2009 06:58:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r66411 - /llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Message-ID: <200903090658.n296wVB0012511@zion.cs.uiuc.edu> Author: void Date: Mon Mar 9 01:58:31 2009 New Revision: 66411 URL: http://llvm.org/viewvc/llvm-project?rev=66411&view=rev Log: Merge 66402 into Dib: Fix PR3744 - Crash on index into zero element struct. Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp?rev=66411&r1=66410&r2=66411&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Mon Mar 9 01:58:31 2009 @@ -6163,9 +6163,15 @@ // If this is a normal field at a fixed offset from the start, handle it. if (TREE_CODE(field_offset) == INTEGER_CST) { unsigned int MemberIndex = GetFieldIndex(FieldDecl); - assert(MemberIndex < StructTy->getNumContainedTypes() && - "Field Idx out of range!"); - FieldPtr = Builder.CreateStructGEP(StructAddrLV.Ptr, MemberIndex); + + // If the LLVM struct has zero field, don't try to index into it, just use + // the current pointer. + FieldPtr = StructAddrLV.Ptr; + if (StructTy->getNumContainedTypes() != 0) { + assert(MemberIndex < StructTy->getNumContainedTypes() && + "Field Idx out of range!"); + FieldPtr = Builder.CreateStructGEP(FieldPtr, MemberIndex); + } // Now that we did an offset from the start of the struct, subtract off // the offset from BitStart. From isanbard at gmail.com Mon Mar 9 02:00:24 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 09 Mar 2009 07:00:24 -0000 Subject: [llvm-commits] [llvm] r66412 - /llvm/branches/Apple/Dib/test/FrontendC/2009-03-08-ZeroEltStructCrash.c Message-ID: <200903090700.n2970OVV012603@zion.cs.uiuc.edu> Author: void Date: Mon Mar 9 02:00:23 2009 New Revision: 66412 URL: http://llvm.org/viewvc/llvm-project?rev=66412&view=rev Log: Merge r66401 into Dib: testcase for PR3744 Added: llvm/branches/Apple/Dib/test/FrontendC/2009-03-08-ZeroEltStructCrash.c - copied unchanged from r66401, llvm/trunk/test/FrontendC/2009-03-08-ZeroEltStructCrash.c From ggreif at gmail.com Mon Mar 9 02:09:01 2009 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 09 Mar 2009 07:09:01 -0000 Subject: [llvm-commits] [llvm] r66415 - in /llvm/trunk/include/llvm: ADT/ilist_node.h BasicBlock.h CodeGen/MachineBasicBlock.h CodeGen/MachineFunction.h CodeGen/SelectionDAG.h Function.h Message-ID: <200903090709.n29791oO013085@zion.cs.uiuc.edu> Author: ggreif Date: Mon Mar 9 02:09:01 2009 New Revision: 66415 URL: http://llvm.org/viewvc/llvm-project?rev=66415&view=rev Log: in builds without asserts we do not need to allocate the Next pointer in "ghostly" sentinels Modified: llvm/trunk/include/llvm/ADT/ilist_node.h llvm/trunk/include/llvm/BasicBlock.h llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/Function.h Modified: llvm/trunk/include/llvm/ADT/ilist_node.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist_node.h?rev=66415&r1=66414&r2=66415&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ilist_node.h (original) +++ llvm/trunk/include/llvm/ADT/ilist_node.h Mon Mar 9 02:09:01 2009 @@ -18,30 +18,49 @@ namespace llvm { template -struct ilist_nextprev_traits; +struct ilist_traits; +/// ilist_half_node - Base class that provides prev services for sentinels. +/// template -struct ilist_traits; +class ilist_half_node { + friend struct ilist_traits; + NodeTy *Prev; +protected: + NodeTy *getPrev() { return Prev; } + const NodeTy *getPrev() const { return Prev; } + void setPrev(NodeTy *P) { Prev = P; } + ilist_half_node() : Prev(0) {} +}; + +template +struct ilist_nextprev_traits; /// ilist_node - Base class that provides next/prev services for nodes /// that use ilist_nextprev_traits or ilist_default_traits. /// template -class ilist_node { -private: +class ilist_node : ilist_half_node { friend struct ilist_nextprev_traits; friend struct ilist_traits; - NodeTy *Prev, *Next; - NodeTy *getPrev() { return Prev; } + NodeTy *Next; NodeTy *getNext() { return Next; } - const NodeTy *getPrev() const { return Prev; } const NodeTy *getNext() const { return Next; } - void setPrev(NodeTy *N) { Prev = N; } void setNext(NodeTy *N) { Next = N; } protected: - ilist_node() : Prev(0), Next(0) {} + ilist_node() : Next(0) {} }; +/// When assertions are off, the Next field of sentinels +/// will not be accessed. So it is not necessary to allocate +/// space for it. The following macro selects the most +/// efficient trais class. +#ifndef NDEBUG +# define ILIST_NODE ilist_node +#else +# define ILIST_NODE ilist_half_node +#endif + } // End llvm namespace #endif Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=66415&r1=66414&r2=66415&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Mon Mar 9 02:09:01 2009 @@ -46,7 +46,7 @@ Instruction *ensureHead(Instruction*) const { return createSentinel(); } static void noteHead(Instruction*, Instruction*) {} private: - mutable ilist_node Sentinel; + mutable ILIST_NODE Sentinel; }; /// This represents a single basic block in LLVM. A basic block is simply a Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=66415&r1=66414&r2=66415&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Mon Mar 9 02:09:01 2009 @@ -26,7 +26,7 @@ template <> struct ilist_traits : public ilist_default_traits { private: - mutable ilist_node Sentinel; + mutable ILIST_NODE Sentinel; // this is only set by the MachineBasicBlock owning the LiveList friend class MachineBasicBlock; Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=66415&r1=66414&r2=66415&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Mar 9 02:09:01 2009 @@ -37,7 +37,7 @@ template <> struct ilist_traits : public ilist_default_traits { - mutable ilist_node Sentinel; + mutable ILIST_NODE Sentinel; public: MachineBasicBlock *createSentinel() const { return static_cast(&Sentinel); Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=66415&r1=66414&r2=66415&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Mar 9 02:09:01 2009 @@ -39,7 +39,7 @@ template<> struct ilist_traits : public ilist_default_traits { private: - mutable ilist_node Sentinel; + mutable ILIST_NODE Sentinel; public: SDNode *createSentinel() const { return static_cast(&Sentinel); Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=66415&r1=66414&r2=66415&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Mon Mar 9 02:09:01 2009 @@ -45,7 +45,7 @@ static ValueSymbolTable *getSymTab(Function *ItemParent); private: - mutable ilist_node Sentinel; + mutable ILIST_NODE Sentinel; }; template<> struct ilist_traits @@ -62,7 +62,7 @@ static ValueSymbolTable *getSymTab(Function *ItemParent); private: - mutable ilist_node Sentinel; + mutable ILIST_NODE Sentinel; }; class Function : public GlobalValue, public Annotable, From sabre at nondot.org Mon Mar 9 03:18:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 08:18:49 -0000 Subject: [llvm-commits] [llvm] r66417 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <200903090818.n298InFI025351@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 03:18:48 2009 New Revision: 66417 URL: http://llvm.org/viewvc/llvm-project?rev=66417&view=rev Log: just remove the use_empty() check entirely, the only reason it existed was for llvm-gcc 3.4 (which used the __main hack) which is really really long dead. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=66417&r1=66416&r2=66417&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Mar 9 03:18:48 2009 @@ -419,23 +419,17 @@ const TargetData *TD = TM.getTargetData(); unsigned Align = Log2_32(TD->getPointerPrefAlignment()); if (GV->getName() == "llvm.global_ctors") { - GV->removeDeadConstantUsers(); - if (GV->use_empty()) { - SwitchToDataSection(TAI->getStaticCtorsSection()); - EmitAlignment(Align, 0); - EmitXXStructorList(GV->getInitializer()); - return true; - } + SwitchToDataSection(TAI->getStaticCtorsSection()); + EmitAlignment(Align, 0); + EmitXXStructorList(GV->getInitializer()); + return true; } if (GV->getName() == "llvm.global_dtors") { - GV->removeDeadConstantUsers(); - if (GV->use_empty()) { - SwitchToDataSection(TAI->getStaticDtorsSection()); - EmitAlignment(Align, 0); - EmitXXStructorList(GV->getInitializer()); - return true; - } + SwitchToDataSection(TAI->getStaticDtorsSection()); + EmitAlignment(Align, 0); + EmitXXStructorList(GV->getInitializer()); + return true; } return false; From baldrick at free.fr Mon Mar 9 06:57:16 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 09 Mar 2009 11:57:16 -0000 Subject: [llvm-commits] [llvm] r66420 - /llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Message-ID: <200903091157.n29BvIxU001439@zion.cs.uiuc.edu> Author: baldrick Date: Mon Mar 9 06:57:08 2009 New Revision: 66420 URL: http://llvm.org/viewvc/llvm-project?rev=66420&view=rev Log: This debug info special case should no longer be needed now that these intrinsics are marked as not accessing memory. Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=66420&r1=66419&r2=66420&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Mon Mar 9 06:57:08 2009 @@ -147,10 +147,6 @@ continue; } - // Ignore dbg info intrinsics. - if (isa(I)) - continue; - // Any remaining instructions need to be taken seriously! Check if they // read or write memory. if (I->mayWriteToMemory()) From bob.wilson at apple.com Mon Mar 9 12:07:16 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 09 Mar 2009 17:07:16 -0000 Subject: [llvm-commits] [llvm] r66424 - /llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200903091707.n29H7GpI012008@zion.cs.uiuc.edu> Author: bwilson Date: Mon Mar 9 12:07:15 2009 New Revision: 66424 URL: http://llvm.org/viewvc/llvm-project?rev=66424&view=rev Log: Add a constructor for BuildVectorSDNode and revert the temporary workaround from 66280. I was unable to verify this with gcc-3.4.6, but with gcc-3.3 it avoids the "base class with only non-default constructor in class without a constructor" warning. Apparently that warning was promoted to an error in gcc-3.4. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=66424&r1=66423&r2=66424&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Mar 9 12:07:15 2009 @@ -1114,10 +1114,6 @@ friend struct ilist_traits; public: - - /// Default SDNode constructor. - SDNode() {} - //===--------------------------------------------------------------------===// // Accessors // @@ -1936,6 +1932,8 @@ /// BuildVectorSDNode - A "pseudo-class" with methods for operating on /// BUILD_VECTORs. class BuildVectorSDNode : public SDNode { + // These are constructed as SDNodes and then cast to BuildVectorSDNodes. + explicit BuildVectorSDNode(); // Do not implement public: /// isConstantSplat - Check if this is a constant splat, and if so, find the /// smallest element size that splats the vector. If MinSplatBits is From bob.wilson at apple.com Mon Mar 9 12:08:58 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 9 Mar 2009 10:08:58 -0700 Subject: [llvm-commits] [llvm] r65747 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp In-Reply-To: <32A9D1C1-1310-4EB4-9BF3-E45C898B4FA2@apple.com> References: <200903010113.n211DtAt028784@zion.cs.uiuc.edu> <32A9D1C1-1310-4EB4-9BF3-E45C898B4FA2@apple.com> Message-ID: <9EB159FF-DFF5-4873-B4CC-A7DD83C99F83@apple.com> On Mar 6, 2009, at 2:23 PM, Tanya Lattner wrote: > This is breaking the build when using gcc 3.4.6 because > BuildVectorSDNode does not have a default constructor and neither > does its parent SDNode. I added a default constructor to SDNode > which fixes the build, but it is not the correct thing to do. I'm > not familiar enough with this code to add the constructor to > BuildVectorSDNode, can you do this and then revert 66280. This should be fixed now. It was an easy change but quite a challenge to verify! From lattner at apple.com Mon Mar 9 12:48:25 2009 From: lattner at apple.com (Tanya Lattner) Date: Mon, 9 Mar 2009 10:48:25 -0700 Subject: [llvm-commits] [llvm] r65747 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp In-Reply-To: <9EB159FF-DFF5-4873-B4CC-A7DD83C99F83@apple.com> References: <200903010113.n211DtAt028784@zion.cs.uiuc.edu> <32A9D1C1-1310-4EB4-9BF3-E45C898B4FA2@apple.com> <9EB159FF-DFF5-4873-B4CC-A7DD83C99F83@apple.com> Message-ID: <3AE25F99-2226-4CA1-9753-0EACC3EB4D56@apple.com> Thank you! -Tanya On Mar 9, 2009, at 10:08 AM, Bob Wilson wrote: > > On Mar 6, 2009, at 2:23 PM, Tanya Lattner wrote: >> This is breaking the build when using gcc 3.4.6 because >> BuildVectorSDNode does not have a default constructor and neither >> does its parent SDNode. I added a default constructor to SDNode >> which fixes the build, but it is not the correct thing to do. I'm >> not familiar enough with this code to add the constructor to >> BuildVectorSDNode, can you do this and then revert 66280. > > This should be fixed now. It was an easy change but quite a challenge > to verify! > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090309/982a8158/attachment.html From isanbard at gmail.com Mon Mar 9 13:01:33 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 09 Mar 2009 18:01:33 -0000 Subject: [llvm-commits] [llvm] r66426 - in /llvm/trunk/include/llvm: ADT/ilist_node.h BasicBlock.h CodeGen/MachineBasicBlock.h CodeGen/MachineFunction.h CodeGen/SelectionDAG.h Function.h Message-ID: <200903091801.n29I1YKl013885@zion.cs.uiuc.edu> Author: void Date: Mon Mar 9 13:01:33 2009 New Revision: 66426 URL: http://llvm.org/viewvc/llvm-project?rev=66426&view=rev Log: Revert r66415. It's causing failures during bootstrap builds: Please submit a full bug report, with preprocessed source if appropriate. See for instructions. /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__muldi3': /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:567: internal compiler error: Bus error Please submit a full bug report, with preprocessed source if appropriate. See for instructions. /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__lshrdi3': /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:421: internal compiler error: Bus error Please submit a full bug report, with preprocessed source if appropriate. See for instructions. make[5]: *** [libgcc/./_lshrdi3.o] Error 1 make[5]: *** Waiting for unfinished jobs.... make[5]: *** [libgcc/./_muldi3.o] Error 1 make[5]: *** [libgcc/./_negdi2.o] Error 1 --- Reverse-merging (from foreign repository) r66415 into '.': U include/llvm/BasicBlock.h U include/llvm/ADT/ilist_node.h U include/llvm/CodeGen/SelectionDAG.h U include/llvm/CodeGen/MachineFunction.h U include/llvm/CodeGen/MachineBasicBlock.h U include/llvm/Function.h Modified: llvm/trunk/include/llvm/ADT/ilist_node.h llvm/trunk/include/llvm/BasicBlock.h llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/Function.h Modified: llvm/trunk/include/llvm/ADT/ilist_node.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist_node.h?rev=66426&r1=66425&r2=66426&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ilist_node.h (original) +++ llvm/trunk/include/llvm/ADT/ilist_node.h Mon Mar 9 13:01:33 2009 @@ -18,49 +18,30 @@ namespace llvm { template -struct ilist_traits; - -/// ilist_half_node - Base class that provides prev services for sentinels. -/// -template -class ilist_half_node { - friend struct ilist_traits; - NodeTy *Prev; -protected: - NodeTy *getPrev() { return Prev; } - const NodeTy *getPrev() const { return Prev; } - void setPrev(NodeTy *P) { Prev = P; } - ilist_half_node() : Prev(0) {} -}; +struct ilist_nextprev_traits; template -struct ilist_nextprev_traits; +struct ilist_traits; /// ilist_node - Base class that provides next/prev services for nodes /// that use ilist_nextprev_traits or ilist_default_traits. /// template -class ilist_node : ilist_half_node { +class ilist_node { +private: friend struct ilist_nextprev_traits; friend struct ilist_traits; - NodeTy *Next; + NodeTy *Prev, *Next; + NodeTy *getPrev() { return Prev; } NodeTy *getNext() { return Next; } + const NodeTy *getPrev() const { return Prev; } const NodeTy *getNext() const { return Next; } + void setPrev(NodeTy *N) { Prev = N; } void setNext(NodeTy *N) { Next = N; } protected: - ilist_node() : Next(0) {} + ilist_node() : Prev(0), Next(0) {} }; -/// When assertions are off, the Next field of sentinels -/// will not be accessed. So it is not necessary to allocate -/// space for it. The following macro selects the most -/// efficient trais class. -#ifndef NDEBUG -# define ILIST_NODE ilist_node -#else -# define ILIST_NODE ilist_half_node -#endif - } // End llvm namespace #endif Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=66426&r1=66425&r2=66426&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Mon Mar 9 13:01:33 2009 @@ -46,7 +46,7 @@ Instruction *ensureHead(Instruction*) const { return createSentinel(); } static void noteHead(Instruction*, Instruction*) {} private: - mutable ILIST_NODE Sentinel; + mutable ilist_node Sentinel; }; /// This represents a single basic block in LLVM. A basic block is simply a Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=66426&r1=66425&r2=66426&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Mon Mar 9 13:01:33 2009 @@ -26,7 +26,7 @@ template <> struct ilist_traits : public ilist_default_traits { private: - mutable ILIST_NODE Sentinel; + mutable ilist_node Sentinel; // this is only set by the MachineBasicBlock owning the LiveList friend class MachineBasicBlock; Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=66426&r1=66425&r2=66426&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Mar 9 13:01:33 2009 @@ -37,7 +37,7 @@ template <> struct ilist_traits : public ilist_default_traits { - mutable ILIST_NODE Sentinel; + mutable ilist_node Sentinel; public: MachineBasicBlock *createSentinel() const { return static_cast(&Sentinel); Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=66426&r1=66425&r2=66426&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Mar 9 13:01:33 2009 @@ -39,7 +39,7 @@ template<> struct ilist_traits : public ilist_default_traits { private: - mutable ILIST_NODE Sentinel; + mutable ilist_node Sentinel; public: SDNode *createSentinel() const { return static_cast(&Sentinel); Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=66426&r1=66425&r2=66426&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Mon Mar 9 13:01:33 2009 @@ -45,7 +45,7 @@ static ValueSymbolTable *getSymTab(Function *ItemParent); private: - mutable ILIST_NODE Sentinel; + mutable ilist_node Sentinel; }; template<> struct ilist_traits @@ -62,7 +62,7 @@ static ValueSymbolTable *getSymTab(Function *ItemParent); private: - mutable ILIST_NODE Sentinel; + mutable ilist_node Sentinel; }; class Function : public GlobalValue, public Annotable, From isanbard at gmail.com Mon Mar 9 13:03:04 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 9 Mar 2009 10:03:04 -0800 Subject: [llvm-commits] [llvm] r66415 - in /llvm/trunk/include/llvm: ADT/ilist_node.h BasicBlock.h CodeGen/MachineBasicBlock.h CodeGen/MachineFunction.h CodeGen/SelectionDAG.h Function.h In-Reply-To: <200903090709.n29791oO013085@zion.cs.uiuc.edu> References: <200903090709.n29791oO013085@zion.cs.uiuc.edu> Message-ID: <16e5fdf90903091103p62b0f08ch7316b45e8073e2f2@mail.gmail.com> Hi Gabor, This is causing internal compiler errors in the llvm-gcc bootstrap build. I reverted this. Could you take a look please? -bw On Sun, Mar 8, 2009 at 11:09 PM, Gabor Greif wrote: > Author: ggreif > Date: Mon Mar ?9 02:09:01 2009 > New Revision: 66415 > > URL: http://llvm.org/viewvc/llvm-project?rev=66415&view=rev > Log: > in builds without asserts we do not need to allocate the Next pointer in "ghostly" sentinels > > Modified: > ? ?llvm/trunk/include/llvm/ADT/ilist_node.h > ? ?llvm/trunk/include/llvm/BasicBlock.h > ? ?llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h > ? ?llvm/trunk/include/llvm/CodeGen/MachineFunction.h > ? ?llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > ? ?llvm/trunk/include/llvm/Function.h > > Modified: llvm/trunk/include/llvm/ADT/ilist_node.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist_node.h?rev=66415&r1=66414&r2=66415&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/ADT/ilist_node.h (original) > +++ llvm/trunk/include/llvm/ADT/ilist_node.h Mon Mar ?9 02:09:01 2009 > @@ -18,30 +18,49 @@ > ?namespace llvm { > > ?template > -struct ilist_nextprev_traits; > +struct ilist_traits; > > +/// ilist_half_node - Base class that provides prev services for sentinels. > +/// > ?template > -struct ilist_traits; > +class ilist_half_node { > + ?friend struct ilist_traits; > + ?NodeTy *Prev; > +protected: > + ?NodeTy *getPrev() { return Prev; } > + ?const NodeTy *getPrev() const { return Prev; } > + ?void setPrev(NodeTy *P) { Prev = P; } > + ?ilist_half_node() : Prev(0) {} > +}; > + > +template > +struct ilist_nextprev_traits; > > ?/// ilist_node - Base class that provides next/prev services for nodes > ?/// that use ilist_nextprev_traits or ilist_default_traits. > ?/// > ?template > -class ilist_node { > -private: > +class ilist_node : ilist_half_node { > ? friend struct ilist_nextprev_traits; > ? friend struct ilist_traits; > - ?NodeTy *Prev, *Next; > - ?NodeTy *getPrev() { return Prev; } > + ?NodeTy *Next; > ? NodeTy *getNext() { return Next; } > - ?const NodeTy *getPrev() const { return Prev; } > ? const NodeTy *getNext() const { return Next; } > - ?void setPrev(NodeTy *N) { Prev = N; } > ? void setNext(NodeTy *N) { Next = N; } > ?protected: > - ?ilist_node() : Prev(0), Next(0) {} > + ?ilist_node() : Next(0) {} > ?}; > > +/// When assertions are off, the Next field of sentinels > +/// will not be accessed. So it is not necessary to allocate > +/// space for it. The following macro selects the most > +/// efficient trais class. > +#ifndef NDEBUG > +# ? define ILIST_NODE ilist_node > +#else > +# ? define ILIST_NODE ilist_half_node > +#endif > + > ?} // End llvm namespace > > ?#endif > > Modified: llvm/trunk/include/llvm/BasicBlock.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=66415&r1=66414&r2=66415&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/BasicBlock.h (original) > +++ llvm/trunk/include/llvm/BasicBlock.h Mon Mar ?9 02:09:01 2009 > @@ -46,7 +46,7 @@ > ? Instruction *ensureHead(Instruction*) const { return createSentinel(); } > ? static void noteHead(Instruction*, Instruction*) {} > ?private: > - ?mutable ilist_node Sentinel; > + ?mutable ILIST_NODE Sentinel; > ?}; > > ?/// This represents a single basic block in LLVM. A basic block is simply a > > Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=66415&r1=66414&r2=66415&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Mon Mar ?9 02:09:01 2009 > @@ -26,7 +26,7 @@ > ?template <> > ?struct ilist_traits : public ilist_default_traits { > ?private: > - ?mutable ilist_node Sentinel; > + ?mutable ILIST_NODE Sentinel; > > ? // this is only set by the MachineBasicBlock owning the LiveList > ? friend class MachineBasicBlock; > > Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=66415&r1=66414&r2=66415&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Mar ?9 02:09:01 2009 > @@ -37,7 +37,7 @@ > ?template <> > ?struct ilist_traits > ? ? : public ilist_default_traits { > - ?mutable ilist_node Sentinel; > + ?mutable ILIST_NODE Sentinel; > ?public: > ? MachineBasicBlock *createSentinel() const { > ? ? return static_cast(&Sentinel); > > Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=66415&r1=66414&r2=66415&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) > +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Mar ?9 02:09:01 2009 > @@ -39,7 +39,7 @@ > > ?template<> struct ilist_traits : public ilist_default_traits { > ?private: > - ?mutable ilist_node Sentinel; > + ?mutable ILIST_NODE Sentinel; > ?public: > ? SDNode *createSentinel() const { > ? ? return static_cast(&Sentinel); > > Modified: llvm/trunk/include/llvm/Function.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=66415&r1=66414&r2=66415&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Function.h (original) > +++ llvm/trunk/include/llvm/Function.h Mon Mar ?9 02:09:01 2009 > @@ -45,7 +45,7 @@ > > ? static ValueSymbolTable *getSymTab(Function *ItemParent); > ?private: > - ?mutable ilist_node Sentinel; > + ?mutable ILIST_NODE Sentinel; > ?}; > > ?template<> struct ilist_traits > @@ -62,7 +62,7 @@ > > ? static ValueSymbolTable *getSymTab(Function *ItemParent); > ?private: > - ?mutable ilist_node Sentinel; > + ?mutable ILIST_NODE Sentinel; > ?}; > > ?class Function : public GlobalValue, public Annotable, > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From evan.cheng at apple.com Mon Mar 9 13:28:37 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 09 Mar 2009 18:28:37 -0000 Subject: [llvm-commits] [llvm] r66427 - /llvm/trunk/Makefile.rules Message-ID: <200903091828.n29ISbg8014904@zion.cs.uiuc.edu> Author: evancheng Date: Mon Mar 9 13:28:37 2009 New Revision: 66427 URL: http://llvm.org/viewvc/llvm-project?rev=66427&view=rev Log: Re-apply 66315, but restrict it to Darwin only. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=66427&r1=66426&r2=66427&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Mon Mar 9 13:28:37 2009 @@ -519,6 +519,16 @@ # Building universal cannot compute dependencies automatically. DISABLE_AUTO_DEPENDENCIES=1 +else + ifeq ($(OS),Darwin) + ifeq ($(ARCH),x86_64) + CompileCommonOpts += -m64 + else + ifeq ($(ARCH),x86) + CompileCommonOpts += -m32 + endif + endif + endif endif ifeq ($(OS),SunOS) From evan.cheng at apple.com Mon Mar 9 14:00:05 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 09 Mar 2009 19:00:05 -0000 Subject: [llvm-commits] [llvm] r66428 - in /llvm/trunk: lib/CodeGen/VirtRegMap.cpp test/CodeGen/X86/2009-03-09-SpillerBug.ll Message-ID: <200903091900.n29J055i015811@zion.cs.uiuc.edu> Author: evancheng Date: Mon Mar 9 14:00:05 2009 New Revision: 66428 URL: http://llvm.org/viewvc/llvm-project?rev=66428&view=rev Log: Yet another case where the spiller marked two uses of the same register on the same instruction as kill. This fixes PR3706. Added: llvm/trunk/test/CodeGen/X86/2009-03-09-SpillerBug.ll Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=66428&r1=66427&r2=66428&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Mon Mar 9 14:00:05 2009 @@ -1317,23 +1317,6 @@ } } -/// hasLaterNon2AddrUse - If the MI has another use of the specified virtual -/// register later and it's not a two-address, return true. That means it's -/// safe to mark the current use at 'i' isKill. -static bool hasLaterNon2AddrUse(MachineInstr &MI, unsigned i, unsigned VirtReg){ - const TargetInstrDesc &TID = MI.getDesc(); - - ++i; - for (unsigned e = TID.getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI.getOperand(i); - if (!MO.isReg() || MO.getReg() != VirtReg) - continue; - if (TID.getOperandConstraint(i, TOI::TIED_TO) == -1) - return true; - } - return false; -} - /// rewriteMBB - Keep track of which spills are available even after the /// register allocator is done with them. If possible, avid reloading vregs. void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, @@ -1357,6 +1340,7 @@ SmallSet ReMatDefs; // Clear kill info. + SmallSet KilledMIRegs; RegKills.reset(); KillOps.clear(); KillOps.resize(TRI->getNumRegs(), NULL); @@ -1539,6 +1523,7 @@ // Process all of the spilled uses and all non spilled reg references. SmallVector PotentialDeadStoreSlots; + KilledMIRegs.clear(); for (unsigned j = 0, e = VirtUseOps.size(); j != e; ++j) { unsigned i = VirtUseOps[j]; MachineOperand &MO = MI.getOperand(i); @@ -1655,8 +1640,11 @@ // Mark is isKill if it's there no other uses of the same virtual // register and it's not a two-address operand. IsKill will be // unset if reg is reused. - if (ti == -1 && !hasLaterNon2AddrUse(MI, i, VirtReg)) + if (ti == -1 && KilledMIRegs.count(VirtReg) == 0) { MI.getOperand(i).setIsKill(); + KilledMIRegs.insert(VirtReg); + } + continue; } // CanReuse @@ -1751,8 +1739,11 @@ Spills.addAvailable(SSorRMId, PhysReg); // Assumes this is the last use. IsKill will be unset if reg is reused // unless it's a two-address operand. - if (TID.getOperandConstraint(i, TOI::TIED_TO) == -1) + if (TID.getOperandConstraint(i, TOI::TIED_TO) == -1 && + KilledMIRegs.count(VirtReg) == 0) { MI.getOperand(i).setIsKill(); + KilledMIRegs.insert(VirtReg); + } unsigned RReg = SubIdx ? TRI->getSubReg(PhysReg, SubIdx) : PhysReg; MI.getOperand(i).setReg(RReg); UpdateKills(*prior(MII), RegKills, KillOps, TRI); Added: llvm/trunk/test/CodeGen/X86/2009-03-09-SpillerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-03-09-SpillerBug.ll?rev=66428&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-03-09-SpillerBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-03-09-SpillerBug.ll Mon Mar 9 14:00:05 2009 @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-pc-linux-gnu +; PR3706 + +define void @__mulxc3(x86_fp80 %b) nounwind { +entry: + %call = call x86_fp80 @y(x86_fp80* null, x86_fp80* null) ; [#uses=0] + %cmp = fcmp ord x86_fp80 %b, 0xK00000000000000000000 ; [#uses=1] + %sub = sub x86_fp80 %b, %b ; [#uses=1] + %cmp7 = fcmp uno x86_fp80 %sub, 0xK00000000000000000000 ; [#uses=1] + %and12 = and i1 %cmp7, %cmp ; [#uses=1] + %and = zext i1 %and12 to i32 ; [#uses=1] + %conv9 = sitofp i32 %and to x86_fp80 ; [#uses=1] + store x86_fp80 %conv9, x86_fp80* null + store x86_fp80 %b, x86_fp80* null + ret void +} + +declare x86_fp80 @y(x86_fp80*, x86_fp80*) From aaronngray.lists at googlemail.com Mon Mar 9 14:09:32 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Mon, 9 Mar 2009 19:09:32 +0000 Subject: [llvm-commits] Cygwin patch Message-ID: <9719867c0903091209j799cc244s9d279da3bc375da@mail.gmail.com> I have the PIC stuff building properly on Cygwin now, patch attached. But unfortunately it does not pass the test/Feature/load_module.ll test in 'make check' though, that needs debugging at some stage, but I have wasted enough time on this patch now, atleast SVN LLVM should compile on Cygwin now. The following adds libraries for Cygwin and also for MinGW (not tested) where Linux's g++ ld finds these from a path using a weird command line which does not work on Cygwin or MinGW. lib/Transofrms/Helol/Makefile :- +ifeq ($(OS), $(filter $(OS), Cygwin MingW)) + USEDLIBS = LLVMAnalysis.a LLVMCore.a LLVMInstrumentation.a LLVMScalarOpts.a LLVMSupport.a LLVMSystem.a LLVMTransformUtils.a LLVMipa.a LLVMipo.a +else + USEDLIBS = +endif Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090309/3bdef8ef/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: cygwin3.patch Type: application/octet-stream Size: 1664 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090309/3bdef8ef/attachment.obj From evan.cheng at apple.com Mon Mar 9 14:15:00 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 09 Mar 2009 19:15:00 -0000 Subject: [llvm-commits] [llvm] r66429 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp test/CodeGen/ARM/2009-03-09-AddrModeBug.ll Message-ID: <200903091915.n29JF0YN016355@zion.cs.uiuc.edu> Author: evancheng Date: Mon Mar 9 14:15:00 2009 New Revision: 66429 URL: http://llvm.org/viewvc/llvm-project?rev=66429&view=rev Log: ARM isLegalAddressImmediate should check if type is a simple type now that optimizer can create values of funky scalar types. Added: llvm/trunk/test/CodeGen/ARM/2009-03-09-AddrModeBug.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=66429&r1=66428&r2=66429&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Mar 9 14:15:00 2009 @@ -1591,6 +1591,9 @@ if (V == 0) return true; + if (!VT.isSimple()) + return false; + if (Subtarget->isThumb()) { if (V < 0) return false; Added: llvm/trunk/test/CodeGen/ARM/2009-03-09-AddrModeBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-03-09-AddrModeBug.ll?rev=66429&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-03-09-AddrModeBug.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-03-09-AddrModeBug.ll Mon Mar 9 14:15:00 2009 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -march=arm + + %struct.hit_t = type { %struct.v_t, double } + %struct.node_t = type { %struct.hit_t, %struct.hit_t, i32 } + %struct.v_t = type { double, double, double } + +define fastcc %struct.node_t* @_ZL6createP6node_tii3v_tS1_d(%struct.node_t* %n, i32 %lvl, i32 %dist, i64 %c.0.0, i64 %c.0.1, i64 %c.0.2, i64 %d.0.0, i64 %d.0.1, i64 %d.0.2, double %r) nounwind { +entry: + %0 = getelementptr %struct.node_t* %n, i32 0, i32 1 ; <%struct.hit_t*> [#uses=1] + %1 = bitcast %struct.hit_t* %0 to i256* ; [#uses=1] + store i256 0, i256* %1, align 4 + unreachable +} From aaronngray.lists at googlemail.com Mon Mar 9 14:15:00 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Mon, 9 Mar 2009 19:15:00 +0000 Subject: [llvm-commits] Cygwin patch In-Reply-To: <9719867c0903091209j799cc244s9d279da3bc375da@mail.gmail.com> References: <9719867c0903091209j799cc244s9d279da3bc375da@mail.gmail.com> Message-ID: <9719867c0903091215j73702356r72c870e47928eb16@mail.gmail.com> Sorry attached wrong patch, use this one instead.. Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090309/96ba49d1/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: cygwin3.patch Type: application/octet-stream Size: 1691 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090309/96ba49d1/attachment.obj From ggreif at gmail.com Mon Mar 9 14:57:50 2009 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 09 Mar 2009 19:57:50 -0000 Subject: [llvm-commits] [llvm] r66430 - /llvm/trunk/include/llvm/User.h Message-ID: <200903091957.n29JvoLn017773@zion.cs.uiuc.edu> Author: ggreif Date: Mon Mar 9 14:57:49 2009 New Revision: 66430 URL: http://llvm.org/viewvc/llvm-project?rev=66430&view=rev Log: make the Op methods protected, how it was intended to be Modified: llvm/trunk/include/llvm/User.h Modified: llvm/trunk/include/llvm/User.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/User.h?rev=66430&r1=66429&r2=66430&view=diff ============================================================================== --- llvm/trunk/include/llvm/User.h (original) +++ llvm/trunk/include/llvm/User.h Mon Mar 9 14:57:49 2009 @@ -82,12 +82,14 @@ void operator delete(void*, unsigned) { assert(0 && "Constructor throws?"); } +protected: template Use &Op() { return OperandTraits::op_begin(this)[Idx]; } template const Use &Op() const { return OperandTraits::op_begin(const_cast(this))[Idx]; } +public: Value *getOperand(unsigned i) const { assert(i < NumOperands && "getOperand() out of range!"); return OperandList[i]; From sabre at nondot.org Mon Mar 9 15:22:18 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 09 Mar 2009 20:22:18 -0000 Subject: [llvm-commits] [llvm] r66434 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/2009-03-09-APIntCrash.ll Message-ID: <200903092022.n29KMIrj018805@zion.cs.uiuc.edu> Author: lattner Date: Mon Mar 9 15:22:18 2009 New Revision: 66434 URL: http://llvm.org/viewvc/llvm-project?rev=66434&view=rev Log: Fix PR3763 by using proper APInt methods instead of uint64_t's. Added: llvm/trunk/test/CodeGen/X86/2009-03-09-APIntCrash.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=66434&r1=66433&r2=66434&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Mar 9 15:22:18 2009 @@ -1311,14 +1311,15 @@ DAG.getConstant(N1C->getAPIntValue().logBase2(), getShiftAmountTy())); // fold (mul x, -(1 << c)) -> -(x << c) or (-x) << c - if (N1C && isPowerOf2_64(-N1C->getSExtValue())) + if (N1C && (-N1C->getAPIntValue()).isPowerOf2()) { + unsigned Log2Val = (-N1C->getAPIntValue()).logBase2(); // FIXME: If the input is something that is easily negated (e.g. a // single-use add), we should put the negate there. return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, DAG.getConstant(0, VT), DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0, - DAG.getConstant(Log2_64(-N1C->getSExtValue()), - getShiftAmountTy()))); + DAG.getConstant(Log2Val, getShiftAmountTy()))); + } // (mul (shl X, c1), c2) -> (mul X, c2 << c1) if (N1C && N0.getOpcode() == ISD::SHL && isa(N0.getOperand(1))) { Added: llvm/trunk/test/CodeGen/X86/2009-03-09-APIntCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-03-09-APIntCrash.ll?rev=66434&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-03-09-APIntCrash.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-03-09-APIntCrash.ll Mon Mar 9 15:22:18 2009 @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -march=x86-64 +; PR3763 + %struct.__block_descriptor = type { i64, i64 } + +define %struct.__block_descriptor @evUTCTime() nounwind { +entry: + br i1 false, label %if.then, label %return + +if.then: ; preds = %entry + %srcval18 = load i128* null, align 8 ; [#uses=1] + %tmp15 = lshr i128 %srcval18, 64 ; [#uses=1] + %tmp9 = mul i128 %tmp15, 18446744073709551616000 ; [#uses=1] + br label %return + +return: ; preds = %if.then, %entry + %retval.0 = phi i128 [ %tmp9, %if.then ], [ undef, %entry ] ; [#uses=0] + ret %struct.__block_descriptor undef +} + +define i128 @test(i128 %arg) nounwind { + %A = shl i128 1, 92 + %B = sub i128 0, %A + %C = mul i128 %arg, %B + ret i128 %C ;; should codegen to neg(shift) +} From evan.cheng at apple.com Mon Mar 9 15:25:39 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 09 Mar 2009 20:25:39 -0000 Subject: [llvm-commits] [llvm] r66435 - in /llvm/trunk/lib/Target/ARM: ARMSubtarget.cpp ARMTargetMachine.cpp Message-ID: <200903092025.n29KPdpK018994@zion.cs.uiuc.edu> Author: evancheng Date: Mon Mar 9 15:25:39 2009 New Revision: 66435 URL: http://llvm.org/viewvc/llvm-project?rev=66435&view=rev Log: ARM target now also recognize triplets like thumbv6-apple-darwin and set thumb mode and arch subversion. Eventually thumb triplets will go way and replaced with function notes. Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=66435&r1=66434&r2=66435&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Mon Mar 9 15:25:39 2009 @@ -36,23 +36,30 @@ // if one cannot be determined, to true. const std::string& TT = M.getTargetTriple(); unsigned Len = TT.length(); - if (Len >= 5) { - if (TT.substr(0, 4) == "armv") { - unsigned SubVer = TT[4]; - if (SubVer > '4' && SubVer <= '9') { - if (SubVer >= '6') - ARMArchVersion = V6; - else if (SubVer == '5') { - ARMArchVersion = V5T; - if (Len >= 7 && TT[5] == 't' && TT[6] == 'e') - ARMArchVersion = V5TE; - } + unsigned Idx = 0; + if (Len >= 5 && TT.substr(0, 4) == "armv") + Idx = 4; + else if (Len >= 6 && TT.substr(0, 6) == "thumb") { + IsThumb = true; + if (Len >= 7 && TT[5] == 'v') + Idx = 6; + } + if (Idx) { + unsigned SubVer = TT[Idx]; + if (SubVer > '4' && SubVer <= '9') { + if (SubVer >= '6') + ARMArchVersion = V6; + else if (SubVer == '5') { + ARMArchVersion = V5T; + if (Len >= Idx+3 && TT[Idx+1] == 't' && TT[Idx+2] == 'e') + ARMArchVersion = V5TE; } } } - if (Len > 5) { + if (Len >= 10) { if (TT.find("-darwin") != std::string::npos) + // arm-darwin TargetType = isDarwin; } else if (TT.empty()) { #if defined(__APPLE__) Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=66435&r1=66434&r2=66435&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Mon Mar 9 15:25:39 2009 @@ -53,7 +53,9 @@ unsigned ThumbTargetMachine::getModuleMatchQuality(const Module &M) { std::string TT = M.getTargetTriple(); - if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "thumb-") + // Match thumb-foo-bar, as well as things like thumbv5blah-* + if (TT.size() >= 6 && + (TT.substr(0, 6) == "thumb-" || TT.substr(0, 6) == "thumbv")) return 20; // If the target triple is something non-thumb, we don't match. @@ -105,7 +107,8 @@ unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) { std::string TT = M.getTargetTriple(); - if (TT.size() >= 4 && // Match arm-foo-bar, as well as things like armv5blah-* + // Match arm-foo-bar, as well as things like armv5blah-* + if (TT.size() >= 4 && (TT.substr(0, 4) == "arm-" || TT.substr(0, 4) == "armv")) return 20; // If the target triple is something non-arm, we don't match. From evan.cheng at apple.com Mon Mar 9 15:26:25 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 09 Mar 2009 20:26:25 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r66436 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200903092026.n29KQPld019034@zion.cs.uiuc.edu> Author: evancheng Date: Mon Mar 9 15:26:24 2009 New Revision: 66436 URL: http://llvm.org/viewvc/llvm-project?rev=66436&view=rev Log: Enhance error message to help debugging. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=66436&r1=66435&r2=66436&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Mar 9 15:26:24 2009 @@ -418,7 +418,7 @@ const TargetMachineRegistry::entry *TME = TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, Err); if (!TME) { - cerr << "Did not get a target machine!\n"; + cerr << "Did not get a target machine! Triplet is " << TargetTriple << '\n'; exit(1); } From evan.cheng at apple.com Mon Mar 9 15:26:59 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 09 Mar 2009 20:26:59 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r66438 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Message-ID: <200903092026.n29KQxg8019072@zion.cs.uiuc.edu> Author: evancheng Date: Mon Mar 9 15:26:59 2009 New Revision: 66438 URL: http://llvm.org/viewvc/llvm-project?rev=66438&view=rev Log: Encode arm arch version in thumb triplets as well. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=66438&r1=66437&r2=66438&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Mon Mar 9 15:26:59 2009 @@ -2949,8 +2949,22 @@ } \ } -#define LLVM_OVERRIDE_TARGET_ARCH() \ - (TARGET_THUMB ? "thumb" : "") +/* Encode arm / thumb modes and arm subversion number in the triplet. e.g. + * armv6-apple-darwin, thumbv5-apple-darwin. FIXME: Replace thumb triplets + * with function notes. + */ +#define LLVM_OVERRIDE_TARGET_ARCH() \ + (TARGET_THUMB \ + ? (arm_arch6 \ + ? "thumbv6" : (arm_arch5e \ + ? "thumbv5e" : (arm_arch5 \ + ? "thumbv5" : (arm_arch4t \ + ? "thumbv4t" : "")))) \ + : (arm_arch6 \ + ? "armv6" : (arm_arch5e \ + ? "armv5e" : (arm_arch5 \ + ? "armv5" : (arm_arch4t \ + ? "armv4t" : ""))))) #define LLVM_SET_MACHINE_OPTIONS(argvec) \ if (TARGET_SOFT_FLOAT) \ From dalej at apple.com Mon Mar 9 15:31:50 2009 From: dalej at apple.com (Dale Johannesen) Date: Mon, 9 Mar 2009 13:31:50 -0700 Subject: [llvm-commits] [llvm] r66366 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll test/Transforms/ScalarRepl/vector_memcpy.ll In-Reply-To: <59F44F2D-7FFD-433B-AD85-2EDD08FF8B0B@apple.com> References: <200903080404.n2844MKo007667@zion.cs.uiuc.edu> <65912812-E63C-45C1-8708-437E819F42C9@mac.com> <200903082048.37146.baldrick@free.fr> <17EA8EB0-EB98-400A-9DFA-D814CC7DBEC8@apple.com> <59F44F2D-7FFD-433B-AD85-2EDD08FF8B0B@apple.com> Message-ID: <77E10AFC-E0AF-417F-8649-6F5CFB94FCCF@apple.com> On Mar 8, 2009, at 11:35 PMPDT, Chris Lattner wrote: > On Mar 8, 2009, at 1:09 PM, Eli Friedman wrote: >> On Sun, Mar 8, 2009 at 11:54 AM, Chris Lattner >> wrote: >>> Do you have an example that would illustrate this problem? >> >> Compile the following with "clang -S -O2 -mattr=-sse". >> >> #include >> #include >> __attribute__((noinline)) void a(float* x, float* y) { >> float z; >> memcpy(&z, y, 4); >> memcpy(x, &z, 4); >> } >> >> int main() { >> unsigned x = 2139095041, y; >> a((float*)&y,(float*)&x); >> if (y != 2139095041) { >> printf("y corrupted!\n"); >> return 1; >> } >> return 0; >> } > > Ok, this is pretty insane, and I'm sure that there are cases where > SROA would get this "wrong" before too. I think that the only > reasonable course of action is to make the IR well defined w.r.t. load > and store and treat this as an x86 backend bug. Note that this has > already been recognized to be a real performance issue (PR3560) as > well. By the time the x86 backend sees this it looks exactly like a floating point load and store in the source. It should be possible for the x86 backend to detect that (load whose only use is in a store) and turn it back into int loads and stores, but it seems like a bad approach. The x87 behavior is IEEE754 conformant AFAICT so the same problem exists on other targets, at least theoretically, and you would lose in the rare case where somebody wrote a float load and store and actually wanted the exception to go off. IMO, memcpy simply does not have the same semantics as a floating point load and store, and it's wrong for SROA to be making that substitution. From gohman at apple.com Mon Mar 9 15:35:00 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 09 Mar 2009 20:35:00 -0000 Subject: [llvm-commits] [llvm] r66443 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200903092035.n29KZ0HM019374@zion.cs.uiuc.edu> Author: djg Date: Mon Mar 9 15:34:59 2009 New Revision: 66443 URL: http://llvm.org/viewvc/llvm-project?rev=66443&view=rev Log: Tidy some LSR debug output: announce the loop it's about to process before it does any processing. 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=66443&r1=66442&r2=66443&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Mar 9 15:34:59 2009 @@ -2606,6 +2606,12 @@ AddUsersIfInteresting(I, L, Processed); if (!IVUsesByStride.empty()) { +#ifndef NDEBUG + DOUT << "\nLSR on \"" << L->getHeader()->getParent()->getNameStart() + << "\" "; + DEBUG(L->dump()); +#endif + // 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 @@ -2625,12 +2631,6 @@ // things. bool HasOneStride = IVUsesByStride.size() == 1; -#ifndef NDEBUG - DOUT << "\nLSR on \"" << L->getHeader()->getParent()->getNameStart() - << "\" "; - DEBUG(L->dump()); -#endif - // IVsByStride keeps IVs for one particular loop. assert(IVsByStride.empty() && "Stale entries in IVsByStride?"); From clattner at apple.com Mon Mar 9 15:36:33 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 9 Mar 2009 13:36:33 -0700 Subject: [llvm-commits] [llvm] r66366 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll test/Transforms/ScalarRepl/vector_memcpy.ll In-Reply-To: <77E10AFC-E0AF-417F-8649-6F5CFB94FCCF@apple.com> References: <200903080404.n2844MKo007667@zion.cs.uiuc.edu> <65912812-E63C-45C1-8708-437E819F42C9@mac.com> <200903082048.37146.baldrick@free.fr> <17EA8EB0-EB98-400A-9DFA-D814CC7DBEC8@apple.com> <59F44F2D-7FFD-433B-AD85-2EDD08FF8B0B@apple.com> <77E10AFC-E0AF-417F-8649-6F5CFB94FCCF@apple.com> Message-ID: <5F28432F-5C81-4DBB-BE02-569A57FB672D@apple.com> On Mar 9, 2009, at 1:31 PM, Dale Johannesen wrote: >> Ok, this is pretty insane, and I'm sure that there are cases where >> SROA would get this "wrong" before too. I think that the only >> reasonable course of action is to make the IR well defined w.r.t. >> load >> and store and treat this as an x86 backend bug. Note that this has >> already been recognized to be a real performance issue (PR3560) as >> well. > > By the time the x86 backend sees this it looks exactly like a floating > point load and store in the source. It should be possible for the > x86 backend to detect that (load whose only use is in a store) and > turn it back into int loads and stores, but it seems like a bad > approach. The x87 behavior is IEEE754 conformant AFAICT so the same > problem exists on other targets, at least theoretically, and you would > lose in the rare case where somebody wrote a float load and store and > actually wanted the exception to go off. I'm not talking about theoretical IEEE here, I'm talking about what semantics we want for LLVM IR. I think that load/store pairs should always be value-preserving. Do you disagree? -Chris From isanbard at gmail.com Mon Mar 9 15:36:45 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 09 Mar 2009 20:36:45 -0000 Subject: [llvm-commits] [llvm] r66445 - in /llvm/branches/Apple/Dib: lib/CodeGen/VirtRegMap.cpp test/CodeGen/X86/2009-03-09-SpillerBug.ll Message-ID: <200903092036.n29KajhK019448@zion.cs.uiuc.edu> Author: void Date: Mon Mar 9 15:36:44 2009 New Revision: 66445 URL: http://llvm.org/viewvc/llvm-project?rev=66445&view=rev Log: --- Merging (from foreign repository) r66428 into '.': A test/CodeGen/X86/2009-03-09-SpillerBug.ll U lib/CodeGen/VirtRegMap.cpp Yet another case where the spiller marked two uses of the same register on the same instruction as kill. This fixes PR3706. Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-09-SpillerBug.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp?rev=66445&r1=66444&r2=66445&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp Mon Mar 9 15:36:44 2009 @@ -1317,23 +1317,6 @@ } } -/// hasLaterNon2AddrUse - If the MI has another use of the specified virtual -/// register later and it's not a two-address, return true. That means it's -/// safe to mark the current use at 'i' isKill. -static bool hasLaterNon2AddrUse(MachineInstr &MI, unsigned i, unsigned VirtReg){ - const TargetInstrDesc &TID = MI.getDesc(); - - ++i; - for (unsigned e = TID.getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI.getOperand(i); - if (!MO.isReg() || MO.getReg() != VirtReg) - continue; - if (TID.getOperandConstraint(i, TOI::TIED_TO) == -1) - return true; - } - return false; -} - /// rewriteMBB - Keep track of which spills are available even after the /// register allocator is done with them. If possible, avoid reloading vregs. void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, @@ -1357,6 +1340,7 @@ SmallSet ReMatDefs; // Clear kill info. + SmallSet KilledMIRegs; RegKills.reset(); KillOps.clear(); KillOps.resize(TRI->getNumRegs(), NULL); @@ -1539,6 +1523,7 @@ // Process all of the spilled uses and all non spilled reg references. SmallVector PotentialDeadStoreSlots; + KilledMIRegs.clear(); for (unsigned j = 0, e = VirtUseOps.size(); j != e; ++j) { unsigned i = VirtUseOps[j]; MachineOperand &MO = MI.getOperand(i); @@ -1655,8 +1640,11 @@ // Mark is isKill if it's there no other uses of the same virtual // register and it's not a two-address operand. IsKill will be // unset if reg is reused. - if (ti == -1 && !hasLaterNon2AddrUse(MI, i, VirtReg)) + if (ti == -1 && KilledMIRegs.count(VirtReg) == 0) { MI.getOperand(i).setIsKill(); + KilledMIRegs.insert(VirtReg); + } + continue; } // CanReuse @@ -1751,8 +1739,11 @@ Spills.addAvailable(SSorRMId, PhysReg); // Assumes this is the last use. IsKill will be unset if reg is reused // unless it's a two-address operand. - if (TID.getOperandConstraint(i, TOI::TIED_TO) == -1) + if (TID.getOperandConstraint(i, TOI::TIED_TO) == -1 && + KilledMIRegs.count(VirtReg) == 0) { MI.getOperand(i).setIsKill(); + KilledMIRegs.insert(VirtReg); + } unsigned RReg = SubIdx ? TRI->getSubReg(PhysReg, SubIdx) : PhysReg; MI.getOperand(i).setReg(RReg); UpdateKills(*prior(MII), RegKills, KillOps, TRI); Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-09-SpillerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-09-SpillerBug.ll?rev=66445&view=auto ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-09-SpillerBug.ll (added) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-09-SpillerBug.ll Mon Mar 9 15:36:44 2009 @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-pc-linux-gnu +; PR3706 + +define void @__mulxc3(x86_fp80 %b) nounwind { +entry: + %call = call x86_fp80 @y(x86_fp80* null, x86_fp80* null) ; [#uses=0] + %cmp = fcmp ord x86_fp80 %b, 0xK00000000000000000000 ; [#uses=1] + %sub = sub x86_fp80 %b, %b ; [#uses=1] + %cmp7 = fcmp uno x86_fp80 %sub, 0xK00000000000000000000 ; [#uses=1] + %and12 = and i1 %cmp7, %cmp ; [#uses=1] + %and = zext i1 %and12 to i32 ; [#uses=1] + %conv9 = sitofp i32 %and to x86_fp80 ; [#uses=1] + store x86_fp80 %conv9, x86_fp80* null + store x86_fp80 %b, x86_fp80* null + ret void +} + +declare x86_fp80 @y(x86_fp80*, x86_fp80*) From dalej at apple.com Mon Mar 9 15:37:52 2009 From: dalej at apple.com (Dale Johannesen) Date: Mon, 9 Mar 2009 13:37:52 -0700 Subject: [llvm-commits] [llvm] r66366 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll test/Transforms/ScalarRepl/vector_memcpy.ll In-Reply-To: <5F28432F-5C81-4DBB-BE02-569A57FB672D@apple.com> References: <200903080404.n2844MKo007667@zion.cs.uiuc.edu> <65912812-E63C-45C1-8708-437E819F42C9@mac.com> <200903082048.37146.baldrick@free.fr> <17EA8EB0-EB98-400A-9DFA-D814CC7DBEC8@apple.com> <59F44F2D-7FFD-433B-AD85-2EDD08FF8B0B@apple.com> <77E10AFC-E0AF-417F-8649-6F5CFB94FCCF@apple.com> <5F28432F-5C81-4DBB-BE02-569A57FB672D@apple.com> Message-ID: <5057853D-66ED-4843-A5A7-2A7AC8027BD4@apple.com> On Mar 9, 2009, at 1:36 PMPDT, Chris Lattner wrote: > > On Mar 9, 2009, at 1:31 PM, Dale Johannesen wrote: > >>> Ok, this is pretty insane, and I'm sure that there are cases where >>> SROA would get this "wrong" before too. I think that the only >>> reasonable course of action is to make the IR well defined w.r.t. >>> load >>> and store and treat this as an x86 backend bug. Note that this has >>> already been recognized to be a real performance issue (PR3560) as >>> well. >> >> By the time the x86 backend sees this it looks exactly like a >> floating >> point load and store in the source. It should be possible for the >> x86 backend to detect that (load whose only use is in a store) and >> turn it back into int loads and stores, but it seems like a bad >> approach. The x87 behavior is IEEE754 conformant AFAICT so the same >> problem exists on other targets, at least theoretically, and you >> would >> lose in the rare case where somebody wrote a float load and store and >> actually wanted the exception to go off. > > I'm not talking about theoretical IEEE here, I'm talking about what > semantics we want for LLVM IR. I think that load/store pairs should > always be value-preserving. Do you disagree? No, that is not what the semantics are when you write f1 = f2; How else would you represent this? From gohman at apple.com Mon Mar 9 15:41:15 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 09 Mar 2009 20:41:15 -0000 Subject: [llvm-commits] [llvm] r66446 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200903092041.n29KfFBt019668@zion.cs.uiuc.edu> Author: djg Date: Mon Mar 9 15:41:15 2009 New Revision: 66446 URL: http://llvm.org/viewvc/llvm-project?rev=66446&view=rev Log: Delete the isOnlyStride argument, which is unused. 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=66446&r1=66445&r2=66446&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Mar 9 15:41:15 2009 @@ -239,7 +239,7 @@ SCEVExpander &PreheaderRewriter); void StrengthReduceStridedIVUsers(const SCEVHandle &Stride, IVUsersOfOneStride &Uses, - Loop *L, bool isOnlyStride); + Loop *L); void DeleteTriviallyDeadInstructions(); }; } @@ -1786,11 +1786,10 @@ /// StrengthReduceStridedIVUsers - Strength reduce all of the users of a single /// stride of IV. All of the users may have different starting values, and this -/// may not be the only stride (we know it is if isOnlyStride is true). +/// may not be the only stride. void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride, IVUsersOfOneStride &Uses, - Loop *L, - bool isOnlyStride) { + Loop *L) { // If all the users are moved to another stride, then there is nothing to do. if (Uses.Users.empty()) return; @@ -2627,10 +2626,6 @@ // 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; - // IVsByStride keeps IVs for one particular loop. assert(IVsByStride.empty() && "Stale entries in IVsByStride?"); @@ -2646,7 +2641,7 @@ std::map::iterator SI = IVUsesByStride.find(StrideOrder[Stride]); assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); - StrengthReduceStridedIVUsers(SI->first, SI->second, L, HasOneStride); + StrengthReduceStridedIVUsers(SI->first, SI->second, L); } } From clattner at apple.com Mon Mar 9 15:46:36 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 9 Mar 2009 13:46:36 -0700 Subject: [llvm-commits] [llvm] r66366 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll test/Transforms/ScalarRepl/vector_memcpy.ll In-Reply-To: <5057853D-66ED-4843-A5A7-2A7AC8027BD4@apple.com> References: <200903080404.n2844MKo007667@zion.cs.uiuc.edu> <65912812-E63C-45C1-8708-437E819F42C9@mac.com> <200903082048.37146.baldrick@free.fr> <17EA8EB0-EB98-400A-9DFA-D814CC7DBEC8@apple.com> <59F44F2D-7FFD-433B-AD85-2EDD08FF8B0B@apple.com> <77E10AFC-E0AF-417F-8649-6F5CFB94FCCF@apple.com> <5F28432F-5C81-4DBB-BE02-569A57FB672D@apple.com> <5057853D-66ED-4843-A5A7-2A7AC8027BD4@apple.com> Message-ID: >> >> I'm not talking about theoretical IEEE here, I'm talking about what >> semantics we want for LLVM IR. I think that load/store pairs should >> always be value-preserving. Do you disagree? > > No, that is not what the semantics are when you write > > f1 = f2; I agree, but the semantics I'm proposing are a valid way to implement f1 = f2;. -Chris From gohman at apple.com Mon Mar 9 15:46:50 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 09 Mar 2009 20:46:50 -0000 Subject: [llvm-commits] [llvm] r66449 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200903092046.n29KkopG019884@zion.cs.uiuc.edu> Author: djg Date: Mon Mar 9 15:46:50 2009 New Revision: 66449 URL: http://llvm.org/viewvc/llvm-project?rev=66449&view=rev Log: Move the sorting of the StrideOrder array earlier so that it doesn't have to be done twice. 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=66449&r1=66448&r2=66449&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Mar 9 15:46:50 2009 @@ -2147,7 +2147,6 @@ Value *NewCmpRHS = NULL; int64_t Scale = 1; SCEVHandle NewOffset = SE->getIntegerSCEV(0, UIntPtrTy); - std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); if (ConstantInt *C = dyn_cast(Cond->getOperand(1))) { int64_t CmpVal = C->getValue().getSExtValue(); @@ -2611,6 +2610,9 @@ DEBUG(L->dump()); #endif + // Sort the StrideOrder so we process larger strides first. + std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); + // 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 @@ -2629,9 +2631,6 @@ // 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()); - // 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 From kremenek at apple.com Mon Mar 9 15:46:58 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 09 Mar 2009 20:46:58 -0000 Subject: [llvm-commits] [llvm] r66450 - /llvm/tags/checker/checker-0.170/ Message-ID: <200903092046.n29Kkwjp019896@zion.cs.uiuc.edu> Author: kremenek Date: Mon Mar 9 15:46:57 2009 New Revision: 66450 URL: http://llvm.org/viewvc/llvm-project?rev=66450&view=rev Log: Removing checker-0.170. Removed: llvm/tags/checker/checker-0.170/ From kremenek at apple.com Mon Mar 9 15:48:45 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 09 Mar 2009 20:48:45 -0000 Subject: [llvm-commits] [llvm] r66452 - /llvm/tags/checker/checker-0.170/ Message-ID: <200903092048.n29KmjJQ019970@zion.cs.uiuc.edu> Author: kremenek Date: Mon Mar 9 15:48:44 2009 New Revision: 66452 URL: http://llvm.org/viewvc/llvm-project?rev=66452&view=rev Log: Tagging checker-0.170. Added: llvm/tags/checker/checker-0.170/ - copied from r66451, llvm/trunk/ From dpatel at apple.com Mon Mar 9 15:49:38 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 09 Mar 2009 20:49:38 -0000 Subject: [llvm-commits] [llvm] r66454 - in /llvm/trunk: include/llvm/Transforms/IPO.h lib/Transforms/IPO/StripSymbols.cpp Message-ID: <200903092049.n29KncNv020018@zion.cs.uiuc.edu> Author: dpatel Date: Mon Mar 9 15:49:37 2009 New Revision: 66454 URL: http://llvm.org/viewvc/llvm-project?rev=66454&view=rev Log: Add helper pass to remove llvm.dbg.declare intrinsics. Modified: llvm/trunk/include/llvm/Transforms/IPO.h llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=66454&r1=66453&r2=66454&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Mon Mar 9 15:49:37 2009 @@ -35,12 +35,17 @@ //===----------------------------------------------------------------------===// // -// These functions removes symbols from functions and modules. -// Only debugging information is not removed. +// These functions strips symbols from functions and modules. +// Only debugging information is not stripped. // ModulePass *createStripNonDebugSymbolsPass(); //===----------------------------------------------------------------------===// +// +// These pass removes llvm.dbg.declare intrinsics. +ModulePass *createStripDebugDeclarePass(); + +//===----------------------------------------------------------------------===// /// createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics /// to invoke/unwind instructions. This should really be part of the C/C++ /// front-end, but it's so much easier to write transformations in LLVM proper. Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=66454&r1=66453&r2=66454&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Mon Mar 9 15:49:37 2009 @@ -60,6 +60,19 @@ AU.setPreservesAll(); } }; + + class VISIBILITY_HIDDEN StripDebugDeclare : public ModulePass { + public: + static char ID; // Pass identification, replacement for typeid + explicit StripDebugDeclare() + : ModulePass(&ID) {} + + virtual bool runOnModule(Module &M); + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + }; } char StripSymbols::ID = 0; @@ -78,6 +91,14 @@ return new StripNonDebugSymbols(); } +char StripDebugDeclare::ID = 0; +static RegisterPass +Z("strip-debug-declare", "Strip all llvm.dbg.declare intrinsics"); + +ModulePass *llvm::createStripDebugDeclarePass() { + return new StripDebugDeclare(); +} + /// OnlyUsedBy - Return true if V is only used by Usr. static bool OnlyUsedBy(Value *V, Value *Usr) { for(Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { @@ -343,3 +364,44 @@ bool StripNonDebugSymbols::runOnModule(Module &M) { return StripSymbolNames(M, true); } + +bool StripDebugDeclare::runOnModule(Module &M) { + + Function *Declare = M.getFunction("llvm.dbg.declare"); + + if (!Declare) + return false; + + std::vector DeadConstants; + + while (!Declare->use_empty()) { + CallInst *CI = cast(Declare->use_back()); + Value *Arg1 = CI->getOperand(1); + Value *Arg2 = CI->getOperand(2); + assert(CI->use_empty() && "llvm.dbg intrinsic should have void result"); + CI->eraseFromParent(); + if (Arg1->use_empty()) { + if (Constant *C = dyn_cast(Arg1)) + DeadConstants.push_back(C); + else + RecursivelyDeleteTriviallyDeadInstructions(Arg1, NULL); + } + if (Arg2->use_empty()) + if (Constant *C = dyn_cast(Arg2)) + DeadConstants.push_back(C); + } + Declare->eraseFromParent(); + + while (!DeadConstants.empty()) { + Constant *C = DeadConstants.back(); + DeadConstants.pop_back(); + if (GlobalVariable *GV = dyn_cast(C)) { + if (GV->hasLocalLinkage()) + RemoveDeadConstant(GV); + } + else + RemoveDeadConstant(C); + } + + return true; +} From isanbard at gmail.com Mon Mar 9 15:52:42 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 09 Mar 2009 20:52:42 -0000 Subject: [llvm-commits] [llvm] r66456 - in /llvm/branches/Apple/Dib: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/Target/ARM/ARMSubtarget.cpp lib/Target/ARM/ARMTargetMachine.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Instr64bit.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td test/CodeGen/ARM/uxtb.ll test/CodeGen/X86/2009-03-05-burr-list-crash.ll test/CodeGen/X86/peep-test-0.ll test/CodeGen/X86/peep-test-1.ll test/CodeGen/X86/peep-test.ll Message-ID: <200903092052.n29KqhXZ020192@zion.cs.uiuc.edu> Author: void Date: Mon Mar 9 15:52:42 2009 New Revision: 66456 URL: http://llvm.org/viewvc/llvm-project?rev=66456&view=rev Log: --- Merging (from foreign repository) r66365 into '.': U test/CodeGen/ARM/uxtb.ll U lib/Target/ARM/ARMSubtarget.cpp Recognize triplets starting with armv5-, armv6- etc. And set the ARM arch version accordingly. --- Merging (from foreign repository) r66435 into '.': G lib/Target/ARM/ARMSubtarget.cpp U lib/Target/ARM/ARMTargetMachine.cpp ARM target now also recognize triplets like thumbv6-apple-darwin and set thumb mode and arch subversion. Eventually thumb triplets will go way and replaced with function notes. Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll llvm/branches/Apple/Dib/test/CodeGen/X86/peep-test-0.ll llvm/branches/Apple/Dib/test/CodeGen/X86/peep-test-1.ll llvm/branches/Apple/Dib/test/CodeGen/X86/peep-test.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Mar 9 15:52:42 2009 @@ -402,7 +402,7 @@ NewSU->isCommutable = true; ComputeLatency(NewSU); - SDep ChainPred; + SmallVector ChainPreds; SmallVector ChainSuccs; SmallVector LoadPreds; SmallVector NodePreds; @@ -410,7 +410,7 @@ for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { if (I->isCtrl()) - ChainPred = *I; + ChainPreds.push_back(*I); else if (I->getSUnit()->getNode() && I->getSUnit()->getNode()->isOperandOf(LoadNode)) LoadPreds.push_back(*I); @@ -425,17 +425,17 @@ NodeSuccs.push_back(*I); } - if (ChainPred.getSUnit()) { - RemovePred(SU, ChainPred); + for (unsigned i = 0, e = ChainPreds.size(); i != e; ++i) { + const SDep &Pred = ChainPreds[i]; + RemovePred(SU, Pred); if (isNewLoad) - AddPred(LoadSU, ChainPred); + AddPred(LoadSU, Pred); } for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) { const SDep &Pred = LoadPreds[i]; RemovePred(SU, Pred); - if (isNewLoad) { + if (isNewLoad) AddPred(LoadSU, Pred); - } } for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) { const SDep &Pred = NodePreds[i]; Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp Mon Mar 9 15:52:42 2009 @@ -35,8 +35,31 @@ // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. const std::string& TT = M.getTargetTriple(); - if (TT.length() > 5) { + unsigned Len = TT.length(); + unsigned Idx = 0; + if (Len >= 5 && TT.substr(0, 4) == "armv") + Idx = 4; + else if (Len >= 6 && TT.substr(0, 6) == "thumb") { + IsThumb = true; + if (Len >= 7 && TT[5] == 'v') + Idx = 6; + } + if (Idx) { + unsigned SubVer = TT[Idx]; + if (SubVer > '4' && SubVer <= '9') { + if (SubVer >= '6') + ARMArchVersion = V6; + else if (SubVer == '5') { + ARMArchVersion = V5T; + if (Len >= Idx+3 && TT[Idx+1] == 't' && TT[Idx+2] == 'e') + ARMArchVersion = V5TE; + } + } + } + + if (Len >= 10) { if (TT.find("-darwin") != std::string::npos) + // arm-darwin TargetType = isDarwin; } else if (TT.empty()) { #if defined(__APPLE__) Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp Mon Mar 9 15:52:42 2009 @@ -53,7 +53,9 @@ unsigned ThumbTargetMachine::getModuleMatchQuality(const Module &M) { std::string TT = M.getTargetTriple(); - if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "thumb-") + // Match thumb-foo-bar, as well as things like thumbv5blah-* + if (TT.size() >= 6 && + (TT.substr(0, 6) == "thumb-" || TT.substr(0, 6) == "thumbv")) return 20; // If the target triple is something non-thumb, we don't match. @@ -105,7 +107,8 @@ unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) { std::string TT = M.getTargetTriple(); - if (TT.size() >= 4 && // Match arm-foo-bar, as well as things like armv5blah-* + // Match arm-foo-bar, as well as things like armv5blah-* + if (TT.size() >= 4 && (TT.substr(0, 4) == "arm-" || TT.substr(0, 4) == "armv")) return 20; // If the target triple is something non-arm, we don't match. Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp Mon Mar 9 15:52:42 2009 @@ -5345,6 +5345,113 @@ return DAG.getNode(X86ISD::FOR, dl, VT, Val, SignBit); } +/// Emit nodes that will be selected as "test Op0,Op0", or something +/// equivalent. +SDValue X86TargetLowering::EmitTest(SDValue Op, unsigned X86CC, + SelectionDAG &DAG) { + DebugLoc dl = Op.getDebugLoc(); + + // CF and OF aren't always set the way we want. Determine which + // of these we need. + bool NeedCF = false; + bool NeedOF = false; + switch (X86CC) { + case X86::COND_A: case X86::COND_AE: + case X86::COND_B: case X86::COND_BE: + NeedCF = true; + break; + case X86::COND_G: case X86::COND_GE: + case X86::COND_L: case X86::COND_LE: + case X86::COND_O: case X86::COND_NO: + NeedOF = true; + break; + default: break; + } + + // See if we can use the EFLAGS value from the operand instead of + // doing a separate TEST. TEST always sets OF and CF to 0, so unless + // we prove that the arithmetic won't overflow, we can't use OF or CF. + if (Op.getResNo() == 0 && !NeedOF && !NeedCF) { + unsigned Opcode = 0; + unsigned NumOperands = 0; + switch (Op.getNode()->getOpcode()) { + case ISD::ADD: + // Due to an isel shortcoming, be conservative if this add is likely to + // be selected as part of a load-modify-store instruction. When the root + // node in a match is a store, isel doesn't know how to remap non-chain + // non-flag uses of other nodes in the match, such as the ADD in this + // case. This leads to the ADD being left around and reselected, with + // the result being two adds in the output. + for (SDNode::use_iterator UI = Op.getNode()->use_begin(), + UE = Op.getNode()->use_end(); UI != UE; ++UI) + if (UI->getOpcode() == ISD::STORE) + goto default_case; + if (ConstantSDNode *C = + dyn_cast(Op.getNode()->getOperand(1))) { + // An add of one will be selected as an INC. + if (C->getAPIntValue() == 1) { + Opcode = X86ISD::INC; + NumOperands = 1; + break; + } + // An add of negative one (subtract of one) will be selected as a DEC. + if (C->getAPIntValue().isAllOnesValue()) { + Opcode = X86ISD::DEC; + NumOperands = 1; + break; + } + } + // Otherwise use a regular EFLAGS-setting add. + Opcode = X86ISD::ADD; + NumOperands = 2; + break; + case ISD::SUB: + // Due to the ISEL shortcoming noted above, be conservative if this sub is + // likely to be selected as part of a load-modify-store instruction. + for (SDNode::use_iterator UI = Op.getNode()->use_begin(), + UE = Op.getNode()->use_end(); UI != UE; ++UI) + if (UI->getOpcode() == ISD::STORE) + goto default_case; + // Otherwise use a regular EFLAGS-setting sub. + Opcode = X86ISD::SUB; + NumOperands = 2; + break; + case X86ISD::ADD: + case X86ISD::SUB: + case X86ISD::INC: + case X86ISD::DEC: + return SDValue(Op.getNode(), 1); + default: + default_case: + break; + } + if (Opcode != 0) { + const MVT *VTs = DAG.getNodeValueTypes(Op.getValueType(), MVT::i32); + SmallVector Ops; + for (unsigned i = 0; i != NumOperands; ++i) + Ops.push_back(Op.getOperand(i)); + SDValue New = DAG.getNode(Opcode, dl, VTs, 2, &Ops[0], NumOperands); + DAG.ReplaceAllUsesWith(Op, New); + return SDValue(New.getNode(), 1); + } + } + + return DAG.getNode(X86ISD::CMP, dl, MVT::i32, Op, + DAG.getConstant(0, Op.getValueType())); +} + +/// Emit nodes that will be selected as "cmp Op0,Op1", or something +/// equivalent. +SDValue X86TargetLowering::EmitCmp(SDValue Op0, SDValue Op1, unsigned X86CC, + SelectionDAG &DAG) { + if (ConstantSDNode *C = dyn_cast(Op1)) + if (C->getAPIntValue() == 0) + return EmitTest(Op0, X86CC, DAG); + + DebugLoc dl = Op0.getDebugLoc(); + return DAG.getNode(X86ISD::CMP, dl, MVT::i32, Op0, Op1); +} + SDValue X86TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) { assert(Op.getValueType() == MVT::i8 && "SetCC type must be 8-bit integer"); SDValue Op0 = Op.getOperand(0); @@ -5407,7 +5514,7 @@ bool isFP = Op.getOperand(1).getValueType().isFloatingPoint(); unsigned X86CC = TranslateX86CC(CC, isFP, Op0, Op1, DAG); - SDValue Cond = DAG.getNode(X86ISD::CMP, dl, MVT::i32, Op0, Op1); + SDValue Cond = EmitCmp(Op0, Op1, X86CC, DAG); return DAG.getNode(X86ISD::SETCC, dl, MVT::i8, DAG.getConstant(X86CC, MVT::i8), Cond); } @@ -5526,8 +5633,20 @@ } // isX86LogicalCmp - Return true if opcode is a X86 logical comparison. -static bool isX86LogicalCmp(unsigned Opc) { - return Opc == X86ISD::CMP || Opc == X86ISD::COMI || Opc == X86ISD::UCOMI; +static bool isX86LogicalCmp(SDValue Op) { + unsigned Opc = Op.getNode()->getOpcode(); + if (Opc == X86ISD::CMP || Opc == X86ISD::COMI || Opc == X86ISD::UCOMI) + return true; + if (Op.getResNo() == 1 && + Opc == X86ISD::ADD || + Opc == X86ISD::SUB || + Opc == X86ISD::SMUL || + Opc == X86ISD::UMUL || + Opc == X86ISD::INC || + Opc == X86ISD::DEC) + return true; + + return false; } SDValue X86TargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) { @@ -5553,7 +5672,7 @@ !isScalarFPTypeInSSEReg(VT)) // FPStack? IllegalFPCMov = !hasFPCMov(cast(CC)->getSExtValue()); - if ((isX86LogicalCmp(Opc) && !IllegalFPCMov) || Opc == X86ISD::BT) { // FIXME + if ((isX86LogicalCmp(Cmp) && !IllegalFPCMov) || Opc == X86ISD::BT) { // FIXME Cond = Cmp; addTest = false; } @@ -5561,8 +5680,7 @@ if (addTest) { CC = DAG.getConstant(X86::COND_NE, MVT::i8); - Cond= DAG.getNode(X86ISD::CMP, dl, MVT::i32, Cond, - DAG.getConstant(0, MVT::i8)); + Cond = EmitTest(Cond, X86::COND_NE, DAG); } const MVT *VTs = DAG.getNodeValueTypes(Op.getValueType(), @@ -5630,7 +5748,7 @@ SDValue Cmp = Cond.getOperand(1); unsigned Opc = Cmp.getOpcode(); // FIXME: WHY THE SPECIAL CASING OF LogicalCmp?? - if (isX86LogicalCmp(Opc) || Opc == X86ISD::BT) { + if (isX86LogicalCmp(Cmp) || Opc == X86ISD::BT) { Cond = Cmp; addTest = false; } else { @@ -5649,13 +5767,12 @@ unsigned CondOpc; if (Cond.hasOneUse() && isAndOrOfSetCCs(Cond, CondOpc)) { SDValue Cmp = Cond.getOperand(0).getOperand(1); - unsigned Opc = Cmp.getOpcode(); if (CondOpc == ISD::OR) { // Also, recognize the pattern generated by an FCMP_UNE. We can emit // two branches instead of an explicit OR instruction with a // separate test. if (Cmp == Cond.getOperand(1).getOperand(1) && - isX86LogicalCmp(Opc)) { + isX86LogicalCmp(Cmp)) { CC = Cond.getOperand(0).getOperand(0); Chain = DAG.getNode(X86ISD::BRCOND, dl, Op.getValueType(), Chain, Dest, CC, Cmp); @@ -5670,7 +5787,7 @@ // have a fall-through edge, because this requires an explicit // jmp when the condition is false. if (Cmp == Cond.getOperand(1).getOperand(1) && - isX86LogicalCmp(Opc) && + isX86LogicalCmp(Cmp) && Op.getNode()->hasOneUse()) { X86::CondCode CCode = (X86::CondCode)Cond.getOperand(0).getConstantOperandVal(0); @@ -5713,8 +5830,7 @@ if (addTest) { CC = DAG.getConstant(X86::COND_NE, MVT::i8); - Cond= DAG.getNode(X86ISD::CMP, dl, MVT::i32, Cond, - DAG.getConstant(0, MVT::i8)); + Cond = EmitTest(Cond, X86::COND_NE, DAG); } return DAG.getNode(X86ISD::BRCOND, dl, Op.getValueType(), Chain, Dest, CC, Cond); @@ -6647,6 +6763,14 @@ switch (Op.getOpcode()) { default: assert(0 && "Unknown ovf instruction!"); case ISD::SADDO: + // A subtract of one will be selected as a INC. Note that INC doesn't + // set CF, so we can't do this for UADDO. + if (ConstantSDNode *C = dyn_cast(Op)) + if (C->getAPIntValue() == 1) { + BaseOp = X86ISD::INC; + Cond = X86::COND_O; + break; + } BaseOp = X86ISD::ADD; Cond = X86::COND_O; break; @@ -6655,6 +6779,14 @@ Cond = X86::COND_B; break; case ISD::SSUBO: + // A subtract of one will be selected as a DEC. Note that DEC doesn't + // set CF, so we can't do this for USUBO. + if (ConstantSDNode *C = dyn_cast(Op)) + if (C->getAPIntValue() == 1) { + BaseOp = X86ISD::DEC; + Cond = X86::COND_O; + break; + } BaseOp = X86ISD::SUB; Cond = X86::COND_O; break; @@ -6995,6 +7127,8 @@ case X86ISD::SUB: return "X86ISD::SUB"; case X86ISD::SMUL: return "X86ISD::SMUL"; case X86ISD::UMUL: return "X86ISD::UMUL"; + case X86ISD::INC: return "X86ISD::INC"; + case X86ISD::DEC: return "X86ISD::DEC"; } } @@ -7793,6 +7927,8 @@ case X86ISD::SUB: case X86ISD::SMUL: case X86ISD::UMUL: + case X86ISD::INC: + case X86ISD::DEC: // These nodes' second result is a boolean. if (Op.getResNo() == 0) break; Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h Mon Mar 9 15:52:42 2009 @@ -235,9 +235,9 @@ PCMPEQB, PCMPEQW, PCMPEQD, PCMPEQQ, PCMPGTB, PCMPGTW, PCMPGTD, PCMPGTQ, - // ADD, SUB, SMUL, UMUL - Arithmetic operations with overflow/carry - // intrinsics. - ADD, SUB, SMUL, UMUL + // ADD, SUB, SMUL, UMUL, etc. - Arithmetic operations with FLAGS results. + ADD, SUB, SMUL, UMUL, + INC, DEC }; } @@ -659,6 +659,15 @@ MachineBasicBlock *EmitAtomicMinMaxWithCustomInserter(MachineInstr *BInstr, MachineBasicBlock *BB, unsigned cmovOpc); + + /// Emit nodes that will be selected as "test Op0,Op0", or something + /// equivalent, for use with the given x86 condition code. + SDValue EmitTest(SDValue Op0, unsigned X86CC, SelectionDAG &DAG); + + /// Emit nodes that will be selected as "cmp Op0,Op1", or something + /// equivalent, for use with the given x86 condition code. + SDValue EmitCmp(SDValue Op0, SDValue Op1, unsigned X86CC, + SelectionDAG &DAG); }; namespace X86 { Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td Mon Mar 9 15:52:42 2009 @@ -538,36 +538,46 @@ let Defs = [EFLAGS], CodeSize = 2 in { let isTwoAddress = 1 in def NEG64r : RI<0xF7, MRM3r, (outs GR64:$dst), (ins GR64:$src), "neg{q}\t$dst", - [(set GR64:$dst, (ineg GR64:$src))]>; + [(set GR64:$dst, (ineg GR64:$src)), + (implicit EFLAGS)]>; def NEG64m : RI<0xF7, MRM3m, (outs), (ins i64mem:$dst), "neg{q}\t$dst", - [(store (ineg (loadi64 addr:$dst)), addr:$dst)]>; + [(store (ineg (loadi64 addr:$dst)), addr:$dst), + (implicit EFLAGS)]>; let isTwoAddress = 1, isConvertibleToThreeAddress = 1 in def INC64r : RI<0xFF, MRM0r, (outs GR64:$dst), (ins GR64:$src), "inc{q}\t$dst", - [(set GR64:$dst, (add GR64:$src, 1))]>; + [(set GR64:$dst, (add GR64:$src, 1)), + (implicit EFLAGS)]>; def INC64m : RI<0xFF, MRM0m, (outs), (ins i64mem:$dst), "inc{q}\t$dst", - [(store (add (loadi64 addr:$dst), 1), addr:$dst)]>; + [(store (add (loadi64 addr:$dst), 1), addr:$dst), + (implicit EFLAGS)]>; let isTwoAddress = 1, isConvertibleToThreeAddress = 1 in def DEC64r : RI<0xFF, MRM1r, (outs GR64:$dst), (ins GR64:$src), "dec{q}\t$dst", - [(set GR64:$dst, (add GR64:$src, -1))]>; + [(set GR64:$dst, (add GR64:$src, -1)), + (implicit EFLAGS)]>; def DEC64m : RI<0xFF, MRM1m, (outs), (ins i64mem:$dst), "dec{q}\t$dst", - [(store (add (loadi64 addr:$dst), -1), addr:$dst)]>; + [(store (add (loadi64 addr:$dst), -1), addr:$dst), + (implicit EFLAGS)]>; // In 64-bit mode, single byte INC and DEC cannot be encoded. let isTwoAddress = 1, isConvertibleToThreeAddress = 1 in { // Can transform into LEA. def INC64_16r : I<0xFF, MRM0r, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst", - [(set GR16:$dst, (add GR16:$src, 1))]>, + [(set GR16:$dst, (add GR16:$src, 1)), + (implicit EFLAGS)]>, OpSize, Requires<[In64BitMode]>; def INC64_32r : I<0xFF, MRM0r, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst", - [(set GR32:$dst, (add GR32:$src, 1))]>, + [(set GR32:$dst, (add GR32:$src, 1)), + (implicit EFLAGS)]>, Requires<[In64BitMode]>; def DEC64_16r : I<0xFF, MRM1r, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst", - [(set GR16:$dst, (add GR16:$src, -1))]>, + [(set GR16:$dst, (add GR16:$src, -1)), + (implicit EFLAGS)]>, OpSize, Requires<[In64BitMode]>; def DEC64_32r : I<0xFF, MRM1r, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst", - [(set GR32:$dst, (add GR32:$src, -1))]>, + [(set GR32:$dst, (add GR32:$src, -1)), + (implicit EFLAGS)]>, Requires<[In64BitMode]>; } // isConvertibleToThreeAddress @@ -575,16 +585,20 @@ // how to unfold them. let isTwoAddress = 0, CodeSize = 2 in { def INC64_16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst", - [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, + [(store (add (loadi16 addr:$dst), 1), addr:$dst), + (implicit EFLAGS)]>, OpSize, Requires<[In64BitMode]>; def INC64_32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst", - [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>, + [(store (add (loadi32 addr:$dst), 1), addr:$dst), + (implicit EFLAGS)]>, Requires<[In64BitMode]>; def DEC64_16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst", - [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, + [(store (add (loadi16 addr:$dst), -1), addr:$dst), + (implicit EFLAGS)]>, OpSize, Requires<[In64BitMode]>; def DEC64_32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst", - [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>, + [(store (add (loadi32 addr:$dst), -1), addr:$dst), + (implicit EFLAGS)]>, Requires<[In64BitMode]>; } } // Defs = [EFLAGS], CodeSize @@ -780,86 +794,107 @@ def AND64rr : RI<0x21, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), "and{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (and GR64:$src1, GR64:$src2))]>; + [(set GR64:$dst, (and GR64:$src1, GR64:$src2)), + (implicit EFLAGS)]>; def AND64rm : RI<0x23, MRMSrcMem, (outs GR64:$dst), (ins GR64:$src1, i64mem:$src2), "and{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (and GR64:$src1, (load addr:$src2)))]>; + [(set GR64:$dst, (and GR64:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def AND64ri8 : RIi8<0x83, MRM4r, (outs GR64:$dst), (ins GR64:$src1, i64i8imm:$src2), "and{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (and GR64:$src1, i64immSExt8:$src2))]>; + [(set GR64:$dst, (and GR64:$src1, i64immSExt8:$src2)), + (implicit EFLAGS)]>; def AND64ri32 : RIi32<0x81, MRM4r, (outs GR64:$dst), (ins GR64:$src1, i64i32imm:$src2), "and{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (and GR64:$src1, i64immSExt32:$src2))]>; + [(set GR64:$dst, (and GR64:$src1, i64immSExt32:$src2)), + (implicit EFLAGS)]>; } // isTwoAddress def AND64mr : RI<0x21, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src), "and{q}\t{$src, $dst|$dst, $src}", - [(store (and (load addr:$dst), GR64:$src), addr:$dst)]>; + [(store (and (load addr:$dst), GR64:$src), addr:$dst), + (implicit EFLAGS)]>; def AND64mi8 : RIi8<0x83, MRM4m, (outs), (ins i64mem:$dst, i64i8imm :$src), "and{q}\t{$src, $dst|$dst, $src}", - [(store (and (load addr:$dst), i64immSExt8:$src), addr:$dst)]>; + [(store (and (load addr:$dst), i64immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>; def AND64mi32 : RIi32<0x81, MRM4m, (outs), (ins i64mem:$dst, i64i32imm:$src), "and{q}\t{$src, $dst|$dst, $src}", - [(store (and (loadi64 addr:$dst), i64immSExt32:$src), addr:$dst)]>; + [(store (and (loadi64 addr:$dst), i64immSExt32:$src), addr:$dst), + (implicit EFLAGS)]>; let isTwoAddress = 1 in { let isCommutable = 1 in def OR64rr : RI<0x09, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), "or{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (or GR64:$src1, GR64:$src2))]>; + [(set GR64:$dst, (or GR64:$src1, GR64:$src2)), + (implicit EFLAGS)]>; def OR64rm : RI<0x0B, MRMSrcMem , (outs GR64:$dst), (ins GR64:$src1, i64mem:$src2), "or{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (or GR64:$src1, (load addr:$src2)))]>; + [(set GR64:$dst, (or GR64:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def OR64ri8 : RIi8<0x83, MRM1r, (outs GR64:$dst), (ins GR64:$src1, i64i8imm:$src2), "or{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (or GR64:$src1, i64immSExt8:$src2))]>; + [(set GR64:$dst, (or GR64:$src1, i64immSExt8:$src2)), + (implicit EFLAGS)]>; def OR64ri32 : RIi32<0x81, MRM1r, (outs GR64:$dst), (ins GR64:$src1, i64i32imm:$src2), "or{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (or GR64:$src1, i64immSExt32:$src2))]>; + [(set GR64:$dst, (or GR64:$src1, i64immSExt32:$src2)), + (implicit EFLAGS)]>; } // isTwoAddress def OR64mr : RI<0x09, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src), "or{q}\t{$src, $dst|$dst, $src}", - [(store (or (load addr:$dst), GR64:$src), addr:$dst)]>; + [(store (or (load addr:$dst), GR64:$src), addr:$dst), + (implicit EFLAGS)]>; def OR64mi8 : RIi8<0x83, MRM1m, (outs), (ins i64mem:$dst, i64i8imm:$src), "or{q}\t{$src, $dst|$dst, $src}", - [(store (or (load addr:$dst), i64immSExt8:$src), addr:$dst)]>; + [(store (or (load addr:$dst), i64immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>; def OR64mi32 : RIi32<0x81, MRM1m, (outs), (ins i64mem:$dst, i64i32imm:$src), "or{q}\t{$src, $dst|$dst, $src}", - [(store (or (loadi64 addr:$dst), i64immSExt32:$src), addr:$dst)]>; + [(store (or (loadi64 addr:$dst), i64immSExt32:$src), addr:$dst), + (implicit EFLAGS)]>; let isTwoAddress = 1 in { let isCommutable = 1 in def XOR64rr : RI<0x31, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), "xor{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (xor GR64:$src1, GR64:$src2))]>; + [(set GR64:$dst, (xor GR64:$src1, GR64:$src2)), + (implicit EFLAGS)]>; def XOR64rm : RI<0x33, MRMSrcMem, (outs GR64:$dst), (ins GR64:$src1, i64mem:$src2), "xor{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (xor GR64:$src1, (load addr:$src2)))]>; + [(set GR64:$dst, (xor GR64:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def XOR64ri8 : RIi8<0x83, MRM6r, (outs GR64:$dst), (ins GR64:$src1, i64i8imm:$src2), "xor{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (xor GR64:$src1, i64immSExt8:$src2))]>; + [(set GR64:$dst, (xor GR64:$src1, i64immSExt8:$src2)), + (implicit EFLAGS)]>; def XOR64ri32 : RIi32<0x81, MRM6r, (outs GR64:$dst), (ins GR64:$src1, i64i32imm:$src2), "xor{q}\t{$src2, $dst|$dst, $src2}", - [(set GR64:$dst, (xor GR64:$src1, i64immSExt32:$src2))]>; + [(set GR64:$dst, (xor GR64:$src1, i64immSExt32:$src2)), + (implicit EFLAGS)]>; } // isTwoAddress def XOR64mr : RI<0x31, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src), "xor{q}\t{$src, $dst|$dst, $src}", - [(store (xor (load addr:$dst), GR64:$src), addr:$dst)]>; + [(store (xor (load addr:$dst), GR64:$src), addr:$dst), + (implicit EFLAGS)]>; def XOR64mi8 : RIi8<0x83, MRM6m, (outs), (ins i64mem:$dst, i64i8imm :$src), "xor{q}\t{$src, $dst|$dst, $src}", - [(store (xor (load addr:$dst), i64immSExt8:$src), addr:$dst)]>; + [(store (xor (load addr:$dst), i64immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>; def XOR64mi32 : RIi32<0x81, MRM6m, (outs), (ins i64mem:$dst, i64i32imm:$src), "xor{q}\t{$src, $dst|$dst, $src}", - [(store (xor (loadi64 addr:$dst), i64immSExt32:$src), addr:$dst)]>; + [(store (xor (loadi64 addr:$dst), i64immSExt32:$src), addr:$dst), + (implicit EFLAGS)]>; } // Defs = [EFLAGS] //===----------------------------------------------------------------------===// @@ -1596,101 +1631,135 @@ (SUB64ri32 GR64:$src1, i64immSExt32:$src2)>; //===----------------------------------------------------------------------===// -// Overflow Patterns +// EFLAGS-defining Patterns //===----------------------------------------------------------------------===// -// Register-Register Addition with Overflow -def : Pat<(parallel (X86add_ovf GR64:$src1, GR64:$src2), +// Register-Register Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR64:$src1, GR64:$src2), (implicit EFLAGS)), (ADD64rr GR64:$src1, GR64:$src2)>; -// Register-Integer Addition with Overflow -def : Pat<(parallel (X86add_ovf GR64:$src1, i64immSExt8:$src2), +// Register-Integer Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR64:$src1, i64immSExt8:$src2), (implicit EFLAGS)), (ADD64ri8 GR64:$src1, i64immSExt8:$src2)>; -def : Pat<(parallel (X86add_ovf GR64:$src1, i64immSExt32:$src2), +def : Pat<(parallel (X86add_flag GR64:$src1, i64immSExt32:$src2), (implicit EFLAGS)), (ADD64ri32 GR64:$src1, i64immSExt32:$src2)>; -// Register-Memory Addition with Overflow -def : Pat<(parallel (X86add_ovf GR64:$src1, (load addr:$src2)), +// Register-Memory Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR64:$src1, (loadi64 addr:$src2)), (implicit EFLAGS)), (ADD64rm GR64:$src1, addr:$src2)>; -// Memory-Register Addition with Overflow -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), GR64:$src2), +// Memory-Register Addition with EFLAGS result +def : Pat<(parallel (store (X86add_flag (loadi64 addr:$dst), GR64:$src2), addr:$dst), (implicit EFLAGS)), (ADD64mr addr:$dst, GR64:$src2)>; -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), i64immSExt8:$src2), +def : Pat<(parallel (store (X86add_flag (loadi64 addr:$dst), i64immSExt8:$src2), addr:$dst), (implicit EFLAGS)), (ADD64mi8 addr:$dst, i64immSExt8:$src2)>; -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), i64immSExt32:$src2), +def : Pat<(parallel (store (X86add_flag (loadi64 addr:$dst), i64immSExt32:$src2), addr:$dst), (implicit EFLAGS)), (ADD64mi32 addr:$dst, i64immSExt32:$src2)>; -// Register-Register Subtraction with Overflow -def : Pat<(parallel (X86sub_ovf GR64:$src1, GR64:$src2), +// Register-Register Subtraction with EFLAGS result +def : Pat<(parallel (X86sub_flag GR64:$src1, GR64:$src2), (implicit EFLAGS)), (SUB64rr GR64:$src1, GR64:$src2)>; -// Register-Memory Subtraction with Overflow -def : Pat<(parallel (X86sub_ovf GR64:$src1, (load addr:$src2)), +// Register-Memory Subtraction with EFLAGS result +def : Pat<(parallel (X86sub_flag GR64:$src1, (loadi64 addr:$src2)), (implicit EFLAGS)), (SUB64rm GR64:$src1, addr:$src2)>; -// Register-Integer Subtraction with Overflow -def : Pat<(parallel (X86sub_ovf GR64:$src1, i64immSExt8:$src2), +// Register-Integer Subtraction with EFLAGS result +def : Pat<(parallel (X86sub_flag GR64:$src1, i64immSExt8:$src2), (implicit EFLAGS)), (SUB64ri8 GR64:$src1, i64immSExt8:$src2)>; -def : Pat<(parallel (X86sub_ovf GR64:$src1, i64immSExt32:$src2), +def : Pat<(parallel (X86sub_flag GR64:$src1, i64immSExt32:$src2), (implicit EFLAGS)), (SUB64ri32 GR64:$src1, i64immSExt32:$src2)>; -// Memory-Register Subtraction with Overflow -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), GR64:$src2), +// Memory-Register Subtraction with EFLAGS result +def : Pat<(parallel (store (X86sub_flag (loadi64 addr:$dst), GR64:$src2), addr:$dst), (implicit EFLAGS)), (SUB64mr addr:$dst, GR64:$src2)>; -// Memory-Integer Subtraction with Overflow -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), i64immSExt8:$src2), +// Memory-Integer Subtraction with EFLAGS result +def : Pat<(parallel (store (X86sub_flag (loadi64 addr:$dst), i64immSExt8:$src2), addr:$dst), (implicit EFLAGS)), (SUB64mi8 addr:$dst, i64immSExt8:$src2)>; -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), i64immSExt32:$src2), +def : Pat<(parallel (store (X86sub_flag (loadi64 addr:$dst), i64immSExt32:$src2), addr:$dst), (implicit EFLAGS)), (SUB64mi32 addr:$dst, i64immSExt32:$src2)>; -// Register-Register Signed Integer Multiplication with Overflow -def : Pat<(parallel (X86smul_ovf GR64:$src1, GR64:$src2), +// Register-Register Signed Integer Multiplication with EFLAGS result +def : Pat<(parallel (X86smul_flag GR64:$src1, GR64:$src2), (implicit EFLAGS)), (IMUL64rr GR64:$src1, GR64:$src2)>; -// Register-Memory Signed Integer Multiplication with Overflow -def : Pat<(parallel (X86smul_ovf GR64:$src1, (load addr:$src2)), +// Register-Memory Signed Integer Multiplication with EFLAGS result +def : Pat<(parallel (X86smul_flag GR64:$src1, (loadi64 addr:$src2)), (implicit EFLAGS)), (IMUL64rm GR64:$src1, addr:$src2)>; -// Register-Integer Signed Integer Multiplication with Overflow -def : Pat<(parallel (X86smul_ovf GR64:$src1, i64immSExt8:$src2), +// Register-Integer Signed Integer Multiplication with EFLAGS result +def : Pat<(parallel (X86smul_flag GR64:$src1, i64immSExt8:$src2), (implicit EFLAGS)), (IMUL64rri8 GR64:$src1, i64immSExt8:$src2)>; -def : Pat<(parallel (X86smul_ovf GR64:$src1, i64immSExt32:$src2), +def : Pat<(parallel (X86smul_flag GR64:$src1, i64immSExt32:$src2), (implicit EFLAGS)), (IMUL64rri32 GR64:$src1, i64immSExt32:$src2)>; -// Memory-Integer Signed Integer Multiplication with Overflow -def : Pat<(parallel (X86smul_ovf (load addr:$src1), i64immSExt8:$src2), +// Memory-Integer Signed Integer Multiplication with EFLAGS result +def : Pat<(parallel (X86smul_flag (loadi64 addr:$src1), i64immSExt8:$src2), (implicit EFLAGS)), (IMUL64rmi8 addr:$src1, i64immSExt8:$src2)>; -def : Pat<(parallel (X86smul_ovf (load addr:$src1), i64immSExt32:$src2), +def : Pat<(parallel (X86smul_flag (loadi64 addr:$src1), i64immSExt32:$src2), (implicit EFLAGS)), (IMUL64rmi32 addr:$src1, i64immSExt32:$src2)>; +// INC and DEC with EFLAGS result. Note that these do not set CF. +def : Pat<(parallel (X86inc_flag GR16:$src), (implicit EFLAGS)), + (INC64_16r GR16:$src)>, Requires<[In64BitMode]>; +def : Pat<(parallel (store (i16 (X86inc_flag (loadi16 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (INC64_16m addr:$dst)>, Requires<[In64BitMode]>; +def : Pat<(parallel (X86dec_flag GR16:$src), (implicit EFLAGS)), + (DEC64_16r GR16:$src)>, Requires<[In64BitMode]>; +def : Pat<(parallel (store (i16 (X86dec_flag (loadi16 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (DEC64_16m addr:$dst)>, Requires<[In64BitMode]>; + +def : Pat<(parallel (X86inc_flag GR32:$src), (implicit EFLAGS)), + (INC64_32r GR32:$src)>, Requires<[In64BitMode]>; +def : Pat<(parallel (store (i32 (X86inc_flag (loadi32 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (INC64_32m addr:$dst)>, Requires<[In64BitMode]>; +def : Pat<(parallel (X86dec_flag GR32:$src), (implicit EFLAGS)), + (DEC64_32r GR32:$src)>, Requires<[In64BitMode]>; +def : Pat<(parallel (store (i32 (X86dec_flag (loadi32 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (DEC64_32m addr:$dst)>, Requires<[In64BitMode]>; + +def : Pat<(parallel (X86inc_flag GR64:$src), (implicit EFLAGS)), + (INC64r GR64:$src)>; +def : Pat<(parallel (store (i64 (X86inc_flag (loadi64 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (INC64m addr:$dst)>; +def : Pat<(parallel (X86dec_flag GR64:$src), (implicit EFLAGS)), + (DEC64r GR64:$src)>; +def : Pat<(parallel (store (i64 (X86dec_flag (loadi64 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (DEC64m addr:$dst)>; + //===----------------------------------------------------------------------===// // X86-64 SSE Instructions //===----------------------------------------------------------------------===// Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp Mon Mar 9 15:52:42 2009 @@ -2404,6 +2404,7 @@ const TargetOperandInfo &TOI = TID.OpInfo[Index]; const TargetRegisterClass *RC = TOI.isLookupPtrRegClass() ? RI.getPointerRegClass() : RI.getRegClass(TOI.RegClass); + unsigned NumDefs = TID.NumDefs; std::vector AddrOps; std::vector BeforeOps; std::vector AfterOps; @@ -2411,11 +2412,11 @@ unsigned NumOps = N->getNumOperands(); for (unsigned i = 0; i != NumOps-1; ++i) { SDValue Op = N->getOperand(i); - if (i >= Index && i < Index+4) + if (i >= Index-NumDefs && i < Index-NumDefs+4) AddrOps.push_back(Op); - else if (i < Index) + else if (i < Index-NumDefs) BeforeOps.push_back(Op); - else if (i > Index) + else if (i > Index-NumDefs) AfterOps.push_back(Op); } SDValue Chain = N->getOperand(NumOps-1); Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td Mon Mar 9 15:52:42 2009 @@ -27,11 +27,13 @@ [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisVT<3, i8>, SDTCisVT<4, i32>]>; -def SDTUnaryArithOvf : SDTypeProfile<1, 1, - [SDTCisInt<0>]>; -def SDTBinaryArithOvf : SDTypeProfile<1, 2, - [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, - SDTCisInt<0>]>; +// Unary and binary operator instructions that set EFLAGS as a side-effect. +def SDTUnaryArithWithFlags : SDTypeProfile<1, 1, + [SDTCisInt<0>]>; +def SDTBinaryArithWithFlags : SDTypeProfile<1, 2, + [SDTCisSameAs<0, 1>, + SDTCisSameAs<0, 2>, + SDTCisInt<0>]>; def SDTX86BrCond : SDTypeProfile<0, 3, [SDTCisVT<0, OtherVT>, @@ -148,10 +150,12 @@ def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET, [SDNPHasChain, SDNPOptInFlag]>; -def X86add_ovf : SDNode<"X86ISD::ADD", SDTBinaryArithOvf>; -def X86sub_ovf : SDNode<"X86ISD::SUB", SDTBinaryArithOvf>; -def X86smul_ovf : SDNode<"X86ISD::SMUL", SDTBinaryArithOvf>; -def X86umul_ovf : SDNode<"X86ISD::UMUL", SDTUnaryArithOvf>; +def X86add_flag : SDNode<"X86ISD::ADD", SDTBinaryArithWithFlags>; +def X86sub_flag : SDNode<"X86ISD::SUB", SDTBinaryArithWithFlags>; +def X86smul_flag : SDNode<"X86ISD::SMUL", SDTBinaryArithWithFlags>; +def X86umul_flag : SDNode<"X86ISD::UMUL", SDTUnaryArithWithFlags>; +def X86inc_flag : SDNode<"X86ISD::INC", SDTUnaryArithWithFlags>; +def X86dec_flag : SDNode<"X86ISD::DEC", SDTUnaryArithWithFlags>; //===----------------------------------------------------------------------===// // X86 Operand Definitions. @@ -1230,19 +1234,24 @@ let CodeSize = 2 in { let Defs = [EFLAGS] in { def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst", - [(set GR8:$dst, (ineg GR8:$src))]>; + [(set GR8:$dst, (ineg GR8:$src)), + (implicit EFLAGS)]>; def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst", - [(set GR16:$dst, (ineg GR16:$src))]>, OpSize; + [(set GR16:$dst, (ineg GR16:$src)), + (implicit EFLAGS)]>, OpSize; def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst", - [(set GR32:$dst, (ineg GR32:$src))]>; + [(set GR32:$dst, (ineg GR32:$src)), + (implicit EFLAGS)]>; let isTwoAddress = 0 in { def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst", - [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>; + [(store (ineg (loadi8 addr:$dst)), addr:$dst), + (implicit EFLAGS)]>; def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst", - [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize; + [(store (ineg (loadi16 addr:$dst)), addr:$dst), + (implicit EFLAGS)]>, OpSize; def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst", - [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>; - + [(store (ineg (loadi32 addr:$dst)), addr:$dst), + (implicit EFLAGS)]>; } } // Defs = [EFLAGS] @@ -1269,44 +1278,56 @@ let Defs = [EFLAGS] in { let CodeSize = 2 in def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst", - [(set GR8:$dst, (add GR8:$src, 1))]>; + [(set GR8:$dst, (add GR8:$src, 1)), + (implicit EFLAGS)]>; let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA. def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst", - [(set GR16:$dst, (add GR16:$src, 1))]>, + [(set GR16:$dst, (add GR16:$src, 1)), + (implicit EFLAGS)]>, OpSize, Requires<[In32BitMode]>; def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst", - [(set GR32:$dst, (add GR32:$src, 1))]>, Requires<[In32BitMode]>; + [(set GR32:$dst, (add GR32:$src, 1)), + (implicit EFLAGS)]>, Requires<[In32BitMode]>; } let isTwoAddress = 0, CodeSize = 2 in { def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst", - [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>; + [(store (add (loadi8 addr:$dst), 1), addr:$dst), + (implicit EFLAGS)]>; def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst", - [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, + [(store (add (loadi16 addr:$dst), 1), addr:$dst), + (implicit EFLAGS)]>, OpSize, Requires<[In32BitMode]>; def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst", - [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>, + [(store (add (loadi32 addr:$dst), 1), addr:$dst), + (implicit EFLAGS)]>, Requires<[In32BitMode]>; } let CodeSize = 2 in def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst", - [(set GR8:$dst, (add GR8:$src, -1))]>; + [(set GR8:$dst, (add GR8:$src, -1)), + (implicit EFLAGS)]>; let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA. def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst", - [(set GR16:$dst, (add GR16:$src, -1))]>, + [(set GR16:$dst, (add GR16:$src, -1)), + (implicit EFLAGS)]>, OpSize, Requires<[In32BitMode]>; def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst", - [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In32BitMode]>; + [(set GR32:$dst, (add GR32:$src, -1)), + (implicit EFLAGS)]>, Requires<[In32BitMode]>; } let isTwoAddress = 0, CodeSize = 2 in { def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst", - [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>; + [(store (add (loadi8 addr:$dst), -1), addr:$dst), + (implicit EFLAGS)]>; def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst", - [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, + [(store (add (loadi16 addr:$dst), -1), addr:$dst), + (implicit EFLAGS)]>, OpSize, Requires<[In32BitMode]>; def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst", - [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>, + [(store (add (loadi32 addr:$dst), -1), addr:$dst), + (implicit EFLAGS)]>, Requires<[In32BitMode]>; } } // Defs = [EFLAGS] @@ -1317,155 +1338,193 @@ def AND8rr : I<0x20, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), "and{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>; + [(set GR8:$dst, (and GR8:$src1, GR8:$src2)), + (implicit EFLAGS)]>; def AND16rr : I<0x21, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), "and{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize; + [(set GR16:$dst, (and GR16:$src1, GR16:$src2)), + (implicit EFLAGS)]>, OpSize; def AND32rr : I<0x21, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), "and{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>; + [(set GR32:$dst, (and GR32:$src1, GR32:$src2)), + (implicit EFLAGS)]>; } def AND8rm : I<0x22, MRMSrcMem, (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2), "and{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>; + [(set GR8:$dst, (and GR8:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def AND16rm : I<0x23, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), "and{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize; + [(set GR16:$dst, (and GR16:$src1, (load addr:$src2))), + (implicit EFLAGS)]>, OpSize; def AND32rm : I<0x23, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), "and{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>; + [(set GR32:$dst, (and GR32:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def AND8ri : Ii8<0x80, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2), "and{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>; + [(set GR8:$dst, (and GR8:$src1, imm:$src2)), + (implicit EFLAGS)]>; def AND16ri : Ii16<0x81, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), "and{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize; + [(set GR16:$dst, (and GR16:$src1, imm:$src2)), + (implicit EFLAGS)]>, OpSize; def AND32ri : Ii32<0x81, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), "and{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>; + [(set GR32:$dst, (and GR32:$src1, imm:$src2)), + (implicit EFLAGS)]>; def AND16ri8 : Ii8<0x83, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), "and{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>, + [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2)), + (implicit EFLAGS)]>, OpSize; def AND32ri8 : Ii8<0x83, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), "and{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>; + [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2)), + (implicit EFLAGS)]>; let isTwoAddress = 0 in { def AND8mr : I<0x20, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src), "and{b}\t{$src, $dst|$dst, $src}", - [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>; + [(store (and (load addr:$dst), GR8:$src), addr:$dst), + (implicit EFLAGS)]>; def AND16mr : I<0x21, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), "and{w}\t{$src, $dst|$dst, $src}", - [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>, + [(store (and (load addr:$dst), GR16:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def AND32mr : I<0x21, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), "and{l}\t{$src, $dst|$dst, $src}", - [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>; + [(store (and (load addr:$dst), GR32:$src), addr:$dst), + (implicit EFLAGS)]>; def AND8mi : Ii8<0x80, MRM4m, (outs), (ins i8mem :$dst, i8imm :$src), "and{b}\t{$src, $dst|$dst, $src}", - [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>; + [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>; def AND16mi : Ii16<0x81, MRM4m, (outs), (ins i16mem:$dst, i16imm:$src), "and{w}\t{$src, $dst|$dst, $src}", - [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>, + [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def AND32mi : Ii32<0x81, MRM4m, (outs), (ins i32mem:$dst, i32imm:$src), "and{l}\t{$src, $dst|$dst, $src}", - [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>; + [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>; def AND16mi8 : Ii8<0x83, MRM4m, (outs), (ins i16mem:$dst, i16i8imm :$src), "and{w}\t{$src, $dst|$dst, $src}", - [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>, + [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def AND32mi8 : Ii8<0x83, MRM4m, (outs), (ins i32mem:$dst, i32i8imm :$src), "and{l}\t{$src, $dst|$dst, $src}", - [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; + [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>; } let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), "or{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>; + [(set GR8:$dst, (or GR8:$src1, GR8:$src2)), + (implicit EFLAGS)]>; def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), "or{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize; + [(set GR16:$dst, (or GR16:$src1, GR16:$src2)), + (implicit EFLAGS)]>, OpSize; def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), "or{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>; + [(set GR32:$dst, (or GR32:$src1, GR32:$src2)), + (implicit EFLAGS)]>; } def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2), "or{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>; + [(set GR8:$dst, (or GR8:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), "or{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize; + [(set GR16:$dst, (or GR16:$src1, (load addr:$src2))), + (implicit EFLAGS)]>, OpSize; def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), "or{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>; + [(set GR32:$dst, (or GR32:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), "or{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>; + [(set GR8:$dst, (or GR8:$src1, imm:$src2)), + (implicit EFLAGS)]>; def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), "or{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize; + [(set GR16:$dst, (or GR16:$src1, imm:$src2)), + (implicit EFLAGS)]>, OpSize; def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), "or{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>; + [(set GR32:$dst, (or GR32:$src1, imm:$src2)), + (implicit EFLAGS)]>; def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), "or{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize; + [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2)), + (implicit EFLAGS)]>, OpSize; def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), "or{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>; + [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2)), + (implicit EFLAGS)]>; let isTwoAddress = 0 in { def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src), "or{b}\t{$src, $dst|$dst, $src}", - [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>; + [(store (or (load addr:$dst), GR8:$src), addr:$dst), + (implicit EFLAGS)]>; def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), "or{w}\t{$src, $dst|$dst, $src}", - [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize; + [(store (or (load addr:$dst), GR16:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), "or{l}\t{$src, $dst|$dst, $src}", - [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>; + [(store (or (load addr:$dst), GR32:$src), addr:$dst), + (implicit EFLAGS)]>; def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src), "or{b}\t{$src, $dst|$dst, $src}", - [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>; + [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>; def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src), "or{w}\t{$src, $dst|$dst, $src}", - [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>, + [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src), "or{l}\t{$src, $dst|$dst, $src}", - [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>; + [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>; def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src), "or{w}\t{$src, $dst|$dst, $src}", - [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>, + [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src), "or{l}\t{$src, $dst|$dst, $src}", - [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; + [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>; } // isTwoAddress = 0 @@ -1473,89 +1532,108 @@ def XOR8rr : I<0x30, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), "xor{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>; + [(set GR8:$dst, (xor GR8:$src1, GR8:$src2)), + (implicit EFLAGS)]>; def XOR16rr : I<0x31, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize; + [(set GR16:$dst, (xor GR16:$src1, GR16:$src2)), + (implicit EFLAGS)]>, OpSize; def XOR32rr : I<0x31, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>; + [(set GR32:$dst, (xor GR32:$src1, GR32:$src2)), + (implicit EFLAGS)]>; } // isCommutable = 1 def XOR8rm : I<0x32, MRMSrcMem , (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2), "xor{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>; + [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def XOR16rm : I<0x33, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, + [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2))), + (implicit EFLAGS)]>, OpSize; def XOR32rm : I<0x33, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>; + [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2))), + (implicit EFLAGS)]>; def XOR8ri : Ii8<0x80, MRM6r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), "xor{b}\t{$src2, $dst|$dst, $src2}", - [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>; + [(set GR8:$dst, (xor GR8:$src1, imm:$src2)), + (implicit EFLAGS)]>; def XOR16ri : Ii16<0x81, MRM6r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize; + [(set GR16:$dst, (xor GR16:$src1, imm:$src2)), + (implicit EFLAGS)]>, OpSize; def XOR32ri : Ii32<0x81, MRM6r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>; + [(set GR32:$dst, (xor GR32:$src1, imm:$src2)), + (implicit EFLAGS)]>; def XOR16ri8 : Ii8<0x83, MRM6r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), "xor{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>, + [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2)), + (implicit EFLAGS)]>, OpSize; def XOR32ri8 : Ii8<0x83, MRM6r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), "xor{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>; + [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2)), + (implicit EFLAGS)]>; let isTwoAddress = 0 in { def XOR8mr : I<0x30, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src), "xor{b}\t{$src, $dst|$dst, $src}", - [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>; + [(store (xor (load addr:$dst), GR8:$src), addr:$dst), + (implicit EFLAGS)]>; def XOR16mr : I<0x31, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), "xor{w}\t{$src, $dst|$dst, $src}", - [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>, + [(store (xor (load addr:$dst), GR16:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def XOR32mr : I<0x31, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), "xor{l}\t{$src, $dst|$dst, $src}", - [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>; + [(store (xor (load addr:$dst), GR32:$src), addr:$dst), + (implicit EFLAGS)]>; def XOR8mi : Ii8<0x80, MRM6m, (outs), (ins i8mem :$dst, i8imm :$src), "xor{b}\t{$src, $dst|$dst, $src}", - [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>; + [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>; def XOR16mi : Ii16<0x81, MRM6m, (outs), (ins i16mem:$dst, i16imm:$src), "xor{w}\t{$src, $dst|$dst, $src}", - [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>, + [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def XOR32mi : Ii32<0x81, MRM6m, (outs), (ins i32mem:$dst, i32imm:$src), "xor{l}\t{$src, $dst|$dst, $src}", - [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>; + [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst), + (implicit EFLAGS)]>; def XOR16mi8 : Ii8<0x83, MRM6m, (outs), (ins i16mem:$dst, i16i8imm :$src), "xor{w}\t{$src, $dst|$dst, $src}", - [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>, + [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>, OpSize; def XOR32mi8 : Ii8<0x83, MRM6m, (outs), (ins i32mem:$dst, i32i8imm :$src), "xor{l}\t{$src, $dst|$dst, $src}", - [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; + [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst), + (implicit EFLAGS)]>; } // isTwoAddress = 0 } // Defs = [EFLAGS] @@ -3413,217 +3491,251 @@ (SHLD16mri8 addr:$dst, GR16:$src2, (i8 imm:$amt1))>; //===----------------------------------------------------------------------===// -// Overflow Patterns +// EFLAGS-defining Patterns //===----------------------------------------------------------------------===// -// Register-Register Addition with Overflow -def : Pat<(parallel (X86add_ovf GR8:$src1, GR8:$src2), +// Register-Register Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR8:$src1, GR8:$src2), (implicit EFLAGS)), (ADD8rr GR8:$src1, GR8:$src2)>; -// Register-Register Addition with Overflow -def : Pat<(parallel (X86add_ovf GR16:$src1, GR16:$src2), +// Register-Register Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR16:$src1, GR16:$src2), (implicit EFLAGS)), (ADD16rr GR16:$src1, GR16:$src2)>; -def : Pat<(parallel (X86add_ovf GR32:$src1, GR32:$src2), +def : Pat<(parallel (X86add_flag GR32:$src1, GR32:$src2), (implicit EFLAGS)), (ADD32rr GR32:$src1, GR32:$src2)>; -// Register-Memory Addition with Overflow -def : Pat<(parallel (X86add_ovf GR8:$src1, (load addr:$src2)), +// Register-Memory Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR8:$src1, (loadi8 addr:$src2)), (implicit EFLAGS)), (ADD8rm GR8:$src1, addr:$src2)>; -def : Pat<(parallel (X86add_ovf GR16:$src1, (load addr:$src2)), +def : Pat<(parallel (X86add_flag GR16:$src1, (loadi16 addr:$src2)), (implicit EFLAGS)), (ADD16rm GR16:$src1, addr:$src2)>; -def : Pat<(parallel (X86add_ovf GR32:$src1, (load addr:$src2)), +def : Pat<(parallel (X86add_flag GR32:$src1, (loadi32 addr:$src2)), (implicit EFLAGS)), (ADD32rm GR32:$src1, addr:$src2)>; -// Register-Integer Addition with Overflow -def : Pat<(parallel (X86add_ovf GR8:$src1, imm:$src2), +// Register-Integer Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR8:$src1, imm:$src2), (implicit EFLAGS)), (ADD8ri GR8:$src1, imm:$src2)>; -// Register-Integer Addition with Overflow -def : Pat<(parallel (X86add_ovf GR16:$src1, imm:$src2), +// Register-Integer Addition with EFLAGS result +def : Pat<(parallel (X86add_flag GR16:$src1, imm:$src2), (implicit EFLAGS)), (ADD16ri GR16:$src1, imm:$src2)>; -def : Pat<(parallel (X86add_ovf GR32:$src1, imm:$src2), +def : Pat<(parallel (X86add_flag GR32:$src1, imm:$src2), (implicit EFLAGS)), (ADD32ri GR32:$src1, imm:$src2)>; -def : Pat<(parallel (X86add_ovf GR16:$src1, i16immSExt8:$src2), +def : Pat<(parallel (X86add_flag GR16:$src1, i16immSExt8:$src2), (implicit EFLAGS)), (ADD16ri8 GR16:$src1, i16immSExt8:$src2)>; -def : Pat<(parallel (X86add_ovf GR32:$src1, i32immSExt8:$src2), +def : Pat<(parallel (X86add_flag GR32:$src1, i32immSExt8:$src2), (implicit EFLAGS)), (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; -// Memory-Register Addition with Overflow -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), GR8:$src2), +// Memory-Register Addition with EFLAGS result +def : Pat<(parallel (store (X86add_flag (loadi8 addr:$dst), GR8:$src2), addr:$dst), (implicit EFLAGS)), (ADD8mr addr:$dst, GR8:$src2)>; -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), GR16:$src2), +def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), GR16:$src2), addr:$dst), (implicit EFLAGS)), (ADD16mr addr:$dst, GR16:$src2)>; -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), GR32:$src2), +def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), GR32:$src2), addr:$dst), (implicit EFLAGS)), (ADD32mr addr:$dst, GR32:$src2)>; -def : Pat<(parallel (store (X86add_ovf (loadi8 addr:$dst), imm:$src2), +def : Pat<(parallel (store (X86add_flag (loadi8 addr:$dst), imm:$src2), addr:$dst), (implicit EFLAGS)), (ADD8mi addr:$dst, imm:$src2)>; -def : Pat<(parallel (store (X86add_ovf (loadi16 addr:$dst), imm:$src2), +def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), imm:$src2), addr:$dst), (implicit EFLAGS)), (ADD16mi addr:$dst, imm:$src2)>; -def : Pat<(parallel (store (X86add_ovf (loadi32 addr:$dst), imm:$src2), +def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), imm:$src2), addr:$dst), (implicit EFLAGS)), (ADD32mi addr:$dst, imm:$src2)>; -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), i16immSExt8:$src2), +def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), i16immSExt8:$src2), addr:$dst), (implicit EFLAGS)), (ADD16mi8 addr:$dst, i16immSExt8:$src2)>; -def : Pat<(parallel (store (X86add_ovf (load addr:$dst), i32immSExt8:$src2), +def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), i32immSExt8:$src2), addr:$dst), (implicit EFLAGS)), (ADD32mi8 addr:$dst, i32immSExt8:$src2)>; -// Register-Register Subtraction with Overflow -def : Pat<(parallel (X86sub_ovf GR8:$src1, GR8:$src2), +// Register-Register Subtraction with EFLAGS result +def : Pat<(parallel (X86sub_flag GR8:$src1, GR8:$src2), (implicit EFLAGS)), (SUB8rr GR8:$src1, GR8:$src2)>; -def : Pat<(parallel (X86sub_ovf GR16:$src1, GR16:$src2), +def : Pat<(parallel (X86sub_flag GR16:$src1, GR16:$src2), (implicit EFLAGS)), (SUB16rr GR16:$src1, GR16:$src2)>; -def : Pat<(parallel (X86sub_ovf GR32:$src1, GR32:$src2), +def : Pat<(parallel (X86sub_flag GR32:$src1, GR32:$src2), (implicit EFLAGS)), (SUB32rr GR32:$src1, GR32:$src2)>; -// Register-Memory Subtraction with Overflow -def : Pat<(parallel (X86sub_ovf GR8:$src1, (load addr:$src2)), +// Register-Memory Subtraction with EFLAGS result +def : Pat<(parallel (X86sub_flag GR8:$src1, (loadi8 addr:$src2)), (implicit EFLAGS)), (SUB8rm GR8:$src1, addr:$src2)>; -def : Pat<(parallel (X86sub_ovf GR16:$src1, (load addr:$src2)), +def : Pat<(parallel (X86sub_flag GR16:$src1, (loadi16 addr:$src2)), (implicit EFLAGS)), (SUB16rm GR16:$src1, addr:$src2)>; -def : Pat<(parallel (X86sub_ovf GR32:$src1, (load addr:$src2)), +def : Pat<(parallel (X86sub_flag GR32:$src1, (loadi32 addr:$src2)), (implicit EFLAGS)), (SUB32rm GR32:$src1, addr:$src2)>; -// Register-Integer Subtraction with Overflow -def : Pat<(parallel (X86sub_ovf GR8:$src1, imm:$src2), +// Register-Integer Subtraction with EFLAGS result +def : Pat<(parallel (X86sub_flag GR8:$src1, imm:$src2), (implicit EFLAGS)), (SUB8ri GR8:$src1, imm:$src2)>; -def : Pat<(parallel (X86sub_ovf GR16:$src1, imm:$src2), +def : Pat<(parallel (X86sub_flag GR16:$src1, imm:$src2), (implicit EFLAGS)), (SUB16ri GR16:$src1, imm:$src2)>; -def : Pat<(parallel (X86sub_ovf GR32:$src1, imm:$src2), +def : Pat<(parallel (X86sub_flag GR32:$src1, imm:$src2), (implicit EFLAGS)), (SUB32ri GR32:$src1, imm:$src2)>; -def : Pat<(parallel (X86sub_ovf GR16:$src1, i16immSExt8:$src2), +def : Pat<(parallel (X86sub_flag GR16:$src1, i16immSExt8:$src2), (implicit EFLAGS)), (SUB16ri8 GR16:$src1, i16immSExt8:$src2)>; -def : Pat<(parallel (X86sub_ovf GR32:$src1, i32immSExt8:$src2), +def : Pat<(parallel (X86sub_flag GR32:$src1, i32immSExt8:$src2), (implicit EFLAGS)), (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>; -// Memory-Register Subtraction with Overflow -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), GR8:$src2), +// Memory-Register Subtraction with EFLAGS result +def : Pat<(parallel (store (X86sub_flag (loadi8 addr:$dst), GR8:$src2), addr:$dst), (implicit EFLAGS)), (SUB8mr addr:$dst, GR8:$src2)>; -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), GR16:$src2), +def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), GR16:$src2), addr:$dst), (implicit EFLAGS)), (SUB16mr addr:$dst, GR16:$src2)>; -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), GR32:$src2), +def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), GR32:$src2), addr:$dst), (implicit EFLAGS)), (SUB32mr addr:$dst, GR32:$src2)>; -// Memory-Integer Subtraction with Overflow -def : Pat<(parallel (store (X86sub_ovf (loadi8 addr:$dst), imm:$src2), +// Memory-Integer Subtraction with EFLAGS result +def : Pat<(parallel (store (X86sub_flag (loadi8 addr:$dst), imm:$src2), addr:$dst), (implicit EFLAGS)), (SUB8mi addr:$dst, imm:$src2)>; -def : Pat<(parallel (store (X86sub_ovf (loadi16 addr:$dst), imm:$src2), +def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), imm:$src2), addr:$dst), (implicit EFLAGS)), (SUB16mi addr:$dst, imm:$src2)>; -def : Pat<(parallel (store (X86sub_ovf (loadi32 addr:$dst), imm:$src2), +def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), imm:$src2), addr:$dst), (implicit EFLAGS)), (SUB32mi addr:$dst, imm:$src2)>; -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), i16immSExt8:$src2), +def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), i16immSExt8:$src2), addr:$dst), (implicit EFLAGS)), (SUB16mi8 addr:$dst, i16immSExt8:$src2)>; -def : Pat<(parallel (store (X86sub_ovf (load addr:$dst), i32immSExt8:$src2), +def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), i32immSExt8:$src2), addr:$dst), (implicit EFLAGS)), (SUB32mi8 addr:$dst, i32immSExt8:$src2)>; -// Register-Register Signed Integer Multiply with Overflow -def : Pat<(parallel (X86smul_ovf GR16:$src1, GR16:$src2), +// Register-Register Signed Integer Multiply with EFLAGS result +def : Pat<(parallel (X86smul_flag GR16:$src1, GR16:$src2), (implicit EFLAGS)), (IMUL16rr GR16:$src1, GR16:$src2)>; -def : Pat<(parallel (X86smul_ovf GR32:$src1, GR32:$src2), +def : Pat<(parallel (X86smul_flag GR32:$src1, GR32:$src2), (implicit EFLAGS)), (IMUL32rr GR32:$src1, GR32:$src2)>; -// Register-Memory Signed Integer Multiply with Overflow -def : Pat<(parallel (X86smul_ovf GR16:$src1, (load addr:$src2)), +// Register-Memory Signed Integer Multiply with EFLAGS result +def : Pat<(parallel (X86smul_flag GR16:$src1, (loadi16 addr:$src2)), (implicit EFLAGS)), (IMUL16rm GR16:$src1, addr:$src2)>; -def : Pat<(parallel (X86smul_ovf GR32:$src1, (load addr:$src2)), +def : Pat<(parallel (X86smul_flag GR32:$src1, (loadi32 addr:$src2)), (implicit EFLAGS)), (IMUL32rm GR32:$src1, addr:$src2)>; -// Register-Integer Signed Integer Multiply with Overflow -def : Pat<(parallel (X86smul_ovf GR16:$src1, imm:$src2), +// Register-Integer Signed Integer Multiply with EFLAGS result +def : Pat<(parallel (X86smul_flag GR16:$src1, imm:$src2), (implicit EFLAGS)), (IMUL16rri GR16:$src1, imm:$src2)>; -def : Pat<(parallel (X86smul_ovf GR32:$src1, imm:$src2), +def : Pat<(parallel (X86smul_flag GR32:$src1, imm:$src2), (implicit EFLAGS)), (IMUL32rri GR32:$src1, imm:$src2)>; -def : Pat<(parallel (X86smul_ovf GR16:$src1, i16immSExt8:$src2), +def : Pat<(parallel (X86smul_flag GR16:$src1, i16immSExt8:$src2), (implicit EFLAGS)), (IMUL16rri8 GR16:$src1, i16immSExt8:$src2)>; -def : Pat<(parallel (X86smul_ovf GR32:$src1, i32immSExt8:$src2), +def : Pat<(parallel (X86smul_flag GR32:$src1, i32immSExt8:$src2), (implicit EFLAGS)), (IMUL32rri8 GR32:$src1, i32immSExt8:$src2)>; -// Memory-Integer Signed Integer Multiply with Overflow -def : Pat<(parallel (X86smul_ovf (load addr:$src1), imm:$src2), +// Memory-Integer Signed Integer Multiply with EFLAGS result +def : Pat<(parallel (X86smul_flag (loadi16 addr:$src1), imm:$src2), (implicit EFLAGS)), (IMUL16rmi addr:$src1, imm:$src2)>; -def : Pat<(parallel (X86smul_ovf (load addr:$src1), imm:$src2), +def : Pat<(parallel (X86smul_flag (loadi32 addr:$src1), imm:$src2), (implicit EFLAGS)), (IMUL32rmi addr:$src1, imm:$src2)>; -def : Pat<(parallel (X86smul_ovf (load addr:$src1), i16immSExt8:$src2), +def : Pat<(parallel (X86smul_flag (loadi16 addr:$src1), i16immSExt8:$src2), (implicit EFLAGS)), (IMUL16rmi8 addr:$src1, i16immSExt8:$src2)>; -def : Pat<(parallel (X86smul_ovf (load addr:$src1), i32immSExt8:$src2), +def : Pat<(parallel (X86smul_flag (loadi32 addr:$src1), i32immSExt8:$src2), (implicit EFLAGS)), (IMUL32rmi8 addr:$src1, i32immSExt8:$src2)>; -// Optimize multiple with overflow by 2. +// Optimize multiply by 2 with EFLAGS result. let AddedComplexity = 2 in { -def : Pat<(parallel (X86smul_ovf GR16:$src1, 2), +def : Pat<(parallel (X86smul_flag GR16:$src1, 2), (implicit EFLAGS)), (ADD16rr GR16:$src1, GR16:$src1)>; -def : Pat<(parallel (X86smul_ovf GR32:$src1, 2), +def : Pat<(parallel (X86smul_flag GR32:$src1, 2), (implicit EFLAGS)), (ADD32rr GR32:$src1, GR32:$src1)>; } +// INC and DEC with EFLAGS result. Note that these do not set CF. +def : Pat<(parallel (X86inc_flag GR8:$src), (implicit EFLAGS)), + (INC8r GR8:$src)>; +def : Pat<(parallel (store (i8 (X86inc_flag (loadi8 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (INC8m addr:$dst)>; +def : Pat<(parallel (X86dec_flag GR8:$src), (implicit EFLAGS)), + (DEC8r GR8:$src)>; +def : Pat<(parallel (store (i8 (X86dec_flag (loadi8 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (DEC8m addr:$dst)>; + +def : Pat<(parallel (X86inc_flag GR16:$src), (implicit EFLAGS)), + (INC16r GR16:$src)>, Requires<[In32BitMode]>; +def : Pat<(parallel (store (i16 (X86inc_flag (loadi16 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (INC16m addr:$dst)>, Requires<[In32BitMode]>; +def : Pat<(parallel (X86dec_flag GR16:$src), (implicit EFLAGS)), + (DEC16r GR16:$src)>, Requires<[In32BitMode]>; +def : Pat<(parallel (store (i16 (X86dec_flag (loadi16 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (DEC16m addr:$dst)>, Requires<[In32BitMode]>; + +def : Pat<(parallel (X86inc_flag GR32:$src), (implicit EFLAGS)), + (INC32r GR32:$src)>, Requires<[In32BitMode]>; +def : Pat<(parallel (store (i32 (X86inc_flag (loadi32 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (INC32m addr:$dst)>, Requires<[In32BitMode]>; +def : Pat<(parallel (X86dec_flag GR32:$src), (implicit EFLAGS)), + (DEC32r GR32:$src)>, Requires<[In32BitMode]>; +def : Pat<(parallel (store (i32 (X86dec_flag (loadi32 addr:$dst))), addr:$dst), + (implicit EFLAGS)), + (DEC32m addr:$dst)>, Requires<[In32BitMode]>; + //===----------------------------------------------------------------------===// // Floating Point Stack Support //===----------------------------------------------------------------------===// Modified: llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll?rev=66456&r1=66455&r2=66456&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll Mon Mar 9 15:52:42 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | \ +; RUN: llvm-as < %s | llc -mtriple=armv6-apple-darwin | \ ; RUN: grep uxt | count 10 define i32 @test1(i32 %x) { Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll?rev=66456&view=auto ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll (added) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-05-burr-list-crash.ll Mon Mar 9 15:52:42 2009 @@ -0,0 +1,35 @@ +; RUN: llvm-as < %s | llc + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-unknown-linux-gnu" +external global i32 ; :0 [#uses=1] + +declare i64 @strlen(i8* nocapture) nounwind readonly + +define fastcc i8* @1(i8*) nounwind { + br i1 false, label %3, label %2 + +;