From jay.foad at gmail.com Mon Aug 1 04:18:30 2011 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 1 Aug 2011 10:18:30 +0100 Subject: [llvm-commits] [cfe-commits] [PATCH][RFC] PR10367: don't allow GlobalAlias's aliasee to be an arbitrary Constant In-Reply-To: <4E350B29.3030305@free.fr> References: <4E33FDD8.1030208@free.fr> <4E350B29.3030305@free.fr> Message-ID: >>> Since we have to accept bitcasts and geps of globals as alias operands, >>> is there any point in allowing the result type to be different to the >>> operand type? >> >> It saves creating a bitcast ConstantExpr where none is needed. > > LLVM has a very regular type system. ?By introducing alias as a special > exception where types don't have to match you make LLVM IR less regular > which is bad. It sounds like you are arguing against PR10367: "Instead, the initializer of a GlobalAlias should be required to be a GlobalValue, but the type of the source and dest of the alias should not be required to be the same, they should just be completely decoupled." ... not against my implementation of it. >?For the sake of saving a few bitcasts you are increasing > the number of concepts: ?"entities must not be multiplied beyond necessity". My patch removes code from the verifier. I think this is evidence that it doesn't complicate the rules for LLVM IR, it simplifies them. Jay. From baldrick at free.fr Mon Aug 1 04:34:20 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 01 Aug 2011 11:34:20 +0200 Subject: [llvm-commits] [cfe-commits] [PATCH][RFC] PR10367: don't allow GlobalAlias's aliasee to be an arbitrary Constant In-Reply-To: References: <4E33FDD8.1030208@free.fr> <4E350B29.3030305@free.fr> Message-ID: <4E36731C.8090706@free.fr> Hi Jay, >>>> Since we have to accept bitcasts and geps of globals as alias operands, >>>> is there any point in allowing the result type to be different to the >>>> operand type? >>> >>> It saves creating a bitcast ConstantExpr where none is needed. >> >> LLVM has a very regular type system. By introducing alias as a special >> exception where types don't have to match you make LLVM IR less regular >> which is bad. > > It sounds like you are arguing against PR10367: > > "Instead, the initializer of a > GlobalAlias should be required to be a GlobalValue, but the type of the source > and dest of the alias should not be required to be the same, they should just > be completely decoupled." > > ... not against my implementation of it. that's correct. It seemed like a good idea at first, but once you see that RAUW means you need to retain bitcasts and GEPs as alias operands, 99% of the interest of the idea goes away in my opinion. That said, your patch simplifies the way global aliases are manipulated by users, right? Do you think you can keep the ease-of-use improvements while discarding the IR modification parts? >> For the sake of saving a few bitcasts you are increasing >> the number of concepts: "entities must not be multiplied beyond necessity". > > My patch removes code from the verifier. I think this is evidence that > it doesn't complicate the rules for LLVM IR, it simplifies them. It creates an exception to a general IR rule for no real gain, and that is bad. Getting rid of code in the verifier is nice but not enough to justify changing the IR in my opinion. Ciao, Duncan. From renato.golin at arm.com Mon Aug 1 07:20:57 2011 From: renato.golin at arm.com (Renato Golin) Date: Mon, 1 Aug 2011 13:20:57 +0100 Subject: [llvm-commits] [PATCH] ULEB FIXME in ARM back-end Message-ID: Hi all, I've been playing with a FIXME in the ARM back-end (to get more acquainted) and one simple FIXME was an ULEB printing in the AsmPrinter. According to the ARM EABI, both build attribute tag and value are ULEBs and not chars as they were being emitted. Today, I don't know of any attribute that would emit tags or values bigger than 127 but this seamed like an easy start. The patch changes the emission of values to ULEB by storing all tags and values in a typed list and emit later the right value, computing the size as it goes. I've run all tests (including the build attributes ones in ARM be) and it passes everything. There are three problems I see with this patch, but would like to know from you what's the best way to solve them: 1. It uses a local structure to hold both ULEB and String values in order, but other MC structures will also emit ULEB in the near future (we should make sure it does, at least), so this structure could become a proper small class on a more visible place. 2. It wastes memory since both number and string values are on every item, but it's not possible to put StringRef in an union since Stringref has non-trivial constructors. A solution is to use polymorphism but that's too big for this tiny case. If we decide to expose the class higher up, then it makes sense to do so. 3. It's calculating the ULEB size in place, where other routines in LLVM can do that (but are not accessible from this class). A refactoring is in need to expose that routine to the intended audience. If neither of those problems are relevant, or if they're just minor, we can put other FIXMEs around. Otherwise, I'm open to suggestions. best, --renato -------------- next part -------------- A non-text attachment was scrubbed... Name: uleb.patch Type: text/x-patch Size: 3595 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/09578498/attachment.bin From jay.foad at gmail.com Mon Aug 1 07:20:36 2011 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 01 Aug 2011 12:20:36 -0000 Subject: [llvm-commits] [llvm] r136608 - /llvm/trunk/include/llvm/GlobalAlias.h Message-ID: <20110801122036.E6F542A6C12C@llvm.org> Author: foad Date: Mon Aug 1 07:20:36 2011 New Revision: 136608 URL: http://llvm.org/viewvc/llvm-project?rev=136608&view=rev Log: The operands of a GlobalAlias are always Constants. Simplify things accordingly. Modified: llvm/trunk/include/llvm/GlobalAlias.h Modified: llvm/trunk/include/llvm/GlobalAlias.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalAlias.h?rev=136608&r1=136607&r2=136608&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalAlias.h (original) +++ llvm/trunk/include/llvm/GlobalAlias.h Mon Aug 1 07:20:36 2011 @@ -23,7 +23,6 @@ namespace llvm { class Module; -class Constant; template class SymbolTableListTraits; @@ -45,7 +44,7 @@ Constant* Aliasee = 0, Module *Parent = 0); /// Provide fast operand accessors - DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); + DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); /// removeFromParent - This method unlinks 'this' from the containing module, /// but does not delete it. @@ -60,10 +59,10 @@ /// set/getAliasee - These methods retrive and set alias target. void setAliasee(Constant *GV); const Constant *getAliasee() const { - return cast_or_null(getOperand(0)); + return getOperand(0); } Constant *getAliasee() { - return cast_or_null(getOperand(0)); + return getOperand(0); } /// getAliasedGlobal() - Aliasee can be either global or bitcast of /// global. This method retrives the global for both aliasee flavours. @@ -88,7 +87,7 @@ public FixedNumOperandTraits { }; -DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GlobalAlias, Value) +DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(GlobalAlias, Constant) } // End llvm namespace From jay.foad at gmail.com Mon Aug 1 07:27:16 2011 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 01 Aug 2011 12:27:16 -0000 Subject: [llvm-commits] [llvm] r136609 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <20110801122716.1AC1B2A6C12C@llvm.org> Author: foad Date: Mon Aug 1 07:27:15 2011 New Revision: 136609 URL: http://llvm.org/viewvc/llvm-project?rev=136609&view=rev Log: Remove an unnecessary cast. 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=136609&r1=136608&r2=136609&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Aug 1 07:27:15 2011 @@ -880,7 +880,7 @@ I != E; ++I) { MCSymbol *Name = Mang->getSymbol(I); - const GlobalValue *GV = cast(I->getAliasedGlobal()); + const GlobalValue *GV = I->getAliasedGlobal(); MCSymbol *Target = Mang->getSymbol(GV); if (I->hasExternalLinkage() || !MAI->getWeakRefDirective()) From jay.foad at gmail.com Mon Aug 1 07:28:01 2011 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 01 Aug 2011 12:28:01 -0000 Subject: [llvm-commits] [llvm] r136610 - /llvm/trunk/lib/VMCore/Globals.cpp Message-ID: <20110801122801.D062D2A6C12C@llvm.org> Author: foad Date: Mon Aug 1 07:28:01 2011 New Revision: 136610 URL: http://llvm.org/viewvc/llvm-project?rev=136610&view=rev Log: Micro-optimisation in getAliasedGlobal. Modified: llvm/trunk/lib/VMCore/Globals.cpp Modified: llvm/trunk/lib/VMCore/Globals.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=136610&r1=136609&r2=136610&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Globals.cpp (original) +++ llvm/trunk/lib/VMCore/Globals.cpp Mon Aug 1 07:28:01 2011 @@ -235,7 +235,7 @@ CE->getOpcode() == Instruction::GetElementPtr) && "Unsupported aliasee"); - return dyn_cast(CE->getOperand(0)); + return cast(CE->getOperand(0)); } const GlobalValue *GlobalAlias::resolveAliasedGlobal(bool stopOnWeak) const { From jay.foad at gmail.com Mon Aug 1 07:29:14 2011 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 01 Aug 2011 12:29:14 -0000 Subject: [llvm-commits] [llvm] r136611 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <20110801122914.6283A2A6C12C@llvm.org> Author: foad Date: Mon Aug 1 07:29:14 2011 New Revision: 136611 URL: http://llvm.org/viewvc/llvm-project?rev=136611&view=rev Log: Simplify printAlias. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=136611&r1=136610&r2=136611&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Aug 1 07:29:14 2011 @@ -1397,27 +1397,8 @@ if (Aliasee == 0) { TypePrinter.print(GA->getType(), Out); Out << " <>"; - } else if (const GlobalVariable *GV = dyn_cast(Aliasee)) { - TypePrinter.print(GV->getType(), Out); - Out << ' '; - PrintLLVMName(Out, GV); - } else if (const Function *F = dyn_cast(Aliasee)) { - TypePrinter.print(F->getFunctionType(), Out); - Out << "* "; - - WriteAsOperandInternal(Out, F, &TypePrinter, &Machine, F->getParent()); - } else if (const GlobalAlias *GA = dyn_cast(Aliasee)) { - TypePrinter.print(GA->getType(), Out); - Out << ' '; - PrintLLVMName(Out, GA); - } else { - const ConstantExpr *CE = cast(Aliasee); - // The only valid GEP is an all zero GEP. - assert((CE->getOpcode() == Instruction::BitCast || - CE->getOpcode() == Instruction::GetElementPtr) && - "Unsupported aliasee"); - writeOperand(CE, false); - } + } else + writeOperand(Aliasee, !isa(Aliasee)); printInfoComment(*GA); Out << '\n'; From baldrick at free.fr Mon Aug 1 07:40:05 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 01 Aug 2011 14:40:05 +0200 Subject: [llvm-commits] [llvm] r136611 - /llvm/trunk/lib/VMCore/AsmWriter.cpp In-Reply-To: <20110801122914.6283A2A6C12C@llvm.org> References: <20110801122914.6283A2A6C12C@llvm.org> Message-ID: <4E369EA5.5080300@free.fr> Hi Jay, > --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) > +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Aug 1 07:29:14 2011 > @@ -1397,27 +1397,8 @@ > if (Aliasee == 0) { > TypePrinter.print(GA->getType(), Out); > Out<< "<>"; > - } else if (const GlobalVariable *GV = dyn_cast(Aliasee)) { > - TypePrinter.print(GV->getType(), Out); > - Out<< ' '; > - PrintLLVMName(Out, GV); > - } else if (const Function *F = dyn_cast(Aliasee)) { > - TypePrinter.print(F->getFunctionType(), Out); > - Out<< "* "; > - > - WriteAsOperandInternal(Out, F,&TypePrinter,&Machine, F->getParent()); > - } else if (const GlobalAlias *GA = dyn_cast(Aliasee)) { > - TypePrinter.print(GA->getType(), Out); > - Out<< ' '; > - PrintLLVMName(Out, GA); > - } else { > - const ConstantExpr *CE = cast(Aliasee); > - // The only valid GEP is an all zero GEP. > - assert((CE->getOpcode() == Instruction::BitCast || > - CE->getOpcode() == Instruction::GetElementPtr)&& > - "Unsupported aliasee"); > - writeOperand(CE, false); > - } > + } else > + writeOperand(Aliasee, !isa(Aliasee)); usual style is: if some branch of an if is wrapped in {} then all branches should be. So here this would be: > + } else { > + writeOperand(Aliasee, !isa(Aliasee)); > + } Ciao, Duncan. From jay.foad at gmail.com Mon Aug 1 07:48:54 2011 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 01 Aug 2011 12:48:54 -0000 Subject: [llvm-commits] [llvm] r136612 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <20110801124854.3262B2A6C12C@llvm.org> Author: foad Date: Mon Aug 1 07:48:54 2011 New Revision: 136612 URL: http://llvm.org/viewvc/llvm-project?rev=136612&view=rev Log: Add braces. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=136612&r1=136611&r2=136612&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Aug 1 07:48:54 2011 @@ -1397,8 +1397,9 @@ if (Aliasee == 0) { TypePrinter.print(GA->getType(), Out); Out << " <>"; - } else + } else { writeOperand(Aliasee, !isa(Aliasee)); + } printInfoComment(*GA); Out << '\n'; From jstaszak at apple.com Mon Aug 1 10:22:10 2011 From: jstaszak at apple.com (Jakub Staszak) Date: Mon, 01 Aug 2011 15:22:10 -0000 Subject: [llvm-commits] [llvm] r136618 - in /llvm/trunk/include/llvm: Analysis/BlockFrequencyImpl.h Support/BlockFrequency.h Message-ID: <20110801152211.096D72A6C12C@llvm.org> Author: kuba Date: Mon Aug 1 10:22:10 2011 New Revision: 136618 URL: http://llvm.org/viewvc/llvm-project?rev=136618&view=rev Log: Add BlockFrequency::getEntryFrequency() Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h llvm/trunk/include/llvm/Support/BlockFrequency.h Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h?rev=136618&r1=136617&r2=136618&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h (original) +++ llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h Mon Aug 1 10:22:10 2011 @@ -49,7 +49,7 @@ typedef GraphTraits< Inverse > GT; - static const uint32_t START_FREQ = 1024; + const uint32_t EntryFreq; std::string getBlockName(BasicBlock *BB) const { return BB->getNameStr(); @@ -176,7 +176,7 @@ setBlockFreq(BB, 0); if (BB == LoopHead) { - setBlockFreq(BB, START_FREQ); + setBlockFreq(BB, EntryFreq); return; } @@ -211,10 +211,10 @@ if (!isLoopHead) return; - assert(START_FREQ >= CycleProb[BB]); + assert(EntryFreq >= CycleProb[BB]); uint32_t CProb = CycleProb[BB]; - uint32_t Numerator = START_FREQ - CProb ? START_FREQ - CProb : 1; - divBlockFreq(BB, BranchProbability(Numerator, START_FREQ)); + uint32_t Numerator = EntryFreq - CProb ? EntryFreq - CProb : 1; + divBlockFreq(BB, BranchProbability(Numerator, EntryFreq)); } /// doLoop - Propagate block frequency down throught the loop. @@ -243,8 +243,8 @@ if (isReachable(Pred) && isBackedge(Pred, Head)) { uint64_t N = getEdgeFreq(Pred, Head).getFrequency(); uint64_t D = getBlockFreq(Head).getFrequency(); - assert(N <= 1024 && "Backedge frequency must be <= 1024!"); - uint64_t Res = (N * START_FREQ) / D; + assert(N <= EntryFreq && "Backedge frequency must be <= EntryFreq!"); + uint64_t Res = (N * EntryFreq) / D; assert(Res <= UINT32_MAX); CycleProb[Head] += (uint32_t) Res; @@ -257,6 +257,8 @@ friend class BlockFrequencyInfo; friend class MachineBlockFrequencyInfo; + BlockFrequencyImpl() : EntryFreq(BlockFrequency::getEntryFrequency()) { } + void doFunction(FunctionT *fn, BlockProbInfoT *bpi) { Fn = fn; BPI = bpi; Modified: llvm/trunk/include/llvm/Support/BlockFrequency.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BlockFrequency.h?rev=136618&r1=136617&r2=136618&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/BlockFrequency.h (original) +++ llvm/trunk/include/llvm/Support/BlockFrequency.h Mon Aug 1 10:22:10 2011 @@ -23,10 +23,12 @@ class BlockFrequency { uint64_t Frequency; + static const int64_t ENTRY_FREQ = 1024; public: BlockFrequency(uint64_t Freq = 0) : Frequency(Freq) { } + static uint64_t getEntryFrequency() { return ENTRY_FREQ; } uint64_t getFrequency() const { return Frequency; } BlockFrequency &operator*=(const BranchProbability &Prob); From bob.wilson at apple.com Mon Aug 1 11:12:13 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 01 Aug 2011 09:12:13 -0700 Subject: [llvm-commits] [patch] Add a pass for duplicating indirectbr at the IL level In-Reply-To: <4E34BD81.4020709@gmail.com> References: <4E265206.6040205@gmail.com> <4E299658.2070601@gmail.com> <932609FD-47A9-48FE-BE29-CA9378742C5E@apple.com> <4E34BD81.4020709@gmail.com> Message-ID: <947B1D6E-CD1D-4A68-8210-9969E952EFA0@apple.com> On Jul 30, 2011, at 7:27 PM, Rafael ?vila de Esp?ndola wrote: >> Your patch is for an "indirect branch duplication" pass, but your >> comments above suggest that you're planning to expand it to do much >> more general IL-level tail duplication. Which is it? And why? I >> don't think it makes sense to have 3 separate taildup passes that are >> all doing essentially the same thing at different points in the >> compilation process. > > I agree that we should not have all of them. I do intend to remove the > MI one if this one works. How do you define "works"? You haven't provided a good explanation for why the LLVM IR level is a better place for tail duplication than the MI level. Have you come up with a solution for the problem that you can't judge the code size of IR instructions? I'd like to see a more detailed design proposal. I realize, of course, that I haven't yet provided any details of my work, either. I've got a bunch more pressing things to do this week, but I'll try to make progress soon. >>> >>> BTW, what is your plan for duplicating into a conditional branch? >>> I would be interested in implementing that too? >> >> The problem I'm working on is specifically for indirect branches. We >> need to essentially undo the front-end's transformation to use a >> single indirect branch per function. (I'm actually including >> branches through jump tables here. Those don't get the same >> treatment by the front-end, but the same motivation applies for >> duplicating them in some cases.) The current taildup approach is >> very naive. It cannot handle important cases like duplicating past >> conditional branches, and in other cases, it duplicates far more than >> necessary, which bloats code size and can hurt i-cache locality, etc. >> The approach I'm taking it is to use dominance information to analyze >> the CFG and find regions of code to duplicate in selected locations. >> You would not want to do this for anything except indirect branches. > > Sorry, the question was more on the "how to duplicate", not "where to > duplicate". If previous optimizations gives us > > zed: > ... > br i1 %foo, %indirectgoto, %bar > > and you decide that the indirect goto should be duplicated to zed, how > do you do it? If you want to duplicate back "zed", you need to duplicate all the code between that point and the indirect branch. >> I agree that a target-specific peephole is not the most elegant >> solution, and I'm sure your new pass nicely solves the specific >> problem you're looking at. I just don't think we want to have 4 >> separate taildup/indirect-branch-dup passes (the 2 existing taildup >> passes, plus yours, plus mine). > > As I mentioned, my intention is to replace the existing early MI level one. > > Cheers, > Rafael From dgregor at apple.com Mon Aug 1 11:29:27 2011 From: dgregor at apple.com (Douglas Gregor) Date: Mon, 01 Aug 2011 16:29:27 -0000 Subject: [llvm-commits] [llvm] r136621 - in /llvm/trunk/lib/Target: ARM/TargetInfo/CMakeLists.txt X86/TargetInfo/CMakeLists.txt X86/Utils/CMakeLists.txt Message-ID: <20110801162927.413F22A6C12C@llvm.org> Author: dgregor Date: Mon Aug 1 11:29:27 2011 New Revision: 136621 URL: http://llvm.org/viewvc/llvm-project?rev=136621&view=rev Log: Update CMake target names for tablegen-generated data in the X86 and ARM targets. This should fix the CMake build with MSVC. Modified: llvm/trunk/lib/Target/ARM/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/X86/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt Modified: llvm/trunk/lib/Target/ARM/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/TargetInfo/CMakeLists.txt?rev=136621&r1=136620&r2=136621&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/ARM/TargetInfo/CMakeLists.txt Mon Aug 1 11:29:27 2011 @@ -4,7 +4,7 @@ ARMTargetInfo.cpp ) -add_dependencies(LLVMARMInfo ARMCodeGenTable_gen) +add_dependencies(LLVMARMInfo ARMCommonTableGen) add_llvm_library_dependencies(LLVMARMInfo LLVMMC Modified: llvm/trunk/lib/Target/X86/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/TargetInfo/CMakeLists.txt?rev=136621&r1=136620&r2=136621&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/X86/TargetInfo/CMakeLists.txt Mon Aug 1 11:29:27 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMX86Info X86CodeGenTable_gen) +add_dependencies(LLVMX86Info X86CommonTableGen) Modified: llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt?rev=136621&r1=136620&r2=136621&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt Mon Aug 1 11:29:27 2011 @@ -9,4 +9,4 @@ LLVMSupport ) -add_dependencies(LLVMX86Utils X86CodeGenTable_gen) +add_dependencies(LLVMX86Utils X86CommonTableGen) From richard at xmos.com Mon Aug 1 11:45:59 2011 From: richard at xmos.com (Richard Osborne) Date: Mon, 01 Aug 2011 16:45:59 -0000 Subject: [llvm-commits] [llvm] r136623 - in /llvm/trunk: lib/Target/XCore/XCoreISelLowering.cpp test/CodeGen/XCore/2011-08-01-VarargsBug.ll Message-ID: <20110801164600.036922A6C12C@llvm.org> Author: friedgold Date: Mon Aug 1 11:45:59 2011 New Revision: 136623 URL: http://llvm.org/viewvc/llvm-project?rev=136623&view=rev Log: Fix crash with varargs function with no named parameters. Added: llvm/trunk/test/CodeGen/XCore/2011-08-01-VarargsBug.ll Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=136623&r1=136622&r2=136623&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Mon Aug 1 11:45:59 2011 @@ -1148,10 +1148,10 @@ int offset = 0; // Save remaining registers, storing higher register numbers at a higher // address - for (unsigned i = array_lengthof(ArgRegs) - 1; i >= FirstVAReg; --i) { + for (int i = array_lengthof(ArgRegs) - 1; i >= (int)FirstVAReg; --i) { // Create a stack slot int FI = MFI->CreateFixedObject(4, offset, true); - if (i == FirstVAReg) { + if (i == (int)FirstVAReg) { XFI->setVarArgsFrameIndex(FI); } offset -= StackSlotSize; Added: llvm/trunk/test/CodeGen/XCore/2011-08-01-VarargsBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/2011-08-01-VarargsBug.ll?rev=136623&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/XCore/2011-08-01-VarargsBug.ll (added) +++ llvm/trunk/test/CodeGen/XCore/2011-08-01-VarargsBug.ll Mon Aug 1 11:45:59 2011 @@ -0,0 +1,17 @@ +; RUN: llc < %s -march=xcore | FileCheck %s +define void @_Z1fz(...) { +entry: +; CHECK: _Z1fz: +; CHECK: extsp 3 +; CHECK: stw r[[REG:[0-3]{1,1}]] +; CHECK: , sp{{\[}}[[REG]]{{\]}} +; CHECK: stw r[[REG:[0-3]{1,1}]] +; CHECK: , sp{{\[}}[[REG]]{{\]}} +; CHECK: stw r[[REG:[0-3]{1,1}]] +; CHECK: , sp{{\[}}[[REG]]{{\]}} +; CHECK: stw r[[REG:[0-3]{1,1}]] +; CHECK: , sp{{\[}}[[REG]]{{\]}} +; CHECK: ldaw sp, sp[3] +; CHECK: retsp 0 + ret void +} From bob.wilson at apple.com Mon Aug 1 12:10:34 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 01 Aug 2011 10:10:34 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r136345 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <4E35A51A.6050009@free.fr> References: <20110728091343.E09F02A6C12C@llvm.org> <515E325F-1081-4CB8-8296-C8D1F5F06E8C@apple.com> <4E35A51A.6050009@free.fr> Message-ID: On Jul 31, 2011, at 11:55 AM, Duncan Sands wrote: > Hi Bob, > >> I'm seeing regressions at -O0 for ARM on the following tests: >> >> SingleSource/UnitTests/ObjC/instance-method-metadata.compile >> SingleSource/UnitTests/ObjC/property.compile >> SingleSource/UnitTests/ObjC/protocols.compile >> SingleSource/UnitTests/ObjC/trivial-interface.compile >> >> They're hitting an assertion: >> >> Assertion failed: (InitVal->getType() == getType()->getElementType()&& "Initializer type must match GlobalVariable type"), function setInitializer, file /Volumes/LocalHD/bwilson/nightly/src/llvm/lib/VMCore/Globals.cpp, line 168. > > commit 136600 hopefully fixed these failures. I haven't confirmed yet whether it fixed the ARM problems (due to other issues), but it seems to be causing massive failures on i386: http://llvm.org/perf/db_default/simple/nts/263/ I can reproduce some of those failures with -O0 and we're not seeing any issues with clang, so I think it's due to your change. I'm going to revert it for now and re-run the tests to confirm that. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/688c1ba2/attachment.html From bob.wilson at apple.com Mon Aug 1 12:13:20 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 01 Aug 2011 17:13:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r136627 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <20110801171320.8CDF52A6C12C@llvm.org> Author: bwilson Date: Mon Aug 1 12:13:20 2011 New Revision: 136627 URL: http://llvm.org/viewvc/llvm-project?rev=136627&view=rev Log: Revert Duncan's r136600 since it seems to be causing lots of test failures. --- Reverse-merging r136600 into '.': U gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=136627&r1=136626&r2=136627&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Aug 1 12:13:20 2011 @@ -571,7 +571,6 @@ case POINTER_TYPE: case REFERENCE_TYPE: case BLOCK_POINTER_TYPE: { - if (Type *Ty = GET_TYPE_LLVM(type)) return Ty; // Disable recursive struct conversion. ConversionStatus SavedCS = RecursionStatus; if (RecursionStatus == CS_Struct) From baldrick at free.fr Mon Aug 1 12:27:54 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 01 Aug 2011 19:27:54 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r136345 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <20110728091343.E09F02A6C12C@llvm.org> <515E325F-1081-4CB8-8296-C8D1F5F06E8C@apple.com> <4E35A51A.6050009@free.fr> Message-ID: <4E36E21A.2050103@free.fr> Hi Bob, >> commit 136600 hopefully fixed these failures. > > I haven't confirmed yet whether it fixed the ARM problems (due to other issues), > but it seems to be causing massive failures on i386: > > http://llvm.org/perf/db_default/simple/nts/263/ > > I can reproduce some of those failures with -O0 and we're not seeing any issues > with clang, so I think it's due to your change. I'm going to revert it for now > and re-run the tests to confirm that. OK, sorry for the breakage. I only tested on x86-64, I will take a look at i386. Ciao, Duncan. From rdivacky at freebsd.org Mon Aug 1 13:19:41 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Mon, 1 Aug 2011 20:19:41 +0200 Subject: [llvm-commits] [PATCH]: sketch of PPC32 ELF writer Message-ID: <20110801181941.GA26227@freebsd.org> Hi, the attached two patches sketch out PPC32 ELF writer. 1) powerpc-mc-md.patch This defines some PPC relocation types and introduces PPCELFObjectWriter and ELFPPCAsmBackend. Including ApplyFixup() implementation. I think this patch is basically committable. 2) powerpc-mc.patch This implements PPCELFObjectWriter class including quite wrong GetRelocType(). There's a hack in RecordRelocation where fixup_ppc_ha16/fixup_ppc_lo16 offset needs to be adjusted by two. I don't know how to do this properly. I think this needs more work on the GetRelocType() and the fixup hack. With these two patches applied I am able to compile a running hello world on FreeBSD using clang -integrated-as. It can compile non-running vim. I used to be able to compile -g version of vim and it went quite far before it crashed. Debug compilation is not possibly anymore, I suspect some endian issue (gdb says: Dwarf Error: wrong version in compilation unit header (is 512, should be 2)) What should I do with these patches? The first one seems committable (and touches only PowerPC code), the second should be ok to commit without the +2 hack and with the GetRelocType() just asserting. I don't have any tests for this nor I think I'll do any more significant work. Comments? roman -------------- next part -------------- A non-text attachment was scrubbed... Name: powerpc-mc-md.patch Type: text/x-diff Size: 5099 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/a92ef5db/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: powerpc-mc.patch Type: text/x-diff Size: 4032 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/a92ef5db/attachment-0001.bin From evan.cheng at apple.com Mon Aug 1 13:22:26 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 01 Aug 2011 11:22:26 -0700 Subject: [llvm-commits] [PATCH]: sketch of PPC32 ELF writer In-Reply-To: <20110801181941.GA26227@freebsd.org> References: <20110801181941.GA26227@freebsd.org> Message-ID: <925BF91C-E5BC-4ABE-9228-00C79583DFBB@apple.com> Looks fine to me. Thanks. Evan On Aug 1, 2011, at 11:19 AM, Roman Divacky wrote: > Hi, > > the attached two patches sketch out PPC32 ELF writer. > > 1) powerpc-mc-md.patch > > This defines some PPC relocation types and introduces > PPCELFObjectWriter and ELFPPCAsmBackend. Including ApplyFixup() > implementation. > > I think this patch is basically committable. > > 2) powerpc-mc.patch > > This implements PPCELFObjectWriter class including quite wrong > GetRelocType(). There's a hack in RecordRelocation where > fixup_ppc_ha16/fixup_ppc_lo16 offset needs to be adjusted by two. > I don't know how to do this properly. > > I think this needs more work on the GetRelocType() and the fixup > hack. > > With these two patches applied I am able to compile a running hello world on > FreeBSD using clang -integrated-as. It can compile non-running vim. I used > to be able to compile -g version of vim and it went quite far before it > crashed. Debug compilation is not possibly anymore, I suspect some endian > issue (gdb says: Dwarf Error: wrong version in compilation unit header (is > 512, should be 2)) > > What should I do with these patches? The first one seems committable (and > touches only PowerPC code), the second should be ok to commit without the +2 > hack and with the GetRelocType() just asserting. > > I don't have any tests for this nor I think I'll do any more significant work. > > Comments? > > roman > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Mon Aug 1 13:43:19 2011 From: resistor at mac.com (Owen Anderson) Date: Mon, 01 Aug 2011 18:43:19 -0000 Subject: [llvm-commits] [llvm] r136634 - /llvm/trunk/include/llvm/MC/MCInst.h Message-ID: <20110801184319.1485E2A6C12C@llvm.org> Author: resistor Date: Mon Aug 1 13:43:18 2011 New Revision: 136634 URL: http://llvm.org/viewvc/llvm-project?rev=136634&view=rev Log: Add a clear() operation to MCInst, to drop all of its operands. Useful for the disassembler, where we may realize fairly late into decoding that something is wrong and need to reset. Modified: llvm/trunk/include/llvm/MC/MCInst.h Modified: llvm/trunk/include/llvm/MC/MCInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInst.h?rev=136634&r1=136633&r2=136634&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCInst.h (original) +++ llvm/trunk/include/llvm/MC/MCInst.h Mon Aug 1 13:43:18 2011 @@ -144,6 +144,8 @@ Operands.push_back(Op); } + void clear() { Operands.clear(); } + void print(raw_ostream &OS, const MCAsmInfo *MAI) const; void dump() const; From resistor at mac.com Mon Aug 1 13:44:37 2011 From: resistor at mac.com (Owen Anderson) Date: Mon, 01 Aug 2011 18:44:37 -0000 Subject: [llvm-commits] [llvm] r136635 - /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Message-ID: <20110801184437.B04D92A6C12C@llvm.org> Author: resistor Date: Mon Aug 1 13:44:37 2011 New Revision: 136635 URL: http://llvm.org/viewvc/llvm-project?rev=136635&view=rev Log: Enhance the fixed length disassembler to better handle operand decoding failures. Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=136635&r1=136634&r2=136635&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Mon Aug 1 13:44:37 2011 @@ -744,8 +744,8 @@ } if (Decoder != "") - o.indent(Indentation) << " " << Decoder - << "(MI, tmp, Address, Decoder);\n"; + o.indent(Indentation) << " if (!" << Decoder + << "(MI, tmp, Address, Decoder)) return false;\n"; else o.indent(Indentation) << " MI.addOperand(MCOperand::CreateImm(tmp));\n"; From evan.cheng at apple.com Mon Aug 1 13:47:42 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 01 Aug 2011 11:47:42 -0700 Subject: [llvm-commits] [llvm] r135760 - in /llvm/trunk: cmake/modules/LLVMLibDeps.cmake lib/Support/CMakeLists.txt lib/Support/TargetRegistry.cpp lib/Target/CMakeLists.txt lib/Target/TargetRegistry.cpp In-Reply-To: <24FFFF91-D94C-47EE-88A5-EF75658DEC6D@apple.com> References: <20110722081654.11A932A6C12E@llvm.org> <8E0E92A0-3D18-45EB-AB84-51F0B7148DD5@apple.com> <24FFFF91-D94C-47EE-88A5-EF75658DEC6D@apple.com> Message-ID: Hi Chandler, Are you planning to fix this? Thanks, Evan On Jul 26, 2011, at 11:54 PM, Evan Cheng wrote: > > > On Jul 26, 2011, at 5:06 PM, Chandler Carruth wrote: > >> On Tue, Jul 26, 2011 at 4:46 PM, Evan Cheng wrote: >> Hi Chandler, >> >> Sorry I missed this earlier. I don't think this is the right change. >> >> No problem, I'm open to any suggestions you have here. Without this change, lots of weird stuff broke due to the Support -> Target -> MC include chain that existed prior, that was my only motivation for making it at all. > > Sure, that was also bad. Thanks for tackling this. > >> >> TargetRegistry is used by everything including those tools which don't need Target library e.g. llvm-mc. >> >> Hrm, is there a better name for it? TargetRegistry seems very confusing for something that shouldn't live in Target. > > I can't come up with a better one. After all, the name clearly matches the purpose of the code! > >> >> If you wish for consistency, the right fix is to move TargetRegistry.h to Support. But to do that, you would need to move Reloc::Model and CodeModel::Model out of MCCodeGenInfo.h first. We can't have something in Support that reference MC. >> >> I don't have any strong feelings here. Is Support the correct logical home for the registry? (Is it more like the TargetedPlatformRegistry? maybe s/Platform/Architecture/ or Backend something...) If so, what would be required (in brief) to move these pieces to support? I'm happy to take a look at fixing them once I have an idea of what you'd like these to look like. =D > > I think Support is fine. We don't need to over-design it especially since it's just one file. > > Thanks, > > Evan > >> >> Evan >> >> On Jul 22, 2011, at 1:16 AM, Chandler Carruth wrote: >> >> > Author: chandlerc >> > Date: Fri Jul 22 03:16:53 2011 >> > New Revision: 135760 >> > >> > URL: http://llvm.org/viewvc/llvm-project?rev=135760&view=rev >> > Log: >> > Move TargetRegistry.cpp from lib/Support to lib/Target where it belongs. >> > The header file was already properly located. The previous need for it >> > in Support had to do with the version string printing which was fixed in >> > r135757. >> > >> > Also update build dependencies where libraries that needed the >> > functionality of the Target library (in the form of the TargetRegistry) >> > were picking it up via Support. This is pretty pervasive, essentially >> > every TargetInfo library (ARMInfo, etc) uses TargetRegistry, making it >> > depend on Target. All of these were previously just sneaking by. >> > >> > Added: >> > llvm/trunk/lib/Target/TargetRegistry.cpp >> > - copied, changed from r135759, llvm/trunk/lib/Support/TargetRegistry.cpp >> > Removed: >> > llvm/trunk/lib/Support/TargetRegistry.cpp >> > Modified: >> > llvm/trunk/cmake/modules/LLVMLibDeps.cmake >> > llvm/trunk/lib/Support/CMakeLists.txt >> > llvm/trunk/lib/Target/CMakeLists.txt >> > >> > Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake >> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMLibDeps.cmake?rev=135760&r1=135759&r2=135760&view=diff >> > ============================================================================== >> > --- llvm/trunk/cmake/modules/LLVMLibDeps.cmake (original) >> > +++ llvm/trunk/cmake/modules/LLVMLibDeps.cmake Fri Jul 22 03:16:53 2011 >> > @@ -3,10 +3,10 @@ >> > set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMAsmPrinter LLVMARMDesc LLVMARMInfo LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMARMDesc LLVMARMInfo LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMARMDisassembler LLVMARMDesc LLVMARMInfo LLVMMC LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaDesc LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMAlphaDesc LLVMAlphaInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport) >> > @@ -15,16 +15,16 @@ >> > set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMAsmPrinter LLVMBlackfinDesc LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMBlackfinDesc LLVMBlackfinInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils) >> > -set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMAsmPrinter LLVMCellSPUDesc LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCellSPUDesc LLVMCellSPUInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMTarget) >> > -set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMInstCombine LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMSupport LLVMTransformUtils) >> > @@ -36,37 +36,37 @@ >> > set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMBlazeAsmPrinter LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMBlazeDisassembler LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMC LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDesc LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaDesc LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinDesc LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUDesc LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info LLVMMipsCodeGen LLVMMipsDesc LLVMMipsInfo LLVMPTXCodeGen LLVMPTXDesc LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCDesc LLVMPowerPCInfo LLVMSparcCodeGen LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen LLVMSystemZDesc LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Desc LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreDesc LLVMXCoreInfo) >> > +set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDesc LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaDesc LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinDesc LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUDesc LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info LLVMMipsCodeGen LLVMMipsDesc LLVMMipsInfo LLVMPTXCodeGen LLVMPTXDesc LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCDesc LLVMPowerPCInfo LLVMSparcCodeGen LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen LLVMSystemZDesc LLVMSystemZInfo LLVMTarget LLVMX86AsmParser LLVMX86CodeGen LLVMX86Desc LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreDesc LLVMXCoreInfo) >> > set(MSVC_LIB_DEPS_LLVMMCJIT LLVMCore LLVMExecutionEngine LLVMRuntimeDyld LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430AsmPrinter LLVMMSP430Desc LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMSP430Desc LLVMMC LLVMMSP430Info) >> > -set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsAsmPrinter LLVMMipsDesc LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMipsDesc LLVMMC LLVMMipsInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMObject LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMPTXCodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPTXDesc LLVMPTXInfo LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMPTXDesc LLVMMC LLVMPTXInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCAsmPrinter LLVMPowerPCDesc LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMPowerPCDesc LLVMMC LLVMPowerPCInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMRuntimeDyld LLVMObject LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMSparcDesc LLVMMC LLVMSparcInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMSupport ) >> > set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZDesc LLVMSystemZInfo LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMSystemZDesc LLVMMC LLVMSystemZInfo) >> > -set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMipa) >> > set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMMCParser LLVMSupport LLVMTarget LLVMX86Info) >> > @@ -74,10 +74,10 @@ >> > set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMX86AsmPrinter LLVMX86Desc LLVMX86Info LLVMX86Utils) >> > set(MSVC_LIB_DEPS_LLVMX86Desc LLVMMC LLVMSupport LLVMX86Info) >> > set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info) >> > -set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMX86Utils LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreDesc LLVMXCoreInfo) >> > set(MSVC_LIB_DEPS_LLVMXCoreDesc LLVMMC LLVMXCoreInfo) >> > -set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) >> > >> > Modified: llvm/trunk/lib/Support/CMakeLists.txt >> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=135760&r1=135759&r2=135760&view=diff >> > ============================================================================== >> > --- llvm/trunk/lib/Support/CMakeLists.txt (original) >> > +++ llvm/trunk/lib/Support/CMakeLists.txt Fri Jul 22 03:16:53 2011 >> > @@ -42,7 +42,6 @@ >> > StringPool.cpp >> > StringRef.cpp >> > SystemUtils.cpp >> > - TargetRegistry.cpp >> > Timer.cpp >> > ToolOutputFile.cpp >> > Triple.cpp >> > >> > Removed: llvm/trunk/lib/Support/TargetRegistry.cpp >> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetRegistry.cpp?rev=135759&view=auto >> > ============================================================================== >> > --- llvm/trunk/lib/Support/TargetRegistry.cpp (original) >> > +++ llvm/trunk/lib/Support/TargetRegistry.cpp (removed) >> > @@ -1,122 +0,0 @@ >> > -//===--- TargetRegistry.cpp - Target registration -------------------------===// >> > -// >> > -// The LLVM Compiler Infrastructure >> > -// >> > -// This file is distributed under the University of Illinois Open Source >> > -// License. See LICENSE.TXT for details. >> > -// >> > -//===----------------------------------------------------------------------===// >> > - >> > -#include "llvm/ADT/STLExtras.h" >> > -#include "llvm/ADT/StringRef.h" >> > -#include "llvm/Target/TargetRegistry.h" >> > -#include "llvm/Support/Host.h" >> > -#include "llvm/Support/raw_ostream.h" >> > -#include >> > -#include >> > -using namespace llvm; >> > - >> > -// Clients are responsible for avoid race conditions in registration. >> > -static Target *FirstTarget = 0; >> > - >> > -TargetRegistry::iterator TargetRegistry::begin() { >> > - return iterator(FirstTarget); >> > -} >> > - >> > -const Target *TargetRegistry::lookupTarget(const std::string &TT, >> > - std::string &Error) { >> > - // Provide special warning when no targets are initialized. >> > - if (begin() == end()) { >> > - Error = "Unable to find target for this triple (no targets are registered)"; >> > - return 0; >> > - } >> > - const Target *Best = 0, *EquallyBest = 0; >> > - unsigned BestQuality = 0; >> > - for (iterator it = begin(), ie = end(); it != ie; ++it) { >> > - if (unsigned Qual = it->TripleMatchQualityFn(TT)) { >> > - if (!Best || Qual > BestQuality) { >> > - Best = &*it; >> > - EquallyBest = 0; >> > - BestQuality = Qual; >> > - } else if (Qual == BestQuality) >> > - EquallyBest = &*it; >> > - } >> > - } >> > - >> > - if (!Best) { >> > - Error = "No available targets are compatible with this triple, " >> > - "see -version for the available targets."; >> > - return 0; >> > - } >> > - >> > - // Otherwise, take the best target, but make sure we don't have two equally >> > - // good best targets. >> > - if (EquallyBest) { >> > - Error = std::string("Cannot choose between targets \"") + >> > - Best->Name + "\" and \"" + EquallyBest->Name + "\""; >> > - return 0; >> > - } >> > - >> > - return Best; >> > -} >> > - >> > -void TargetRegistry::RegisterTarget(Target &T, >> > - const char *Name, >> > - const char *ShortDesc, >> > - Target::TripleMatchQualityFnTy TQualityFn, >> > - bool HasJIT) { >> > - assert(Name && ShortDesc && TQualityFn && >> > - "Missing required target information!"); >> > - >> > - // Check if this target has already been initialized, we allow this as a >> > - // convenience to some clients. >> > - if (T.Name) >> > - return; >> > - >> > - // Add to the list of targets. >> > - T.Next = FirstTarget; >> > - FirstTarget = &T; >> > - >> > - T.Name = Name; >> > - T.ShortDesc = ShortDesc; >> > - T.TripleMatchQualityFn = TQualityFn; >> > - T.HasJIT = HasJIT; >> > -} >> > - >> > -const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) { >> > - const Target *TheTarget = lookupTarget(sys::getHostTriple(), Error); >> > - >> > - if (TheTarget && !TheTarget->hasJIT()) { >> > - Error = "No JIT compatible target available for this host"; >> > - return 0; >> > - } >> > - >> > - return TheTarget; >> > -} >> > - >> > -static int TargetArraySortFn(const void *LHS, const void *RHS) { >> > - typedef std::pair pair_ty; >> > - return ((const pair_ty*)LHS)->first.compare(((const pair_ty*)RHS)->first); >> > -} >> > - >> > -void TargetRegistry::printRegisteredTargetsForVersion() { >> > - std::vector > Targets; >> > - size_t Width = 0; >> > - for (TargetRegistry::iterator I = TargetRegistry::begin(), >> > - E = TargetRegistry::end(); >> > - I != E; ++I) { >> > - Targets.push_back(std::make_pair(I->getName(), &*I)); >> > - Width = std::max(Width, Targets.back().first.size()); >> > - } >> > - array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn); >> > - >> > - raw_ostream &OS = outs(); >> > - OS << " Registered Targets:\n"; >> > - for (unsigned i = 0, e = Targets.size(); i != e; ++i) { >> > - OS << " " << Targets[i].first; >> > - OS.indent(Width - Targets[i].first.size()) << " - " >> > - << Targets[i].second->getShortDescription() << '\n'; >> > - } >> > - if (Targets.empty()) >> > - OS << " (none)\n"; >> > -} >> > >> > Modified: llvm/trunk/lib/Target/CMakeLists.txt >> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=135760&r1=135759&r2=135760&view=diff >> > ============================================================================== >> > --- llvm/trunk/lib/Target/CMakeLists.txt (original) >> > +++ llvm/trunk/lib/Target/CMakeLists.txt Fri Jul 22 03:16:53 2011 >> > @@ -11,6 +11,7 @@ >> > TargetLoweringObjectFile.cpp >> > TargetMachine.cpp >> > TargetRegisterInfo.cpp >> > + TargetRegistry.cpp >> > TargetSubtargetInfo.cpp >> > ) >> > >> > >> > Copied: llvm/trunk/lib/Target/TargetRegistry.cpp (from r135759, llvm/trunk/lib/Support/TargetRegistry.cpp) >> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegistry.cpp?p2=llvm/trunk/lib/Target/TargetRegistry.cpp&p1=llvm/trunk/lib/Support/TargetRegistry.cpp&r1=135759&r2=135760&rev=135760&view=diff >> > ============================================================================== >> > (empty) >> > >> > >> > _______________________________________________ >> > llvm-commits mailing list >> > llvm-commits at cs.uiuc.edu >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/43becbd7/attachment.html From rdivacky at freebsd.org Mon Aug 1 13:53:07 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Mon, 1 Aug 2011 20:53:07 +0200 Subject: [llvm-commits] [PATCH]: sketch of PPC32 ELF writer In-Reply-To: <925BF91C-E5BC-4ABE-9228-00C79583DFBB@apple.com> References: <20110801181941.GA26227@freebsd.org> <925BF91C-E5BC-4ABE-9228-00C79583DFBB@apple.com> Message-ID: <20110801185307.GA32212@freebsd.org> Looks fine to do what? :) One more thing, PPCLinuxMCAsmInfo() does not set PPC to be BigEndian. OK to commit this? pes ~rdivacky/llvm# svn diff lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp Index: lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp =================================================================== --- lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp (revision 136618) +++ lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp (working copy) @@ -58,5 +58,6 @@ Data64bitsDirective = is64Bit ? "\t.quad\t" : 0; HasLCOMMDirective = true; AssemblerDialect = 0; // Old-Style mnemonics. + IsLittleEndian = false; } With this I am able to debug vim and floats work again (with the ELF writer patches). On Mon, Aug 01, 2011 at 11:22:26AM -0700, Evan Cheng wrote: > Looks fine to me. Thanks. > > Evan > On Aug 1, 2011, at 11:19 AM, Roman Divacky wrote: > > > Hi, > > > > the attached two patches sketch out PPC32 ELF writer. > > > > 1) powerpc-mc-md.patch > > > > This defines some PPC relocation types and introduces > > PPCELFObjectWriter and ELFPPCAsmBackend. Including ApplyFixup() > > implementation. > > > > I think this patch is basically committable. > > > > 2) powerpc-mc.patch > > > > This implements PPCELFObjectWriter class including quite wrong > > GetRelocType(). There's a hack in RecordRelocation where > > fixup_ppc_ha16/fixup_ppc_lo16 offset needs to be adjusted by two. > > I don't know how to do this properly. > > > > I think this needs more work on the GetRelocType() and the fixup > > hack. > > > > With these two patches applied I am able to compile a running hello world on > > FreeBSD using clang -integrated-as. It can compile non-running vim. I used > > to be able to compile -g version of vim and it went quite far before it > > crashed. Debug compilation is not possibly anymore, I suspect some endian > > issue (gdb says: Dwarf Error: wrong version in compilation unit header (is > > 512, should be 2)) > > > > What should I do with these patches? The first one seems committable (and > > touches only PowerPC code), the second should be ok to commit without the +2 > > hack and with the GetRelocType() just asserting. > > > > I don't have any tests for this nor I think I'll do any more significant work. > > > > Comments? > > > > roman > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From criswell at uiuc.edu Mon Aug 1 13:57:38 2011 From: criswell at uiuc.edu (John Criswell) Date: Mon, 01 Aug 2011 18:57:38 -0000 Subject: [llvm-commits] [poolalloc] r136637 - in /poolalloc/trunk: Makefile tools/Makefile Message-ID: <20110801185738.EE17B2A6C12C@llvm.org> Author: criswell Date: Mon Aug 1 13:57:38 2011 New Revision: 136637 URL: http://llvm.org/viewvc/llvm-project?rev=136637&view=rev Log: Only the WatchDog program is going to compile with LLVM mainline right now. Disable everything else. Modified: poolalloc/trunk/Makefile poolalloc/trunk/tools/Makefile Modified: poolalloc/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/Makefile?rev=136637&r1=136636&r2=136637&view=diff ============================================================================== --- poolalloc/trunk/Makefile (original) +++ poolalloc/trunk/Makefile Mon Aug 1 13:57:38 2011 @@ -10,7 +10,7 @@ # # Directories that needs to be built. # -DIRS = lib runtime tools +DIRS = tools # # Include the Master Makefile that knows how to build all. Modified: poolalloc/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/tools/Makefile?rev=136637&r1=136636&r2=136637&view=diff ============================================================================== --- poolalloc/trunk/tools/Makefile (original) +++ poolalloc/trunk/tools/Makefile Mon Aug 1 13:57:38 2011 @@ -6,6 +6,6 @@ # # List all of the subdirectories that we will compile. # -PARALLEL_DIRS=WatchDog Pa +PARALLEL_DIRS=WatchDog include $(LEVEL)/Makefile.common From jstaszak at apple.com Mon Aug 1 14:16:27 2011 From: jstaszak at apple.com (Jakub Staszak) Date: Mon, 01 Aug 2011 19:16:27 -0000 Subject: [llvm-commits] [llvm] r136638 - /llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp Message-ID: <20110801191627.160372A6C12C@llvm.org> Author: kuba Date: Mon Aug 1 14:16:26 2011 New Revision: 136638 URL: http://llvm.org/viewvc/llvm-project?rev=136638&view=rev Log: Change SmallVector to SmallPtrSet in BranchProbabilityInfo. Handle cases where one than one successor goes to the same block. Modified: llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp Modified: llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp?rev=136638&r1=136637&r2=136638&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp (original) +++ llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp Mon Aug 1 14:16:26 2011 @@ -142,15 +142,15 @@ if (BB->getTerminator()->getNumSuccessors() == 1) return false; - SmallVector ReturningEdges; - SmallVector StayEdges; + SmallPtrSet ReturningEdges; + SmallPtrSet StayEdges; for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { BasicBlock *Succ = *I; if (isReturningBlock(Succ)) - ReturningEdges.push_back(Succ); + ReturningEdges.insert(Succ); else - StayEdges.push_back(Succ); + StayEdges.insert(Succ); } if (uint32_t numStayEdges = StayEdges.size()) { @@ -158,7 +158,7 @@ if (stayWeight < NORMAL_WEIGHT) stayWeight = NORMAL_WEIGHT; - for (SmallVector::iterator I = StayEdges.begin(), + for (SmallPtrSet::iterator I = StayEdges.begin(), E = StayEdges.end(); I != E; ++I) BP->setEdgeWeight(BB, *I, stayWeight); } @@ -167,7 +167,7 @@ uint32_t retWeight = RH_NONTAKEN_WEIGHT / numRetEdges; if (retWeight < MIN_WEIGHT) retWeight = MIN_WEIGHT; - for (SmallVector::iterator I = ReturningEdges.begin(), + for (SmallPtrSet::iterator I = ReturningEdges.begin(), E = ReturningEdges.end(); I != E; ++I) { BP->setEdgeWeight(BB, *I, retWeight); } @@ -220,9 +220,9 @@ if (!L) return false; - SmallVector BackEdges; - SmallVector ExitingEdges; - SmallVector InEdges; // Edges from header to the loop. + SmallPtrSet BackEdges; + SmallPtrSet ExitingEdges; + SmallPtrSet InEdges; // Edges from header to the loop. bool isHeader = BB == L->getHeader(); @@ -230,11 +230,11 @@ BasicBlock *Succ = *I; Loop *SuccL = LI->getLoopFor(Succ); if (SuccL != L) - ExitingEdges.push_back(Succ); + ExitingEdges.insert(Succ); else if (Succ == L->getHeader()) - BackEdges.push_back(Succ); + BackEdges.insert(Succ); else if (isHeader) - InEdges.push_back(Succ); + InEdges.insert(Succ); } if (uint32_t numBackEdges = BackEdges.size()) { @@ -242,7 +242,7 @@ if (backWeight < NORMAL_WEIGHT) backWeight = NORMAL_WEIGHT; - for (SmallVector::iterator EI = BackEdges.begin(), + for (SmallPtrSet::iterator EI = BackEdges.begin(), EE = BackEdges.end(); EI != EE; ++EI) { BasicBlock *Back = *EI; BP->setEdgeWeight(BB, Back, backWeight); @@ -254,7 +254,7 @@ if (inWeight < NORMAL_WEIGHT) inWeight = NORMAL_WEIGHT; - for (SmallVector::iterator EI = InEdges.begin(), + for (SmallPtrSet::iterator EI = InEdges.begin(), EE = InEdges.end(); EI != EE; ++EI) { BasicBlock *Back = *EI; BP->setEdgeWeight(BB, Back, inWeight); @@ -267,7 +267,7 @@ if (exitWeight < MIN_WEIGHT) exitWeight = MIN_WEIGHT; - for (SmallVector::iterator EI = ExitingEdges.begin(), + for (SmallPtrSet::iterator EI = ExitingEdges.begin(), EE = ExitingEdges.end(); EI != EE; ++EI) { BasicBlock *Exiting = *EI; BP->setEdgeWeight(BB, Exiting, exitWeight); From chandlerc at gmail.com Mon Aug 1 14:36:23 2011 From: chandlerc at gmail.com (Chandler Carruth) Date: Mon, 1 Aug 2011 12:36:23 -0700 Subject: [llvm-commits] [llvm] r135760 - in /llvm/trunk: cmake/modules/LLVMLibDeps.cmake lib/Support/CMakeLists.txt lib/Support/TargetRegistry.cpp lib/Target/CMakeLists.txt lib/Target/TargetRegistry.cpp In-Reply-To: References: <20110722081654.11A932A6C12E@llvm.org> <8E0E92A0-3D18-45EB-AB84-51F0B7148DD5@apple.com> <24FFFF91-D94C-47EE-88A5-EF75658DEC6D@apple.com> Message-ID: On Mon, Aug 1, 2011 at 11:47 AM, Evan Cheng wrote: > Hi Chandler, > > Are you planning to fix this? > Yes, I just got pre-empted by really really bad CMake issues. If you get time to hack on it first, that's cool. Otherwise I should get to it in the next couple of days. > > Thanks, > > Evan > > On Jul 26, 2011, at 11:54 PM, Evan Cheng wrote: > > > > On Jul 26, 2011, at 5:06 PM, Chandler Carruth wrote: > > On Tue, Jul 26, 2011 at 4:46 PM, Evan Cheng < > evan.cheng at apple.com> wrote: > >> Hi Chandler, >> >> Sorry I missed this earlier. I don't think this is the right change. > > > No problem, I'm open to any suggestions you have here. Without this change, > lots of weird stuff broke due to the Support -> Target -> MC include chain > that existed prior, that was my only motivation for making it at all. > > > Sure, that was also bad. Thanks for tackling this. > > > >> TargetRegistry is used by everything including those tools which don't >> need Target library e.g. llvm-mc. >> > > Hrm, is there a better name for it? TargetRegistry seems very confusing for > something that shouldn't live in Target. > > > I can't come up with a better one. After all, the name clearly matches the > purpose of the code! > > > >> If you wish for consistency, the right fix is to move TargetRegistry.h to >> Support. But to do that, you would need to move Reloc::Model and >> CodeModel::Model out of MCCodeGenInfo.h first. We can't have something in >> Support that reference MC. >> > > I don't have any strong feelings here. Is Support the correct logical home > for the registry? (Is it more like the TargetedPlatformRegistry? maybe > s/Platform/Architecture/ or Backend something...) If so, what would be > required (in brief) to move these pieces to support? I'm happy to take a > look at fixing them once I have an idea of what you'd like these to look > like. =D > > > I think Support is fine. We don't need to over-design it especially since > it's just one file. > > Thanks, > > Evan > > >> Evan >> >> On Jul 22, 2011, at 1:16 AM, Chandler Carruth wrote: >> >> > Author: chandlerc >> > Date: Fri Jul 22 03:16:53 2011 >> > New Revision: 135760 >> > >> > URL: >> http://llvm.org/viewvc/llvm-project?rev=135760&view=rev >> > Log: >> > Move TargetRegistry.cpp from lib/Support to lib/Target where it belongs. >> > The header file was already properly located. The previous need for it >> > in Support had to do with the version string printing which was fixed in >> > r135757. >> > >> > Also update build dependencies where libraries that needed the >> > functionality of the Target library (in the form of the TargetRegistry) >> > were picking it up via Support. This is pretty pervasive, essentially >> > every TargetInfo library (ARMInfo, etc) uses TargetRegistry, making it >> > depend on Target. All of these were previously just sneaking by. >> > >> > Added: >> > llvm/trunk/lib/Target/TargetRegistry.cpp >> > - copied, changed from r135759, >> llvm/trunk/lib/Support/TargetRegistry.cpp >> > Removed: >> > llvm/trunk/lib/Support/TargetRegistry.cpp >> > Modified: >> > llvm/trunk/cmake/modules/LLVMLibDeps.cmake >> > llvm/trunk/lib/Support/CMakeLists.txt >> > llvm/trunk/lib/Target/CMakeLists.txt >> > >> > Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake >> > URL: >> >> http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMLibDeps.cmake?rev=135760&r1=135759&r2=135760&view=diff >> > >> ============================================================================== >> > --- llvm/trunk/cmake/modules/LLVMLibDeps.cmake (original) >> > +++ llvm/trunk/cmake/modules/LLVMLibDeps.cmake Fri Jul 22 03:16:53 2011 >> > @@ -3,10 +3,10 @@ >> > set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMAsmPrinter LLVMARMDesc >> LLVMARMInfo LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC >> LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMARMDesc LLVMARMInfo LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMARMDisassembler LLVMARMDesc LLVMARMInfo LLVMMC >> LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaDesc LLVMAlphaInfo >> LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport >> LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMAlphaDesc LLVMAlphaInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport) >> > @@ -15,16 +15,16 @@ >> > set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMAsmPrinter LLVMBlackfinDesc >> LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport >> LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMBlackfinDesc LLVMBlackfinInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen >> LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils) >> > -set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMAsmPrinter LLVMCellSPUDesc >> LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport >> LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCellSPUDesc LLVMCellSPUInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC >> LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport >> LLVMTarget) >> > -set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMMC LLVMSupport >> LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMInstCombine LLVMAnalysis LLVMCore LLVMSupport >> LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMSupport >> LLVMTransformUtils) >> > @@ -36,37 +36,37 @@ >> > set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore >> LLVMMBlazeAsmPrinter LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC LLVMSelectionDAG >> LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMBlazeDisassembler LLVMMBlazeCodeGen >> LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC) >> > -set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMC LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen >> LLVMARMDesc LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaDesc >> LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinDesc LLVMBlackfinInfo >> LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUDesc >> LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser >> LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeDisassembler LLVMMBlazeInfo >> LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info >> LLVMMipsCodeGen LLVMMipsDesc LLVMMipsInfo LLVMPTXCodeGen LLVMPTXDesc >> LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCDesc LLVMPowerPCInfo >> LLVMSparcCodeGen LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen >> LLVMSystemZDesc LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Desc >> LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreDesc >> LLVMXCoreInfo) >> > +set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen >> LLVMARMDesc LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaDesc >> LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinDesc LLVMBlackfinInfo >> LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUDesc >> LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser >> LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeDisassembler LLVMMBlazeInfo >> LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info >> LLVMMipsCodeGen LLVMMipsDesc LLVMMipsInfo LLVMPTXCodeGen LLVMPTXDesc >> LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCDesc LLVMPowerPCInfo >> LLVMSparcCodeGen LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen >> LLVMSystemZDesc LLVMSystemZInfo LLVMTarget LLVMX86AsmParser LLVMX86CodeGen >> LLVMX86Desc LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreDesc >> LLVMXCoreInfo) >> > set(MSVC_LIB_DEPS_LLVMMCJIT LLVMCore LLVMExecutionEngine LLVMRuntimeDyld >> LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore >> LLVMMC LLVMMSP430AsmPrinter LLVMMSP430Desc LLVMMSP430Info LLVMSelectionDAG >> LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMSP430Desc LLVMMC LLVMMSP430Info) >> > -set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore >> LLVMMC LLVMMipsAsmPrinter LLVMMipsDesc LLVMMipsInfo LLVMSelectionDAG >> LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMMipsDesc LLVMMC LLVMMipsInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMObject LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMPTXCodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen >> LLVMCore LLVMMC LLVMPTXDesc LLVMPTXInfo LLVMSelectionDAG LLVMSupport >> LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMPTXDesc LLVMMC LLVMPTXInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMAnalysis LLVMAsmPrinter >> LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCAsmPrinter LLVMPowerPCDesc >> LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMPowerPCDesc LLVMMC LLVMPowerPCInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMRuntimeDyld LLVMObject LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine >> LLVMSupport LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore >> LLVMMC LLVMSupport LLVMTarget LLVMTransformUtils) >> > set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore >> LLVMMC LLVMSelectionDAG LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMSparcDesc LLVMMC LLVMSparcInfo LLVMSupport) >> > -set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMSupport ) >> > set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore >> LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZDesc LLVMSystemZInfo >> LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMSystemZDesc LLVMMC LLVMSystemZInfo) >> > -set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport >> LLVMTarget LLVMipa) >> > set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMMCParser LLVMSupport >> LLVMTarget LLVMX86Info) >> > @@ -74,10 +74,10 @@ >> > set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen >> LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMX86AsmPrinter >> LLVMX86Desc LLVMX86Info LLVMX86Utils) >> > set(MSVC_LIB_DEPS_LLVMX86Desc LLVMMC LLVMSupport LLVMX86Info) >> > set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info) >> > -set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMX86Utils LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore >> LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreDesc LLVMXCoreInfo) >> > set(MSVC_LIB_DEPS_LLVMXCoreDesc LLVMMC LLVMXCoreInfo) >> > -set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport) >> > +set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport LLVMTarget) >> > set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport) >> > set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMScalarOpts >> LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) >> > >> > Modified: llvm/trunk/lib/Support/CMakeLists.txt >> > URL: >> >> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=135760&r1=135759&r2=135760&view=diff >> > >> ============================================================================== >> > --- llvm/trunk/lib/Support/CMakeLists.txt (original) >> > +++ llvm/trunk/lib/Support/CMakeLists.txt Fri Jul 22 03:16:53 2011 >> > @@ -42,7 +42,6 @@ >> > StringPool.cpp >> > StringRef.cpp >> > SystemUtils.cpp >> > - TargetRegistry.cpp >> > Timer.cpp >> > ToolOutputFile.cpp >> > Triple.cpp >> > >> > Removed: llvm/trunk/lib/Support/TargetRegistry.cpp >> > URL: >> >> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetRegistry.cpp?rev=135759&view=auto >> > >> ============================================================================== >> > --- llvm/trunk/lib/Support/TargetRegistry.cpp (original) >> > +++ llvm/trunk/lib/Support/TargetRegistry.cpp (removed) >> > @@ -1,122 +0,0 @@ >> > -//===--- TargetRegistry.cpp - Target registration >> -------------------------===// >> > -// >> > -// The LLVM Compiler Infrastructure >> > -// >> > -// This file is distributed under the University of Illinois Open >> Source >> > -// License. See LICENSE.TXT for details. >> > -// >> > >> -//===----------------------------------------------------------------------===// >> > - >> > -#include "llvm/ADT/STLExtras.h" >> > -#include "llvm/ADT/StringRef.h" >> > -#include "llvm/Target/TargetRegistry.h" >> > -#include "llvm/Support/Host.h" >> > -#include "llvm/Support/raw_ostream.h" >> > -#include >> > -#include >> > -using namespace llvm; >> > - >> > -// Clients are responsible for avoid race conditions in registration. >> > -static Target *FirstTarget = 0; >> > - >> > -TargetRegistry::iterator TargetRegistry::begin() { >> > - return iterator(FirstTarget); >> > -} >> > - >> > -const Target *TargetRegistry::lookupTarget(const std::string &TT, >> > - std::string &Error) { >> > - // Provide special warning when no targets are initialized. >> > - if (begin() == end()) { >> > - Error = "Unable to find target for this triple (no targets are >> registered)"; >> > - return 0; >> > - } >> > - const Target *Best = 0, *EquallyBest = 0; >> > - unsigned BestQuality = 0; >> > - for (iterator it = begin(), ie = end(); it != ie; ++it) { >> > - if (unsigned Qual = it->TripleMatchQualityFn(TT)) { >> > - if (!Best || Qual > BestQuality) { >> > - Best = &*it; >> > - EquallyBest = 0; >> > - BestQuality = Qual; >> > - } else if (Qual == BestQuality) >> > - EquallyBest = &*it; >> > - } >> > - } >> > - >> > - if (!Best) { >> > - Error = "No available targets are compatible with this triple, " >> > - "see -version for the available targets."; >> > - return 0; >> > - } >> > - >> > - // Otherwise, take the best target, but make sure we don't have two >> equally >> > - // good best targets. >> > - if (EquallyBest) { >> > - Error = std::string("Cannot choose between targets \"") + >> > - Best->Name + "\" and \"" + EquallyBest->Name + "\""; >> > - return 0; >> > - } >> > - >> > - return Best; >> > -} >> > - >> > -void TargetRegistry::RegisterTarget(Target &T, >> > - const char *Name, >> > - const char *ShortDesc, >> > - Target::TripleMatchQualityFnTy >> TQualityFn, >> > - bool HasJIT) { >> > - assert(Name && ShortDesc && TQualityFn && >> > - "Missing required target information!"); >> > - >> > - // Check if this target has already been initialized, we allow this >> as a >> > - // convenience to some clients. >> > - if (T.Name) >> > - return; >> > - >> > - // Add to the list of targets. >> > - T.Next = FirstTarget; >> > - FirstTarget = &T; >> > - >> > - T.Name = Name; >> > - T.ShortDesc = ShortDesc; >> > - T.TripleMatchQualityFn = TQualityFn; >> > - T.HasJIT = HasJIT; >> > -} >> > - >> > -const Target *TargetRegistry::getClosestTargetForJIT(std::string >> &Error) { >> > - const Target *TheTarget = lookupTarget(sys::getHostTriple(), Error); >> > - >> > - if (TheTarget && !TheTarget->hasJIT()) { >> > - Error = "No JIT compatible target available for this host"; >> > - return 0; >> > - } >> > - >> > - return TheTarget; >> > -} >> > - >> > -static int TargetArraySortFn(const void *LHS, const void *RHS) { >> > - typedef std::pair pair_ty; >> > - return ((const pair_ty*)LHS)->first.compare(((const >> pair_ty*)RHS)->first); >> > -} >> > - >> > -void TargetRegistry::printRegisteredTargetsForVersion() { >> > - std::vector > Targets; >> > - size_t Width = 0; >> > - for (TargetRegistry::iterator I = TargetRegistry::begin(), >> > - E = TargetRegistry::end(); >> > - I != E; ++I) { >> > - Targets.push_back(std::make_pair(I->getName(), &*I)); >> > - Width = std::max(Width, Targets.back().first.size()); >> > - } >> > - array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn); >> > - >> > - raw_ostream &OS = outs(); >> > - OS << " Registered Targets:\n"; >> > - for (unsigned i = 0, e = Targets.size(); i != e; ++i) { >> > - OS << " " << Targets[i].first; >> > - OS.indent(Width - Targets[i].first.size()) << " - " >> > - << Targets[i].second->getShortDescription() << '\n'; >> > - } >> > - if (Targets.empty()) >> > - OS << " (none)\n"; >> > -} >> > >> > Modified: llvm/trunk/lib/Target/CMakeLists.txt >> > URL: >> >> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=135760&r1=135759&r2=135760&view=diff >> > >> ============================================================================== >> > --- llvm/trunk/lib/Target/CMakeLists.txt (original) >> > +++ llvm/trunk/lib/Target/CMakeLists.txt Fri Jul 22 03:16:53 2011 >> > @@ -11,6 +11,7 @@ >> > TargetLoweringObjectFile.cpp >> > TargetMachine.cpp >> > TargetRegisterInfo.cpp >> > + TargetRegistry.cpp >> > TargetSubtargetInfo.cpp >> > ) >> > >> > >> > Copied: llvm/trunk/lib/Target/TargetRegistry.cpp (from r135759, >> llvm/trunk/lib/Support/TargetRegistry.cpp) >> > URL: >> >> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegistry.cpp?p2=llvm/trunk/lib/Target/TargetRegistry.cpp&p1=llvm/trunk/lib/Support/TargetRegistry.cpp&r1=135759&r2=135760&rev=135760&view=diff >> > >> ============================================================================== >> > (empty) >> > >> > >> > _______________________________________________ >> > llvm-commits mailing list >> > llvm-commits at cs.uiuc.edu >> > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > _______________________________________________ > 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/20110801/fa5ad55e/attachment.html From evan.cheng at apple.com Mon Aug 1 14:43:05 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 01 Aug 2011 19:43:05 -0000 Subject: [llvm-commits] [llvm] r136639 - /llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp Message-ID: <20110801194305.E03522A6C12C@llvm.org> Author: evancheng Date: Mon Aug 1 14:43:05 2011 New Revision: 136639 URL: http://llvm.org/viewvc/llvm-project?rev=136639&view=rev Log: Set endianess and pointer size for PPC Linux. Bug noticed by Roman Divacky. Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp?rev=136639&r1=136638&r2=136639&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp Mon Aug 1 14:43:05 2011 @@ -31,6 +31,10 @@ } PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) { + if (is64Bit) + PointerSize = 8; + IsLittleEndian = false; + // ".comm align is in bytes but .align is pow-2." AlignmentIsInBytes = false; From evan.cheng at apple.com Mon Aug 1 14:43:47 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 01 Aug 2011 12:43:47 -0700 Subject: [llvm-commits] [PATCH]: sketch of PPC32 ELF writer In-Reply-To: <20110801185307.GA32212@freebsd.org> References: <20110801181941.GA26227@freebsd.org> <925BF91C-E5BC-4ABE-9228-00C79583DFBB@apple.com> <20110801185307.GA32212@freebsd.org> Message-ID: On Aug 1, 2011, at 11:53 AM, Roman Divacky wrote: > Looks fine to do what? :) Go ahead and commit please. > > One more thing, PPCLinuxMCAsmInfo() does not set PPC to be BigEndian. > OK to commit this? > > pes ~rdivacky/llvm# svn diff lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp > Index: lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp > =================================================================== > --- lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp (revision 136618) > +++ lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp (working copy) > @@ -58,5 +58,6 @@ > Data64bitsDirective = is64Bit ? "\t.quad\t" : 0; > HasLCOMMDirective = true; > AssemblerDialect = 0; // Old-Style mnemonics. > + IsLittleEndian = false; > } Oops. PPCLinuxMCAsmInfo also forgot to set PointerSize to 8 for ppc64. I've fixed this. Thanks, Evan > > > With this I am able to debug vim and floats work again (with the ELF writer > patches). > > On Mon, Aug 01, 2011 at 11:22:26AM -0700, Evan Cheng wrote: >> Looks fine to me. Thanks. >> >> Evan >> On Aug 1, 2011, at 11:19 AM, Roman Divacky wrote: >> >>> Hi, >>> >>> the attached two patches sketch out PPC32 ELF writer. >>> >>> 1) powerpc-mc-md.patch >>> >>> This defines some PPC relocation types and introduces >>> PPCELFObjectWriter and ELFPPCAsmBackend. Including ApplyFixup() >>> implementation. >>> >>> I think this patch is basically committable. >>> >>> 2) powerpc-mc.patch >>> >>> This implements PPCELFObjectWriter class including quite wrong >>> GetRelocType(). There's a hack in RecordRelocation where >>> fixup_ppc_ha16/fixup_ppc_lo16 offset needs to be adjusted by two. >>> I don't know how to do this properly. >>> >>> I think this needs more work on the GetRelocType() and the fixup >>> hack. >>> >>> With these two patches applied I am able to compile a running hello world on >>> FreeBSD using clang -integrated-as. It can compile non-running vim. I used >>> to be able to compile -g version of vim and it went quite far before it >>> crashed. Debug compilation is not possibly anymore, I suspect some endian >>> issue (gdb says: Dwarf Error: wrong version in compilation unit header (is >>> 512, should be 2)) >>> >>> What should I do with these patches? The first one seems committable (and >>> touches only PowerPC code), the second should be ok to commit without the +2 >>> hack and with the GetRelocType() just asserting. >>> >>> I don't have any tests for this nor I think I'll do any more significant work. >>> >>> Comments? >>> >>> roman >>> _______________________________________________ >>> 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 Aug 1 14:44:37 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 01 Aug 2011 12:44:37 -0700 Subject: [llvm-commits] [llvm] r135760 - in /llvm/trunk: cmake/modules/LLVMLibDeps.cmake lib/Support/CMakeLists.txt lib/Support/TargetRegistry.cpp lib/Target/CMakeLists.txt lib/Target/TargetRegistry.cpp In-Reply-To: References: <20110722081654.11A932A6C12E@llvm.org> <8E0E92A0-3D18-45EB-AB84-51F0B7148DD5@apple.com> <24FFFF91-D94C-47EE-88A5-EF75658DEC6D@apple.com> Message-ID: <8C219416-76F7-49A8-A569-C3825DD861D6@apple.com> On Aug 1, 2011, at 12:36 PM, Chandler Carruth wrote: > On Mon, Aug 1, 2011 at 11:47 AM, Evan Cheng wrote: > Hi Chandler, > > Are you planning to fix this? > > Yes, I just got pre-empted by really really bad CMake issues. If you get time to hack on it first, that's cool. Otherwise I should get to it in the next couple of days. Thanks, please do. I've verified this bug has increased size of release build of llvm-mc by about 900k. Evan > > > Thanks, > > Evan > > On Jul 26, 2011, at 11:54 PM, Evan Cheng wrote: > >> >> >> On Jul 26, 2011, at 5:06 PM, Chandler Carruth wrote: >> >>> On Tue, Jul 26, 2011 at 4:46 PM, Evan Cheng wrote: >>> Hi Chandler, >>> >>> Sorry I missed this earlier. I don't think this is the right change. >>> >>> No problem, I'm open to any suggestions you have here. Without this change, lots of weird stuff broke due to the Support -> Target -> MC include chain that existed prior, that was my only motivation for making it at all. >> >> Sure, that was also bad. Thanks for tackling this. >> >>> >>> TargetRegistry is used by everything including those tools which don't need Target library e.g. llvm-mc. >>> >>> Hrm, is there a better name for it? TargetRegistry seems very confusing for something that shouldn't live in Target. >> >> I can't come up with a better one. After all, the name clearly matches the purpose of the code! >> >>> >>> If you wish for consistency, the right fix is to move TargetRegistry.h to Support. But to do that, you would need to move Reloc::Model and CodeModel::Model out of MCCodeGenInfo.h first. We can't have something in Support that reference MC. >>> >>> I don't have any strong feelings here. Is Support the correct logical home for the registry? (Is it more like the TargetedPlatformRegistry? maybe s/Platform/Architecture/ or Backend something...) If so, what would be required (in brief) to move these pieces to support? I'm happy to take a look at fixing them once I have an idea of what you'd like these to look like. =D >> >> I think Support is fine. We don't need to over-design it especially since it's just one file. >> >> Thanks, >> >> Evan >> >>> >>> Evan >>> >>> On Jul 22, 2011, at 1:16 AM, Chandler Carruth wrote: >>> >>> > Author: chandlerc >>> > Date: Fri Jul 22 03:16:53 2011 >>> > New Revision: 135760 >>> > >>> > URL: http://llvm.org/viewvc/llvm-project?rev=135760&view=rev >>> > Log: >>> > Move TargetRegistry.cpp from lib/Support to lib/Target where it belongs. >>> > The header file was already properly located. The previous need for it >>> > in Support had to do with the version string printing which was fixed in >>> > r135757. >>> > >>> > Also update build dependencies where libraries that needed the >>> > functionality of the Target library (in the form of the TargetRegistry) >>> > were picking it up via Support. This is pretty pervasive, essentially >>> > every TargetInfo library (ARMInfo, etc) uses TargetRegistry, making it >>> > depend on Target. All of these were previously just sneaking by. >>> > >>> > Added: >>> > llvm/trunk/lib/Target/TargetRegistry.cpp >>> > - copied, changed from r135759, llvm/trunk/lib/Support/TargetRegistry.cpp >>> > Removed: >>> > llvm/trunk/lib/Support/TargetRegistry.cpp >>> > Modified: >>> > llvm/trunk/cmake/modules/LLVMLibDeps.cmake >>> > llvm/trunk/lib/Support/CMakeLists.txt >>> > llvm/trunk/lib/Target/CMakeLists.txt >>> > >>> > Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake >>> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMLibDeps.cmake?rev=135760&r1=135759&r2=135760&view=diff >>> > ============================================================================== >>> > --- llvm/trunk/cmake/modules/LLVMLibDeps.cmake (original) >>> > +++ llvm/trunk/cmake/modules/LLVMLibDeps.cmake Fri Jul 22 03:16:53 2011 >>> > @@ -3,10 +3,10 @@ >>> > set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMAsmPrinter LLVMARMDesc LLVMARMInfo LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMARMDesc LLVMARMInfo LLVMMC LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMARMDisassembler LLVMARMDesc LLVMARMInfo LLVMMC LLVMSupport) >>> > -set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaDesc LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMAlphaDesc LLVMAlphaInfo LLVMMC) >>> > -set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport) >>> > @@ -15,16 +15,16 @@ >>> > set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMAsmPrinter LLVMBlackfinDesc LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMBlackfinDesc LLVMBlackfinInfo LLVMMC) >>> > -set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils) >>> > -set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMAsmPrinter LLVMCellSPUDesc LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMCellSPUDesc LLVMCellSPUInfo LLVMMC) >>> > -set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils) >>> > set(MSVC_LIB_DEPS_LLVMCore LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMTarget) >>> > -set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMInstCombine LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMTransformUtils) >>> > set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMSupport LLVMTransformUtils) >>> > @@ -36,37 +36,37 @@ >>> > set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMBlazeAsmPrinter LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMMBlazeDisassembler LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeInfo LLVMMC) >>> > -set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMMC LLVMSupport) >>> > -set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDesc LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaDesc LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinDesc LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUDesc LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info LLVMMipsCodeGen LLVMMipsDesc LLVMMipsInfo LLVMPTXCodeGen LLVMPTXDesc LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCDesc LLVMPowerPCInfo LLVMSparcCodeGen LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen LLVMSystemZDesc LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Desc LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreDesc LLVMXCoreInfo) >>> > +set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDesc LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaDesc LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinDesc LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUDesc LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDesc LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Desc LLVMMSP430Info LLVMMipsCodeGen LLVMMipsDesc LLVMMipsInfo LLVMPTXCodeGen LLVMPTXDesc LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCDesc LLVMPowerPCInfo LLVMSparcCodeGen LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen LLVMSystemZDesc LLVMSystemZInfo LLVMTarget LLVMX86AsmParser LLVMX86CodeGen LLVMX86Desc LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreDesc LLVMXCoreInfo) >>> > set(MSVC_LIB_DEPS_LLVMMCJIT LLVMCore LLVMExecutionEngine LLVMRuntimeDyld LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMMC LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430AsmPrinter LLVMMSP430Desc LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMMSP430Desc LLVMMC LLVMMSP430Info) >>> > -set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMMC LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsAsmPrinter LLVMMipsDesc LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMMipsDesc LLVMMC LLVMMipsInfo LLVMSupport) >>> > -set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMObject LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMPTXCodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPTXDesc LLVMPTXInfo LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMPTXDesc LLVMMC LLVMPTXInfo LLVMSupport) >>> > -set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMMC LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCAsmPrinter LLVMPowerPCDesc LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMPowerPCDesc LLVMMC LLVMPowerPCInfo LLVMSupport) >>> > -set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMRuntimeDyld LLVMObject LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMTarget LLVMTransformUtils) >>> > set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMTransformUtils) >>> > set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcDesc LLVMSparcInfo LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMSparcDesc LLVMMC LLVMSparcInfo LLVMSupport) >>> > -set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMSupport ) >>> > set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZDesc LLVMSystemZInfo LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMSystemZDesc LLVMMC LLVMSystemZInfo) >>> > -set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMipa) >>> > set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMMCParser LLVMSupport LLVMTarget LLVMX86Info) >>> > @@ -74,10 +74,10 @@ >>> > set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMX86AsmPrinter LLVMX86Desc LLVMX86Info LLVMX86Utils) >>> > set(MSVC_LIB_DEPS_LLVMX86Desc LLVMMC LLVMSupport LLVMX86Info) >>> > set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info) >>> > -set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMX86Utils LLVMCore LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreDesc LLVMXCoreInfo) >>> > set(MSVC_LIB_DEPS_LLVMXCoreDesc LLVMMC LLVMXCoreInfo) >>> > -set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport) >>> > +set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport LLVMTarget) >>> > set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport) >>> > set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) >>> > >>> > Modified: llvm/trunk/lib/Support/CMakeLists.txt >>> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=135760&r1=135759&r2=135760&view=diff >>> > ============================================================================== >>> > --- llvm/trunk/lib/Support/CMakeLists.txt (original) >>> > +++ llvm/trunk/lib/Support/CMakeLists.txt Fri Jul 22 03:16:53 2011 >>> > @@ -42,7 +42,6 @@ >>> > StringPool.cpp >>> > StringRef.cpp >>> > SystemUtils.cpp >>> > - TargetRegistry.cpp >>> > Timer.cpp >>> > ToolOutputFile.cpp >>> > Triple.cpp >>> > >>> > Removed: llvm/trunk/lib/Support/TargetRegistry.cpp >>> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetRegistry.cpp?rev=135759&view=auto >>> > ============================================================================== >>> > --- llvm/trunk/lib/Support/TargetRegistry.cpp (original) >>> > +++ llvm/trunk/lib/Support/TargetRegistry.cpp (removed) >>> > @@ -1,122 +0,0 @@ >>> > -//===--- TargetRegistry.cpp - Target registration -------------------------===// >>> > -// >>> > -// The LLVM Compiler Infrastructure >>> > -// >>> > -// This file is distributed under the University of Illinois Open Source >>> > -// License. See LICENSE.TXT for details. >>> > -// >>> > -//===----------------------------------------------------------------------===// >>> > - >>> > -#include "llvm/ADT/STLExtras.h" >>> > -#include "llvm/ADT/StringRef.h" >>> > -#include "llvm/Target/TargetRegistry.h" >>> > -#include "llvm/Support/Host.h" >>> > -#include "llvm/Support/raw_ostream.h" >>> > -#include >>> > -#include >>> > -using namespace llvm; >>> > - >>> > -// Clients are responsible for avoid race conditions in registration. >>> > -static Target *FirstTarget = 0; >>> > - >>> > -TargetRegistry::iterator TargetRegistry::begin() { >>> > - return iterator(FirstTarget); >>> > -} >>> > - >>> > -const Target *TargetRegistry::lookupTarget(const std::string &TT, >>> > - std::string &Error) { >>> > - // Provide special warning when no targets are initialized. >>> > - if (begin() == end()) { >>> > - Error = "Unable to find target for this triple (no targets are registered)"; >>> > - return 0; >>> > - } >>> > - const Target *Best = 0, *EquallyBest = 0; >>> > - unsigned BestQuality = 0; >>> > - for (iterator it = begin(), ie = end(); it != ie; ++it) { >>> > - if (unsigned Qual = it->TripleMatchQualityFn(TT)) { >>> > - if (!Best || Qual > BestQuality) { >>> > - Best = &*it; >>> > - EquallyBest = 0; >>> > - BestQuality = Qual; >>> > - } else if (Qual == BestQuality) >>> > - EquallyBest = &*it; >>> > - } >>> > - } >>> > - >>> > - if (!Best) { >>> > - Error = "No available targets are compatible with this triple, " >>> > - "see -version for the available targets."; >>> > - return 0; >>> > - } >>> > - >>> > - // Otherwise, take the best target, but make sure we don't have two equally >>> > - // good best targets. >>> > - if (EquallyBest) { >>> > - Error = std::string("Cannot choose between targets \"") + >>> > - Best->Name + "\" and \"" + EquallyBest->Name + "\""; >>> > - return 0; >>> > - } >>> > - >>> > - return Best; >>> > -} >>> > - >>> > -void TargetRegistry::RegisterTarget(Target &T, >>> > - const char *Name, >>> > - const char *ShortDesc, >>> > - Target::TripleMatchQualityFnTy TQualityFn, >>> > - bool HasJIT) { >>> > - assert(Name && ShortDesc && TQualityFn && >>> > - "Missing required target information!"); >>> > - >>> > - // Check if this target has already been initialized, we allow this as a >>> > - // convenience to some clients. >>> > - if (T.Name) >>> > - return; >>> > - >>> > - // Add to the list of targets. >>> > - T.Next = FirstTarget; >>> > - FirstTarget = &T; >>> > - >>> > - T.Name = Name; >>> > - T.ShortDesc = ShortDesc; >>> > - T.TripleMatchQualityFn = TQualityFn; >>> > - T.HasJIT = HasJIT; >>> > -} >>> > - >>> > -const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) { >>> > - const Target *TheTarget = lookupTarget(sys::getHostTriple(), Error); >>> > - >>> > - if (TheTarget && !TheTarget->hasJIT()) { >>> > - Error = "No JIT compatible target available for this host"; >>> > - return 0; >>> > - } >>> > - >>> > - return TheTarget; >>> > -} >>> > - >>> > -static int TargetArraySortFn(const void *LHS, const void *RHS) { >>> > - typedef std::pair pair_ty; >>> > - return ((const pair_ty*)LHS)->first.compare(((const pair_ty*)RHS)->first); >>> > -} >>> > - >>> > -void TargetRegistry::printRegisteredTargetsForVersion() { >>> > - std::vector > Targets; >>> > - size_t Width = 0; >>> > - for (TargetRegistry::iterator I = TargetRegistry::begin(), >>> > - E = TargetRegistry::end(); >>> > - I != E; ++I) { >>> > - Targets.push_back(std::make_pair(I->getName(), &*I)); >>> > - Width = std::max(Width, Targets.back().first.size()); >>> > - } >>> > - array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn); >>> > - >>> > - raw_ostream &OS = outs(); >>> > - OS << " Registered Targets:\n"; >>> > - for (unsigned i = 0, e = Targets.size(); i != e; ++i) { >>> > - OS << " " << Targets[i].first; >>> > - OS.indent(Width - Targets[i].first.size()) << " - " >>> > - << Targets[i].second->getShortDescription() << '\n'; >>> > - } >>> > - if (Targets.empty()) >>> > - OS << " (none)\n"; >>> > -} >>> > >>> > Modified: llvm/trunk/lib/Target/CMakeLists.txt >>> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=135760&r1=135759&r2=135760&view=diff >>> > ============================================================================== >>> > --- llvm/trunk/lib/Target/CMakeLists.txt (original) >>> > +++ llvm/trunk/lib/Target/CMakeLists.txt Fri Jul 22 03:16:53 2011 >>> > @@ -11,6 +11,7 @@ >>> > TargetLoweringObjectFile.cpp >>> > TargetMachine.cpp >>> > TargetRegisterInfo.cpp >>> > + TargetRegistry.cpp >>> > TargetSubtargetInfo.cpp >>> > ) >>> > >>> > >>> > Copied: llvm/trunk/lib/Target/TargetRegistry.cpp (from r135759, llvm/trunk/lib/Support/TargetRegistry.cpp) >>> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegistry.cpp?p2=llvm/trunk/lib/Target/TargetRegistry.cpp&p1=llvm/trunk/lib/Support/TargetRegistry.cpp&r1=135759&r2=135760&rev=135760&view=diff >>> > ============================================================================== >>> > (empty) >>> > >>> > >>> > _______________________________________________ >>> > llvm-commits mailing list >>> > llvm-commits at cs.uiuc.edu >>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > _______________________________________________ > 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/20110801/b57af3c0/attachment-0001.html From criswell at uiuc.edu Mon Aug 1 14:44:05 2011 From: criswell at uiuc.edu (John Criswell) Date: Mon, 01 Aug 2011 19:44:05 -0000 Subject: [llvm-commits] [www] r136640 - /www/trunk/Users.html Message-ID: <20110801194405.824ED2A6C12C@llvm.org> Author: criswell Date: Mon Aug 1 14:44:05 2011 New Revision: 136640 URL: http://llvm.org/viewvc/llvm-project?rev=136640&view=rev Log: Updated the URL to Vikram's home page. Began a list of projects in Vikram's research group that have web pages and use LLVM. Modified: www/trunk/Users.html Modified: www/trunk/Users.html URL: http://llvm.org/viewvc/llvm-project/www/trunk/Users.html?rev=136640&r1=136639&r2=136640&view=diff ============================================================================== --- www/trunk/Users.html (original) +++ www/trunk/Users.html Mon Aug 1 14:44:05 2011 @@ -480,9 +480,11 @@ University of Illinois at Urbana-Champaign - Vikram Adve's Research Group + Vikram Adve's Research Group - All LLVM Group Research Projects + + Secure Virtual Architecture/SAFECode + From clattner at apple.com Mon Aug 1 14:49:58 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 01 Aug 2011 12:49:58 -0700 Subject: [llvm-commits] [llvm] r136638 - /llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp In-Reply-To: <20110801191627.160372A6C12C@llvm.org> References: <20110801191627.160372A6C12C@llvm.org> Message-ID: <0EC87048-CCAA-4931-8BC6-734B6DC11AEB@apple.com> On Aug 1, 2011, at 12:16 PM, Jakub Staszak wrote: > Author: kuba > Date: Mon Aug 1 14:16:26 2011 > New Revision: 136638 > > URL: http://llvm.org/viewvc/llvm-project?rev=136638&view=rev > Log: > Change SmallVector to SmallPtrSet in BranchProbabilityInfo. Handle cases where > one than one successor goes to the same block. Hi Kuba, Are you sure that this won't introduce non-determinstic behavior? You're iterating over the sets, which will now be in "random order". -Chris > > Modified: > llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp > > Modified: llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp?rev=136638&r1=136637&r2=136638&view=diff > ============================================================================== > --- llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp (original) > +++ llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp Mon Aug 1 14:16:26 2011 > @@ -142,15 +142,15 @@ > if (BB->getTerminator()->getNumSuccessors() == 1) > return false; > > - SmallVector ReturningEdges; > - SmallVector StayEdges; > + SmallPtrSet ReturningEdges; > + SmallPtrSet StayEdges; > > for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { > BasicBlock *Succ = *I; > if (isReturningBlock(Succ)) > - ReturningEdges.push_back(Succ); > + ReturningEdges.insert(Succ); > else > - StayEdges.push_back(Succ); > + StayEdges.insert(Succ); > } > > if (uint32_t numStayEdges = StayEdges.size()) { > @@ -158,7 +158,7 @@ > if (stayWeight < NORMAL_WEIGHT) > stayWeight = NORMAL_WEIGHT; > > - for (SmallVector::iterator I = StayEdges.begin(), > + for (SmallPtrSet::iterator I = StayEdges.begin(), > E = StayEdges.end(); I != E; ++I) > BP->setEdgeWeight(BB, *I, stayWeight); > } > @@ -167,7 +167,7 @@ > uint32_t retWeight = RH_NONTAKEN_WEIGHT / numRetEdges; > if (retWeight < MIN_WEIGHT) > retWeight = MIN_WEIGHT; > - for (SmallVector::iterator I = ReturningEdges.begin(), > + for (SmallPtrSet::iterator I = ReturningEdges.begin(), > E = ReturningEdges.end(); I != E; ++I) { > BP->setEdgeWeight(BB, *I, retWeight); > } > @@ -220,9 +220,9 @@ > if (!L) > return false; > > - SmallVector BackEdges; > - SmallVector ExitingEdges; > - SmallVector InEdges; // Edges from header to the loop. > + SmallPtrSet BackEdges; > + SmallPtrSet ExitingEdges; > + SmallPtrSet InEdges; // Edges from header to the loop. > > bool isHeader = BB == L->getHeader(); > > @@ -230,11 +230,11 @@ > BasicBlock *Succ = *I; > Loop *SuccL = LI->getLoopFor(Succ); > if (SuccL != L) > - ExitingEdges.push_back(Succ); > + ExitingEdges.insert(Succ); > else if (Succ == L->getHeader()) > - BackEdges.push_back(Succ); > + BackEdges.insert(Succ); > else if (isHeader) > - InEdges.push_back(Succ); > + InEdges.insert(Succ); > } > > if (uint32_t numBackEdges = BackEdges.size()) { > @@ -242,7 +242,7 @@ > if (backWeight < NORMAL_WEIGHT) > backWeight = NORMAL_WEIGHT; > > - for (SmallVector::iterator EI = BackEdges.begin(), > + for (SmallPtrSet::iterator EI = BackEdges.begin(), > EE = BackEdges.end(); EI != EE; ++EI) { > BasicBlock *Back = *EI; > BP->setEdgeWeight(BB, Back, backWeight); > @@ -254,7 +254,7 @@ > if (inWeight < NORMAL_WEIGHT) > inWeight = NORMAL_WEIGHT; > > - for (SmallVector::iterator EI = InEdges.begin(), > + for (SmallPtrSet::iterator EI = InEdges.begin(), > EE = InEdges.end(); EI != EE; ++EI) { > BasicBlock *Back = *EI; > BP->setEdgeWeight(BB, Back, inWeight); > @@ -267,7 +267,7 @@ > if (exitWeight < MIN_WEIGHT) > exitWeight = MIN_WEIGHT; > > - for (SmallVector::iterator EI = ExitingEdges.begin(), > + for (SmallPtrSet::iterator EI = ExitingEdges.begin(), > EE = ExitingEdges.end(); EI != EE; ++EI) { > BasicBlock *Exiting = *EI; > BP->setEdgeWeight(BB, Exiting, exitWeight); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From bruno.cardoso at gmail.com Mon Aug 1 14:51:53 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 01 Aug 2011 19:51:53 -0000 Subject: [llvm-commits] [llvm] r136642 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/avx-256.ll Message-ID: <20110801195153.E182C2A6C12C@llvm.org> Author: bruno Date: Mon Aug 1 14:51:53 2011 New Revision: 136642 URL: http://llvm.org/viewvc/llvm-project?rev=136642&view=rev Log: Since vectors with all ones can't be created with a 256-bit instruction, avoid returning early for v8i32 types, which would only be valid for vector with all zeros. Also split the handling of zeros and ones into separate checking logic since they are handled differently. This fixes PR10547 Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/avx-256.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=136642&r1=136641&r2=136642&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 1 14:51:53 2011 @@ -4673,24 +4673,26 @@ EVT ExtVT = VT.getVectorElementType(); unsigned NumElems = Op.getNumOperands(); - // All zero's: - // - pxor (SSE2), xorps (SSE1), vpxor (128 AVX), xorp[s|d] (256 AVX) - // All one's: - // - pcmpeqd (SSE2 and 128 AVX), fallback to constant pools (256 AVX) - if (ISD::isBuildVectorAllZeros(Op.getNode()) || - ISD::isBuildVectorAllOnes(Op.getNode())) { - // Canonicalize this to <4 x i32> or <8 x 32> (SSE) to - // 1) ensure the zero vectors are CSE'd, and 2) ensure that i64 scalars are - // eliminated on x86-32 hosts. + // Vectors containing all zeros can be matched by pxor and xorps later + if (ISD::isBuildVectorAllZeros(Op.getNode())) { + // Canonicalize this to <4 x i32> to 1) ensure the zero vectors are CSE'd + // and 2) ensure that i64 scalars are eliminated on x86-32 hosts. if (Op.getValueType() == MVT::v4i32 || Op.getValueType() == MVT::v8i32) return Op; - if (ISD::isBuildVectorAllOnes(Op.getNode())) - return getOnesVector(Op.getValueType(), DAG, dl); return getZeroVector(Op.getValueType(), Subtarget->hasSSE2(), DAG, dl); } + // Vectors containing all ones can be matched by pcmpeqd on 128-bit width + // vectors or broken into v4i32 operations on 256-bit vectors. + if (ISD::isBuildVectorAllOnes(Op.getNode())) { + if (Op.getValueType() == MVT::v4i32) + return Op; + + return getOnesVector(Op.getValueType(), DAG, dl); + } + unsigned EVTBits = ExtVT.getSizeInBits(); unsigned NumZero = 0; Modified: llvm/trunk/test/CodeGen/X86/avx-256.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256.ll?rev=136642&r1=136641&r2=136642&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/avx-256.ll (original) +++ llvm/trunk/test/CodeGen/X86/avx-256.ll Mon Aug 1 14:51:53 2011 @@ -24,3 +24,12 @@ float>* %ptr2vec615, align 32 ret void } + +; CHECK: vpcmpeqd +; CHECK: vinsertf128 $1 +define void @ones2([0 x i32]* nocapture %RET, [0 x i32]* nocapture %aFOO) nounwind { +allocas: + %ptr2vec615 = bitcast [0 x i32]* %RET to <8 x i32>* + store <8 x i32> , <8 x i32>* %ptr2vec615, align 32 + ret void +} From jstaszak at apple.com Mon Aug 1 14:53:32 2011 From: jstaszak at apple.com (Jakub Staszak) Date: Mon, 01 Aug 2011 12:53:32 -0700 Subject: [llvm-commits] [llvm] r136638 - /llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp In-Reply-To: <0EC87048-CCAA-4931-8BC6-734B6DC11AEB@apple.com> References: <20110801191627.160372A6C12C@llvm.org> <0EC87048-CCAA-4931-8BC6-734B6DC11AEB@apple.com> Message-ID: <0D5F612D-4DD7-46BD-B28C-DCEF5903A266@apple.com> On Aug 1, 2011, at 12:49 PM, Chris Lattner wrote: > > On Aug 1, 2011, at 12:16 PM, Jakub Staszak wrote: > >> Author: kuba >> Date: Mon Aug 1 14:16:26 2011 >> New Revision: 136638 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=136638&view=rev >> Log: >> Change SmallVector to SmallPtrSet in BranchProbabilityInfo. Handle cases where >> one than one successor goes to the same block. > > Hi Kuba, > > Are you sure that this won't introduce non-determinstic behavior? You're iterating over the sets, which will now be in "random order". Order of the iterations doesn't make any difference because all we do is we set the same value to the all successors in the SmallPtrSet. - Kuba From clattner at apple.com Mon Aug 1 14:55:16 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 01 Aug 2011 12:55:16 -0700 Subject: [llvm-commits] [llvm] r136638 - /llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp In-Reply-To: <0D5F612D-4DD7-46BD-B28C-DCEF5903A266@apple.com> References: <20110801191627.160372A6C12C@llvm.org> <0EC87048-CCAA-4931-8BC6-734B6DC11AEB@apple.com> <0D5F612D-4DD7-46BD-B28C-DCEF5903A266@apple.com> Message-ID: <2DAD3394-4715-4414-8A83-F34D7EB24303@apple.com> On Aug 1, 2011, at 12:53 PM, Jakub Staszak wrote: >> >> Are you sure that this won't introduce non-determinstic behavior? You're iterating over the sets, which will now be in "random order". > > Order of the iterations doesn't make any difference because all we do is we set the same value to the all successors in the SmallPtrSet. > Ok! From chandlerc at gmail.com Mon Aug 1 14:55:11 2011 From: chandlerc at gmail.com (Chandler Carruth) Date: Mon, 01 Aug 2011 19:55:11 -0000 Subject: [llvm-commits] [llvm] r136643 - in /llvm/trunk/lib/Target: Blackfin/TargetInfo/CMakeLists.txt CellSPU/TargetInfo/CMakeLists.txt MBlaze/TargetInfo/CMakeLists.txt MSP430/TargetInfo/CMakeLists.txt Mips/TargetInfo/CMakeLists.txt PTX/TargetInfo/CMakeLists.txt PowerPC/TargetInfo/CMakeLists.txt Sparc/TargetInfo/CMakeLists.txt SystemZ/TargetInfo/CMakeLists.txt Message-ID: <20110801195512.0E4262A6C12C@llvm.org> Author: chandlerc Date: Mon Aug 1 14:55:11 2011 New Revision: 136643 URL: http://llvm.org/viewvc/llvm-project?rev=136643&view=rev Log: Actually finish switching to the new system for Target sublibrary TableGen deps introduced in r136023. This completes the fixing that dgregor started in r136621. Sorry for missing these the first time around. This should fix some of the random race-condition failures people are still seeing with CMake. Modified: llvm/trunk/lib/Target/Blackfin/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/CellSPU/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/MBlaze/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/MSP430/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/Mips/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/PTX/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/PowerPC/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/Sparc/TargetInfo/CMakeLists.txt llvm/trunk/lib/Target/SystemZ/TargetInfo/CMakeLists.txt Modified: llvm/trunk/lib/Target/Blackfin/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Blackfin/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMBlackfinInfo BlackfinCodeGenTable_gen) +add_dependencies(LLVMBlackfinInfo BlackfinCommonTableGen) Modified: llvm/trunk/lib/Target/CellSPU/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/CellSPU/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMCellSPUInfo CellSPUCodeGenTable_gen) +add_dependencies(LLVMCellSPUInfo CellSPUCommonTableGen) Modified: llvm/trunk/lib/Target/MBlaze/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/MBlaze/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/MBlaze/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -11,4 +11,4 @@ LLVMTarget ) -add_dependencies(LLVMMBlazeInfo MBlazeCodeGenTable_gen) +add_dependencies(LLVMMBlazeInfo MBlazeCommonTableGen) Modified: llvm/trunk/lib/Target/MSP430/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/MSP430/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMMSP430Info MSP430CodeGenTable_gen) +add_dependencies(LLVMMSP430Info MSP430CommonTableGen) Modified: llvm/trunk/lib/Target/Mips/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Mips/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMMipsInfo MipsCodeGenTable_gen) +add_dependencies(LLVMMipsInfo MipsCommonTableGen) Modified: llvm/trunk/lib/Target/PTX/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/PTX/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/PTX/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMPTXInfo PTXCodeGenTable_gen) +add_dependencies(LLVMPTXInfo PTXCommonTableGen) Modified: llvm/trunk/lib/Target/PowerPC/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/PowerPC/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMPowerPCInfo PowerPCCodeGenTable_gen) +add_dependencies(LLVMPowerPCInfo PowerPCCommonTableGen) Modified: llvm/trunk/lib/Target/Sparc/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Sparc/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMSparcInfo SparcCodeGenTable_gen) +add_dependencies(LLVMSparcInfo SparcCommonTableGen) Modified: llvm/trunk/lib/Target/SystemZ/TargetInfo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/TargetInfo/CMakeLists.txt?rev=136643&r1=136642&r2=136643&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/TargetInfo/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/SystemZ/TargetInfo/CMakeLists.txt Mon Aug 1 14:55:11 2011 @@ -10,4 +10,4 @@ LLVMTarget ) -add_dependencies(LLVMSystemZInfo SystemZCodeGenTable_gen) +add_dependencies(LLVMSystemZInfo SystemZCommonTableGen) From resistor at mac.com Mon Aug 1 15:06:49 2011 From: resistor at mac.com (Owen Anderson) Date: Mon, 01 Aug 2011 20:06:49 -0000 Subject: [llvm-commits] [llvm] r136645 - /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Message-ID: <20110801200649.4ABB22A6C12C@llvm.org> Author: resistor Date: Mon Aug 1 15:06:49 2011 New Revision: 136645 URL: http://llvm.org/viewvc/llvm-project?rev=136645&view=rev Log: The FixedLenDecoder needs to gracefully handle failing per-instruction decoder hooks in addition to per-operand decoder hooks. Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=136645&r1=136644&r2=136645&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Mon Aug 1 15:06:49 2011 @@ -566,7 +566,7 @@ "static bool decode" << Namespace << "Instruction" << BitWidth << "(MCInst &MI, uint" << BitWidth << "_t insn, uint64_t Address, " << "const void *Decoder) {\n"; - o.indent(Indentation) << " unsigned tmp = 0;\n(void)tmp;\n"; + o.indent(Indentation) << " unsigned tmp = 0;\n (void)tmp;\n"; ++Indentation; ++Indentation; // Emits code to decode the instructions. @@ -776,8 +776,8 @@ I = InsnOperands.begin(), E = InsnOperands.end(); I != E; ++I) { // If a custom instruction decoder was specified, use that. if (I->numFields() == 0 && I->Decoder.size()) { - o.indent(Indentation) << " " << I->Decoder - << "(MI, insn, Address, Decoder);\n"; + o.indent(Indentation) << " if (!" << I->Decoder + << "(MI, insn, Address, Decoder)) return false;\n"; break; } From rdivacky at freebsd.org Mon Aug 1 15:38:27 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Mon, 01 Aug 2011 20:38:27 -0000 Subject: [llvm-commits] [llvm] r136646 - /llvm/trunk/docs/CodeGenerator.html Message-ID: <20110801203828.07EE92A6C12C@llvm.org> Author: rdivacky Date: Mon Aug 1 15:38:27 2011 New Revision: 136646 URL: http://llvm.org/viewvc/llvm-project?rev=136646&view=rev Log: Fix a typo. Modified: llvm/trunk/docs/CodeGenerator.html Modified: llvm/trunk/docs/CodeGenerator.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodeGenerator.html?rev=136646&r1=136645&r2=136646&view=diff ============================================================================== --- llvm/trunk/docs/CodeGenerator.html (original) +++ llvm/trunk/docs/CodeGenerator.html Mon Aug 1 15:38:27 2011 @@ -1830,7 +1830,7 @@

The compact unwind encoding is a 32-bit value, which is encoded in an architecture-specific way. It specifies which registers to restore and from - where, and how to unwind out of the funciton. When the linker creates a final + where, and how to unwind out of the function. When the linker creates a final linked image, it will create a __TEXT,__unwind_info section. This section is a small and fast way for the runtime to access unwind info for any given function. If we emit compact unwind info for the From bruno.cardoso at gmail.com Mon Aug 1 16:54:02 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 01 Aug 2011 21:54:02 -0000 Subject: [llvm-commits] [llvm] r136652 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <20110801215402.D9C582A6C12C@llvm.org> Author: bruno Date: Mon Aug 1 16:54:02 2011 New Revision: 136652 URL: http://llvm.org/viewvc/llvm-project?rev=136652&view=rev Log: Lower CONCAT_VECTORS to use two VINSERTF128 instructions instead of using a stack store. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=136652&r1=136651&r2=136652&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 1 16:54:02 2011 @@ -967,6 +967,13 @@ setOperationAction(ISD::FP_TO_SINT, MVT::v8i32, Legal); setOperationAction(ISD::SINT_TO_FP, MVT::v8i32, Legal); + setOperationAction(ISD::CONCAT_VECTORS, MVT::v4f64, Custom); + setOperationAction(ISD::CONCAT_VECTORS, MVT::v4i64, Custom); + setOperationAction(ISD::CONCAT_VECTORS, MVT::v8f32, Custom); + setOperationAction(ISD::CONCAT_VECTORS, MVT::v8i32, Custom); + setOperationAction(ISD::CONCAT_VECTORS, MVT::v32i8, Custom); + setOperationAction(ISD::CONCAT_VECTORS, MVT::v16i16, Custom); + // Custom lower several nodes for 256-bit types. for (unsigned i = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) { @@ -4984,13 +4991,12 @@ return SDValue(); } -SDValue -X86TargetLowering::LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const { - // We support concatenate two MMX registers and place them in a MMX - // register. This is better than doing a stack convert. +// LowerMMXCONCAT_VECTORS - We support concatenate two MMX registers and place +// them in a MMX register. This is better than doing a stack convert. +static SDValue LowerMMXCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) { DebugLoc dl = Op.getDebugLoc(); EVT ResVT = Op.getValueType(); - assert(Op.getNumOperands() == 2); + assert(ResVT == MVT::v2i64 || ResVT == MVT::v4i32 || ResVT == MVT::v8i16 || ResVT == MVT::v16i8); int Mask[2]; @@ -5011,6 +5017,43 @@ return DAG.getNode(ISD::BITCAST, dl, ResVT, VecOp); } +// LowerAVXCONCAT_VECTORS - 256-bit AVX can use the vinsertf128 instruction +// to create 256-bit vectors from two other 128-bit ones. +static SDValue LowerAVXCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) { + DebugLoc dl = Op.getDebugLoc(); + EVT ResVT = Op.getValueType(); + + assert(ResVT.getSizeInBits() == 256 && "Value type must be 256-bit wide"); + + SDValue V1 = Op.getOperand(0); + SDValue V2 = Op.getOperand(1); + unsigned NumElems = ResVT.getVectorNumElements(); + + SDValue V = Insert128BitVector(DAG.getNode(ISD::UNDEF, dl, ResVT), V1, + DAG.getConstant(0, MVT::i32), DAG, dl); + return Insert128BitVector(V, V2, DAG.getConstant(NumElems/2, MVT::i32), + DAG, dl); +} + +SDValue +X86TargetLowering::LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const { + DebugLoc dl = Op.getDebugLoc(); + EVT ResVT = Op.getValueType(); + + assert(Op.getNumOperands() == 2); + assert((ResVT.getSizeInBits() == 128 || ResVT.getSizeInBits() == 256) && + "Unsupported CONCAT_VECTORS for value type"); + + // We support concatenate two MMX registers and place them in a MMX register. + // This is better than doing a stack convert. + if (ResVT.is128BitVector()) + return LowerMMXCONCAT_VECTORS(Op, DAG); + + // 256-bit AVX can use the vinsertf128 instruction to create 256-bit vectors + // from two other 128-bit ones. + return LowerAVXCONCAT_VECTORS(Op, DAG); +} + // v8i16 shuffles - Prefer shuffles in the following order: // 1. [all] pshuflw, pshufhw, optional move // 2. [ssse3] 1 x pshufb From bruno.cardoso at gmail.com Mon Aug 1 16:54:05 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 01 Aug 2011 21:54:05 -0000 Subject: [llvm-commits] [llvm] r136653 - in /llvm/trunk/lib/Target/X86: X86FastISel.cpp X86ISelDAGToDAG.cpp X86ISelLowering.cpp Message-ID: <20110801215405.E13592A6C12D@llvm.org> Author: bruno Date: Mon Aug 1 16:54:05 2011 New Revision: 136653 URL: http://llvm.org/viewvc/llvm-project?rev=136653&view=rev Log: Teach PreprocessISelDAG to be aware of vector types and to not process them. Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=136653&r1=136652&r2=136653&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Aug 1 16:54:05 2011 @@ -59,8 +59,8 @@ explicit X86FastISel(FunctionLoweringInfo &funcInfo) : FastISel(funcInfo) { Subtarget = &TM.getSubtarget(); StackPtr = Subtarget->is64Bit() ? X86::RSP : X86::ESP; - X86ScalarSSEf64 = Subtarget->hasSSE2(); - X86ScalarSSEf32 = Subtarget->hasSSE1(); + X86ScalarSSEf64 = Subtarget->hasSSE2() || Subtarget->hasAVX(); + X86ScalarSSEf32 = Subtarget->hasSSE1() || Subtarget->hasAVX(); } virtual bool TargetSelectInstruction(const Instruction *I); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=136653&r1=136652&r2=136653&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug 1 16:54:05 2011 @@ -474,10 +474,15 @@ if (N->getOpcode() != ISD::FP_ROUND && N->getOpcode() != ISD::FP_EXTEND) continue; - // If the source and destination are SSE registers, then this is a legal - // conversion that should not be lowered. EVT SrcVT = N->getOperand(0).getValueType(); EVT DstVT = N->getValueType(0); + + // If any of the sources are vectors, no fp stack involved. + if (SrcVT.isVector() || DstVT.isVector()) + continue; + + // If the source and destination are SSE registers, then this is a legal + // conversion that should not be lowered. bool SrcIsSSE = X86Lowering.isScalarFPTypeInSSEReg(SrcVT); bool DstIsSSE = X86Lowering.isScalarFPTypeInSSEReg(DstVT); if (SrcIsSSE && DstIsSSE) Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=136653&r1=136652&r2=136653&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 1 16:54:05 2011 @@ -168,8 +168,8 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM) : TargetLowering(TM, createTLOF(TM)) { Subtarget = &TM.getSubtarget(); - X86ScalarSSEf64 = Subtarget->hasXMMInt(); - X86ScalarSSEf32 = Subtarget->hasXMM(); + X86ScalarSSEf64 = Subtarget->hasXMMInt() || Subtarget->hasAVX(); + X86ScalarSSEf32 = Subtarget->hasXMM() || Subtarget->hasAVX(); X86StackPtr = Subtarget->is64Bit() ? X86::RSP : X86::ESP; RegInfo = TM.getRegisterInfo(); From bruno.cardoso at gmail.com Mon Aug 1 16:54:09 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 01 Aug 2011 21:54:09 -0000 Subject: [llvm-commits] [llvm] r136654 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/avx-256-cvt.ll Message-ID: <20110801215409.733B92A6C12E@llvm.org> Author: bruno Date: Mon Aug 1 16:54:09 2011 New Revision: 136654 URL: http://llvm.org/viewvc/llvm-project?rev=136654&view=rev Log: Add v4f64 -> v2f32 fp_round support. Also add a testcase to exercise the legalizer. This commit together with the two previous ones fixes PR10495. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=136654&r1=136653&r2=136654&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 1 16:54:09 2011 @@ -966,6 +966,7 @@ setOperationAction(ISD::FP_TO_SINT, MVT::v8i32, Legal); setOperationAction(ISD::SINT_TO_FP, MVT::v8i32, Legal); + setOperationAction(ISD::FP_ROUND, MVT::v4f32, Legal); setOperationAction(ISD::CONCAT_VECTORS, MVT::v4f64, Custom); setOperationAction(ISD::CONCAT_VECTORS, MVT::v4i64, Custom); Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=136654&r1=136653&r2=136654&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Aug 1 16:54:09 2011 @@ -1054,6 +1054,12 @@ def : Pat<(int_x86_avx_cvtt_ps2dq_256 (memopv8f32 addr:$src)), (VCVTTPS2DQYrm addr:$src)>; +// Match fround for 128/256-bit conversions +def : Pat<(v4f32 (fround (v4f64 VR256:$src))), + (VCVTPD2PSYrr VR256:$src)>; +def : Pat<(v4f32 (fround (loadv4f64 addr:$src))), + (VCVTPD2PSYrm addr:$src)>; + //===----------------------------------------------------------------------===// // SSE 1 & 2 - Compare Instructions //===----------------------------------------------------------------------===// Modified: llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll?rev=136654&r1=136653&r2=136654&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll (original) +++ llvm/trunk/test/CodeGen/X86/avx-256-cvt.ll Mon Aug 1 16:54:09 2011 @@ -12,3 +12,10 @@ ret <8 x i32> %b } +; CHECK: vcvtpd2psy %ymm +; CHECK-NEXT: vcvtpd2psy %ymm +; CHECK-NEXT: vinsertf128 $1 +define <8 x float> @funcC(<8 x double> %b) nounwind { + %a = fptrunc <8 x double> %b to <8 x float> + ret <8 x float> %a +} From grosbach at apple.com Mon Aug 1 16:55:12 2011 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 01 Aug 2011 21:55:12 -0000 Subject: [llvm-commits] [llvm] r136655 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Message-ID: <20110801215512.EFA492A6C12C@llvm.org> Author: grosbach Date: Mon Aug 1 16:55:12 2011 New Revision: 136655 URL: http://llvm.org/viewvc/llvm-project?rev=136655&view=rev Log: Fix comments. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=136655&r1=136654&r2=136655&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Aug 1 16:55:12 2011 @@ -489,7 +489,7 @@ return ARM_AM::isSOImmTwoPartVal((unsigned)N->getZExtValue()); }]>; -/// imm0_7 predicate - Immediate in the range [0,31]. +/// imm0_7 predicate - Immediate in the range [0,7]. def Imm0_7AsmOperand: AsmOperandClass { let Name = "Imm0_7"; } def imm0_7 : Operand, ImmLeaf= 0 && Imm < 8; @@ -497,7 +497,7 @@ let ParserMatchClass = Imm0_7AsmOperand; } -/// imm0_15 predicate - Immediate in the range [0,31]. +/// imm0_15 predicate - Immediate in the range [0,15]. def Imm0_15AsmOperand: AsmOperandClass { let Name = "Imm0_15"; } def imm0_15 : Operand, ImmLeaf= 0 && Imm < 16; From chandlerc at gmail.com Mon Aug 1 17:01:41 2011 From: chandlerc at gmail.com (Chandler Carruth) Date: Mon, 1 Aug 2011 15:01:41 -0700 Subject: [llvm-commits] [llvm] r135760 - in /llvm/trunk: cmake/modules/LLVMLibDeps.cmake lib/Support/CMakeLists.txt lib/Support/TargetRegistry.cpp lib/Target/CMakeLists.txt lib/Target/TargetRegistry.cpp In-Reply-To: <8C219416-76F7-49A8-A569-C3825DD861D6@apple.com> References: <20110722081654.11A932A6C12E@llvm.org> <8E0E92A0-3D18-45EB-AB84-51F0B7148DD5@apple.com> <24FFFF91-D94C-47EE-88A5-EF75658DEC6D@apple.com> <8C219416-76F7-49A8-A569-C3825DD861D6@apple.com> Message-ID: On Mon, Aug 1, 2011 at 12:44 PM, Evan Cheng wrote: > > On Aug 1, 2011, at 12:36 PM, Chandler Carruth wrote: > > On Mon, Aug 1, 2011 at 11:47 AM, Evan Cheng wrote: > >> Hi Chandler, >> >> Are you planning to fix this? >> > > Yes, I just got pre-empted by really really bad CMake issues. If you get > time to hack on it first, that's cool. Otherwise I should get to it in the > next couple of days. > > > Thanks, please do. I've verified this bug has increased size of release > build of llvm-mc by about 900k. > I understand that llvm-mc has grown because of this, but previously it only worked by happenstance. Everything related to TargetMachine was confined to inline functions, and all of the classes managed to be incomplete, and so things "just worked", but that doesn't seem realistically tenable. I started looking at how this could be fixed without the size increase to llvm-mc, but moving everything to Support really doesn't feel like the right solution. Fundamentally, I feel like there are several different registries intermingled into one file here. Were we to separate them, they would each have a more logical home: 1) Abstract Target / Triple registration. Essentially this is only concerned with mapping particular triples to some abstract target. This seems to make a lot of sense for Support. It also wouldn't (by default) register anything, simply exposing the fundamental APIs and the *means* of registering. 2) MC-subsystem registration. This is the registration of various MC subsystems for a particular abstract target. This makes the most sense to live in the MC layer. The clients of this layer are already MC clients (Info, Desc, Disassembler ...). They could specialize the abstract target as an MCTarget (or some better name), and register it with the appropriate facilities. 3) TargetMachine registration. This is the registration of the concrete target machine representation used by the codegen layer to model a particular target. This makes sense to live in the Target layer, and could either specialize MCTarget with any further information needed or (in the case of say CBackend) directly specialize the abstract target, etc. The reason I feel this shouldn't be sunk into Support is that it leaks all of these concepts (MC, TargetMachine, MCStreamer, InstPrinter, Disassembler) into the Support library. Clients of it might easily fail to depend on the appropriate libraries to actually cause entities to be registered that they want to query, etc etc. That said, the above is a lot more work, and not likely something I can tackle this week. What are your thoughts here? Is the current state one we can live with for a few weeks? -Chandler -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/67709fcc/attachment.html From grosbach at apple.com Mon Aug 1 17:02:20 2011 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 01 Aug 2011 22:02:20 -0000 Subject: [llvm-commits] [llvm] r136656 - in /llvm/trunk/lib/Target/ARM: ARMInstrInfo.td ARMInstrThumb.td Message-ID: <20110801220220.446312A6C12C@llvm.org> Author: grosbach Date: Mon Aug 1 17:02:20 2011 New Revision: 136656 URL: http://llvm.org/viewvc/llvm-project?rev=136656&view=rev Log: Move imm0_255 to ARMInstrInfo.td with the other immediate predicates. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=136656&r1=136655&r2=136656&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Aug 1 17:02:20 2011 @@ -513,6 +513,12 @@ let ParserMatchClass = Imm0_31AsmOperand; } +/// imm0_255 predicate - Immediate in the range [0,255]. +def Imm0_255AsmOperand : AsmOperandClass { let Name = "Imm0_255"; } +def imm0_255 : Operand, ImmLeaf= 0 && Imm < 256; }]> { + let ParserMatchClass = Imm0_255AsmOperand; +} + // imm0_65535_expr - For movt/movw - 16-bit immediate that can also reference // a relocatable expression. // Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=136656&r1=136655&r2=136656&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Aug 1 17:02:20 2011 @@ -30,10 +30,6 @@ return (uint32_t)-N->getZExtValue() < 8; }], imm_neg_XFORM>; -def imm0_255_asmoperand : AsmOperandClass { let Name = "Imm0_255"; } -def imm0_255 : Operand, ImmLeaf= 0 && Imm < 256; }]> { - let ParserMatchClass = imm0_255_asmoperand; -} def imm0_255_comp : PatLeaf<(i32 imm), [{ return ~((uint32_t)N->getZExtValue()) < 256; }]>; From grosser at fim.uni-passau.de Mon Aug 1 17:39:01 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Mon, 01 Aug 2011 22:39:01 -0000 Subject: [llvm-commits] [polly] r136657 - in /polly/trunk/lib: CodeGeneration.cpp ScheduleOptimizer.cpp Message-ID: <20110801223901.1340F2A6C12C@llvm.org> Author: grosser Date: Mon Aug 1 17:39:00 2011 New Revision: 136657 URL: http://llvm.org/viewvc/llvm-project?rev=136657&view=rev Log: Fix two compiler warnings One of them actually pointed to an invalid condition in an assert. Modified: polly/trunk/lib/CodeGeneration.cpp polly/trunk/lib/ScheduleOptimizer.cpp Modified: polly/trunk/lib/CodeGeneration.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=136657&r1=136656&r2=136657&view=diff ============================================================================== --- polly/trunk/lib/CodeGeneration.cpp (original) +++ polly/trunk/lib/CodeGeneration.cpp Mon Aug 1 17:39:00 2011 @@ -1434,7 +1434,7 @@ // bb0 // | // polly.splitBlock - // / \ + // / \. // | startBlock // | | // orig_scop new_scop Modified: polly/trunk/lib/ScheduleOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=136657&r1=136656&r2=136657&view=diff ============================================================================== --- polly/trunk/lib/ScheduleOptimizer.cpp (original) +++ polly/trunk/lib/ScheduleOptimizer.cpp Mon Aug 1 17:39:00 2011 @@ -213,7 +213,7 @@ int scheduleDimensions, int parameterDimensions, int vectorWidth = 4) { - assert (0 <= vectorDimension < scheduleDimensions); + assert (0 <= vectorDimension && vectorDimension < scheduleDimensions); isl_dim *dim = isl_dim_alloc(ctx, parameterDimensions, scheduleDimensions, scheduleDimensions + 2); From evan.cheng at apple.com Mon Aug 1 17:40:29 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 01 Aug 2011 15:40:29 -0700 Subject: [llvm-commits] [llvm] r135760 - in /llvm/trunk: cmake/modules/LLVMLibDeps.cmake lib/Support/CMakeLists.txt lib/Support/TargetRegistry.cpp lib/Target/CMakeLists.txt lib/Target/TargetRegistry.cpp In-Reply-To: References: <20110722081654.11A932A6C12E@llvm.org> <8E0E92A0-3D18-45EB-AB84-51F0B7148DD5@apple.com> <24FFFF91-D94C-47EE-88A5-EF75658DEC6D@apple.com> <8C219416-76F7-49A8-A569-C3825DD861D6@apple.com> Message-ID: On Aug 1, 2011, at 3:01 PM, Chandler Carruth wrote: > On Mon, Aug 1, 2011 at 12:44 PM, Evan Cheng wrote: > > On Aug 1, 2011, at 12:36 PM, Chandler Carruth wrote: > >> On Mon, Aug 1, 2011 at 11:47 AM, Evan Cheng wrote: >> Hi Chandler, >> >> Are you planning to fix this? >> >> Yes, I just got pre-empted by really really bad CMake issues. If you get time to hack on it first, that's cool. Otherwise I should get to it in the next couple of days. > > Thanks, please do. I've verified this bug has increased size of release build of llvm-mc by about 900k. > > I understand that llvm-mc has grown because of this, but previously it only worked by happenstance. Everything related to TargetMachine was confined to inline functions, and all of the classes managed to be incomplete, and so things "just worked", but that doesn't seem realistically tenable. No, I don't think it worked by luck. TargetRegistry is designed so it doesn't need the details of the class implementations. > > I started looking at how this could be fixed without the size increase to llvm-mc, but moving everything to Support really doesn't feel like the right solution. > > Fundamentally, I feel like there are several different registries intermingled into one file here. Were we to separate them, they would each have a more logical home: > > 1) Abstract Target / Triple registration. Essentially this is only concerned with mapping particular triples to some abstract target. This seems to make a lot of sense for Support. It also wouldn't (by default) register anything, simply exposing the fundamental APIs and the *means* of registering. > > 2) MC-subsystem registration. This is the registration of various MC subsystems for a particular abstract target. This makes the most sense to live in the MC layer. The clients of this layer are already MC clients (Info, Desc, Disassembler ...). They could specialize the abstract target as an MCTarget (or some better name), and register it with the appropriate facilities. > > 3) TargetMachine registration. This is the registration of the concrete target machine representation used by the codegen layer to model a particular target. This makes sense to live in the Target layer, and could either specialize MCTarget with any further information needed or (in the case of say CBackend) directly specialize the abstract target, etc. > > > The reason I feel this shouldn't be sunk into Support is that it leaks all of these concepts (MC, TargetMachine, MCStreamer, InstPrinter, Disassembler) into the Support library. Clients of it might easily fail to depend on the appropriate libraries to actually cause entities to be registered that they want to query, etc etc. I think you are over-thinking this a bit. TargetRegistry is just a collection of routines for creating target specific implementation of Target and MC classes. It's a bunch of "support" routines for clients, nothing more. Sure, they can be organized into Target / MC parts or that "TargetInfo" can be moved to a separate library. But I think there is limited value there. > > That said, the above is a lot more work, and not likely something I can tackle this week. What are your thoughts here? Is the current state one we can live with for a few weeks? I am not comfortable with a few weeks. Is it not possible to just move TargetRegistry.cpp back to Support? Evan > > -Chandler -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/5b2a4f34/attachment.html From resistor at mac.com Mon Aug 1 17:45:43 2011 From: resistor at mac.com (Owen Anderson) Date: Mon, 01 Aug 2011 22:45:43 -0000 Subject: [llvm-commits] [llvm] r136660 - /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Message-ID: <20110801224543.74CAA2A6C12C@llvm.org> Author: resistor Date: Mon Aug 1 17:45:43 2011 New Revision: 136660 URL: http://llvm.org/viewvc/llvm-project?rev=136660&view=rev Log: Make the FixedLengthDecoderEmitter smart enough to autogenerate decoders for encodings like "let Inst{11-7} = foo;", where the RHS has no bitwidth specifiers. Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=136660&r1=136659&r2=136660&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Mon Aug 1 17:45:43 2011 @@ -1267,8 +1267,14 @@ unsigned Offset = 0; for (unsigned bi = 0; bi < Bits.getNumBits(); ++bi) { + VarInit *Var = 0; VarBitInit *BI = dynamic_cast(Bits.getBit(bi)); - if (!BI) { + if (BI) + Var = dynamic_cast(BI->getVariable()); + else + Var = dynamic_cast(Bits.getBit(bi)); + + if (!Var) { if (Base != ~0U) { OpInfo.addField(Base, Width, Offset); Base = ~0U; @@ -1278,8 +1284,6 @@ continue; } - VarInit *Var = dynamic_cast(BI->getVariable()); - assert(Var); if (Var->getName() != NI->second && Var->getName() != TiedNames[NI->second]) { if (Base != ~0U) { @@ -1294,8 +1298,8 @@ if (Base == ~0U) { Base = bi; Width = 1; - Offset = BI->getBitNum(); - } else if (BI->getBitNum() != Offset + Width) { + Offset = BI ? BI->getBitNum() : 0; + } else if (BI && BI->getBitNum() != Offset + Width) { OpInfo.addField(Base, Width, Offset); Base = bi; Width = 1; From krasin at chromium.org Mon Aug 1 16:13:19 2011 From: krasin at chromium.org (Ivan Krasin) Date: Mon, 1 Aug 2011 14:13:19 -0700 Subject: [llvm-commits] X86 FastISel: Emit immediate call arguments locally to save stack size when compiling with -O0 Message-ID: Hi llvm team, this patch fixes the FastISel stack allocation strategy issue described here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-July/041452.html The solution is to emit immediate int arguments just before the call (instead of spilling them on stack at the beginning of the function) Please, take a look (the patch is attached the message and is also available here: http://codereview.chromium.org/7539010/) Thanks, Ivan Krasin -------------- next part -------------- A non-text attachment was scrubbed... Name: FastISel-krasin-v2.patch Type: text/x-patch Size: 3798 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/147a5183/attachment-0001.bin From krasin at chromium.org Mon Aug 1 19:28:20 2011 From: krasin at chromium.org (Ivan Krasin) Date: Mon, 1 Aug 2011 17:28:20 -0700 Subject: [llvm-commits] FastISel: don't handle volatile memset Message-ID: Hi llvm team, FastISel is not capable to handle volatile memcpy or memset. Currently, it fails graciously in case of memcpy, but it proceeds with volatile memset. This patch fixes this issue. Ivan Krasin -------------- next part -------------- A non-text attachment was scrubbed... Name: FastISel-no-volatile-memset.patch Type: text/x-patch Size: 502 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110801/14c458d0/attachment.bin From nicholas at mxc.ca Mon Aug 1 19:40:16 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 02 Aug 2011 00:40:16 -0000 Subject: [llvm-commits] [llvm] r136663 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp Message-ID: <20110802004016.C656D2A6C12C@llvm.org> Author: nicholas Date: Mon Aug 1 19:40:16 2011 New Revision: 136663 URL: http://llvm.org/viewvc/llvm-project?rev=136663&view=rev Log: Bail from FastISel when we encounter a volatile memset intrinsic. Patch by Ivan Krasin! Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=136663&r1=136662&r2=136663&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Aug 1 19:40:16 2011 @@ -1365,6 +1365,9 @@ case Intrinsic::memset: { const MemSetInst &MSI = cast(I); + if (MSI.isVolatile()) + return false; + unsigned SizeWidth = Subtarget->is64Bit() ? 64 : 32; if (!MSI.getLength()->getType()->isIntegerTy(SizeWidth)) return false; From nlewycky at google.com Mon Aug 1 19:41:22 2011 From: nlewycky at google.com (Nick Lewycky) Date: Mon, 1 Aug 2011 17:41:22 -0700 Subject: [llvm-commits] FastISel: don't handle volatile memset In-Reply-To: References: Message-ID: Thanks! Committed in r136663. On 1 August 2011 17:28, Ivan Krasin wrote: > Hi llvm team, > > FastISel is not capable to handle volatile memcpy or memset. > Currently, it fails graciously in case of memcpy, but it proceeds with > volatile memset. This patch fixes this issue. > > Ivan Krasin > > _______________________________________________ > 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/20110801/e72a9bec/attachment.html From eli.friedman at gmail.com Mon Aug 1 19:45:35 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 02 Aug 2011 00:45:35 -0000 Subject: [llvm-commits] [llvm] r136665 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <20110802004535.7492A2A6C12C@llvm.org> Author: efriedma Date: Mon Aug 1 19:45:35 2011 New Revision: 136665 URL: http://llvm.org/viewvc/llvm-project?rev=136665&view=rev Log: Fix a couple silly typos in IRBuilder in the new atomic instructions. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=136665&r1=136664&r2=136665&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Mon Aug 1 19:45:35 2011 @@ -770,14 +770,14 @@ SynchronizationScope SynchScope = CrossThread) { return Insert(new FenceInst(Context, Ordering, SynchScope)); } - FenceInst *CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, - AtomicOrdering Ordering, - SynchronizationScope SynchScope = CrossThread){ + AtomicCmpXchgInst *CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, + AtomicOrdering Ordering, + SynchronizationScope SynchScope = CrossThread) { return Insert(new AtomicCmpXchgInst(Ptr, Cmp, New, Ordering, SynchScope)); } - FenceInst *CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, - AtomicOrdering Ordering, - SynchronizationScope SynchScope = CrossThread) { + AtomicRMWInst *CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, + AtomicOrdering Ordering, + SynchronizationScope SynchScope = CrossThread) { return Insert(new AtomicRMWInst(Op, Ptr, Val, Ordering, SynchScope)); } Value *CreateGEP(Value *Ptr, ArrayRef IdxList, From eli.friedman at gmail.com Mon Aug 1 20:15:35 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 02 Aug 2011 01:15:35 -0000 Subject: [llvm-commits] [llvm] r136668 - /llvm/trunk/docs/LangRef.html Message-ID: <20110802011535.5AA462A6C12C@llvm.org> Author: efriedma Date: Mon Aug 1 20:15:34 2011 New Revision: 136668 URL: http://llvm.org/viewvc/llvm-project?rev=136668&view=rev Log: Minor wording tweak for memory model. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=136668&r1=136667&r2=136668&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Aug 1 20:15:34 2011 @@ -1555,10 +1555,10 @@

Note that in cases where none of the atomic intrinsics are used, this model places only one restriction on IR transformations on top of what is required for single-threaded execution: introducing a store to a byte which might not -otherwise be stored to can introduce undefined behavior. (Specifically, in -the case where another thread might write to and read from an address, -introducing a store can change a load that may see exactly one write into -a load that may see multiple writes.)

+otherwise be stored is not allowed in general. (Specifically, in the case +where another thread might write to and read from an address, introducing a +store can change a load that may see exactly one write into a load that may +see multiple writes.)

From clattner at apple.com Tue Aug 2 15:32:03 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 02 Aug 2011 13:32:03 -0700 Subject: [llvm-commits] [Patch] Landingpad Instruction In-Reply-To: References: Message-ID: On Aug 2, 2011, at 11:36 AM, Bill Wendling wrote: > On Aug 2, 2011, at 11:19 AM, Eli Friedman wrote: > >> On Tue, Aug 2, 2011 at 10:58 AM, Bill Wendling wrote: >>> Ping? >> >> Are you sure the verifier changes are correct given a module which >> uses two different different personality functions? It looks >> suspicious. >> > Good point. I'll have to clear the PersonalityFn value after it's run on a function. > >> Otherwise, it looks okay to me; not sure if you were trying to ping >> Chris specifically. >> > The ping was for anyone who is qualified to review the patch. I suspect that Chris may have some input and I didn't want to have this fall off his plate. :-) > > Thanks for the review! Please update the patch after the langref change goes in and I'll take a look, thanks Bill! -Chris From mcrosier at apple.com Tue Aug 2 15:53:43 2011 From: mcrosier at apple.com (Chad Rosier) Date: Tue, 02 Aug 2011 20:53:43 -0000 Subject: [llvm-commits] [llvm] r136721 - /llvm/trunk/autoconf/configure.ac Message-ID: <20110802205343.800B52A6C12C@llvm.org> Author: mcrosier Date: Tue Aug 2 15:53:43 2011 New Revision: 136721 URL: http://llvm.org/viewvc/llvm-project?rev=136721&view=rev Log: Update the default bug report url in autoconf. Modified: llvm/trunk/autoconf/configure.ac Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=136721&r1=136720&r2=136721&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Tue Aug 2 15:53:43 2011 @@ -942,8 +942,8 @@ dnl Specify the URL where bug reports should be submitted. AC_ARG_WITH(bug-report-url, AS_HELP_STRING([--with-bug-report-url], - [Specify the URL where bug reports should be submitted (default=http://llvm.org)]),, - withval="http://llvm.org") + [Specify the URL where bug reports should be submitted (default=http://llvm.org/bugs/)]),, + withval="http://llvm.org/bugs/") AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval", [Bug report URL.]) From stoklund at 2pi.dk Tue Aug 2 16:01:58 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 02 Aug 2011 14:01:58 -0700 Subject: [llvm-commits] X86 FastISel: Emit immediate call arguments locally to save stack size when compiling with -O0 In-Reply-To: References: <6E62C135-64F3-43C4-8C33-19CB9679FBD2@2pi.dk> Message-ID: On Aug 2, 2011, at 12:55 PM, Ivan Krasin wrote: > Hi Jacob, > > On Mon, Aug 1, 2011 at 10:35 PM, Jakob Stoklund Olesen wrote: >> >> On Aug 1, 2011, at 2:13 PM, Ivan Krasin wrote: >> >> this patch fixes the FastISel stack allocation strategy issue described >> here: >> http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-July/041452.html >> The solution is to emit immediate int arguments just before the call >> (instead of spilling them on stack at the beginning of the function) >> >> Thanks for working on this, Ivan. >> I don't think there is any reason to special-case function arguments. It is >> just as bad when fast-isel hoists the immediate in 'x+1'. >> I would prefer an approach that handled all immediates. > Thanks, it's a good point. I have tried to use double arguments as > immediates as well, but FastISel fails on them. > I think it also should be fixed, but I would prefer to make it in the next CL. Floating point constants are probably not important. They will be folded as constant pool loads most of the time, I expect. What I meant was, don't treat function arguments as a special case. You should handle all integer constants, whether they are used as function arguments or 'add' operands. Your patch doesn't work or this code, right? f(y + 5); f(x + 5); That '5' gets hoisted to the top of the block and spilled because of the first call. It shouldn't. Here is how fast isel currently works: It emits instructions bottom-up. When it needs a constant, the code for the constant is emitted to the top of the block, and it makes a note that the constant is now in a virtual register. Further uses of that constant simply get the virtual register. Here is what you should do: When you need a constant, don't emit the code immediately, but do allocate a virtual register and make a note that the constant needs to be materialized. Whenever you are about to emit a call, materialize all the pending constants. Then insert the call instruction. That way, virtual registers holding constants will never cross a call instruction, so they won't get spilled (much). For patches like this, please provide measurements of code size and compile time as well. Thanks, /jakob From nicholas at mxc.ca Tue Aug 2 16:19:27 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 02 Aug 2011 21:19:27 -0000 Subject: [llvm-commits] [llvm] r136722 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp test/Transforms/InstCombine/deadcode.ll Message-ID: <20110802211927.680DE2A6C12C@llvm.org> Author: nicholas Date: Tue Aug 2 16:19:27 2011 New Revision: 136722 URL: http://llvm.org/viewvc/llvm-project?rev=136722&view=rev Log: Lifetime intrinsics on undef are dead. Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp llvm/trunk/test/Transforms/InstCombine/deadcode.ll Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=136722&r1=136721&r2=136722&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/Local.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/Local.cpp Tue Aug 2 16:19:27 2011 @@ -229,10 +229,10 @@ // We don't want debug info removed by anything this general, unless // debug info is empty. if (DbgDeclareInst *DDI = dyn_cast(I)) { - if (DDI->getAddress()) + if (DDI->getAddress()) return false; return true; - } + } if (DbgValueInst *DVI = dyn_cast(I)) { if (DVI->getValue()) return false; @@ -243,10 +243,16 @@ // Special case intrinsics that "may have side effects" but can be deleted // when dead. - if (IntrinsicInst *II = dyn_cast(I)) + if (IntrinsicInst *II = dyn_cast(I)) { // Safe to delete llvm.stacksave if dead. if (II->getIntrinsicID() == Intrinsic::stacksave) return true; + + // Lifetime intrinsics are dead when their right-hand is undef. + if (II->getIntrinsicID() == Intrinsic::lifetime_start || + II->getIntrinsicID() == Intrinsic::lifetime_end) + return isa(II->getArgOperand(1)); + } return false; } Modified: llvm/trunk/test/Transforms/InstCombine/deadcode.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/deadcode.ll?rev=136722&r1=136721&r2=136722&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/deadcode.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/deadcode.ll Tue Aug 2 16:19:27 2011 @@ -1,5 +1,5 @@ ; RUN: opt < %s -instcombine -S | grep {ret i32 %A} -; RUN: opt < %s -die -S | not grep call.*llvm.stacksave +; RUN: opt < %s -die -S | not grep call.*llvm define i32 @test(i32 %A) { %X = or i1 false, false @@ -22,3 +22,12 @@ declare i8* @llvm.stacksave() +declare void @llvm.lifetime.start(i64, i8*) +declare void @llvm.lifetime.end(i64, i8*) + +define void @test3() { + call void @llvm.lifetime.start(i64 -1, i8* undef) + call void @llvm.lifetime.end(i64 -1, i8* undef) + ret void +} + From wendling at apple.com Tue Aug 2 16:29:32 2011 From: wendling at apple.com (Bill Wendling) Date: Tue, 02 Aug 2011 14:29:32 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> Message-ID: <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> On Aug 2, 2011, at 1:24 PM, Chris Lattner wrote: > @@ -3372,17 +3384,18 @@ > successors.

> >
Arguments:
> -

The 'resume' instruction's argument must have the same type as the > - result of any 'landingpad' instruction in the same function.

> +

The 'resume' instruction requires one argument, which must have the > + same type as the result of any 'landingpad' instruction in the same > + function.

> > Thanks for mentioning this. As a devil's advocate question: shouldn't this be forced to match the landingpad instruction that interrupted the unwind? isn't it theoretically possible to have code like this: > > > invoke @somefunc -> unwind %landingpadbb > > landingpadbb: > %A = landingpad ... > call foo(%A) > unreachable > > void foo( ... %A) { > resume %A > } > > In other words, does the resume actually have to be in the same function as the landing pad? > Interesting. No, it doesn't need to be in the same function. So I'll change the wording. > +
Syntax:
> +
> +  <resultval> = landingpad <somety> personality <type> <pers_fn> cleanup? <clause>+
> +  <clause> := catch <type> <value> {, <type> <value>}*
> +  <clause> := filter <type> <value> {, <type> <value>}*
> 
> 
> I thought we dropped "cleanup" for now.  Also, it doesn't make sense to me to allow both lists of clauses and lists of values in each clause.  Is there any reason not to simplify this down to:
> 
> +  <resultval> = landingpad <somety> personality <type> <pers_fn><clause>+
> +  <clause> := catch <type> <value>
> +  <clause> := filter <type> <value>
> 
> ?
> 
It's a bit more verbose, but I have no real objections to it.

> The optional
> +   cleanup flag indicates that the landing pad block is a cleanup.

> > Again, I thought we were leaving this out of the first cut. > I think you may be thinking of the 'terminate' clause? The 'cleanup' bit needs to be here for correct EH semantics. > > +
  • A landing pad blcok must have a 'landingpad' instruction as its > + first non-PHI instruction.
  • > +
  • The 'landingpad' instruction must be the first non-PHI > + instruction in the landing pad block.
  • > > typo "blcok". It's not clear to me what the difference between these two points is. > The second is restricting the placement of the landingpad instruction. The first is restricting how the landing pad block is set up. It would prevent this, admittedly broken, landing pad block: lpad: %exn = landingpad ... %exn1 = landingpad ... Though this may be overkill? > > +
  • Like indirect branches, splitting the critical edge to a landing pad block > + requires considerable care, and SplitCriticalEdge will refuse to > + do it.
  • > > This shouldn't be in LangRef.html > Okay. > > > + > > Something seems wrong here. Why so many /div's? > I looked carefully and it looks like the 'divs' really are nested three deep. *shrug* > Otherwise this looks great, please commit with the changes above if you agree. > The latest draft is attached. The only issues that remain are the 'cleanup' and the 'restrictions'. If you are okay with them, I can commit the changes. Thanks for the review! -bw -------------- next part -------------- A non-text attachment was scrubbed... Name: eh.1.2.lp.diff Type: application/octet-stream Size: 5656 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110802/59c58397/attachment.obj -------------- next part -------------- From eli.friedman at gmail.com Tue Aug 2 16:35:16 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 02 Aug 2011 21:35:16 -0000 Subject: [llvm-commits] [llvm] r136723 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Message-ID: <20110802213516.E60C12A6C12C@llvm.org> Author: efriedma Date: Tue Aug 2 16:35:16 2011 New Revision: 136723 URL: http://llvm.org/viewvc/llvm-project?rev=136723&view=rev Log: Add new atomic instructions to SCCP. No functional change, but stops debug spam. Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=136723&r1=136722&r2=136723&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Tue Aug 2 16:35:16 2011 @@ -532,6 +532,8 @@ void visitUnwindInst (TerminatorInst &I) { /*returns void*/ } void visitUnreachableInst(TerminatorInst &I) { /*returns void*/ } void visitFenceInst (FenceInst &I) { /*returns void*/ } + void visitAtomicCmpXchgInst (AtomicCmpXchgInst &I) { markOverdefined(&I); } + void visitAtomicRMWInst (AtomicRMWInst &I) { markOverdefined(&I); } void visitAllocaInst (Instruction &I) { markOverdefined(&I); } void visitVAArgInst (Instruction &I) { markAnythingOverdefined(&I); } From wendling at apple.com Tue Aug 2 16:38:25 2011 From: wendling at apple.com (Bill Wendling) Date: Tue, 02 Aug 2011 14:38:25 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> Message-ID: <59444632-A578-46B8-990A-5E2E9978F6B1@apple.com> On Aug 2, 2011, at 2:29 PM, Bill Wendling wrote: >> +
  • A landing pad blcok must have a 'landingpad' instruction as its >> + first non-PHI instruction.
  • >> +
  • The 'landingpad' instruction must be the first non-PHI >> + instruction in the landing pad block.
  • >> >> typo "blcok". It's not clear to me what the difference between these two points is. >> > The second is restricting the placement of the landingpad instruction. The first is restricting how the landing pad block is set up. It would prevent this, admittedly broken, landing pad block: > > lpad: > %exn = landingpad ... > %exn1 = landingpad ... > > Though this may be overkill? > How about these for the restrictions? ? A landing pad block is a basic block which is the unwind destination of an 'invoke' instruction. ? A landing pad block must have a 'landingpad' instruction as its first non-PHI instruction. ? There can be only one 'landingpad' instruction within the landing pad block. ? A basic block that is not a landing pad block may not include a 'landingpad' instruction. ? All 'landingpad' instructions in a function must have the same personality function. -bw From dblaikie at gmail.com Tue Aug 2 16:49:34 2011 From: dblaikie at gmail.com (David Blaikie) Date: Tue, 2 Aug 2011 14:49:34 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <59444632-A578-46B8-990A-5E2E9978F6B1@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <59444632-A578-46B8-990A-5E2E9978F6B1@apple.com> Message-ID: >>> + ?
  • A landing pad blcok must have a 'landingpad' instruction as its >>> + ? ? ?first non-PHI instruction.
  • >>> + ?
  • The 'landingpad' instruction must be the first non-PHI >>> + ? ? ?instruction in the landing pad block.
  • >>> >>> typo "blcok". ?It's not clear to me what the difference between these two points is. >>> >> The second is restricting the placement of the landingpad instruction. The first is restricting how the landing pad block is set up. It would prevent this, admittedly broken, landing pad block: I for one kind of liked the original phrasing compared to the alternative below - though I had the same double take when I read it "wait, what's it saying - oh, I see" kind of moment. Perhaps: >> lpad: >> ?%exn = landingpad ... >> ?%exn1 = landingpad ... >> >> Though this may be overkill? >> > How about these for the restrictions? > > ? ? ? ?? A landing pad block is a basic block which is the unwind destination of an 'invoke' instruction. > ? ? ? ?? A landing pad block must have a 'landingpad' instruction as its first non-PHI instruction. > ? ? ? ?? There can be only one 'landingpad' instruction within the landing pad block. > ? ? ? ?? A basic block that is not a landing pad block may not include a 'landingpad' instruction. > ? ? ? ?? All 'landingpad' instructions in a function must have the same personality function. How about: "A landing pad instruction must (and may only) be the first non-PHI instruction in a landing pad block" This covers 2, 3, and 4 in one sentence, if I'm not mistaken. (& seems clearer to me) - David From clattner at apple.com Tue Aug 2 16:50:50 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 02 Aug 2011 14:50:50 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <59444632-A578-46B8-990A-5E2E9978F6B1@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <59444632-A578-46B8-990A-5E2E9978F6B1@apple.com> Message-ID: <7410A368-2AFD-4919-9032-3131A88BB405@apple.com> On Aug 2, 2011, at 2:38 PM, Bill Wendling wrote: > On Aug 2, 2011, at 2:29 PM, Bill Wendling wrote: > >>> +
  • A landing pad blcok must have a 'landingpad' instruction as its >>> + first non-PHI instruction.
  • >>> +
  • The 'landingpad' instruction must be the first non-PHI >>> + instruction in the landing pad block.
  • >>> >>> typo "blcok". It's not clear to me what the difference between these two points is. >>> >> The second is restricting the placement of the landingpad instruction. The first is restricting how the landing pad block is set up. It would prevent this, admittedly broken, landing pad block: >> >> lpad: >> %exn = landingpad ... >> %exn1 = landingpad ... >> >> Though this may be overkill? >> > How about these for the restrictions? > > ? A landing pad block is a basic block which is the unwind destination of an 'invoke' instruction. > ? A landing pad block must have a 'landingpad' instruction as its first non-PHI instruction. > ? There can be only one 'landingpad' instruction within the landing pad block. > ? A basic block that is not a landing pad block may not include a 'landingpad' instruction. > ? All 'landingpad' instructions in a function must have the same personality function. Sounds fine to me, please land the landingpad in langref! I'll take a look at the 'landingpad instruction' patch once you update it for the grammar change. -Chris From rafael.espindola at gmail.com Tue Aug 2 16:50:24 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 02 Aug 2011 21:50:24 -0000 Subject: [llvm-commits] [llvm] r136726 - in /llvm/trunk: include/llvm/Support/PassManagerBuilder.h include/llvm/Transforms/IPO/PassManagerBuilder.h tools/bugpoint/bugpoint.cpp tools/llvm-ld/Optimize.cpp tools/lto/LTOCodeGenerator.cpp tools/opt/opt.cpp Message-ID: <20110802215024.4E7182A6C12C@llvm.org> Author: rafael Date: Tue Aug 2 16:50:24 2011 New Revision: 136726 URL: http://llvm.org/viewvc/llvm-project?rev=136726&view=rev Log: move PassManagerBuilder.h to IPO. This is a non intuitive place to put it, but it solves a layering violation since things in Support are not supposed to use things in Transforms. Added: llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h - copied, changed from r136716, llvm/trunk/include/llvm/Support/PassManagerBuilder.h Removed: llvm/trunk/include/llvm/Support/PassManagerBuilder.h Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp llvm/trunk/tools/llvm-ld/Optimize.cpp llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/opt/opt.cpp Removed: llvm/trunk/include/llvm/Support/PassManagerBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PassManagerBuilder.h?rev=136725&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/PassManagerBuilder.h (original) +++ llvm/trunk/include/llvm/Support/PassManagerBuilder.h (removed) @@ -1,331 +0,0 @@ -//===-- llvm/Support/PassManagerBuilder.h - Build Standard Pass -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the PassManagerBuilder class, which is used to set up a -// "standard" optimization sequence suitable for languages like C and C++. -// -// These are implemented as inline functions so that we do not have to worry -// about link issues. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_PASSMANAGERBUILDER_H -#define LLVM_SUPPORT_PASSMANAGERBUILDER_H - -#include "llvm/PassManager.h" -#include "llvm/DefaultPasses.h" -#include "llvm/Analysis/Passes.h" -#include "llvm/Analysis/Verifier.h" -#include "llvm/Target/TargetLibraryInfo.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/IPO.h" - -namespace llvm { - -/// PassManagerBuilder - This class is used to set up a standard optimization -/// sequence for languages like C and C++, allowing some APIs to customize the -/// pass sequence in various ways. A simple example of using it would be: -/// -/// PassManagerBuilder Builder; -/// Builder.OptLevel = 2; -/// Builder.populateFunctionPassManager(FPM); -/// Builder.populateModulePassManager(MPM); -/// -/// In addition to setting up the basic passes, PassManagerBuilder allows -/// frontends to vend a plugin API, where plugins are allowed to add extensions -/// to the default pass manager. They do this by specifying where in the pass -/// pipeline they want to be added, along with a callback function that adds -/// the pass(es). For example, a plugin that wanted to add a loop optimization -/// could do something like this: -/// -/// static void addMyLoopPass(const PMBuilder &Builder, PassManagerBase &PM) { -/// if (Builder.getOptLevel() > 2 && Builder.getOptSizeLevel() == 0) -/// PM.add(createMyAwesomePass()); -/// } -/// ... -/// Builder.addExtension(PassManagerBuilder::EP_LoopOptimizerEnd, -/// addMyLoopPass); -/// ... -class PassManagerBuilder { -public: - - /// Extensions are passed the builder itself (so they can see how it is - /// configured) as well as the pass manager to add stuff to. - typedef void (*ExtensionFn)(const PassManagerBuilder &Builder, - PassManagerBase &PM); - enum ExtensionPointTy { - /// EP_EarlyAsPossible - This extension point allows adding passes before - /// any other transformations, allowing them to see the code as it is coming - /// out of the frontend. - EP_EarlyAsPossible, - - /// EP_LoopOptimizerEnd - This extension point allows adding loop passes to - /// the end of the loop optimizer. - EP_LoopOptimizerEnd, - - /// EP_ScalarOptimizerLate - This extension point allows adding optimization - /// passes after most of the main optimizations, but before the last - /// cleanup-ish optimizations. - EP_ScalarOptimizerLate - }; - - /// The Optimization Level - Specify the basic optimization level. - /// 0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3 - unsigned OptLevel; - - /// SizeLevel - How much we're optimizing for size. - /// 0 = none, 1 = -Os, 2 = -Oz - unsigned SizeLevel; - - /// LibraryInfo - Specifies information about the runtime library for the - /// optimizer. If this is non-null, it is added to both the function and - /// per-module pass pipeline. - TargetLibraryInfo *LibraryInfo; - - /// Inliner - Specifies the inliner to use. If this is non-null, it is - /// added to the per-module passes. - Pass *Inliner; - - bool DisableSimplifyLibCalls; - bool DisableUnitAtATime; - bool DisableUnrollLoops; - -private: - /// ExtensionList - This is list of all of the extensions that are registered. - std::vector > Extensions; - -public: - PassManagerBuilder() { - OptLevel = 2; - SizeLevel = 0; - LibraryInfo = 0; - Inliner = 0; - DisableSimplifyLibCalls = false; - DisableUnitAtATime = false; - DisableUnrollLoops = false; - } - - ~PassManagerBuilder() { - delete LibraryInfo; - delete Inliner; - } - - void addExtension(ExtensionPointTy Ty, ExtensionFn Fn) { - Extensions.push_back(std::make_pair(Ty, Fn)); - } - -private: - void addExtensionsToPM(ExtensionPointTy ETy, PassManagerBase &PM) const { - for (unsigned i = 0, e = Extensions.size(); i != e; ++i) - if (Extensions[i].first == ETy) - Extensions[i].second(*this, PM); - } - - void addInitialAliasAnalysisPasses(PassManagerBase &PM) const { - // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that - // BasicAliasAnalysis wins if they disagree. This is intended to help - // support "obvious" type-punning idioms. - PM.add(createTypeBasedAliasAnalysisPass()); - PM.add(createBasicAliasAnalysisPass()); - } -public: - - /// populateFunctionPassManager - This fills in the function pass manager, - /// which is expected to be run on each function immediately as it is - /// generated. The idea is to reduce the size of the IR in memory. - void populateFunctionPassManager(FunctionPassManager &FPM) { - addExtensionsToPM(EP_EarlyAsPossible, FPM); - - // Add LibraryInfo if we have some. - if (LibraryInfo) FPM.add(new TargetLibraryInfo(*LibraryInfo)); - - if (OptLevel == 0) return; - - addInitialAliasAnalysisPasses(FPM); - - FPM.add(createCFGSimplificationPass()); - FPM.add(createScalarReplAggregatesPass()); - FPM.add(createEarlyCSEPass()); - FPM.add(createLowerExpectIntrinsicPass()); - } - - /// populateModulePassManager - This sets up the primary pass manager. - void populateModulePassManager(PassManagerBase &MPM) { - // If all optimizations are disabled, just run the always-inline pass. - if (OptLevel == 0) { - if (Inliner) { - MPM.add(Inliner); - Inliner = 0; - } - return; - } - - // Add LibraryInfo if we have some. - if (LibraryInfo) MPM.add(new TargetLibraryInfo(*LibraryInfo)); - - addInitialAliasAnalysisPasses(MPM); - - if (!DisableUnitAtATime) { - MPM.add(createGlobalOptimizerPass()); // Optimize out global vars - - MPM.add(createIPSCCPPass()); // IP SCCP - MPM.add(createDeadArgEliminationPass()); // Dead argument elimination - - MPM.add(createInstructionCombiningPass());// Clean up after IPCP & DAE - MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE - } - - // Start of CallGraph SCC passes. - if (!DisableUnitAtATime) - MPM.add(createPruneEHPass()); // Remove dead EH info - if (Inliner) { - MPM.add(Inliner); - Inliner = 0; - } - if (!DisableUnitAtATime) - MPM.add(createFunctionAttrsPass()); // Set readonly/readnone attrs - if (OptLevel > 2) - MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args - - // Start of function pass. - // Break up aggregate allocas, using SSAUpdater. - MPM.add(createScalarReplAggregatesPass(-1, false)); - MPM.add(createEarlyCSEPass()); // Catch trivial redundancies - if (!DisableSimplifyLibCalls) - MPM.add(createSimplifyLibCallsPass()); // Library Call Optimizations - MPM.add(createJumpThreadingPass()); // Thread jumps. - MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals - MPM.add(createCFGSimplificationPass()); // Merge & remove BBs - MPM.add(createInstructionCombiningPass()); // Combine silly seq's - - MPM.add(createTailCallEliminationPass()); // Eliminate tail calls - MPM.add(createCFGSimplificationPass()); // Merge & remove BBs - MPM.add(createReassociatePass()); // Reassociate expressions - MPM.add(createLoopRotatePass()); // Rotate Loop - MPM.add(createLICMPass()); // Hoist loop invariants - MPM.add(createLoopUnswitchPass(SizeLevel || OptLevel < 3)); - MPM.add(createInstructionCombiningPass()); - MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars - MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. - MPM.add(createLoopDeletionPass()); // Delete dead loops - if (!DisableUnrollLoops) - MPM.add(createLoopUnrollPass()); // Unroll small loops - addExtensionsToPM(EP_LoopOptimizerEnd, MPM); - - if (OptLevel > 1) - MPM.add(createGVNPass()); // Remove redundancies - MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset - MPM.add(createSCCPPass()); // Constant prop with SCCP - - // Run instcombine after redundancy elimination to exploit opportunities - // opened up by them. - MPM.add(createInstructionCombiningPass()); - MPM.add(createJumpThreadingPass()); // Thread jumps - MPM.add(createCorrelatedValuePropagationPass()); - MPM.add(createDeadStoreEliminationPass()); // Delete dead stores - - addExtensionsToPM(EP_ScalarOptimizerLate, MPM); - - MPM.add(createAggressiveDCEPass()); // Delete dead instructions - MPM.add(createCFGSimplificationPass()); // Merge & remove BBs - MPM.add(createInstructionCombiningPass()); // Clean up after everything. - - if (!DisableUnitAtATime) { - // FIXME: We shouldn't bother with this anymore. - MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes - - // GlobalOpt already deletes dead functions and globals, at -O3 try a - // late pass of GlobalDCE. It is capable of deleting dead cycles. - if (OptLevel > 2) - MPM.add(createGlobalDCEPass()); // Remove dead fns and globals. - - if (OptLevel > 1) - MPM.add(createConstantMergePass()); // Merge dup global constants - } - } - - void populateLTOPassManager(PassManagerBase &PM, bool Internalize, - bool RunInliner) { - // Provide AliasAnalysis services for optimizations. - addInitialAliasAnalysisPasses(PM); - - // Now that composite has been compiled, scan through the module, looking - // for a main function. If main is defined, mark all other functions - // internal. - if (Internalize) - PM.add(createInternalizePass(true)); - - // Propagate constants at call sites into the functions they call. This - // opens opportunities for globalopt (and inlining) by substituting function - // pointers passed as arguments to direct uses of functions. - PM.add(createIPSCCPPass()); - - // Now that we internalized some globals, see if we can hack on them! - PM.add(createGlobalOptimizerPass()); - - // Linking modules together can lead to duplicated global constants, only - // keep one copy of each constant. - PM.add(createConstantMergePass()); - - // Remove unused arguments from functions. - PM.add(createDeadArgEliminationPass()); - - // Reduce the code after globalopt and ipsccp. Both can open up significant - // simplification opportunities, and both can propagate functions through - // function pointers. When this happens, we often have to resolve varargs - // calls, etc, so let instcombine do this. - PM.add(createInstructionCombiningPass()); - - // Inline small functions - if (RunInliner) - PM.add(createFunctionInliningPass()); - - PM.add(createPruneEHPass()); // Remove dead EH info. - - // Optimize globals again if we ran the inliner. - if (RunInliner) - PM.add(createGlobalOptimizerPass()); - PM.add(createGlobalDCEPass()); // Remove dead functions. - - // If we didn't decide to inline a function, check to see if we can - // transform it to pass arguments by value instead of by reference. - PM.add(createArgumentPromotionPass()); - - // The IPO passes may leave cruft around. Clean up after them. - PM.add(createInstructionCombiningPass()); - PM.add(createJumpThreadingPass()); - // Break up allocas - PM.add(createScalarReplAggregatesPass()); - - // Run a few AA driven optimizations here and now, to cleanup the code. - PM.add(createFunctionAttrsPass()); // Add nocapture. - PM.add(createGlobalsModRefPass()); // IP alias analysis. - - PM.add(createLICMPass()); // Hoist loop invariants. - PM.add(createGVNPass()); // Remove redundancies. - PM.add(createMemCpyOptPass()); // Remove dead memcpys. - // Nuke dead stores. - PM.add(createDeadStoreEliminationPass()); - - // Cleanup and simplify the code after the scalar optimizations. - PM.add(createInstructionCombiningPass()); - - PM.add(createJumpThreadingPass()); - - // Delete basic blocks, which optimization passes may have killed. - PM.add(createCFGSimplificationPass()); - - // Now that we have optimized the program, discard unreachable functions. - PM.add(createGlobalDCEPass()); - } -}; - - -} // end namespace llvm -#endif Copied: llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h (from r136716, llvm/trunk/include/llvm/Support/PassManagerBuilder.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h?p2=llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h&p1=llvm/trunk/include/llvm/Support/PassManagerBuilder.h&r1=136716&r2=136726&rev=136726&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PassManagerBuilder.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h Tue Aug 2 16:50:24 2011 @@ -1,4 +1,4 @@ -//===-- llvm/Support/PassManagerBuilder.h - Build Standard Pass -*- C++ -*-===// +// llvm/Transforms/IPO/PassManagerBuilder.h - Build Standard Pass -*- C++ -*-=// // // The LLVM Compiler Infrastructure // Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=136726&r1=136725&r2=136726&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original) +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Tue Aug 2 16:50:24 2011 @@ -22,11 +22,11 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PluginLoader.h" #include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/PassManagerBuilder.h" #include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" #include "llvm/Support/Valgrind.h" #include "llvm/LinkAllVMCore.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" //Enable this macro to debug bugpoint itself. //#define DEBUG_BUGPOINT 1 Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=136726&r1=136725&r2=136726&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Tue Aug 2 16:50:24 2011 @@ -13,13 +13,13 @@ #include "llvm/Module.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/PassManagerBuilder.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/DynamicLibrary.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/PluginLoader.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" using namespace llvm; // Pass Name Options as generated by the PassNameParser Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=136726&r1=136725&r2=136726&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Tue Aug 2 16:50:24 2011 @@ -37,7 +37,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/PassManagerBuilder.h" #include "llvm/Support/SystemUtils.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/Host.h" @@ -45,6 +44,7 @@ #include "llvm/Support/Signals.h" #include "llvm/Support/system_error.h" #include "llvm/Config/config.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include #include #include Modified: llvm/trunk/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=136726&r1=136725&r2=136726&view=diff ============================================================================== --- llvm/trunk/tools/opt/opt.cpp (original) +++ llvm/trunk/tools/opt/opt.cpp Tue Aug 2 16:50:24 2011 @@ -35,11 +35,11 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PluginLoader.h" #include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/PassManagerBuilder.h" #include "llvm/Support/SystemUtils.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/LinkAllPasses.h" #include "llvm/LinkAllVMCore.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include #include using namespace llvm; From rafael.espindola at gmail.com Tue Aug 2 16:50:27 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 02 Aug 2011 21:50:27 -0000 Subject: [llvm-commits] [llvm] r136727 - in /llvm/trunk: include/llvm/Transforms/IPO/PassManagerBuilder.h lib/Transforms/IPO/CMakeLists.txt lib/Transforms/IPO/PassManagerBuilder.cpp tools/bugpoint/bugpoint.cpp tools/llvm-ld/Optimize.cpp tools/lto/LTOCodeGenerator.cpp Message-ID: <20110802215027.7454E2A6C12D@llvm.org> Author: rafael Date: Tue Aug 2 16:50:27 2011 New Revision: 136727 URL: http://llvm.org/viewvc/llvm-project?rev=136727&view=rev Log: Move methods in PassManagerBuilder offline. Added: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Modified: llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h llvm/trunk/lib/Transforms/IPO/CMakeLists.txt llvm/trunk/tools/bugpoint/bugpoint.cpp llvm/trunk/tools/llvm-ld/Optimize.cpp llvm/trunk/tools/lto/LTOCodeGenerator.cpp Modified: llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h?rev=136727&r1=136726&r2=136727&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h Tue Aug 2 16:50:27 2011 @@ -10,24 +10,19 @@ // This file defines the PassManagerBuilder class, which is used to set up a // "standard" optimization sequence suitable for languages like C and C++. // -// These are implemented as inline functions so that we do not have to worry -// about link issues. -// //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_PASSMANAGERBUILDER_H #define LLVM_SUPPORT_PASSMANAGERBUILDER_H -#include "llvm/PassManager.h" -#include "llvm/DefaultPasses.h" -#include "llvm/Analysis/Passes.h" -#include "llvm/Analysis/Verifier.h" -#include "llvm/Target/TargetLibraryInfo.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/IPO.h" +#include namespace llvm { - + class TargetLibraryInfo; + class PassManagerBase; + class Pass; + class FunctionPassManager; + /// PassManagerBuilder - This class is used to set up a standard optimization /// sequence for languages like C and C++, allowing some APIs to customize the /// pass sequence in various ways. A simple example of using it would be: @@ -54,7 +49,7 @@ /// ... class PassManagerBuilder { public: - + /// Extensions are passed the builder itself (so they can see how it is /// configured) as well as the pass manager to add stuff to. typedef void (*ExtensionFn)(const PassManagerBuilder &Builder, @@ -64,7 +59,7 @@ /// any other transformations, allowing them to see the code as it is coming /// out of the frontend. EP_EarlyAsPossible, - + /// EP_LoopOptimizerEnd - This extension point allows adding loop passes to /// the end of the loop optimizer. EP_LoopOptimizerEnd, @@ -74,258 +69,52 @@ /// cleanup-ish optimizations. EP_ScalarOptimizerLate }; - + /// The Optimization Level - Specify the basic optimization level. /// 0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3 unsigned OptLevel; - + /// SizeLevel - How much we're optimizing for size. /// 0 = none, 1 = -Os, 2 = -Oz unsigned SizeLevel; - + /// LibraryInfo - Specifies information about the runtime library for the /// optimizer. If this is non-null, it is added to both the function and /// per-module pass pipeline. TargetLibraryInfo *LibraryInfo; - + /// Inliner - Specifies the inliner to use. If this is non-null, it is /// added to the per-module passes. Pass *Inliner; - + bool DisableSimplifyLibCalls; bool DisableUnitAtATime; bool DisableUnrollLoops; - + private: /// ExtensionList - This is list of all of the extensions that are registered. std::vector > Extensions; - + public: - PassManagerBuilder() { - OptLevel = 2; - SizeLevel = 0; - LibraryInfo = 0; - Inliner = 0; - DisableSimplifyLibCalls = false; - DisableUnitAtATime = false; - DisableUnrollLoops = false; - } - - ~PassManagerBuilder() { - delete LibraryInfo; - delete Inliner; - } - - void addExtension(ExtensionPointTy Ty, ExtensionFn Fn) { - Extensions.push_back(std::make_pair(Ty, Fn)); - } - + PassManagerBuilder(); + ~PassManagerBuilder(); + void addExtension(ExtensionPointTy Ty, ExtensionFn Fn); + private: - void addExtensionsToPM(ExtensionPointTy ETy, PassManagerBase &PM) const { - for (unsigned i = 0, e = Extensions.size(); i != e; ++i) - if (Extensions[i].first == ETy) - Extensions[i].second(*this, PM); - } - - void addInitialAliasAnalysisPasses(PassManagerBase &PM) const { - // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that - // BasicAliasAnalysis wins if they disagree. This is intended to help - // support "obvious" type-punning idioms. - PM.add(createTypeBasedAliasAnalysisPass()); - PM.add(createBasicAliasAnalysisPass()); - } + void addExtensionsToPM(ExtensionPointTy ETy, PassManagerBase &PM) const; + void addInitialAliasAnalysisPasses(PassManagerBase &PM) const; public: - + /// populateFunctionPassManager - This fills in the function pass manager, /// which is expected to be run on each function immediately as it is /// generated. The idea is to reduce the size of the IR in memory. - void populateFunctionPassManager(FunctionPassManager &FPM) { - addExtensionsToPM(EP_EarlyAsPossible, FPM); - - // Add LibraryInfo if we have some. - if (LibraryInfo) FPM.add(new TargetLibraryInfo(*LibraryInfo)); - - if (OptLevel == 0) return; - - addInitialAliasAnalysisPasses(FPM); - - FPM.add(createCFGSimplificationPass()); - FPM.add(createScalarReplAggregatesPass()); - FPM.add(createEarlyCSEPass()); - FPM.add(createLowerExpectIntrinsicPass()); - } - + void populateFunctionPassManager(FunctionPassManager &FPM); + /// populateModulePassManager - This sets up the primary pass manager. - void populateModulePassManager(PassManagerBase &MPM) { - // If all optimizations are disabled, just run the always-inline pass. - if (OptLevel == 0) { - if (Inliner) { - MPM.add(Inliner); - Inliner = 0; - } - return; - } - - // Add LibraryInfo if we have some. - if (LibraryInfo) MPM.add(new TargetLibraryInfo(*LibraryInfo)); - - addInitialAliasAnalysisPasses(MPM); - - if (!DisableUnitAtATime) { - MPM.add(createGlobalOptimizerPass()); // Optimize out global vars - - MPM.add(createIPSCCPPass()); // IP SCCP - MPM.add(createDeadArgEliminationPass()); // Dead argument elimination - - MPM.add(createInstructionCombiningPass());// Clean up after IPCP & DAE - MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE - } - - // Start of CallGraph SCC passes. - if (!DisableUnitAtATime) - MPM.add(createPruneEHPass()); // Remove dead EH info - if (Inliner) { - MPM.add(Inliner); - Inliner = 0; - } - if (!DisableUnitAtATime) - MPM.add(createFunctionAttrsPass()); // Set readonly/readnone attrs - if (OptLevel > 2) - MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args - - // Start of function pass. - // Break up aggregate allocas, using SSAUpdater. - MPM.add(createScalarReplAggregatesPass(-1, false)); - MPM.add(createEarlyCSEPass()); // Catch trivial redundancies - if (!DisableSimplifyLibCalls) - MPM.add(createSimplifyLibCallsPass()); // Library Call Optimizations - MPM.add(createJumpThreadingPass()); // Thread jumps. - MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals - MPM.add(createCFGSimplificationPass()); // Merge & remove BBs - MPM.add(createInstructionCombiningPass()); // Combine silly seq's - - MPM.add(createTailCallEliminationPass()); // Eliminate tail calls - MPM.add(createCFGSimplificationPass()); // Merge & remove BBs - MPM.add(createReassociatePass()); // Reassociate expressions - MPM.add(createLoopRotatePass()); // Rotate Loop - MPM.add(createLICMPass()); // Hoist loop invariants - MPM.add(createLoopUnswitchPass(SizeLevel || OptLevel < 3)); - MPM.add(createInstructionCombiningPass()); - MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars - MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. - MPM.add(createLoopDeletionPass()); // Delete dead loops - if (!DisableUnrollLoops) - MPM.add(createLoopUnrollPass()); // Unroll small loops - addExtensionsToPM(EP_LoopOptimizerEnd, MPM); - - if (OptLevel > 1) - MPM.add(createGVNPass()); // Remove redundancies - MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset - MPM.add(createSCCPPass()); // Constant prop with SCCP - - // Run instcombine after redundancy elimination to exploit opportunities - // opened up by them. - MPM.add(createInstructionCombiningPass()); - MPM.add(createJumpThreadingPass()); // Thread jumps - MPM.add(createCorrelatedValuePropagationPass()); - MPM.add(createDeadStoreEliminationPass()); // Delete dead stores - - addExtensionsToPM(EP_ScalarOptimizerLate, MPM); - - MPM.add(createAggressiveDCEPass()); // Delete dead instructions - MPM.add(createCFGSimplificationPass()); // Merge & remove BBs - MPM.add(createInstructionCombiningPass()); // Clean up after everything. - - if (!DisableUnitAtATime) { - // FIXME: We shouldn't bother with this anymore. - MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes - - // GlobalOpt already deletes dead functions and globals, at -O3 try a - // late pass of GlobalDCE. It is capable of deleting dead cycles. - if (OptLevel > 2) - MPM.add(createGlobalDCEPass()); // Remove dead fns and globals. - - if (OptLevel > 1) - MPM.add(createConstantMergePass()); // Merge dup global constants - } - } - + void populateModulePassManager(PassManagerBase &MPM); void populateLTOPassManager(PassManagerBase &PM, bool Internalize, - bool RunInliner) { - // Provide AliasAnalysis services for optimizations. - addInitialAliasAnalysisPasses(PM); - - // Now that composite has been compiled, scan through the module, looking - // for a main function. If main is defined, mark all other functions - // internal. - if (Internalize) - PM.add(createInternalizePass(true)); - - // Propagate constants at call sites into the functions they call. This - // opens opportunities for globalopt (and inlining) by substituting function - // pointers passed as arguments to direct uses of functions. - PM.add(createIPSCCPPass()); - - // Now that we internalized some globals, see if we can hack on them! - PM.add(createGlobalOptimizerPass()); - - // Linking modules together can lead to duplicated global constants, only - // keep one copy of each constant. - PM.add(createConstantMergePass()); - - // Remove unused arguments from functions. - PM.add(createDeadArgEliminationPass()); - - // Reduce the code after globalopt and ipsccp. Both can open up significant - // simplification opportunities, and both can propagate functions through - // function pointers. When this happens, we often have to resolve varargs - // calls, etc, so let instcombine do this. - PM.add(createInstructionCombiningPass()); - - // Inline small functions - if (RunInliner) - PM.add(createFunctionInliningPass()); - - PM.add(createPruneEHPass()); // Remove dead EH info. - - // Optimize globals again if we ran the inliner. - if (RunInliner) - PM.add(createGlobalOptimizerPass()); - PM.add(createGlobalDCEPass()); // Remove dead functions. - - // If we didn't decide to inline a function, check to see if we can - // transform it to pass arguments by value instead of by reference. - PM.add(createArgumentPromotionPass()); - - // The IPO passes may leave cruft around. Clean up after them. - PM.add(createInstructionCombiningPass()); - PM.add(createJumpThreadingPass()); - // Break up allocas - PM.add(createScalarReplAggregatesPass()); - - // Run a few AA driven optimizations here and now, to cleanup the code. - PM.add(createFunctionAttrsPass()); // Add nocapture. - PM.add(createGlobalsModRefPass()); // IP alias analysis. - - PM.add(createLICMPass()); // Hoist loop invariants. - PM.add(createGVNPass()); // Remove redundancies. - PM.add(createMemCpyOptPass()); // Remove dead memcpys. - // Nuke dead stores. - PM.add(createDeadStoreEliminationPass()); - - // Cleanup and simplify the code after the scalar optimizations. - PM.add(createInstructionCombiningPass()); - - PM.add(createJumpThreadingPass()); - - // Delete basic blocks, which optimization passes may have killed. - PM.add(createCFGSimplificationPass()); - - // Now that we have optimized the program, discard unreachable functions. - PM.add(createGlobalDCEPass()); - } + bool RunInliner); }; - } // end namespace llvm #endif Modified: llvm/trunk/lib/Transforms/IPO/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CMakeLists.txt?rev=136727&r1=136726&r2=136727&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Tue Aug 2 16:50:27 2011 @@ -16,6 +16,7 @@ LowerSetJmp.cpp MergeFunctions.cpp PartialInlining.cpp + PassManagerBuilder.cpp PruneEH.cpp StripDeadPrototypes.cpp StripSymbols.cpp Added: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=136727&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (added) +++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Tue Aug 2 16:50:27 2011 @@ -0,0 +1,248 @@ +//===- PassManagerBuilder.cpp - Build Standard Pass -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the PassManagerBuilder class, which is used to set up a +// "standard" optimization sequence suitable for languages like C and C++. +// +//===----------------------------------------------------------------------===// + + +#include "llvm/Transforms/IPO/PassManagerBuilder.h" + +#include "llvm/PassManager.h" +#include "llvm/DefaultPasses.h" +#include "llvm/PassManager.h" +#include "llvm/Analysis/Passes.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Target/TargetLibraryInfo.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/IPO.h" + +using namespace llvm; + +PassManagerBuilder::PassManagerBuilder() { + OptLevel = 2; + SizeLevel = 0; + LibraryInfo = 0; + Inliner = 0; + DisableSimplifyLibCalls = false; + DisableUnitAtATime = false; + DisableUnrollLoops = false; +} + +PassManagerBuilder::~PassManagerBuilder() { + delete LibraryInfo; + delete Inliner; +} + +void PassManagerBuilder::addExtension(ExtensionPointTy Ty, ExtensionFn Fn) { + Extensions.push_back(std::make_pair(Ty, Fn)); +} + +void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy, + PassManagerBase &PM) const { + for (unsigned i = 0, e = Extensions.size(); i != e; ++i) + if (Extensions[i].first == ETy) + Extensions[i].second(*this, PM); +} + +void +PassManagerBuilder::addInitialAliasAnalysisPasses(PassManagerBase &PM) const { + // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that + // BasicAliasAnalysis wins if they disagree. This is intended to help + // support "obvious" type-punning idioms. + PM.add(createTypeBasedAliasAnalysisPass()); + PM.add(createBasicAliasAnalysisPass()); +} + +void PassManagerBuilder::populateFunctionPassManager(FunctionPassManager &FPM) { + addExtensionsToPM(EP_EarlyAsPossible, FPM); + + // Add LibraryInfo if we have some. + if (LibraryInfo) FPM.add(new TargetLibraryInfo(*LibraryInfo)); + + if (OptLevel == 0) return; + + addInitialAliasAnalysisPasses(FPM); + + FPM.add(createCFGSimplificationPass()); + FPM.add(createScalarReplAggregatesPass()); + FPM.add(createEarlyCSEPass()); + FPM.add(createLowerExpectIntrinsicPass()); +} + +void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) { + // If all optimizations are disabled, just run the always-inline pass. + if (OptLevel == 0) { + if (Inliner) { + MPM.add(Inliner); + Inliner = 0; + } + return; + } + + // Add LibraryInfo if we have some. + if (LibraryInfo) MPM.add(new TargetLibraryInfo(*LibraryInfo)); + + addInitialAliasAnalysisPasses(MPM); + + if (!DisableUnitAtATime) { + MPM.add(createGlobalOptimizerPass()); // Optimize out global vars + + MPM.add(createIPSCCPPass()); // IP SCCP + MPM.add(createDeadArgEliminationPass()); // Dead argument elimination + + MPM.add(createInstructionCombiningPass());// Clean up after IPCP & DAE + MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE + } + + // Start of CallGraph SCC passes. + if (!DisableUnitAtATime) + MPM.add(createPruneEHPass()); // Remove dead EH info + if (Inliner) { + MPM.add(Inliner); + Inliner = 0; + } + if (!DisableUnitAtATime) + MPM.add(createFunctionAttrsPass()); // Set readonly/readnone attrs + if (OptLevel > 2) + MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args + + // Start of function pass. + // Break up aggregate allocas, using SSAUpdater. + MPM.add(createScalarReplAggregatesPass(-1, false)); + MPM.add(createEarlyCSEPass()); // Catch trivial redundancies + if (!DisableSimplifyLibCalls) + MPM.add(createSimplifyLibCallsPass()); // Library Call Optimizations + MPM.add(createJumpThreadingPass()); // Thread jumps. + MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals + MPM.add(createCFGSimplificationPass()); // Merge & remove BBs + MPM.add(createInstructionCombiningPass()); // Combine silly seq's + + MPM.add(createTailCallEliminationPass()); // Eliminate tail calls + MPM.add(createCFGSimplificationPass()); // Merge & remove BBs + MPM.add(createReassociatePass()); // Reassociate expressions + MPM.add(createLoopRotatePass()); // Rotate Loop + MPM.add(createLICMPass()); // Hoist loop invariants + MPM.add(createLoopUnswitchPass(SizeLevel || OptLevel < 3)); + MPM.add(createInstructionCombiningPass()); + MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars + MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. + MPM.add(createLoopDeletionPass()); // Delete dead loops + if (!DisableUnrollLoops) + MPM.add(createLoopUnrollPass()); // Unroll small loops + addExtensionsToPM(EP_LoopOptimizerEnd, MPM); + + if (OptLevel > 1) + MPM.add(createGVNPass()); // Remove redundancies + MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset + MPM.add(createSCCPPass()); // Constant prop with SCCP + + // Run instcombine after redundancy elimination to exploit opportunities + // opened up by them. + MPM.add(createInstructionCombiningPass()); + MPM.add(createJumpThreadingPass()); // Thread jumps + MPM.add(createCorrelatedValuePropagationPass()); + MPM.add(createDeadStoreEliminationPass()); // Delete dead stores + + addExtensionsToPM(EP_ScalarOptimizerLate, MPM); + + MPM.add(createAggressiveDCEPass()); // Delete dead instructions + MPM.add(createCFGSimplificationPass()); // Merge & remove BBs + MPM.add(createInstructionCombiningPass()); // Clean up after everything. + + if (!DisableUnitAtATime) { + // FIXME: We shouldn't bother with this anymore. + MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes + + // GlobalOpt already deletes dead functions and globals, at -O3 try a + // late pass of GlobalDCE. It is capable of deleting dead cycles. + if (OptLevel > 2) + MPM.add(createGlobalDCEPass()); // Remove dead fns and globals. + + if (OptLevel > 1) + MPM.add(createConstantMergePass()); // Merge dup global constants + } +} + +void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM, + bool Internalize, + bool RunInliner) { + // Provide AliasAnalysis services for optimizations. + addInitialAliasAnalysisPasses(PM); + + // Now that composite has been compiled, scan through the module, looking + // for a main function. If main is defined, mark all other functions + // internal. + if (Internalize) + PM.add(createInternalizePass(true)); + + // Propagate constants at call sites into the functions they call. This + // opens opportunities for globalopt (and inlining) by substituting function + // pointers passed as arguments to direct uses of functions. + PM.add(createIPSCCPPass()); + + // Now that we internalized some globals, see if we can hack on them! + PM.add(createGlobalOptimizerPass()); + + // Linking modules together can lead to duplicated global constants, only + // keep one copy of each constant. + PM.add(createConstantMergePass()); + + // Remove unused arguments from functions. + PM.add(createDeadArgEliminationPass()); + + // Reduce the code after globalopt and ipsccp. Both can open up significant + // simplification opportunities, and both can propagate functions through + // function pointers. When this happens, we often have to resolve varargs + // calls, etc, so let instcombine do this. + PM.add(createInstructionCombiningPass()); + + // Inline small functions + if (RunInliner) + PM.add(createFunctionInliningPass()); + + PM.add(createPruneEHPass()); // Remove dead EH info. + + // Optimize globals again if we ran the inliner. + if (RunInliner) + PM.add(createGlobalOptimizerPass()); + PM.add(createGlobalDCEPass()); // Remove dead functions. + + // If we didn't decide to inline a function, check to see if we can + // transform it to pass arguments by value instead of by reference. + PM.add(createArgumentPromotionPass()); + + // The IPO passes may leave cruft around. Clean up after them. + PM.add(createInstructionCombiningPass()); + PM.add(createJumpThreadingPass()); + // Break up allocas + PM.add(createScalarReplAggregatesPass()); + + // Run a few AA driven optimizations here and now, to cleanup the code. + PM.add(createFunctionAttrsPass()); // Add nocapture. + PM.add(createGlobalsModRefPass()); // IP alias analysis. + + PM.add(createLICMPass()); // Hoist loop invariants. + PM.add(createGVNPass()); // Remove redundancies. + PM.add(createMemCpyOptPass()); // Remove dead memcpys. + // Nuke dead stores. + PM.add(createDeadStoreEliminationPass()); + + // Cleanup and simplify the code after the scalar optimizations. + PM.add(createInstructionCombiningPass()); + + PM.add(createJumpThreadingPass()); + + // Delete basic blocks, which optimization passes may have killed. + PM.add(createCFGSimplificationPass()); + + // Now that we have optimized the program, discard unreachable functions. + PM.add(createGlobalDCEPass()); +} Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=136727&r1=136726&r2=136727&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original) +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Tue Aug 2 16:50:27 2011 @@ -17,6 +17,7 @@ #include "ToolRunner.h" #include "llvm/LinkAllPasses.h" #include "llvm/LLVMContext.h" +#include "llvm/PassManager.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=136727&r1=136726&r2=136727&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Tue Aug 2 16:50:27 2011 @@ -12,6 +12,8 @@ //===----------------------------------------------------------------------===// #include "llvm/Module.h" +#include "llvm/PassManager.h" +#include "llvm/Analysis/Verifier.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/DynamicLibrary.h" @@ -19,7 +21,9 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/PluginLoader.h" +#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" +#include "llvm/Transforms/Scalar.h" using namespace llvm; // Pass Name Options as generated by the PassNameParser Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=136727&r1=136726&r2=136727&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Tue Aug 2 16:50:27 2011 @@ -23,6 +23,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Triple.h" #include "llvm/Analysis/Passes.h" +#include "llvm/Analysis/Verifier.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" @@ -44,6 +45,7 @@ #include "llvm/Support/Signals.h" #include "llvm/Support/system_error.h" #include "llvm/Config/config.h" +#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" #include #include From isanbard at gmail.com Tue Aug 2 16:52:38 2011 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 02 Aug 2011 21:52:38 -0000 Subject: [llvm-commits] [llvm] r136729 - /llvm/trunk/docs/LangRef.html Message-ID: <20110802215238.892232A6C12C@llvm.org> Author: void Date: Tue Aug 2 16:52:38 2011 New Revision: 136729 URL: http://llvm.org/viewvc/llvm-project?rev=136729&view=rev Log: Add the documentation for the 'landingpad' instruction. Improve the 'invoke' instruction's documentation to reference the landingpad and resume instructions. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=136729&r1=136728&r2=136729&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Tue Aug 2 16:52:38 2011 @@ -202,6 +202,7 @@
  • 'select' Instruction
  • 'call' Instruction
  • 'va_arg' Instruction
  • +
  • 'landingpad' Instruction
  • @@ -3256,6 +3257,17 @@ instruction, control is interrupted and continued at the dynamically nearest "exception" label.

    +

    The 'exception' label is a + landing pad for the + exception. As such, 'exception' label is required to have the + "landingpad" instruction, which contains + the information about about the behavior of the program after unwinding + happens, as its first non-PHI instruction. The restrictions on the + "landingpad" instruction's tightly couples it to the + "invoke" instruction, so that the important information contained + within the "landingpad" instruction can't be lost through normal + code motion.

    +
    Arguments:

    This instruction requires several arguments:

    @@ -3372,17 +3384,18 @@ successors.

    Arguments:
    -

    The 'resume' instruction's argument must have the same type as the - result of any 'landingpad' instruction in the same function.

    +

    The 'resume' instruction requires one argument, which must have the + same type as the result of the 'landingpad' instruction which + interrupted the unwinding.

    Semantics:

    The 'resume' instruction resumes propagation of an existing (in-flight) exception whose unwinding was interrupted with - a landingpad instruction.

    + a landingpad instruction.

    Example:
    - resume { i8*, i32 } %exn
    +  resume { i8*, i32 } %exn
     
    @@ -5970,6 +5983,79 @@ + +

    + 'landingpad' Instruction +

    + +
    + +
    Syntax:
    +
    +  <resultval> = landingpad <somety> personality <type> <pers_fn> cleanup? <clause>+
    +  <clause> := catch <type> <value>
    +  <clause> := filter <type> <value>
    +
    + +
    Overview:
    +

    The 'landingpad' instruction is used by + LLVM's exception handling + system to specify that a basic block is a landing pad — one where + the exception lands, and corresponds to the code found in the + catch portion of a try/catch sequence. It + defines values supplied by the personality function (pers_fn) upon + re-entry to the function. The resultval has the + type somety.

    + +
    Arguments:
    +

    This instruction takes a pers_fn value. This is the personality + function associated with the unwinding mechanism. The optional + cleanup flag indicates that the landing pad block is a cleanup.

    + +

    A clause begins with the clause type — catch + or filter — and contains a list of global variables + representing the "types" that may be caught or filtered respectively. The + 'landingpad' instruction must contain at least + one clause or the cleanup flag.

    + +
    Semantics:
    +

    The 'landingpad' instruction defines the values which are set by the + personality function (pers_fn) upon re-entry to the function, and + therefore the "result type" of the landingpad instruction. As with + calling conventions, how the personality function results are represented in + LLVM IR is target specific.

    + +

    The landingpad instruction has several restrictions:

    + +
      +
    • A landing pad block is a basic block which is the unwind destination of an + 'invoke' instruction.
    • +
    • A landing pad block must have a 'landingpad' instruction as its + first non-PHI instruction.
    • +
    • There can be only one 'landingpad' instruction within the landing + pad block.
    • +
    • A basic block that is not a landing pad block may not include a + 'landingpad' instruction.
    • +
    • All 'landingpad' instructions in a function must have the same + personality function.
    • +
    + +
    Example:
    +
    +  ;; A landing pad which can catch an integer.
    +  %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
    +           catch i8** @_ZTIi
    +  ;; A landing pad that is a cleanup.
    +  %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
    +           cleanup  
    +  ;; A landing pad which can catch an integer and can only throw a double.
    +  %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
    +           catch i8** @_ZTIi
    +           filter i8** @_ZTId
    +
    + +
    + From stoklund at 2pi.dk Tue Aug 2 16:53:04 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 02 Aug 2011 21:53:04 -0000 Subject: [llvm-commits] [llvm] r136731 - in /llvm/trunk/lib/CodeGen: SpillPlacement.cpp SpillPlacement.h Message-ID: <20110802215304.163A62A6C12D@llvm.org> Author: stoklund Date: Tue Aug 2 16:53:03 2011 New Revision: 136731 URL: http://llvm.org/viewvc/llvm-project?rev=136731&view=rev Log: Extend the SpillPlacement interface with two new features. The PrefBoth constraint is used for blocks that ideally want a live-in value both on the stack and in a register. This would be used by a block that has a use before interference forces a spill. Secondly, add the ChangesValue flag to BlockConstraint. This tells SpillPlacement if a live-in value on the stack can be reused as a live-out stack value for free. If the block redefines the virtual register, a spill would be required for that. This extra information will be used by SpillPlacement to more accurately calculate spill costs when a value can exist both on the stack and in a register. The simplest example is a basic block that reads the virtual register, but doesn't change its value. Spilling around such a block requires a reload, but no spill in the block. The spiller already knows this, but the spill placer doesn't. That can sometimes lead to suboptimal regions. Modified: llvm/trunk/lib/CodeGen/SpillPlacement.cpp llvm/trunk/lib/CodeGen/SpillPlacement.h Modified: llvm/trunk/lib/CodeGen/SpillPlacement.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SpillPlacement.cpp?rev=136731&r1=136730&r2=136731&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SpillPlacement.cpp (original) +++ llvm/trunk/lib/CodeGen/SpillPlacement.cpp Tue Aug 2 16:53:03 2011 @@ -220,6 +220,7 @@ 0, // DontCare, 1, // PrefReg, -1, // PrefSpill + 0, // PrefBoth -HUGE_VALF // MustSpill }; Modified: llvm/trunk/lib/CodeGen/SpillPlacement.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SpillPlacement.h?rev=136731&r1=136730&r2=136731&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SpillPlacement.h (original) +++ llvm/trunk/lib/CodeGen/SpillPlacement.h Tue Aug 2 16:53:03 2011 @@ -71,6 +71,7 @@ DontCare, ///< Block doesn't care / variable not live. PrefReg, ///< Block entry/exit prefers a register. PrefSpill, ///< Block entry/exit prefers a stack slot. + PrefBoth, ///< Block entry prefers both register and stack. MustSpill ///< A register is impossible, variable must be spilled. }; @@ -79,6 +80,11 @@ unsigned Number; ///< Basic block number (from MBB::getNumber()). BorderConstraint Entry : 8; ///< Constraint on block entry. BorderConstraint Exit : 8; ///< Constraint on block exit. + + /// True when this block changes the value of the live range. This means + /// the block has a non-PHI def. When this is false, a live-in value on + /// the stack can be live-out on the stack without inserting a spill. + bool ChangesValue; }; /// prepare - Reset state and prepare for a new spill placement computation. @@ -96,7 +102,10 @@ /// live out. void addConstraints(ArrayRef LiveBlocks); - /// addPrefSpill - Add PrefSpill constraints to all blocks listed. + /// addPrefSpill - Add PrefSpill constraints to all blocks listed. This is + /// equivalent to calling addConstraint with identical BlockConstraints with + /// Entry = Exit = PrefSpill, and ChangesValue = false. + /// /// @param Blocks Array of block numbers that prefer to spill in and out. void addPrefSpill(ArrayRef Blocks); From wendling at apple.com Tue Aug 2 16:54:23 2011 From: wendling at apple.com (Bill Wendling) Date: Tue, 02 Aug 2011 14:54:23 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <59444632-A578-46B8-990A-5E2E9978F6B1@apple.com> Message-ID: <8E2ADC4C-701C-4F97-868F-3B018BAC9A4A@apple.com> On Aug 2, 2011, at 2:49 PM, David Blaikie wrote: >> How about these for the restrictions? >> >> ? A landing pad block is a basic block which is the unwind destination of an 'invoke' instruction. >> ? A landing pad block must have a 'landingpad' instruction as its first non-PHI instruction. >> ? There can be only one 'landingpad' instruction within the landing pad block. >> ? A basic block that is not a landing pad block may not include a 'landingpad' instruction. >> ? All 'landingpad' instructions in a function must have the same personality function. > > > How about: "A landing pad instruction must (and may only) be the first > non-PHI instruction in a landing pad block" > > This covers 2, 3, and 4 in one sentence, if I'm not mistaken. (& seems > clearer to me) > Hi David, That's not bad, but would like to err on the side of caution and make everything verbose when it comes to the restrictions we're placing on this instruction. :-) -bw From nicholas at mxc.ca Tue Aug 2 17:08:02 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 02 Aug 2011 22:08:02 -0000 Subject: [llvm-commits] [llvm] r136732 - in /llvm/trunk: lib/Transforms/InstCombine/InstructionCombining.cpp test/Transforms/InstCombine/malloc-free-delete.ll Message-ID: <20110802220802.15BD72A6C12C@llvm.org> Author: nicholas Date: Tue Aug 2 17:08:01 2011 New Revision: 136732 URL: http://llvm.org/viewvc/llvm-project?rev=136732&view=rev Log: Teach InstCombine that lifetime intrincs aren't a real user on the result of a malloc call. Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=136732&r1=136731&r2=136732&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Aug 2 17:08:01 2011 @@ -1043,7 +1043,10 @@ -static bool IsOnlyNullComparedAndFreed(const Value &V) { +static bool IsOnlyNullComparedAndFreed(const Value &V, int Depth = 0) { + if (Depth == 8) + return false; + for (Value::const_use_iterator UI = V.use_begin(), UE = V.use_end(); UI != UE; ++UI) { const User *U = *UI; @@ -1052,6 +1055,20 @@ if (const ICmpInst *ICI = dyn_cast(U)) if (ICI->isEquality() && isa(ICI->getOperand(1))) continue; + if (const BitCastInst *BCI = dyn_cast(U)) { + if (IsOnlyNullComparedAndFreed(*BCI, Depth+1)) + continue; + } + if (const GetElementPtrInst *GEPI = dyn_cast(U)) { + if (GEPI->hasAllZeroIndices() && + IsOnlyNullComparedAndFreed(*GEPI, Depth+1)) + continue; + } + if (const IntrinsicInst *II = dyn_cast(U)) { + if (II->getIntrinsicID() == Intrinsic::lifetime_start || + II->getIntrinsicID() == Intrinsic::lifetime_end) + continue; + } return false; } return true; @@ -1064,22 +1081,29 @@ if (IsOnlyNullComparedAndFreed(MI)) { for (Value::use_iterator UI = MI.use_begin(), UE = MI.use_end(); UI != UE;) { - // We can assume that every remaining use is a free call or an icmp eq/ne - // to null, so the cast is safe. + // All the users permitted by IsOnlyNullComparedAndFreed are Instructions. Instruction *I = cast(*UI); // Early increment here, as we're about to get rid of the user. ++UI; - if (isFreeCall(I)) { - EraseInstFromFunction(*cast(I)); - continue; + if (CallInst *CI = isFreeCall(I)) { + if (CI != I) + EraseInstFromFunction(*CI); + EraseInstFromFunction(*I); + } else if (ICmpInst *C = dyn_cast(I)) { + ReplaceInstUsesWith(*C, + ConstantInt::get(Type::getInt1Ty(C->getContext()), + C->isFalseWhenEqual())); + EraseInstFromFunction(*C); + } else if (I->getType()->isVoidTy()) { + // An all-zero GEP or a bitcast. + ReplaceInstUsesWith(*I, UndefValue::get(I->getType())); + EraseInstFromFunction(*I); + } else { + // A lifetime intrinsic. + EraseInstFromFunction(*I); } - // Again, the cast is safe. - ICmpInst *C = cast(I); - ReplaceInstUsesWith(*C, ConstantInt::get(Type::getInt1Ty(C->getContext()), - C->isFalseWhenEqual())); - EraseInstFromFunction(*C); } return EraseInstFromFunction(MI); } Modified: llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll?rev=136732&r1=136731&r2=136732&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll Tue Aug 2 17:08:01 2011 @@ -12,7 +12,7 @@ ; CHECK: ret i32 0 } -declare i8* @malloc(i32) +declare noalias i8* @malloc(i32) declare void @free(i8*) define i1 @foo() { @@ -23,3 +23,15 @@ call void @free(i8* %m) ret i1 %z } + +declare void @llvm.lifetime.start(i64, i8*) +declare void @llvm.lifetime.end(i64, i8*) + +define void @test3() { +; CHECK: @test3 +; CHECK-NEXT: ret void + %a = call noalias i8* @malloc(i32 10) + call void @llvm.lifetime.start(i64 10, i8* %a) + call void @llvm.lifetime.end(i64 10, i8* %a) + ret void +} From wendling at apple.com Tue Aug 2 17:19:31 2011 From: wendling at apple.com (Bill Wendling) Date: Tue, 02 Aug 2011 15:19:31 -0700 Subject: [llvm-commits] [Patch] Landingpad Instruction In-Reply-To: References: Message-ID: <375FE820-8F45-4AF6-A322-E0717B6131BB@apple.com> On Aug 2, 2011, at 1:32 PM, Chris Lattner wrote: > On Aug 2, 2011, at 11:36 AM, Bill Wendling wrote: > >> On Aug 2, 2011, at 11:19 AM, Eli Friedman wrote: >> >>> On Tue, Aug 2, 2011 at 10:58 AM, Bill Wendling wrote: >>>> Ping? >>> >>> Are you sure the verifier changes are correct given a module which >>> uses two different different personality functions? It looks >>> suspicious. >>> >> Good point. I'll have to clear the PersonalityFn value after it's run on a function. >> >>> Otherwise, it looks okay to me; not sure if you were trying to ping >>> Chris specifically. >>> >> The ping was for anyone who is qualified to review the patch. I suspect that Chris may have some input and I didn't want to have this fall off his plate. :-) >> >> Thanks for the review! > > Please update the patch after the langref change goes in and I'll take a look, thanks Bill! > Here's an updated version of the landingpad inst patch. Share and enjoy! -bw -------------- next part -------------- A non-text attachment was scrubbed... Name: landingpadinst.diff Type: application/octet-stream Size: 31906 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110802/b9deadeb/attachment.obj -------------- next part -------------- From stoklund at 2pi.dk Tue Aug 2 17:37:20 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 02 Aug 2011 22:37:20 -0000 Subject: [llvm-commits] [llvm] r136735 - in /llvm/trunk/lib/CodeGen: SplitKit.cpp SplitKit.h Message-ID: <20110802223720.82C1C2A6C12C@llvm.org> Author: stoklund Date: Tue Aug 2 17:37:20 2011 New Revision: 136735 URL: http://llvm.org/viewvc/llvm-project?rev=136735&view=rev Log: Delete BlockInfo::LiveThrough. It wasn't used any more. Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=136735&r1=136734&r2=136735&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Tue Aug 2 17:37:20 2011 @@ -203,7 +203,6 @@ ++NumGapBlocks; // Push the Live-in part. - BI.LiveThrough = false; BI.LiveOut = false; UseBlocks.push_back(BI); UseBlocks.back().LastUse = LastStop; @@ -215,8 +214,6 @@ } } - // Don't set LiveThrough when the block has a gap. - BI.LiveThrough = BI.LiveIn && BI.LiveOut; UseBlocks.push_back(BI); // LVI is now at LVE or LVI->end >= Stop. Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=136735&r1=136734&r2=136735&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Tue Aug 2 17:37:20 2011 @@ -78,7 +78,6 @@ MachineBasicBlock *MBB; SlotIndex FirstUse; ///< First instr using current reg. SlotIndex LastUse; ///< Last instr using current reg. - bool LiveThrough; ///< Live in whole block (Templ 5. above). bool LiveIn; ///< Current reg is live in. bool LiveOut; ///< Current reg is live out. From stoklund at 2pi.dk Tue Aug 2 17:37:22 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 02 Aug 2011 22:37:22 -0000 Subject: [llvm-commits] [llvm] r136736 - in /llvm/trunk/lib/CodeGen: SplitKit.cpp SplitKit.h Message-ID: <20110802223722.DC54D2A6C12D@llvm.org> Author: stoklund Date: Tue Aug 2 17:37:22 2011 New Revision: 136736 URL: http://llvm.org/viewvc/llvm-project?rev=136736&view=rev Log: Add a BlockInfo::FirstDef field. This is either an invalid SlotIndex, or valno->def for the first value defined inside the block. PHI values are not counted as defined inside the block. The FirstDef field will be used when estimating the cost of spilling around a block. Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=136736&r1=136735&r2=136736&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Tue Aug 2 17:37:22 2011 @@ -188,6 +188,13 @@ // LVI is the first live segment overlapping MBB. BI.LiveIn = LVI->start <= Start; + // When not live in, the first use should be a def. + if (!BI.LiveIn) { + assert(LVI->start == LVI->valno->def && "Dangling LiveRange start"); + assert(LVI->start == BI.FirstUse && "First instr should be a def"); + BI.FirstDef = BI.FirstUse; + } + // Look for gaps in the live range. BI.LiveOut = true; while (LVI->end < Stop) { @@ -197,6 +204,7 @@ BI.LastUse = LastStop; break; } + if (LastStop < LVI->start) { // There is a gap in the live range. Create duplicate entries for the // live-in snippet and the live-out snippet. @@ -210,8 +218,13 @@ // Set up BI for the live-out part. BI.LiveIn = false; BI.LiveOut = true; - BI.FirstUse = LVI->start; + BI.FirstUse = BI.FirstDef = LVI->start; } + + // A LiveRange that starts in the middle of the block must be a def. + assert(LVI->start == LVI->valno->def && "Dangling LiveRange start"); + if (!BI.FirstDef) + BI.FirstDef = LVI->start; } UseBlocks.push_back(BI); Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=136736&r1=136735&r2=136736&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Tue Aug 2 17:37:22 2011 @@ -78,6 +78,7 @@ MachineBasicBlock *MBB; SlotIndex FirstUse; ///< First instr using current reg. SlotIndex LastUse; ///< Last instr using current reg. + SlotIndex FirstDef; ///< First non-phi valno->def, or SlotIndex(). bool LiveIn; ///< Current reg is live in. bool LiveOut; ///< Current reg is live out. From eli.friedman at gmail.com Tue Aug 2 17:44:16 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 02 Aug 2011 22:44:16 -0000 Subject: [llvm-commits] [llvm] r136737 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <20110802224416.507432A6C12C@llvm.org> Author: efriedma Date: Tue Aug 2 17:44:16 2011 New Revision: 136737 URL: http://llvm.org/viewvc/llvm-project?rev=136737&view=rev Log: ARM backend support for atomicrmw and cmpxchg with non-monotonic ordering. Not especially pretty, but seems to work well enough. If this looks okay, I'll put together similar patches for Mips, PPC, and Alpha. 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=136737&r1=136736&r2=136737&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Aug 2 17:44:16 2011 @@ -602,58 +602,37 @@ // normally. setOperationAction(ISD::MEMBARRIER, MVT::Other, Custom); setOperationAction(ISD::ATOMIC_FENCE, MVT::Other, Custom); + setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_SWAP, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_ADD, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_SUB, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_AND, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_OR, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_XOR, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_NAND, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_MIN, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_MAX, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_UMIN, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_UMAX, MVT::i32, Custom); } else { // Set them all for expansion, which will force libcalls. setOperationAction(ISD::MEMBARRIER, MVT::Other, Expand); setOperationAction(ISD::ATOMIC_FENCE, MVT::Other, Expand); - setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_SWAP, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_SWAP, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_SWAP, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_ADD, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_ADD, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_ADD, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_SUB, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_SUB, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_SUB, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_AND, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_AND, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_AND, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_OR, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_OR, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_OR, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_XOR, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_XOR, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_XOR, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_NAND, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_NAND, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_NAND, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_MIN, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_MIN, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_MIN, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_MAX, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_MAX, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_MAX, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_UMIN, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_UMIN, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_UMIN, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_UMAX, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_UMAX, MVT::i16, Expand); setOperationAction(ISD::ATOMIC_LOAD_UMAX, MVT::i32, Expand); // Since the libcalls include locking, fold in the fences setShouldFoldAtomicFences(true); } - // 64-bit versions are always libcalls (for now) - setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i64, Expand); - setOperationAction(ISD::ATOMIC_SWAP, MVT::i64, Expand); - setOperationAction(ISD::ATOMIC_LOAD_ADD, MVT::i64, Expand); - setOperationAction(ISD::ATOMIC_LOAD_SUB, MVT::i64, Expand); - setOperationAction(ISD::ATOMIC_LOAD_AND, MVT::i64, Expand); - setOperationAction(ISD::ATOMIC_LOAD_OR, MVT::i64, Expand); - setOperationAction(ISD::ATOMIC_LOAD_XOR, MVT::i64, Expand); - setOperationAction(ISD::ATOMIC_LOAD_NAND, MVT::i64, Expand); setOperationAction(ISD::PREFETCH, MVT::Other, Custom); @@ -2279,33 +2258,72 @@ DAG.getConstant(DMBOpt, MVT::i32)); } - -static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG, - const ARMSubtarget *Subtarget) { - // FIXME: handle "fence singlethread" more efficiently. - DebugLoc dl = Op.getDebugLoc(); +static SDValue getFence(SDValue InChain, DebugLoc dl, SelectionDAG &DAG, + const ARMSubtarget *Subtarget) { if (!Subtarget->hasDataBarrier()) { // Some ARMv6 cpus can support data barriers with an mcr instruction. // Thumb1 and pre-v6 ARM mode use a libcall instead and should never get // here. assert(Subtarget->hasV6Ops() && !Subtarget->isThumb() && "Unexpected ISD::MEMBARRIER encountered. Should be libcall!"); - return DAG.getNode(ARMISD::MEMBARRIER_MCR, dl, MVT::Other, Op.getOperand(0), + return DAG.getNode(ARMISD::MEMBARRIER_MCR, dl, MVT::Other, InChain, DAG.getConstant(0, MVT::i32)); } - AtomicOrdering FenceOrdering = static_cast( - cast(Op.getOperand(1))->getZExtValue()); + return DAG.getNode(ARMISD::MEMBARRIER, dl, MVT::Other, InChain, + DAG.getConstant(ARM_MB::ISH, MVT::i32)); +} - ARM_MB::MemBOpt DMBOpt; - if (FenceOrdering == Release) - DMBOpt = ARM_MB::ISHST; +static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG, + const ARMSubtarget *Subtarget) { + // FIXME: handle "fence singlethread" more efficiently. + DebugLoc dl = Op.getDebugLoc(); + return getFence(Op.getOperand(0), dl, DAG, Subtarget); +} + +static SDValue LowerAtomicMemOp(SDValue Op, SelectionDAG &DAG, + const ARMSubtarget *Subtarget) { + DebugLoc dl = Op.getDebugLoc(); + int Order = cast(Op)->getOrdering(); + if (Order <= Monotonic) + return Op; + + SDValue InChain = Op.getOperand(0); + + // Fence, if necessary + if (Order == Release || Order >= AcquireRelease) + InChain = getFence(InChain, dl, DAG, Subtarget); + + // Rather than mess with target-specific nodes, use the target-indepedent + // node, and assume the DAGCombiner will not touch it post-legalize. + SDValue OutVal; + if (Op.getOpcode() == ISD::ATOMIC_CMP_SWAP) + OutVal = DAG.getAtomic(ISD::ATOMIC_CMP_SWAP, dl, + cast(Op)->getMemoryVT(), + InChain, Op.getOperand(1), Op.getOperand(2), + Op.getOperand(3), + cast(Op)->getMemOperand(), + Monotonic, + cast(Op)->getSynchScope()); else - DMBOpt = ARM_MB::ISH; - return DAG.getNode(ARMISD::MEMBARRIER, dl, MVT::Other, Op.getOperand(0), - DAG.getConstant(DMBOpt, MVT::i32)); + OutVal = DAG.getAtomic(Op.getOpcode(), dl, + cast(Op)->getMemoryVT(), + InChain, Op.getOperand(1), Op.getOperand(2), + cast(Op)->getMemOperand(), + Monotonic, + cast(Op)->getSynchScope()); + + SDValue OutChain = OutVal.getValue(1); + + // Fence, if necessary + if (Order == Acquire || Order >= AcquireRelease) + OutChain = getFence(OutChain, dl, DAG, Subtarget); + + SDValue Ops[2] = { OutVal, OutChain }; + return DAG.getMergeValues(Ops, 2, dl); } + static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget) { // ARM pre v5TE and Thumb1 does not have preload instructions. @@ -4864,6 +4882,18 @@ case ISD::VASTART: return LowerVASTART(Op, DAG); case ISD::MEMBARRIER: return LowerMEMBARRIER(Op, DAG, Subtarget); case ISD::ATOMIC_FENCE: return LowerATOMIC_FENCE(Op, DAG, Subtarget); + case ISD::ATOMIC_CMP_SWAP: + case ISD::ATOMIC_SWAP: + case ISD::ATOMIC_LOAD_ADD: + case ISD::ATOMIC_LOAD_SUB: + case ISD::ATOMIC_LOAD_AND: + case ISD::ATOMIC_LOAD_OR: + case ISD::ATOMIC_LOAD_XOR: + case ISD::ATOMIC_LOAD_NAND: + case ISD::ATOMIC_LOAD_MIN: + case ISD::ATOMIC_LOAD_MAX: + case ISD::ATOMIC_LOAD_UMIN: + case ISD::ATOMIC_LOAD_UMAX: return LowerAtomicMemOp(Op, DAG, Subtarget); case ISD::PREFETCH: return LowerPREFETCH(Op, DAG, Subtarget); case ISD::SINT_TO_FP: case ISD::UINT_TO_FP: return LowerINT_TO_FP(Op, DAG); From evan.cheng at apple.com Tue Aug 2 17:53:49 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 02 Aug 2011 22:53:49 -0000 Subject: [llvm-commits] [llvm] r136738 - /llvm/trunk/tools/edis/Makefile Message-ID: <20110802225349.2C89C2A6C12C@llvm.org> Author: evancheng Date: Tue Aug 2 17:53:48 2011 New Revision: 136738 URL: http://llvm.org/viewvc/llvm-project?rev=136738&view=rev Log: lldb doesn't need the edis dylib any more. Modified: llvm/trunk/tools/edis/Makefile Modified: llvm/trunk/tools/edis/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/Makefile?rev=136738&r1=136737&r2=136738&view=diff ============================================================================== --- llvm/trunk/tools/edis/Makefile (original) +++ llvm/trunk/tools/edis/Makefile Tue Aug 2 17:53:48 2011 @@ -10,7 +10,6 @@ LEVEL = ../.. LIBRARYNAME = EnhancedDisassembly LINK_LIBS_IN_SHARED = 1 -SHARED_LIBRARY = 1 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/EnhancedDisassembly.exports From stoklund at 2pi.dk Tue Aug 2 17:54:14 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 02 Aug 2011 22:54:14 -0000 Subject: [llvm-commits] [llvm] r136739 - in /llvm/trunk/lib/CodeGen: RegAllocGreedy.cpp SplitKit.cpp SplitKit.h Message-ID: <20110802225414.B49A02A6C12C@llvm.org> Author: stoklund Date: Tue Aug 2 17:54:14 2011 New Revision: 136739 URL: http://llvm.org/viewvc/llvm-project?rev=136739&view=rev Log: Rename {First,Last}Use to {First,Last}Instr. With a 'FirstDef' field right there, it is very confusing that FirstUse refers to an instruction that may be a def. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp llvm/trunk/lib/CodeGen/SplitKit.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=136739&r1=136738&r2=136739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Aug 2 17:54:14 2011 @@ -687,9 +687,9 @@ if (BI.LiveIn) { if (Intf.first() <= Indexes->getMBBStartIdx(BC.Number)) BC.Entry = SpillPlacement::MustSpill, ++Ins; - else if (Intf.first() < BI.FirstUse) + else if (Intf.first() < BI.FirstInstr) BC.Entry = SpillPlacement::PrefSpill, ++Ins; - else if (Intf.first() < BI.LastUse) + else if (Intf.first() < BI.LastInstr) ++Ins; } @@ -697,9 +697,9 @@ if (BI.LiveOut) { if (Intf.last() >= SA->getLastSplitPoint(BC.Number)) BC.Exit = SpillPlacement::MustSpill, ++Ins; - else if (Intf.last() > BI.LastUse) + else if (Intf.last() > BI.LastInstr) BC.Exit = SpillPlacement::PrefSpill, ++Ins; - else if (Intf.last() > BI.FirstUse) + else if (Intf.last() > BI.FirstInstr) ++Ins; } @@ -1216,8 +1216,10 @@ const unsigned NumGaps = Uses.size()-1; // Start and end points for the interference check. - SlotIndex StartIdx = BI.LiveIn ? BI.FirstUse.getBaseIndex() : BI.FirstUse; - SlotIndex StopIdx = BI.LiveOut ? BI.LastUse.getBoundaryIndex() : BI.LastUse; + SlotIndex StartIdx = + BI.LiveIn ? BI.FirstInstr.getBaseIndex() : BI.FirstInstr; + SlotIndex StopIdx = + BI.LiveOut ? BI.LastInstr.getBoundaryIndex() : BI.LastInstr; GapWeight.assign(NumGaps, 0.0f); @@ -1227,8 +1229,8 @@ .checkInterference()) continue; - // We know that VirtReg is a continuous interval from FirstUse to LastUse, - // so we don't need InterferenceQuery. + // We know that VirtReg is a continuous interval from FirstInstr to + // LastInstr, so we don't need InterferenceQuery. // // Interference that overlaps an instruction is counted in both gaps // surrounding the instruction. The exception is interference before @@ -1268,8 +1270,8 @@ // while only covering a single block - A phi-def can use undef values from // predecessors, and the block could be a single-block loop. // We don't bother doing anything clever about such a case, we simply assume - // that the interval is continuous from FirstUse to LastUse. We should make - // sure that we don't do anything illegal to such an interval, though. + // that the interval is continuous from FirstInstr to LastInstr. We should + // make sure that we don't do anything illegal to such an interval, though. const SmallVectorImpl &Uses = SA->UseSlots; if (Uses.size() <= 2) Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=136739&r1=136738&r2=136739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Tue Aug 2 17:54:14 2011 @@ -178,12 +178,12 @@ return false; } else { // This block has uses. Find the first and last uses in the block. - BI.FirstUse = *UseI; - assert(BI.FirstUse >= Start); + BI.FirstInstr = *UseI; + assert(BI.FirstInstr >= Start); do ++UseI; while (UseI != UseE && *UseI < Stop); - BI.LastUse = UseI[-1]; - assert(BI.LastUse < Stop); + BI.LastInstr = UseI[-1]; + assert(BI.LastInstr < Stop); // LVI is the first live segment overlapping MBB. BI.LiveIn = LVI->start <= Start; @@ -191,8 +191,8 @@ // When not live in, the first use should be a def. if (!BI.LiveIn) { assert(LVI->start == LVI->valno->def && "Dangling LiveRange start"); - assert(LVI->start == BI.FirstUse && "First instr should be a def"); - BI.FirstDef = BI.FirstUse; + assert(LVI->start == BI.FirstInstr && "First instr should be a def"); + BI.FirstDef = BI.FirstInstr; } // Look for gaps in the live range. @@ -201,7 +201,7 @@ SlotIndex LastStop = LVI->end; if (++LVI == LVE || LVI->start >= Stop) { BI.LiveOut = false; - BI.LastUse = LastStop; + BI.LastInstr = LastStop; break; } @@ -213,12 +213,12 @@ // Push the Live-in part. BI.LiveOut = false; UseBlocks.push_back(BI); - UseBlocks.back().LastUse = LastStop; + UseBlocks.back().LastInstr = LastStop; // Set up BI for the live-out part. BI.LiveIn = false; BI.LiveOut = true; - BI.FirstUse = BI.FirstDef = LVI->start; + BI.FirstInstr = BI.FirstDef = LVI->start; } // A LiveRange that starts in the middle of the block must be a def. @@ -1096,7 +1096,7 @@ // Add blocks with multiple uses. for (unsigned i = 0, e = UseBlocks.size(); i != e; ++i) { const BlockInfo &BI = UseBlocks[i]; - if (BI.FirstUse == BI.LastUse) + if (BI.FirstInstr == BI.LastInstr) continue; Blocks.insert(BI.MBB); } @@ -1106,15 +1106,15 @@ void SplitEditor::splitSingleBlock(const SplitAnalysis::BlockInfo &BI) { openIntv(); SlotIndex LastSplitPoint = SA.getLastSplitPoint(BI.MBB->getNumber()); - SlotIndex SegStart = enterIntvBefore(std::min(BI.FirstUse, + SlotIndex SegStart = enterIntvBefore(std::min(BI.FirstInstr, LastSplitPoint)); - if (!BI.LiveOut || BI.LastUse < LastSplitPoint) { - useIntv(SegStart, leaveIntvAfter(BI.LastUse)); + if (!BI.LiveOut || BI.LastInstr < LastSplitPoint) { + useIntv(SegStart, leaveIntvAfter(BI.LastInstr)); } else { // The last use is after the last valid split point. SlotIndex SegStop = leaveIntvBefore(LastSplitPoint); useIntv(SegStart, SegStop); - overlapIntv(SegStop, BI.LastUse); + overlapIntv(SegStop, BI.LastInstr); } } @@ -1253,7 +1253,7 @@ tie(Start, Stop) = LIS.getSlotIndexes()->getMBBRange(BI.MBB); DEBUG(dbgs() << "BB#" << BI.MBB->getNumber() << " [" << Start << ';' << Stop - << "), uses " << BI.FirstUse << '-' << BI.LastUse + << "), uses " << BI.FirstInstr << '-' << BI.LastInstr << ", reg-in " << IntvIn << ", leave before " << LeaveBefore << (BI.LiveOut ? ", stack-out" : ", killed in block")); @@ -1261,7 +1261,7 @@ assert(BI.LiveIn && "Must be live-in"); assert((!LeaveBefore || LeaveBefore > Start) && "Bad interference"); - if (!BI.LiveOut && (!LeaveBefore || LeaveBefore >= BI.LastUse)) { + if (!BI.LiveOut && (!LeaveBefore || LeaveBefore >= BI.LastInstr)) { DEBUG(dbgs() << " before interference.\n"); // // <<< Interference after kill. @@ -1269,13 +1269,13 @@ // ========= Use IntvIn everywhere. // selectIntv(IntvIn); - useIntv(Start, BI.LastUse); + useIntv(Start, BI.LastInstr); return; } SlotIndex LSP = SA.getLastSplitPoint(BI.MBB->getNumber()); - if (!LeaveBefore || LeaveBefore > BI.LastUse.getBoundaryIndex()) { + if (!LeaveBefore || LeaveBefore > BI.LastInstr.getBoundaryIndex()) { // // <<< Possible interference after last use. // |---o---o---| Live-out on stack. @@ -1286,17 +1286,17 @@ // ============ Copy to stack after LSP, overlap IntvIn. // \_____ Stack interval is live-out. // - if (BI.LastUse < LSP) { + if (BI.LastInstr < LSP) { DEBUG(dbgs() << ", spill after last use before interference.\n"); selectIntv(IntvIn); - SlotIndex Idx = leaveIntvAfter(BI.LastUse); + SlotIndex Idx = leaveIntvAfter(BI.LastInstr); useIntv(Start, Idx); assert((!LeaveBefore || Idx <= LeaveBefore) && "Interference"); } else { DEBUG(dbgs() << ", spill before last split point.\n"); selectIntv(IntvIn); SlotIndex Idx = leaveIntvBefore(LSP); - overlapIntv(Idx, BI.LastUse); + overlapIntv(Idx, BI.LastInstr); useIntv(Start, Idx); assert((!LeaveBefore || Idx <= LeaveBefore) && "Interference"); } @@ -1310,13 +1310,13 @@ (void)LocalIntv; DEBUG(dbgs() << ", creating local interval " << LocalIntv << ".\n"); - if (!BI.LiveOut || BI.LastUse < LSP) { + if (!BI.LiveOut || BI.LastInstr < LSP) { // // <<<<<<< Interference overlapping uses. // |---o---o---| Live-out on stack. // =====----____ Leave IntvIn before interference, then spill. // - SlotIndex To = leaveIntvAfter(BI.LastUse); + SlotIndex To = leaveIntvAfter(BI.LastInstr); SlotIndex From = enterIntvBefore(LeaveBefore); useIntv(From, To); selectIntv(IntvIn); @@ -1331,7 +1331,7 @@ // \_____ Stack interval is live-out. // SlotIndex To = leaveIntvBefore(LSP); - overlapIntv(To, BI.LastUse); + overlapIntv(To, BI.LastInstr); SlotIndex From = enterIntvBefore(std::min(To, LeaveBefore)); useIntv(From, To); selectIntv(IntvIn); @@ -1345,7 +1345,7 @@ tie(Start, Stop) = LIS.getSlotIndexes()->getMBBRange(BI.MBB); DEBUG(dbgs() << "BB#" << BI.MBB->getNumber() << " [" << Start << ';' << Stop - << "), uses " << BI.FirstUse << '-' << BI.LastUse + << "), uses " << BI.FirstInstr << '-' << BI.LastInstr << ", reg-out " << IntvOut << ", enter after " << EnterAfter << (BI.LiveIn ? ", stack-in" : ", defined in block")); @@ -1355,7 +1355,7 @@ assert(BI.LiveOut && "Must be live-out"); assert((!EnterAfter || EnterAfter < LSP) && "Bad interference"); - if (!BI.LiveIn && (!EnterAfter || EnterAfter <= BI.FirstUse)) { + if (!BI.LiveIn && (!EnterAfter || EnterAfter <= BI.FirstInstr)) { DEBUG(dbgs() << " after interference.\n"); // // >>>> Interference before def. @@ -1363,11 +1363,11 @@ // ========= Use IntvOut everywhere. // selectIntv(IntvOut); - useIntv(BI.FirstUse, Stop); + useIntv(BI.FirstInstr, Stop); return; } - if (!EnterAfter || EnterAfter < BI.FirstUse.getBaseIndex()) { + if (!EnterAfter || EnterAfter < BI.FirstInstr.getBaseIndex()) { DEBUG(dbgs() << ", reload after interference.\n"); // // >>>> Interference before def. @@ -1375,7 +1375,7 @@ // ____========= Enter IntvOut before first use. // selectIntv(IntvOut); - SlotIndex Idx = enterIntvBefore(std::min(LSP, BI.FirstUse)); + SlotIndex Idx = enterIntvBefore(std::min(LSP, BI.FirstInstr)); useIntv(Idx, Stop); assert((!EnterAfter || Idx >= EnterAfter) && "Interference"); return; @@ -1396,6 +1396,6 @@ assert((!EnterAfter || Idx >= EnterAfter) && "Interference"); openIntv(); - SlotIndex From = enterIntvBefore(std::min(Idx, BI.FirstUse)); + SlotIndex From = enterIntvBefore(std::min(Idx, BI.FirstInstr)); useIntv(From, Idx); } Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=136739&r1=136738&r2=136739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Tue Aug 2 17:54:14 2011 @@ -76,8 +76,8 @@ /// struct BlockInfo { MachineBasicBlock *MBB; - SlotIndex FirstUse; ///< First instr using current reg. - SlotIndex LastUse; ///< Last instr using current reg. + SlotIndex FirstInstr; ///< First instr accessing current reg. + SlotIndex LastInstr; ///< Last instr accessing current reg. SlotIndex FirstDef; ///< First non-phi valno->def, or SlotIndex(). bool LiveIn; ///< Current reg is live in. bool LiveOut; ///< Current reg is live out. @@ -85,7 +85,7 @@ /// isOneInstr - Returns true when this BlockInfo describes a single /// instruction. bool isOneInstr() const { - return SlotIndex::isSameInstr(FirstUse, LastUse); + return SlotIndex::isSameInstr(FirstInstr, LastInstr); } }; From stoklund at 2pi.dk Tue Aug 2 18:04:06 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 02 Aug 2011 23:04:06 -0000 Subject: [llvm-commits] [llvm] r136741 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110802230406.561952A6C12D@llvm.org> Author: stoklund Date: Tue Aug 2 18:04:06 2011 New Revision: 136741 URL: http://llvm.org/viewvc/llvm-project?rev=136741&view=rev Log: Inform SpillPlacement about blocks with defs. This information is not used for anything yet. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=136741&r1=136740&r2=136741&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Aug 2 18:04:06 2011 @@ -676,6 +676,7 @@ Intf.moveToBlock(BC.Number); BC.Entry = BI.LiveIn ? SpillPlacement::PrefReg : SpillPlacement::DontCare; BC.Exit = BI.LiveOut ? SpillPlacement::PrefReg : SpillPlacement::DontCare; + BC.ChangesValue = BI.FirstDef; if (!Intf.hasInterference()) continue; From stoklund at 2pi.dk Tue Aug 2 18:04:08 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 02 Aug 2011 23:04:08 -0000 Subject: [llvm-commits] [llvm] r136742 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110802230408.4AC182A6C12F@llvm.org> Author: stoklund Date: Tue Aug 2 18:04:08 2011 New Revision: 136742 URL: http://llvm.org/viewvc/llvm-project?rev=136742&view=rev Log: Use the precomputed def presence in RAGreedy::calcSpillCost. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=136742&r1=136741&r2=136742&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Aug 2 18:04:08 2011 @@ -864,7 +864,6 @@ /// SA around all use blocks instead of forming bundle regions. float RAGreedy::calcSpillCost() { float Cost = 0; - const LiveInterval &LI = SA->getParent(); ArrayRef UseBlocks = SA->getUseBlocks(); for (unsigned i = 0; i != UseBlocks.size(); ++i) { const SplitAnalysis::BlockInfo &BI = UseBlocks[i]; @@ -873,16 +872,8 @@ Cost += SpillPlacer->getBlockFrequency(Number); // Unless the value is redefined in the block. - if (BI.LiveIn && BI.LiveOut) { - SlotIndex Start, Stop; - tie(Start, Stop) = Indexes->getMBBRange(Number); - LiveInterval::const_iterator I = LI.find(Start); - assert(I != LI.end() && "Expected live-in value"); - // Is there a different live-out value? If so, we need an extra spill - // instruction. - if (I->end < Stop) - Cost += SpillPlacer->getBlockFrequency(Number); - } + if (BI.LiveIn && BI.LiveOut && BI.FirstDef) + Cost += SpillPlacer->getBlockFrequency(Number); } return Cost; } From rafael.espindola at gmail.com Tue Aug 2 18:38:19 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 02 Aug 2011 23:38:19 -0000 Subject: [llvm-commits] [dragonegg] r136746 - /dragonegg/trunk/src/Backend.cpp Message-ID: <20110802233819.43AA62A6C12C@llvm.org> Author: rafael Date: Tue Aug 2 18:38:19 2011 New Revision: 136746 URL: http://llvm.org/viewvc/llvm-project?rev=136746&view=rev Log: Update dragonegg for API change. Modified: dragonegg/trunk/src/Backend.cpp Modified: dragonegg/trunk/src/Backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=136746&r1=136745&r2=136746&view=diff ============================================================================== --- dragonegg/trunk/src/Backend.cpp (original) +++ dragonegg/trunk/src/Backend.cpp Tue Aug 2 18:38:19 2011 @@ -42,7 +42,7 @@ #include "llvm/MC/MCCodeGenInfo.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/PassManagerBuilder.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetRegistry.h" From rafael.espindola at gmail.com Tue Aug 2 18:41:45 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 02 Aug 2011 23:41:45 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r136747 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <20110802234146.000B52A6C12C@llvm.org> Author: rafael Date: Tue Aug 2 18:41:45 2011 New Revision: 136747 URL: http://llvm.org/viewvc/llvm-project?rev=136747&view=rev Log: Update for llvm api change. 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=136747&r1=136746&r2=136747&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Aug 2 18:41:45 2011 @@ -49,7 +49,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/PassManagerBuilder.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Program.h" From grosser at fim.uni-passau.de Tue Aug 2 19:09:49 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Wed, 03 Aug 2011 00:09:49 -0000 Subject: [llvm-commits] [polly] r136749 - /polly/trunk/lib/Analysis/Dependences.cpp Message-ID: <20110803000949.6E8A32A6C12C@llvm.org> Author: grosser Date: Tue Aug 2 19:09:49 2011 New Revision: 136749 URL: http://llvm.org/viewvc/llvm-project?rev=136749&view=rev Log: Dependences: Fix memory corruption. Signed-off-by: Tobias Grosser Modified: polly/trunk/lib/Analysis/Dependences.cpp Modified: polly/trunk/lib/Analysis/Dependences.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=136749&r1=136748&r2=136749&view=diff ============================================================================== --- polly/trunk/lib/Analysis/Dependences.cpp (original) +++ polly/trunk/lib/Analysis/Dependences.cpp Tue Aug 2 19:09:49 2011 @@ -102,12 +102,12 @@ accdom = isl_map_intersect_domain(accdom, domcp); if ((*MI)->isRead()) - isl_union_map_add_map(sink, accdom); + sink = isl_union_map_add_map(sink, accdom); else - isl_union_map_add_map(must_source, accdom); + must_source = isl_union_map_add_map(must_source, accdom); } isl_map *scattering = isl_map_copy(Stmt->getScattering()); - isl_union_map_add_map(schedule, scattering); + schedule = isl_union_map_add_map(schedule, scattering); } DEBUG( @@ -167,7 +167,7 @@ else scattering = isl_map_copy((*NewScattering)[Stmt]); - isl_union_map_add_map(schedule, scattering); + schedule = isl_union_map_add_map(schedule, scattering); } isl_union_map *temp_must_dep, *temp_may_dep; @@ -240,7 +240,7 @@ unsigned remainingDimensions = isl_map_n_out(scattering) - dimLevel; scattering = isl_map_project_out(scattering, isl_dim_out, dimLevel, remainingDimensions); - isl_union_map_add_map(schedule, scattering); + schedule = isl_union_map_add_map(schedule, scattering); } return schedule; From grosser at fim.uni-passau.de Tue Aug 2 19:12:12 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Wed, 03 Aug 2011 00:12:12 -0000 Subject: [llvm-commits] [polly] r136750 - /polly/trunk/lib/Analysis/ScopInfo.cpp Message-ID: <20110803001212.293082A6C12C@llvm.org> Author: grosser Date: Tue Aug 2 19:12:11 2011 New Revision: 136750 URL: http://llvm.org/viewvc/llvm-project?rev=136750&view=rev Log: ScopInfo: Do not use >"< in statement names. Signed-off-by: Tobias Grosser Modified: polly/trunk/lib/Analysis/ScopInfo.cpp Modified: polly/trunk/lib/Analysis/ScopInfo.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=136750&r1=136749&r2=136750&view=diff ============================================================================== --- polly/trunk/lib/Analysis/ScopInfo.cpp (original) +++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Aug 2 19:12:11 2011 @@ -126,6 +126,7 @@ static void makeIslCompatible(std::string& str) { replace(str, ".", "_"); + replace(str, "\"", "_"); } void MemoryAccess::setBaseName() { From isanbard at gmail.com Tue Aug 2 19:30:20 2011 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 03 Aug 2011 00:30:20 -0000 Subject: [llvm-commits] [llvm] r136751 - /llvm/trunk/lib/Analysis/PathNumbering.cpp Message-ID: <20110803003020.1C1E52A6C12C@llvm.org> Author: void Date: Tue Aug 2 19:30:19 2011 New Revision: 136751 URL: http://llvm.org/viewvc/llvm-project?rev=136751&view=rev Log: Replace the 'UnwindInst' check with a check for 'ResumeInst', which also exits the function, because the UnwindInst is going away. Modified: llvm/trunk/lib/Analysis/PathNumbering.cpp Modified: llvm/trunk/lib/Analysis/PathNumbering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PathNumbering.cpp?rev=136751&r1=136750&r2=136751&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PathNumbering.cpp (original) +++ llvm/trunk/lib/Analysis/PathNumbering.cpp Tue Aug 2 19:30:19 2011 @@ -387,7 +387,7 @@ TerminatorInst* terminator = currentNode->getBlock()->getTerminator(); if(isa(terminator) || isa(terminator) - || isa(terminator)) + || isa(terminator)) addEdge(currentNode, getExit(),0); currentNode->setColor(BallLarusNode::GRAY); From krasin at chromium.org Tue Aug 2 19:43:48 2011 From: krasin at chromium.org (Ivan Krasin) Date: Tue, 2 Aug 2011 17:43:48 -0700 Subject: [llvm-commits] X86 FastISel: Emit immediate call arguments locally to save stack size when compiling with -O0 In-Reply-To: References: <6E62C135-64F3-43C4-8C33-19CB9679FBD2@2pi.dk> Message-ID: On Tue, Aug 2, 2011 at 2:01 PM, Jakob Stoklund Olesen wrote: > > On Aug 2, 2011, at 12:55 PM, Ivan Krasin wrote: > >> Hi Jacob, >> >> On Mon, Aug 1, 2011 at 10:35 PM, Jakob Stoklund Olesen wrote: >>> >>> On Aug 1, 2011, at 2:13 PM, Ivan Krasin wrote: >>> >>> this patch fixes the FastISel stack allocation strategy issue described >>> here: >>> http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-July/041452.html >>> The solution is to emit immediate int arguments just before the call >>> (instead of spilling them on stack at the beginning of the function) >>> >>> Thanks for working on this, Ivan. >>> I don't think there is any reason to special-case function arguments. It is >>> just as bad when fast-isel hoists the immediate in 'x+1'. >>> I would prefer an approach that handled all immediates. >> Thanks, it's a good point. I have tried to use double arguments as >> immediates as well, but FastISel fails on them. >> I think it also should be fixed, but I would prefer to make it in the next CL. > > Floating point constants are probably not important. They will be folded as constant pool loads most of the time, I expect. > > What I meant was, don't treat function arguments as a special case. You should handle all integer constants, whether they are used as function arguments or 'add' operands. > > Your patch doesn't work or this code, right? > > ?f(y + 5); > ?f(x + 5); > > That '5' gets hoisted to the top of the block and spilled because of the first call. It shouldn't. > > Here is how fast isel currently works: It emits instructions bottom-up. When it needs a constant, the code for the constant is emitted to the top of the block, and it makes a note that the constant is now in a virtual register. Further uses of that constant simply get the virtual register. > > Here is what you should do: When you need a constant, don't emit the code immediately, but do allocate a virtual register and make a note that the constant needs to be materialized. Whenever you are about to emit a call, materialize all the pending constants. Then insert the call instruction. > > That way, virtual registers holding constants will never cross a call instruction, so they won't get spilled (much). OK, I've got your point and I like it. > > For patches like this, please provide measurements of code size and compile time as well. I agree that metrics are the key to optimizing the code. Here is my metrics: time and stack used. /usr/bin/time -f '%U' Release/bin/llc jsinterp.bc -march=x86-64 -O0 0.42 I calculate the amount of stack needed (thx to Rafael for the suggestion) with the following script: krasin at krasin$ cat calc_stack.sh #!/bin/sh ASM_FILE=$1 ( cat $ASM_FILE | grep "sub.*, %rsp" | sed 's/.*\$\([0-9]*\),.*/\1/' | awk '{s+=$1} END {print s}' for i in {1..8} do cat $ASM_FILE | grep push | wc -l done ) | awk '{s+=$1} END {print s}' Basically, it greps all subtractions from rsp and sums them + 8 * count(pushq). The example: ./calc_stack.sh ./jsinterp.s 28272 Of course, I will run the test several times to get the median value and also I need more bitcode files to test than just the example from Rafael. (I would be glad to get a suggestion here. By default, I will use bitcode files from Chromium) Jakob, are you fine with the proposed metrics? Ivan > > Thanks, > /jakob > > From nicholas at mxc.ca Tue Aug 2 19:43:36 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 03 Aug 2011 00:43:36 -0000 Subject: [llvm-commits] [llvm] r136752 - in /llvm/trunk: lib/Transforms/InstCombine/InstructionCombining.cpp test/Transforms/InstCombine/malloc-free-delete.ll Message-ID: <20110803004336.288E32A6C12C@llvm.org> Author: nicholas Date: Tue Aug 2 19:43:35 2011 New Revision: 136752 URL: http://llvm.org/viewvc/llvm-project?rev=136752&view=rev Log: Fix logical error when detecting lifetime intrinsics. Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)" which in turn means "unreachable". What we wanted was a no-op. Instead, analyze the whole tree and look for all the instructions we need to delete first, then delete them second, not relying on the use_list to stay consistent. Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=136752&r1=136751&r2=136752&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Aug 2 19:43:35 2011 @@ -46,6 +46,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/PatternMatch.h" +#include "llvm/Support/ValueHandle.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include "llvm-c/Initialization.h" @@ -1043,31 +1044,43 @@ -static bool IsOnlyNullComparedAndFreed(const Value &V, int Depth = 0) { +static bool IsOnlyNullComparedAndFreed(Value *V, SmallVector &Users, + int Depth = 0) { if (Depth == 8) return false; - for (Value::const_use_iterator UI = V.use_begin(), UE = V.use_end(); + for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); UI != UE; ++UI) { - const User *U = *UI; - if (isFreeCall(U)) + User *U = *UI; + if (isFreeCall(U)) { + Users.push_back(U); continue; - if (const ICmpInst *ICI = dyn_cast(U)) - if (ICI->isEquality() && isa(ICI->getOperand(1))) + } + if (ICmpInst *ICI = dyn_cast(U)) { + if (ICI->isEquality() && isa(ICI->getOperand(1))) { + Users.push_back(ICI); continue; - if (const BitCastInst *BCI = dyn_cast(U)) { - if (IsOnlyNullComparedAndFreed(*BCI, Depth+1)) + } + } + if (BitCastInst *BCI = dyn_cast(U)) { + if (IsOnlyNullComparedAndFreed(BCI, Users, Depth+1)) { + Users.push_back(BCI); continue; + } } - if (const GetElementPtrInst *GEPI = dyn_cast(U)) { + if (GetElementPtrInst *GEPI = dyn_cast(U)) { if (GEPI->hasAllZeroIndices() && - IsOnlyNullComparedAndFreed(*GEPI, Depth+1)) + IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) { + Users.push_back(GEPI); continue; + } } - if (const IntrinsicInst *II = dyn_cast(U)) { + if (IntrinsicInst *II = dyn_cast(U)) { if (II->getIntrinsicID() == Intrinsic::lifetime_start || - II->getIntrinsicID() == Intrinsic::lifetime_end) + II->getIntrinsicID() == Intrinsic::lifetime_end) { + Users.push_back(II); continue; + } } return false; } @@ -1078,32 +1091,20 @@ // If we have a malloc call which is only used in any amount of comparisons // to null and free calls, delete the calls and replace the comparisons with // true or false as appropriate. - if (IsOnlyNullComparedAndFreed(MI)) { - for (Value::use_iterator UI = MI.use_begin(), UE = MI.use_end(); - UI != UE;) { - // All the users permitted by IsOnlyNullComparedAndFreed are Instructions. - Instruction *I = cast(*UI); - - // Early increment here, as we're about to get rid of the user. - ++UI; - - if (CallInst *CI = isFreeCall(I)) { - if (CI != I) - EraseInstFromFunction(*CI); - EraseInstFromFunction(*I); - } else if (ICmpInst *C = dyn_cast(I)) { + SmallVector Users; + if (IsOnlyNullComparedAndFreed(&MI, Users)) { + for (unsigned i = 0, e = Users.size(); i != e; ++i) { + Instruction *I = cast_or_null(&*Users[i]); + if (!I) continue; + + if (ICmpInst *C = dyn_cast(I)) { ReplaceInstUsesWith(*C, ConstantInt::get(Type::getInt1Ty(C->getContext()), C->isFalseWhenEqual())); - EraseInstFromFunction(*C); - } else if (I->getType()->isVoidTy()) { - // An all-zero GEP or a bitcast. + } else if (isa(I) || isa(I)) { ReplaceInstUsesWith(*I, UndefValue::get(I->getType())); - EraseInstFromFunction(*I); - } else { - // A lifetime intrinsic. - EraseInstFromFunction(*I); } + EraseInstFromFunction(*I); } return EraseInstFromFunction(MI); } Modified: llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll?rev=136752&r1=136751&r2=136752&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll Tue Aug 2 19:43:35 2011 @@ -35,3 +35,14 @@ call void @llvm.lifetime.end(i64 10, i8* %a) ret void } + +;; This used to crash. +define void @test4() { +; CHECK: @test4 +; CHECK-NEXT: ret void + %A = call i8* @malloc(i32 16000) + %B = bitcast i8* %A to double* + %C = bitcast double* %B to i8* + call void @free(i8* %C) + ret void +} From clattner at apple.com Tue Aug 2 19:55:18 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 02 Aug 2011 17:55:18 -0700 Subject: [llvm-commits] [llvm] r136751 - /llvm/trunk/lib/Analysis/PathNumbering.cpp In-Reply-To: <20110803003020.1C1E52A6C12C@llvm.org> References: <20110803003020.1C1E52A6C12C@llvm.org> Message-ID: On Aug 2, 2011, at 5:30 PM, Bill Wendling wrote: > Author: void > Date: Tue Aug 2 19:30:19 2011 > New Revision: 136751 > > URL: http://llvm.org/viewvc/llvm-project?rev=136751&view=rev > Log: > Replace the 'UnwindInst' check with a check for 'ResumeInst', which also exits > the function, because the UnwindInst is going away. I guess this is safe because no one uses unwind? -Chris > > Modified: > llvm/trunk/lib/Analysis/PathNumbering.cpp > > Modified: llvm/trunk/lib/Analysis/PathNumbering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PathNumbering.cpp?rev=136751&r1=136750&r2=136751&view=diff > ============================================================================== > --- llvm/trunk/lib/Analysis/PathNumbering.cpp (original) > +++ llvm/trunk/lib/Analysis/PathNumbering.cpp Tue Aug 2 19:30:19 2011 > @@ -387,7 +387,7 @@ > > TerminatorInst* terminator = currentNode->getBlock()->getTerminator(); > if(isa(terminator) || isa(terminator) > - || isa(terminator)) > + || isa(terminator)) > addEdge(currentNode, getExit(),0); > > currentNode->setColor(BallLarusNode::GRAY); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From stoklund at 2pi.dk Tue Aug 2 20:03:55 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 2 Aug 2011 18:03:55 -0700 Subject: [llvm-commits] X86 FastISel: Emit immediate call arguments locally to save stack size when compiling with -O0 In-Reply-To: References: <6E62C135-64F3-43C4-8C33-19CB9679FBD2@2pi.dk> Message-ID: <729D9CF6-3563-4841-A45A-469DF60B756D@2pi.dk> On Aug 2, 2011, at 5:43 PM, Ivan Krasin wrote: >> Here is how fast isel currently works: It emits instructions bottom-up. When it needs a constant, the code for the constant is emitted to the top of the block, and it makes a note that the constant is now in a virtual register. Further uses of that constant simply get the virtual register. >> >> Here is what you should do: When you need a constant, don't emit the code immediately, but do allocate a virtual register and make a note that the constant needs to be materialized. Whenever you are about to emit a call, materialize all the pending constants. Then insert the call instruction. >> >> That way, virtual registers holding constants will never cross a call instruction, so they won't get spilled (much). > OK, I've got your point and I like it. Cool. It is probably a good idea to keep track of the first instruction (i.e. last visited) using each constant. That is the best place to materialize the virtual register. >> For patches like this, please provide measurements of code size and compile time as well. > I agree that metrics are the key to optimizing the code. Here is my > metrics: time and stack used. > > /usr/bin/time -f '%U' Release/bin/llc jsinterp.bc -march=x86-64 -O0 > 0.42 This is good, but you should probably time the integrated assembler with -filetype=obj, and definitely -asm-verbose=false. You can also use 'llc -time-passes' to get per-pass timing. Your changes here affect the isel pass, of course, but also regalloc and asm-writer. > I calculate the amount of stack needed (thx to Rafael for the > suggestion) with the following script: > > krasin at krasin$ cat calc_stack.sh Neat. This is a good metric. I wonder if you could add a statistic to PrologEpilogInserter.cpp instead? That would provide a target independent stack usage metric with 'llc -stats'. > Jakob, are you fine with the proposed metrics? Yes, but please measure generated code size as well. On Darwin, 'size -m' will tell you the size of the __text segment in bytes. Linux probably has something similar. Be careful, some tools rounds the sizes up to the nearest page size. Make sure you measure code size with -relocation-model=pic. The address of a global is a constant that may require multiple instructions to materialize. LLVM's nightly test suite should provide you with plenty of bitcode examples. /jakob From isanbard at gmail.com Tue Aug 2 20:07:57 2011 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 03 Aug 2011 01:07:57 -0000 Subject: [llvm-commits] [llvm] r136756 - /llvm/trunk/lib/Analysis/PathNumbering.cpp Message-ID: <20110803010757.75BFB2A6C12C@llvm.org> Author: void Date: Tue Aug 2 20:07:57 2011 New Revision: 136756 URL: http://llvm.org/viewvc/llvm-project?rev=136756&view=rev Log: Add this back in for now. There are still a few passes which create unwind instructions at the moment. Modified: llvm/trunk/lib/Analysis/PathNumbering.cpp Modified: llvm/trunk/lib/Analysis/PathNumbering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PathNumbering.cpp?rev=136756&r1=136755&r2=136756&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PathNumbering.cpp (original) +++ llvm/trunk/lib/Analysis/PathNumbering.cpp Tue Aug 2 20:07:57 2011 @@ -387,7 +387,7 @@ TerminatorInst* terminator = currentNode->getBlock()->getTerminator(); if(isa(terminator) || isa(terminator) - || isa(terminator)) + || isa(terminator) || isa(terminator)) addEdge(currentNode, getExit(),0); currentNode->setColor(BallLarusNode::GRAY); From isanbard at gmail.com Tue Aug 2 20:10:11 2011 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 02 Aug 2011 18:10:11 -0700 Subject: [llvm-commits] [llvm] r136751 - /llvm/trunk/lib/Analysis/PathNumbering.cpp In-Reply-To: References: <20110803003020.1C1E52A6C12C@llvm.org> Message-ID: On Aug 2, 2011, at 5:55 PM, Chris Lattner wrote: > On Aug 2, 2011, at 5:30 PM, Bill Wendling wrote: > >> Author: void >> Date: Tue Aug 2 19:30:19 2011 >> New Revision: 136751 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=136751&view=rev >> Log: >> Replace the 'UnwindInst' check with a check for 'ResumeInst', which also exits >> the function, because the UnwindInst is going away. > > I guess this is safe because no one uses unwind? > There are about four passes which create unwind instructions: ShadowStackGC.cpp, LowerSetJmp.cpp, LowerInvoke.cpp, and UnifyFunctionExitNodes.cpp. I don't think they will interfere with this. But I added the UnwindInst back for now just to be on the safe side... > -Chris > >> >> Modified: >> llvm/trunk/lib/Analysis/PathNumbering.cpp >> >> Modified: llvm/trunk/lib/Analysis/PathNumbering.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PathNumbering.cpp?rev=136751&r1=136750&r2=136751&view=diff >> ============================================================================== >> --- llvm/trunk/lib/Analysis/PathNumbering.cpp (original) >> +++ llvm/trunk/lib/Analysis/PathNumbering.cpp Tue Aug 2 19:30:19 2011 >> @@ -387,7 +387,7 @@ >> >> TerminatorInst* terminator = currentNode->getBlock()->getTerminator(); >> if(isa(terminator) || isa(terminator) >> - || isa(terminator)) >> + || isa(terminator)) >> addEdge(currentNode, getExit(),0); >> >> currentNode->setColor(BallLarusNode::GRAY); >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From nicholas at mxc.ca Tue Aug 2 20:11:40 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 03 Aug 2011 01:11:40 -0000 Subject: [llvm-commits] [llvm] r136757 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Message-ID: <20110803011140.E81B12A6C12C@llvm.org> Author: nicholas Date: Tue Aug 2 20:11:40 2011 New Revision: 136757 URL: http://llvm.org/viewvc/llvm-project?rev=136757&view=rev Log: Small cleanups: - use SmallVectorImpl& for the function argument. - ignore the operands on the GEP, even if they aren't constant! Much as we pretend the malloc succeeds, we pretend that malloc + whatever-you-GEP'd-by is not null. It's magic! Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=136757&r1=136756&r2=136757&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Aug 2 20:11:40 2011 @@ -1044,7 +1044,7 @@ -static bool IsOnlyNullComparedAndFreed(Value *V, SmallVector &Users, +static bool IsOnlyNullComparedAndFreed(Value *V, SmallVectorImpl &Users, int Depth = 0) { if (Depth == 8) return false; @@ -1069,8 +1069,7 @@ } } if (GetElementPtrInst *GEPI = dyn_cast(U)) { - if (GEPI->hasAllZeroIndices() && - IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) { + if (IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) { Users.push_back(GEPI); continue; } From dpatel at apple.com Tue Aug 2 20:25:46 2011 From: dpatel at apple.com (Devang Patel) Date: Wed, 03 Aug 2011 01:25:46 -0000 Subject: [llvm-commits] [llvm] r136759 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll Message-ID: <20110803012546.7B64E2A6C12C@llvm.org> Author: dpatel Date: Tue Aug 2 20:25:46 2011 New Revision: 136759 URL: http://llvm.org/viewvc/llvm-project?rev=136759&view=rev Log: Use byte offset, instead of element number, to access merged global. Added: llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=136759&r1=136758&r2=136759&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Aug 2 20:25:46 2011 @@ -955,7 +955,8 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) { const ConstantExpr *CE = dyn_cast_or_null(V); if (!CE || CE->getNumOperands() != 3 || - CE->getOpcode() != Instruction::GetElementPtr) + CE->getOpcode() != Instruction::GetElementPtr || + !isa(CE->getOperand(0)->getType())) return NULL; // First operand points to a global value. @@ -974,6 +975,23 @@ return CE; } +// getMergedGlobalElementOffset - If CE is accessing a merged global +// then find byte offset of the element accessed by CE. This must be +// used only CE returned by getMergedGlobalExpr(). See above. +static uint64_t getMergedGlobalElementOffset(const TargetData &TD, + const ConstantExpr *CE) { + assert (getMergedGlobalExpr(CE) && "This is not a merged global!"); + uint64_t e = cast(CE->getOperand(2))->getZExtValue(); + if (e == 0) return 0; + + uint64_t Offset = 0; + const PointerType *PTy = dyn_cast(CE->getOperand(0)->getType()); + const StructType *STy = dyn_cast(PTy->getElementType()); + for (uint64_t i = 0; i != e; ++i) + Offset += TD.getTypeAllocSize(STy->getElementType(i)); + return Offset; +} + /// constructGlobalVariableDIE - Construct global variable DIE. void DwarfDebug::constructGlobalVariableDIE(const MDNode *N) { DIGlobalVariable GV(N); @@ -1045,9 +1063,9 @@ TheCU->addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr); TheCU->addLabel(Block, 0, dwarf::DW_FORM_udata, Asm->Mang->getSymbol(cast(CE->getOperand(0)))); - ConstantInt *CII = cast(CE->getOperand(2)); TheCU->addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_constu); - TheCU->addUInt(Block, 0, dwarf::DW_FORM_udata, CII->getZExtValue()); + TheCU->addUInt(Block, 0, dwarf::DW_FORM_udata, + getMergedGlobalElementOffset(Asm->getTargetData(), CE)); TheCU->addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus); TheCU->addBlock(VariableDIE, dwarf::DW_AT_location, 0, Block); } Added: llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll?rev=136759&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll Tue Aug 2 20:25:46 2011 @@ -0,0 +1,124 @@ +; RUN: llc < %s | FileCheck %s + +; Check debug info output for merged global. +; DW_AT_location +; DW_OP_addr +; DW_OP_plus +; .long __MergedGlobals +; DW_OP_constu +; offset + +;CHECK: .ascii "x2" @ DW_AT_name +;CHECK-NEXT: .byte 0 +;CHECK-NEXT: @ DW_AT_type +;CHECK-NEXT: @ DW_AT_decl_file +;CHECK-NEXT: @ DW_AT_decl_line +;CHECK-NEXT: @ DW_AT_location +;CHECK-NEXT: .byte 3 +;CHECK-NEXT: .long __MergedGlobals +;CHECK-NEXT: .byte 16 +; 4 is byte offset of x2 in __MergedGobals +;CHECK-NEXT: .byte 4 +;CHECK-NEXT: .byte 34 + + +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32" +target triple = "thumbv7-apple-macosx10.7.0" + + at x1 = internal unnamed_addr global i32 1, align 4 + at x2 = internal unnamed_addr global i32 2, align 4 + at x3 = internal unnamed_addr global i32 3, align 4 + at x4 = internal unnamed_addr global i32 4, align 4 + at x5 = global i32 0, align 4 + +define i32 @get1(i32 %a) nounwind optsize ssp { + tail call void @llvm.dbg.value(metadata !{i32 %a}, i64 0, metadata !10), !dbg !30 + %1 = load i32* @x1, align 4, !dbg !31 + tail call void @llvm.dbg.value(metadata !{i32 %1}, i64 0, metadata !11), !dbg !31 + store i32 %a, i32* @x1, align 4, !dbg !31 + ret i32 %1, !dbg !31 +} + +define i32 @get2(i32 %a) nounwind optsize ssp { + tail call void @llvm.dbg.value(metadata !{i32 %a}, i64 0, metadata !13), !dbg !32 + %1 = load i32* @x2, align 4, !dbg !33 + tail call void @llvm.dbg.value(metadata !{i32 %1}, i64 0, metadata !14), !dbg !33 + store i32 %a, i32* @x2, align 4, !dbg !33 + ret i32 %1, !dbg !33 +} + +define i32 @get3(i32 %a) nounwind optsize ssp { + tail call void @llvm.dbg.value(metadata !{i32 %a}, i64 0, metadata !16), !dbg !34 + %1 = load i32* @x3, align 4, !dbg !35 + tail call void @llvm.dbg.value(metadata !{i32 %1}, i64 0, metadata !17), !dbg !35 + store i32 %a, i32* @x3, align 4, !dbg !35 + ret i32 %1, !dbg !35 +} + +define i32 @get4(i32 %a) nounwind optsize ssp { + tail call void @llvm.dbg.value(metadata !{i32 %a}, i64 0, metadata !19), !dbg !36 + %1 = load i32* @x4, align 4, !dbg !37 + tail call void @llvm.dbg.value(metadata !{i32 %1}, i64 0, metadata !20), !dbg !37 + store i32 %a, i32* @x4, align 4, !dbg !37 + ret i32 %1, !dbg !37 +} + +define i32 @get5(i32 %a) nounwind optsize ssp { + tail call void @llvm.dbg.value(metadata !{i32 %a}, i64 0, metadata !27), !dbg !38 + %1 = load i32* @x5, align 4, !dbg !39 + tail call void @llvm.dbg.value(metadata !{i32 %1}, i64 0, metadata !28), !dbg !39 + store i32 %a, i32* @x5, align 4, !dbg !39 + ret i32 %1, !dbg !39 +} + +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone + +!llvm.dbg.cu = !{!0} +!llvm.dbg.sp = !{!1, !6, !7, !8, !9} +!llvm.dbg.lv.get1 = !{!10, !11} +!llvm.dbg.lv.get2 = !{!13, !14} +!llvm.dbg.lv.get3 = !{!16, !17} +!llvm.dbg.lv.get4 = !{!19, !20} +!llvm.dbg.gv = !{!22, !23, !24, !25, !26} +!llvm.dbg.lv.get5 = !{!27, !28} + +!0 = metadata !{i32 589841, i32 0, i32 12, metadata !"ss3.c", metadata !"/private/tmp", metadata !"clang", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] +!1 = metadata !{i32 589870, i32 0, metadata !2, metadata !"get1", metadata !"get1", metadata !"", metadata !2, i32 5, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32)* @get1, null, null} ; [ DW_TAG_subprogram ] +!2 = metadata !{i32 589865, metadata !"ss3.c", metadata !"/private/tmp", metadata !0} ; [ DW_TAG_file_type ] +!3 = metadata !{i32 589845, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!4 = metadata !{metadata !5} +!5 = metadata !{i32 589860, metadata !0, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] +!6 = metadata !{i32 589870, i32 0, metadata !2, metadata !"get2", metadata !"get2", metadata !"", metadata !2, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32)* @get2, null, null} ; [ DW_TAG_subprogram ] +!7 = metadata !{i32 589870, i32 0, metadata !2, metadata !"get3", metadata !"get3", metadata !"", metadata !2, i32 11, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32)* @get3, null, null} ; [ DW_TAG_subprogram ] +!8 = metadata !{i32 589870, i32 0, metadata !2, metadata !"get4", metadata !"get4", metadata !"", metadata !2, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32)* @get4, null, null} ; [ DW_TAG_subprogram ] +!9 = metadata !{i32 589870, i32 0, metadata !2, metadata !"get5", metadata !"get5", metadata !"", metadata !2, i32 17, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32)* @get5, null, null} ; [ DW_TAG_subprogram ] +!10 = metadata !{i32 590081, metadata !1, metadata !"a", metadata !2, i32 16777221, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!11 = metadata !{i32 590080, metadata !12, metadata !"b", metadata !2, i32 5, metadata !5, i32 0} ; [ DW_TAG_auto_variable ] +!12 = metadata !{i32 589835, metadata !1, i32 5, i32 19, metadata !2, i32 0} ; [ DW_TAG_lexical_block ] +!13 = metadata !{i32 590081, metadata !6, metadata !"a", metadata !2, i32 16777224, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!14 = metadata !{i32 590080, metadata !15, metadata !"b", metadata !2, i32 8, metadata !5, i32 0} ; [ DW_TAG_auto_variable ] +!15 = metadata !{i32 589835, metadata !6, i32 8, i32 17, metadata !2, i32 1} ; [ DW_TAG_lexical_block ] +!16 = metadata !{i32 590081, metadata !7, metadata !"a", metadata !2, i32 16777227, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!17 = metadata !{i32 590080, metadata !18, metadata !"b", metadata !2, i32 11, metadata !5, i32 0} ; [ DW_TAG_auto_variable ] +!18 = metadata !{i32 589835, metadata !7, i32 11, i32 19, metadata !2, i32 2} ; [ DW_TAG_lexical_block ] +!19 = metadata !{i32 590081, metadata !8, metadata !"a", metadata !2, i32 16777230, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!20 = metadata !{i32 590080, metadata !21, metadata !"b", metadata !2, i32 14, metadata !5, i32 0} ; [ DW_TAG_auto_variable ] +!21 = metadata !{i32 589835, metadata !8, i32 14, i32 19, metadata !2, i32 3} ; [ DW_TAG_lexical_block ] +!22 = metadata !{i32 589876, i32 0, metadata !0, metadata !"x5", metadata !"x5", metadata !"", metadata !2, i32 16, metadata !5, i32 0, i32 1, i32* @x5} ; [ DW_TAG_variable ] +!23 = metadata !{i32 589876, i32 0, metadata !0, metadata !"x4", metadata !"x4", metadata !"", metadata !2, i32 13, metadata !5, i32 1, i32 1, i32* @x4} ; [ DW_TAG_variable ] +!24 = metadata !{i32 589876, i32 0, metadata !0, metadata !"x3", metadata !"x3", metadata !"", metadata !2, i32 10, metadata !5, i32 1, i32 1, i32* @x3} ; [ DW_TAG_variable ] +!25 = metadata !{i32 589876, i32 0, metadata !0, metadata !"x2", metadata !"x2", metadata !"", metadata !2, i32 7, metadata !5, i32 1, i32 1, i32* @x2} ; [ DW_TAG_variable ] +!26 = metadata !{i32 589876, i32 0, metadata !0, metadata !"x1", metadata !"x1", metadata !"", metadata !2, i32 4, metadata !5, i32 1, i32 1, i32* @x1} ; [ DW_TAG_variable ] +!27 = metadata !{i32 590081, metadata !9, metadata !"a", metadata !2, i32 16777233, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!28 = metadata !{i32 590080, metadata !29, metadata !"b", metadata !2, i32 17, metadata !5, i32 0} ; [ DW_TAG_auto_variable ] +!29 = metadata !{i32 589835, metadata !9, i32 17, i32 19, metadata !2, i32 4} ; [ DW_TAG_lexical_block ] +!30 = metadata !{i32 5, i32 16, metadata !1, null} +!31 = metadata !{i32 5, i32 32, metadata !12, null} +!32 = metadata !{i32 8, i32 14, metadata !6, null} +!33 = metadata !{i32 8, i32 29, metadata !15, null} +!34 = metadata !{i32 11, i32 16, metadata !7, null} +!35 = metadata !{i32 11, i32 32, metadata !18, null} +!36 = metadata !{i32 14, i32 16, metadata !8, null} +!37 = metadata !{i32 14, i32 32, metadata !21, null} +!38 = metadata !{i32 17, i32 16, metadata !9, null} +!39 = metadata !{i32 17, i32 32, metadata !29, null} From rjmccall at apple.com Tue Aug 2 20:38:17 2011 From: rjmccall at apple.com (John McCall) Date: Tue, 02 Aug 2011 18:38:17 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> Message-ID: <86199D0A-5B2D-4315-BEE4-E8908579E7B9@apple.com> On Aug 2, 2011, at 2:29 PM, Bill Wendling wrote: > On Aug 2, 2011, at 1:24 PM, Chris Lattner wrote: >> @@ -3372,17 +3384,18 @@ >> successors.

    >> >>
    Arguments:
    >> -

    The 'resume' instruction's argument must have the same type as the >> - result of any 'landingpad' instruction in the same function.

    >> +

    The 'resume' instruction requires one argument, which must have the >> + same type as the result of any 'landingpad' instruction in the same >> + function.

    >> >> Thanks for mentioning this. As a devil's advocate question: shouldn't this be forced to match the landingpad instruction that interrupted the unwind? isn't it theoretically possible to have code like this: >> >> >> invoke @somefunc -> unwind %landingpadbb >> >> landingpadbb: >> %A = landingpad ... >> call foo(%A) >> unreachable >> >> void foo( ... %A) { >> resume %A >> } >> >> In other words, does the resume actually have to be in the same function as the landing pad? >> > Interesting. No, it doesn't need to be in the same function. I don't think this is true; the exceptions ABI strongly suggests that the call to _Unwind_Resume should happen from the "landing pad", i.e. from the function that unwinding stopped at. I would not be surprised if some existing implementations broke if you "outlined" the call to _Unwind_Resume, and I certainly see no value in supporting it. It should be undefined behavior to reach a resume and give it an operand that does not correspond to the value of a landingpad instruction from the same execution context. (That's a dynamic constraint about the data content of the value, not an SSA constraint about the form of the operand). >> +
  • A landing pad blcok must have a 'landingpad' instruction as its >> + first non-PHI instruction.
  • >> +
  • The 'landingpad' instruction must be the first non-PHI >> + instruction in the landing pad block.
  • >> >> typo "blcok". It's not clear to me what the difference between these two points is. It's two directions of implication. If you have a landing pad block, its first non-PHI instruction is a landingpad instruction, and if you have a landingpad instruction, it is the first non-PHI instruction in a landing pad block. John. From rafael.espindola at gmail.com Tue Aug 2 21:07:14 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 03 Aug 2011 02:07:14 -0000 Subject: [llvm-commits] [dragonegg] r136762 - /dragonegg/trunk/src/Backend.cpp Message-ID: <20110803020714.CBCDB2A6C12C@llvm.org> Author: rafael Date: Tue Aug 2 21:07:14 2011 New Revision: 136762 URL: http://llvm.org/viewvc/llvm-project?rev=136762&view=rev Log: Add missing include. Modified: dragonegg/trunk/src/Backend.cpp Modified: dragonegg/trunk/src/Backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=136762&r1=136761&r2=136762&view=diff ============================================================================== --- dragonegg/trunk/src/Backend.cpp (original) +++ dragonegg/trunk/src/Backend.cpp Tue Aug 2 21:07:14 2011 @@ -35,6 +35,7 @@ #define DEBUG_TYPE "plugin" #include "llvm/LLVMContext.h" #include "llvm/Module.h" +#include "llvm/PassManager.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/Bitcode/ReaderWriter.h" From rafael.espindola at gmail.com Tue Aug 2 22:22:58 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 03 Aug 2011 03:22:58 -0000 Subject: [llvm-commits] [dragonegg] r136764 - /dragonegg/trunk/src/Backend.cpp Message-ID: <20110803032258.CE0932A6C12C@llvm.org> Author: rafael Date: Tue Aug 2 22:22:58 2011 New Revision: 136764 URL: http://llvm.org/viewvc/llvm-project?rev=136764&view=rev Log: More missing headers. Modified: dragonegg/trunk/src/Backend.cpp Modified: dragonegg/trunk/src/Backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=136764&r1=136763&r2=136764&view=diff ============================================================================== --- dragonegg/trunk/src/Backend.cpp (original) +++ dragonegg/trunk/src/Backend.cpp Tue Aug 2 22:22:58 2011 @@ -44,6 +44,8 @@ #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" +#include "llvm/Transforms/IPO.h" +#include "llvm/Analysis/Verifier.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetRegistry.h" From clattner at apple.com Tue Aug 2 22:58:10 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 02 Aug 2011 20:58:10 -0700 Subject: [llvm-commits] [llvm] r136751 - /llvm/trunk/lib/Analysis/PathNumbering.cpp In-Reply-To: References: <20110803003020.1C1E52A6C12C@llvm.org> Message-ID: <19951088-F9D8-46FA-A3B9-8ADBB9352AE3@apple.com> On Aug 2, 2011, at 6:10 PM, Bill Wendling wrote: >>> Replace the 'UnwindInst' check with a check for 'ResumeInst', which also exits >>> the function, because the UnwindInst is going away. >> >> I guess this is safe because no one uses unwind? >> > There are about four passes which create unwind instructions: ShadowStackGC.cpp, LowerSetJmp.cpp, LowerInvoke.cpp, and UnifyFunctionExitNodes.cpp. I don't think they will interfere with this. But I added the UnwindInst back for now just to be on the safe side... Thanks! From jediknil at belkadan.com Tue Aug 2 23:38:42 2011 From: jediknil at belkadan.com (Jordy Rose) Date: Tue, 2 Aug 2011 21:38:42 -0700 Subject: [llvm-commits] [PATCH] Look up symbols in a specific library with DynamicLibrary Message-ID: <6D7D7232-0894-41DD-8C0C-5A74EBD887E2@belkadan.com> This patch adds the ability to look up symbols in a specific library by instantiating llvm::sys::DynamicLibrary. I've tried to make it minimally intrusive and preserve the existing interface (LoadLibraryPermanently and SearchForAddressOfSymbol). Requiring that DynamicLibrary instances must represent already-loaded libraries also means not having to deal with potentially unloaded libraries, though since both dlfcn handles and HMODULEs are ref-counted, that shouldn't be too hard to deal with if we ever lift this restriction. The use case for this is for Clang plugins loaded with -load, which can have standard entry points like clang_registerASTActions. The advantages over llvm::Registry: - it is easier on Windows (or so I've heard) - it allows us to be lazy (e.g. no need to register plugin AST actions if we're running a standard action) (I'm not pushing for a change in how ASTConsumer plugins are registered. The impetus for this is coming out of a discussion with Ted, Argyrios, and Anna on pluggable analyzer checkers.) Is this approach reasonable? Thanks, Jordy P.S. I would especially appreciate if someone could look over my Windows changes; I have very little Windows experience and don't have a Windows dev machine available. -------------- next part -------------- A non-text attachment was scrubbed... Name: DynamicLibrary.patch Type: application/octet-stream Size: 7665 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110802/c35f3ae2/attachment.obj From sabre at nondot.org Wed Aug 3 01:15:41 2011 From: sabre at nondot.org (Chris Lattner) Date: Wed, 03 Aug 2011 06:15:41 -0000 Subject: [llvm-commits] [llvm] r136768 - in /llvm/trunk: lib/VMCore/AsmWriter.cpp test/Transforms/StripSymbols/block-address.ll Message-ID: <20110803061541.6A6FA2A6C12C@llvm.org> Author: lattner Date: Wed Aug 3 01:15:41 2011 New Revision: 136768 URL: http://llvm.org/viewvc/llvm-project?rev=136768&view=rev Log: fix PR10286, a problem with the .ll printer handling block addresses that are out-of-scope. Added: llvm/trunk/test/Transforms/StripSymbols/block-address.ll Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=136768&r1=136767&r2=136768&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Aug 3 01:15:41 2011 @@ -1037,26 +1037,35 @@ char Prefix = '%'; int Slot; + // If we have a SlotTracker, use it. if (Machine) { if (const GlobalValue *GV = dyn_cast(V)) { Slot = Machine->getGlobalSlot(GV); Prefix = '@'; } else { Slot = Machine->getLocalSlot(V); + + // If the local value didn't succeed, then we may be referring to a value + // from a different function. Translate it, as this can happen when using + // address of blocks. + if (Slot == -1) + if ((Machine = createSlotTracker(V))) { + Slot = Machine->getLocalSlot(V); + delete Machine; + } } - } else { - Machine = createSlotTracker(V); - if (Machine) { - if (const GlobalValue *GV = dyn_cast(V)) { - Slot = Machine->getGlobalSlot(GV); - Prefix = '@'; - } else { - Slot = Machine->getLocalSlot(V); - } - delete Machine; + } else if ((Machine = createSlotTracker(V))) { + // Otherwise, create one to get the # and then destroy it. + if (const GlobalValue *GV = dyn_cast(V)) { + Slot = Machine->getGlobalSlot(GV); + Prefix = '@'; } else { - Slot = -1; + Slot = Machine->getLocalSlot(V); } + delete Machine; + Machine = 0; + } else { + Slot = -1; } if (Slot != -1) Added: llvm/trunk/test/Transforms/StripSymbols/block-address.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/StripSymbols/block-address.ll?rev=136768&view=auto ============================================================================== --- llvm/trunk/test/Transforms/StripSymbols/block-address.ll (added) +++ llvm/trunk/test/Transforms/StripSymbols/block-address.ll Wed Aug 3 01:15:41 2011 @@ -0,0 +1,23 @@ +; RUN: opt %s -strip -S | FileCheck %s +; PR10286 + + at main_addrs = constant [2 x i8*] [i8* blockaddress(@f, %FOO), i8* blockaddress(@f, %BAR)] +; CHECK: @main_addrs = constant [2 x i8*] [i8* blockaddress(@f, %2), i8* blockaddress(@f, %3)] + +declare void @foo() nounwind +declare void @bar() nounwind + +define void @f(i8* %indirect.goto.dest) nounwind uwtable ssp { +entry: + indirectbr i8* %indirect.goto.dest, [label %FOO, label %BAR] + + ; CHECK: indirectbr i8* %0, [label %2, label %3] + +FOO: + call void @foo() + ret void + +BAR: + call void @bar() + ret void +} From wendling at apple.com Wed Aug 3 01:48:49 2011 From: wendling at apple.com (Bill Wendling) Date: Tue, 02 Aug 2011 23:48:49 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <86199D0A-5B2D-4315-BEE4-E8908579E7B9@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <86199D0A-5B2D-4315-BEE4-E8908579E7B9@apple.com> Message-ID: <312E007D-67A9-49C6-A441-64FCC321A517@apple.com> On Aug 2, 2011, at 6:38 PM, John McCall wrote: > On Aug 2, 2011, at 2:29 PM, Bill Wendling wrote: >> On Aug 2, 2011, at 1:24 PM, Chris Lattner wrote: >>>
    Arguments:
    >>> -

    The 'resume' instruction's argument must have the same type as the >>> - result of any 'landingpad' instruction in the same function.

    >>> +

    The 'resume' instruction requires one argument, which must have the >>> + same type as the result of any 'landingpad' instruction in the same >>> + function.

    >>> >>> Thanks for mentioning this. As a devil's advocate question: shouldn't this be forced to match the landingpad instruction that interrupted the unwind? isn't it theoretically possible to have code like this: >>> >>> >>> invoke @somefunc -> unwind %landingpadbb >>> >>> landingpadbb: >>> %A = landingpad ... >>> call foo(%A) >>> unreachable >>> >>> void foo( ... %A) { >>> resume %A >>> } >>> >>> In other words, does the resume actually have to be in the same function as the landing pad? >>> >> Interesting. No, it doesn't need to be in the same function. > > I don't think this is true; the exceptions ABI strongly suggests that the > call to _Unwind_Resume should happen from the "landing pad", i.e. > from the function that unwinding stopped at. I would not be surprised > if some existing implementations broke if you "outlined" the call to > _Unwind_Resume, and I certainly see no value in supporting it. > > It should be undefined behavior to reach a resume and give it an > operand that does not correspond to the value of a landingpad > instruction from the same execution context. (That's a dynamic > constraint about the data content of the value, not an SSA > constraint about the form of the operand). > It strongly suggests, but it doesn't sound like a requirement to me. And after talking with Nick, I convinced myself that it is "okay" to have the _Unwind_Resume outside of the current function (I even did some tests). How he outlined it to me was: * The call to a function containing the _Unwind_Resume (foo here) is made. * The _Unwind_Resume is called with the existing exception. * The stack resumes unwinding from "foo". * The place where "foo" was called will have an entry in the LSDA (typically saying it can't catch anything and has no landing pad). * The exception will continue from the "foo" call-site. This is not to say that an existing implementation won't subvert this somehow. But it's hypothetically okay to do this. Consider that the _Unwind_Resume function may (and indeed does) call other functions itself before the exception is resumed (deep within the call stack), then you have an analogous situation. Perhaps we could list this as an "okay to do, but not advised" feature? -bw From rjmccall at apple.com Wed Aug 3 02:12:47 2011 From: rjmccall at apple.com (John McCall) Date: Wed, 03 Aug 2011 00:12:47 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <312E007D-67A9-49C6-A441-64FCC321A517@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <86199D0A-5B2D-4315-BEE4-E8908579E7B9@apple.com> <312E007D-67A9-49C6-A441-64FCC321A517@apple.com> Message-ID: On Aug 2, 2011, at 11:48 PM, Bill Wendling wrote: > On Aug 2, 2011, at 6:38 PM, John McCall wrote: >> >> I don't think this is true; the exceptions ABI strongly suggests that the >> call to _Unwind_Resume should happen from the "landing pad", i.e. >> from the function that unwinding stopped at. I would not be surprised >> if some existing implementations broke if you "outlined" the call to >> _Unwind_Resume, and I certainly see no value in supporting it. >> >> It should be undefined behavior to reach a resume and give it an >> operand that does not correspond to the value of a landingpad >> instruction from the same execution context. (That's a dynamic >> constraint about the data content of the value, not an SSA >> constraint about the form of the operand). >> > It strongly suggests, but it doesn't sound like a requirement to me. And after talking with Nick, I convinced myself that it is "okay" to have the _Unwind_Resume outside of the current function (I even did some tests). How he outlined it to me was: I agree that this is likely to work with Darwin's libUnwind as long as the LSDA doesn't indicate a cleanup for the call to calls_resume(), or that landing pad doesn't lead to an outlined _Unwind_Resume call. I am less certain about SjLj unwinding, but it'll probably work there again. I really see zero value in supporting this, though, and I do think it's contrary to the intent of the ABI document. John. From baldrick at free.fr Wed Aug 3 03:56:54 2011 From: baldrick at free.fr (Duncan Sands) Date: Wed, 03 Aug 2011 08:56:54 -0000 Subject: [llvm-commits] [dragonegg] r136770 - /dragonegg/trunk/src/Backend.cpp Message-ID: <20110803085654.D4C092A6C12C@llvm.org> Author: baldrick Date: Wed Aug 3 03:56:54 2011 New Revision: 136770 URL: http://llvm.org/viewvc/llvm-project?rev=136770&view=rev Log: Reorder some includes. Modified: dragonegg/trunk/src/Backend.cpp Modified: dragonegg/trunk/src/Backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=136770&r1=136769&r2=136770&view=diff ============================================================================== --- dragonegg/trunk/src/Backend.cpp (original) +++ dragonegg/trunk/src/Backend.cpp Wed Aug 3 03:56:54 2011 @@ -37,18 +37,18 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Analysis/Verifier.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/MC/MCCodeGenInfo.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/ManagedStatic.h" -#include "llvm/Transforms/IPO/PassManagerBuilder.h" -#include "llvm/Transforms/IPO.h" -#include "llvm/Analysis/Verifier.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetRegistry.h" +#include "llvm/Transforms/IPO.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" // System headers #include From jay.foad at gmail.com Wed Aug 3 05:05:04 2011 From: jay.foad at gmail.com (Jay Foad) Date: Wed, 03 Aug 2011 10:05:04 -0000 Subject: [llvm-commits] [llvm] r136771 - /llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h Message-ID: <20110803100504.9506B2A6C12C@llvm.org> Author: foad Date: Wed Aug 3 05:05:04 2011 New Revision: 136771 URL: http://llvm.org/viewvc/llvm-project?rev=136771&view=rev Log: Use cast<> instead of a C-style cast to get some free assertions. Modified: llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h Modified: llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h?rev=136771&r1=136770&r2=136771&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h Wed Aug 3 05:05:04 2011 @@ -66,12 +66,12 @@ inline MDNode *MapValue(const MDNode *V, ValueToValueMapTy &VM, RemapFlags Flags = RF_None, ValueMapTypeRemapper *TypeMapper = 0) { - return (MDNode*)MapValue((const Value*)V, VM, Flags, TypeMapper); + return cast(MapValue((const Value*)V, VM, Flags, TypeMapper)); } inline Constant *MapValue(const Constant *V, ValueToValueMapTy &VM, RemapFlags Flags = RF_None, ValueMapTypeRemapper *TypeMapper = 0) { - return (Constant*)MapValue((const Value*)V, VM, Flags, TypeMapper); + return cast(MapValue((const Value*)V, VM, Flags, TypeMapper)); } From wdietz2 at illinois.edu Wed Aug 3 05:21:14 2011 From: wdietz2 at illinois.edu (Will Dietz) Date: Wed, 03 Aug 2011 10:21:14 -0000 Subject: [llvm-commits] [poolalloc] r136772 - /poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Message-ID: <20110803102115.017612A6C12E@llvm.org> Author: wdietz2 Date: Wed Aug 3 05:21:14 2011 New Revision: 136772 URL: http://llvm.org/viewvc/llvm-project?rev=136772&view=rev Log: AllocatorIdentification.cpp: Small fix to comment. No functionality changed. Modified: poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Modified: poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp?rev=136772&r1=136771&r2=136772&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp (original) +++ poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Wed Aug 3 05:21:14 2011 @@ -61,7 +61,7 @@ } bool isNotStored(Value *V) { - // check that V is not stroed to a location taht is accessible outside this fn + // check that V is not stored to a location that is accessible outside this fn for(Value::use_iterator ui = V->use_begin(), ue = V->use_end(); ui != ue; ++ui) { if(isa(*ui)) From wdietz2 at illinois.edu Wed Aug 3 05:22:23 2011 From: wdietz2 at illinois.edu (Will Dietz) Date: Wed, 03 Aug 2011 10:22:23 -0000 Subject: [llvm-commits] [poolalloc] r136773 - /poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Message-ID: <20110803102223.C3E542A6C12E@llvm.org> Author: wdietz2 Date: Wed Aug 3 05:22:23 2011 New Revision: 136773 URL: http://llvm.org/viewvc/llvm-project?rev=136773&view=rev Log: AllocatorIdentification.cpp: Remove trailing whitespace No functionality changes. Modified: poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Modified: poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp?rev=136773&r1=136772&r2=136773&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp (original) +++ poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Wed Aug 3 05:22:23 2011 @@ -37,9 +37,9 @@ bool AllocIdentify::flowsFrom(Value *Dest,Value *Src) { if(Dest == Src) return true; - if(ReturnInst *Ret = dyn_cast(Dest)) { + if(ReturnInst *Ret = dyn_cast(Dest)) { return flowsFrom(Ret->getReturnValue(), Src); - } + } if(PHINode *PN = dyn_cast(Dest)) { Function *F = PN->getParent()->getParent(); LoopInfo &LI = getAnalysis(*F); @@ -73,13 +73,13 @@ if(BitCastInst *BI = dyn_cast(*ui)) { if(isNotStored(BI)) continue; - else + else return false; } if(PHINode *PN = dyn_cast(*ui)) { if(isNotStored(PN)) continue; - else + else return false; } From raghesh.a at gmail.com Wed Aug 3 08:47:59 2011 From: raghesh.a at gmail.com (Raghesh Aloor) Date: Wed, 03 Aug 2011 13:47:59 -0000 Subject: [llvm-commits] [polly] r136774 - in /polly/trunk: lib/Analysis/ScopInfo.cpp lib/Exchange/JSONExporter.cpp test/CodeGen/MemAccess/memaccess_simple_analyze.ll Message-ID: <20110803134759.4AB3E2A6C12C@llvm.org> Author: raghesh Date: Wed Aug 3 08:47:59 2011 New Revision: 136774 URL: http://llvm.org/viewvc/llvm-project?rev=136774&view=rev Log: Memaccess: Display Changed Access Relation The changed access relations imported from JSCOP file is shown as output of -analyze pass. Added: polly/trunk/test/CodeGen/MemAccess/memaccess_simple_analyze.ll Modified: polly/trunk/lib/Analysis/ScopInfo.cpp polly/trunk/lib/Exchange/JSONExporter.cpp Modified: polly/trunk/lib/Analysis/ScopInfo.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=136774&r1=136773&r2=136774&view=diff ============================================================================== --- polly/trunk/lib/Analysis/ScopInfo.cpp (original) +++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Aug 3 08:47:59 2011 @@ -337,8 +337,8 @@ return isl_set_is_equal(stride, strideZero); } -void MemoryAccess::setNewAccessFunction(isl_map *newAccessRelation) { - newAccessRelation = newAccessRelation; +void MemoryAccess::setNewAccessFunction(isl_map *newAccess) { + newAccessRelation = newAccess; } //===----------------------------------------------------------------------===// Modified: polly/trunk/lib/Exchange/JSONExporter.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=136774&r1=136773&r2=136774&view=diff ============================================================================== --- polly/trunk/lib/Exchange/JSONExporter.cpp (original) +++ polly/trunk/lib/Exchange/JSONExporter.cpp Wed Aug 3 08:47:59 2011 @@ -69,6 +69,7 @@ struct JSONImporter : public ScopPass { static char ID; Scop *S; + std::vector newAccessStrings; explicit JSONImporter() : ScopPass(ID) {} std::string getFileName(Scop *S) const; @@ -189,6 +190,9 @@ void JSONImporter::printScop(raw_ostream &OS) const { S->print(OS); + for (std::vector::const_iterator I = newAccessStrings.begin(), + E = newAccessStrings.end(); I != E; I++) + OS << "New access function '" << *I << "'detected in JSCOP file\n"; } typedef Dependences::StatementToIslMapTy StatementToIslMapTy; @@ -268,6 +272,7 @@ if (!isl_map_is_equal(newAccessMap, currentAccessMap)) { // Statistics. ++NewAccessMapFound; + newAccessStrings.push_back(accesses.asCString()); (*MI)->setNewAccessFunction(newAccessMap); } memoryAccessIdx++; Added: polly/trunk/test/CodeGen/MemAccess/memaccess_simple_analyze.ll URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CodeGen/MemAccess/memaccess_simple_analyze.ll?rev=136774&view=auto ============================================================================== --- polly/trunk/test/CodeGen/MemAccess/memaccess_simple_analyze.ll (added) +++ polly/trunk/test/CodeGen/MemAccess/memaccess_simple_analyze.ll Wed Aug 3 08:47:59 2011 @@ -0,0 +1,48 @@ +;RUN: opt %loadPolly -polly-import-jscop -analyze -polly-import-jscop-dir=`dirname %s` -polly-import-jscop-postfix=transformed %s | FileCheck %s +; ModuleID = 'memaccess_simple.ll' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-linux-gnu" + + at A = common global [100 x i32] zeroinitializer, align 4 + at B = common global [100 x i32] zeroinitializer, align 4 + +define i32 @memaccess_simple() nounwind { +entry: + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] + %arrayidx = getelementptr [100 x i32]* @A, i32 0, i32 %0 + %exitcond1 = icmp ne i32 %0, 12 + br i1 %exitcond1, label %for.body, label %for.end + +for.body: ; preds = %for.cond + store i32 %0, i32* %arrayidx + br label %for.inc + +for.inc: ; preds = %for.body + %inc = add nsw i32 %0, 1 + br label %for.cond + +for.end: ; preds = %for.cond + br label %for.cond4 + +for.cond4: ; preds = %for.inc11, %for.end + %1 = phi i32 [ 0, %for.end ], [ %inc13, %for.inc11 ] + %arrayidx10 = getelementptr [100 x i32]* @B, i32 0, i32 %1 + %exitcond = icmp ne i32 %1, 12 + br i1 %exitcond, label %for.body7, label %for.end14 + +for.body7: ; preds = %for.cond4 + store i32 %1, i32* %arrayidx10 + br label %for.inc11 + +for.inc11: ; preds = %for.body7 + %inc13 = add nsw i32 %1, 1 + br label %for.cond4 + +for.end14: ; preds = %for.cond4 + ret i32 0 +} +; CHECK: New access function '{ Stmt_for_body7[i0] -> MemRef_B[0] }'detected in JSCOP file +; CHECK: New access function '{ Stmt_for_body[i0] -> MemRef_A[0] }'detected in JSCOP file From aggarwa4 at illinois.edu Wed Aug 3 11:15:53 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Wed, 03 Aug 2011 16:15:53 -0000 Subject: [llvm-commits] [poolalloc] r136782 - in /poolalloc/trunk: include/assistDS/TypeChecks.h lib/AssistDS/TypeChecks.cpp runtime/DynamicTypeChecks/TypeRuntime.cpp Message-ID: <20110803161553.109FC2A6C12C@llvm.org> Author: aggarwa4 Date: Wed Aug 3 11:15:52 2011 New Revision: 136782 URL: http://llvm.org/viewvc/llvm-project?rev=136782&view=rev Log: Only create casts during instrumentation if they are needed. Simplified some cases. Make the runtime easier to read. Modified: poolalloc/trunk/include/assistDS/TypeChecks.h poolalloc/trunk/lib/AssistDS/TypeChecks.cpp poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp Modified: poolalloc/trunk/include/assistDS/TypeChecks.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/TypeChecks.h?rev=136782&r1=136781&r2=136782&view=diff ============================================================================== --- poolalloc/trunk/include/assistDS/TypeChecks.h (original) +++ poolalloc/trunk/include/assistDS/TypeChecks.h Wed Aug 3 11:15:52 2011 @@ -76,7 +76,7 @@ bool visitAllocaInst(Module &M, AllocaInst &AI); bool visitVAArgInst(Module &M, VAArgInst &VI); - bool visitUses(Instruction *I, Instruction *AI, Instruction *BCI); + bool visitUses(Instruction *I, Instruction *AI, Value *BCI); bool visitGlobal(Module &M, GlobalVariable &GV, Constant *C, Instruction &I, SmallVector); Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=136782&r1=136781&r2=136782&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original) +++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Wed Aug 3 11:15:52 2011 @@ -126,6 +126,28 @@ return ConstantInt::get(TypeTagTy, getTypeMarker(T)); } +static inline Value * +castTo (Value * V, const Type * Ty, std::string Name, Instruction * InsertPt) { + // + // Don't bother creating a cast if it's already the correct type. + // + if (V->getType() == Ty) + return V; + + // + // If it's a constant, just create a constant expression. + // + if (Constant * C = dyn_cast(V)) { + Constant * CE = ConstantExpr::getZExtOrBitCast (C, Ty); + return CE; + } + + // + // Otherwise, insert a cast instruction. + // + return CastInst::CreateZExtOrBitCast (V, Ty, Name, InsertPt); +} + bool TypeChecks::runOnModule(Module &M) { bool modified = false; // Flags whether we modified the module. bool transformIndirectCalls = true; @@ -879,7 +901,7 @@ if(CalledF->getIntrinsicID() != Intrinsic::vastart) continue; // Reinitialize the counter - CastInst *BCI = BitCastInst::CreatePointerCast(CI->getOperand(1), VoidPtrTy, "", CI); + Value *BCI = castTo(CI->getOperand(1), VoidPtrTy, "", CI); std::vector Args; Args.push_back(BCI); Args.push_back(NewValue); @@ -902,8 +924,8 @@ continue; if(CalledF->getIntrinsicID() != Intrinsic::vacopy) continue; - CastInst *BCI_Src = BitCastInst::CreatePointerCast(CI->getOperand(2), VoidPtrTy, "", CI); - CastInst *BCI_Dest = BitCastInst::CreatePointerCast(CI->getOperand(1), VoidPtrTy, "", CI); + Value *BCI_Src = castTo(CI->getOperand(2), VoidPtrTy, "", CI); + Value *BCI_Dest = castTo(CI->getOperand(1), VoidPtrTy, "", CI); std::vector Args; Args.push_back(BCI_Dest); Args.push_back(BCI_Src); @@ -1171,7 +1193,7 @@ const Type * ET = PT->getElementType(); Value * AllocSize = ConstantInt::get(Int64Ty, TD->getTypeAllocSize(ET)); Instruction * InsertPt = &(F.getEntryBlock().front()); - CastInst *BCI = BitCastInst::CreatePointerCast(I, VoidPtrTy, "", InsertPt); + Value *BCI = castTo(I, VoidPtrTy, "", InsertPt); std::vector Args; Args.push_back(BCI); Args.push_back(AllocSize); @@ -1202,7 +1224,7 @@ const PointerType * PT = cast((*I)->getType()); const Type * ET = PT->getElementType(); Value * AllocSize = ConstantInt::get(Int64Ty, TD->getTypeAllocSize(ET)); - CastInst *BCI = BitCastInst::CreatePointerCast(*I, VoidPtrTy, "", Pt); + Value *BCI = castTo(*I, VoidPtrTy, "", Pt); std::vector Args; Args.push_back(BCI); Args.push_back(AllocSize); @@ -1256,7 +1278,7 @@ I->getNameStr() == "optind" || I->getNameStr() == "optarg") { // assume initialized - CastInst *BCI = BitCastInst::CreatePointerCast(I, VoidPtrTy, "", InsertPt); + Value *BCI = castTo(I, VoidPtrTy, "", InsertPt); std::vector Args; Args.push_back(BCI); Args.push_back(getSizeConstant(I->getType()->getElementType())); @@ -1368,7 +1390,7 @@ GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(&GV, Indices.begin(), Indices.end(),"", &I) ; - CastInst *BCI = BitCastInst::CreatePointerCast(GEP, VoidPtrTy, "", &I); + Value *BCI = castTo(GEP, VoidPtrTy, "", &I); // Copy the type metadata for the first element // over for the rest of the elements. @@ -1403,7 +1425,7 @@ GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(&GV, Indices.begin(), Indices.end(),"", &I) ; - CastInst *BCI = BitCastInst::CreatePointerCast(GEP, VoidPtrTy, "", &I); + Value *BCI = castTo(GEP, VoidPtrTy, "", &I); std::vector Args; Args.push_back(BCI); Args.push_back(getSizeConstant(ElementType)); @@ -1424,7 +1446,7 @@ GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(&GV, Indices.begin(), Indices.end(),"", &I) ; - CastInst *BCI = BitCastInst::CreatePointerCast(GEP, VoidPtrTy, "", &I); + Value *BCI = castTo(GEP, VoidPtrTy, "", &I); std::vector Args; Args.push_back(BCI); Args.push_back(getTypeMarkerConstant(CAZ)); @@ -1438,7 +1460,7 @@ GetElementPtrInst *GEP = GetElementPtrInst::CreateInBounds(&GV, Indices.begin(), Indices.end(),"", &I) ; - CastInst *BCI = BitCastInst::CreatePointerCast(GEP, VoidPtrTy, "", &I); + Value *BCI = castTo(GEP, VoidPtrTy, "", &I); std::vector Args; Args.push_back(BCI); Args.push_back(getTypeMarkerConstant(C)); @@ -1451,7 +1473,7 @@ bool TypeChecks::visitVAArgInst(Module &M, VAArgInst &VI) { if(!VI.getParent()->getParent()->hasInternalLinkage()) return false; - CastInst *BCI = BitCastInst::CreatePointerCast(VI.getOperand(0), VoidPtrTy, "", &VI); + Value *BCI = castTo(VI.getOperand(0), VoidPtrTy, "", &VI); std::vectorArgs; Args.push_back(BCI); Args.push_back(getTypeMarkerConstant(&VI)); @@ -1514,8 +1536,8 @@ case Intrinsic::memcpy: case Intrinsic::memmove: { - CastInst *BCI_Src = BitCastInst::CreatePointerCast(CS.getArgument(1), VoidPtrTy, "", I); - CastInst *BCI_Dest = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI_Src = castTo(CS.getArgument(1), VoidPtrTy, "", I); + Value *BCI_Dest = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vector Args; Args.push_back(BCI_Dest); Args.push_back(BCI_Src); @@ -1527,7 +1549,7 @@ } case Intrinsic::memset: - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vector Args; Args.push_back(BCI); CastInst *Size = CastInst::CreateIntegerCast(CS.getArgument(2), Int64Ty, false, "", I); @@ -1551,7 +1573,7 @@ ++InsertPt; CI->insertBefore(InsertPt); } else if (F->getNameStr() == std::string("_ZNSsC1EPKcRKSaIcE")) { //c_str() - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vectorArgs; Args.push_back(BCI); Args.push_back(getTagCounter()); @@ -1620,7 +1642,7 @@ } else if (F->getNameStr() == std::string("gettimeofday") || F->getNameStr() == std::string("time") || F->getNameStr() == std::string("times")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); assert (isa(CS.getArgument(0)->getType())); const PointerType * PT = cast(CS.getArgument(0)->getType()); const Type * ET = PT->getElementType(); @@ -1737,7 +1759,7 @@ F->getNameStr() == std::string("vfsstat") || F->getNameStr() == std::string("fstat") || F->getNameStr() == std::string("lstat")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(1), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(1), VoidPtrTy, "", I); assert (isa(CS.getArgument(1)->getType())); const PointerType * PT = cast(CS.getArgument(1)->getType()); const Type * ET = PT->getElementType(); @@ -1748,7 +1770,7 @@ Args.push_back(getTagCounter()); CallInst::Create(trackInitInst, Args.begin(), Args.end(), "", I); } else if (F->getNameStr() == std::string("sigaction")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(2), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(2), VoidPtrTy, "", I); assert (isa(CS.getArgument(2)->getType())); const PointerType * PT = cast(CS.getArgument(2)->getType()); const Type * ET = PT->getElementType(); @@ -1787,7 +1809,7 @@ CI->insertAfter(BCI); } else if (F->getNameStr() == std::string("strtol") || F->getNameStr() == std::string("strtod")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(1), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(1), VoidPtrTy, "", I); const PointerType *PTy = cast(CS.getArgument(1)->getType()); const Type * ElementType = PTy->getElementType(); std::vectorArgs; @@ -1798,8 +1820,8 @@ return true; } else if (F->getNameStr() == std::string("strcat") || F->getNameStr() == std::string("_ZNSspLEPKc")) { - CastInst *BCI_Src = BitCastInst::CreatePointerCast(CS.getArgument(1), VoidPtrTy, "", I); - CastInst *BCI_Dest = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI_Src = castTo(CS.getArgument(1), VoidPtrTy, "", I); + Value *BCI_Dest = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vector Args; Args.push_back(BCI_Dest); Args.push_back(BCI_Src); @@ -1830,7 +1852,7 @@ CallInst *CI = CallInst::Create(F, Args.begin(), Args.end()); CI->insertAfter(I); } else if (F->getNameStr() == std::string("pipe")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vector Args; Args.push_back(BCI); Args.push_back(getTagCounter()); @@ -1876,7 +1898,7 @@ CI->insertAfter(BCI); } else if (F->getNameStr() == std::string("ftime") || F->getNameStr() == std::string("gettimeofday")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); const PointerType *PTy = cast(CS.getArgument(0)->getType()); const Type * ElementType = PTy->getElementType(); std::vector Args; @@ -1945,7 +1967,7 @@ CI->insertAfter(BCI_Dest); return true; } else if(F->getNameStr() == std::string("fgets")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vector Args; Args.push_back(BCI); CastInst *Size = CastInst::CreateIntegerCast(CS.getArgument(1), Int64Ty, false, "", I); @@ -1955,7 +1977,7 @@ return true; } else if(F->getNameStr() == std::string("snprintf") || F->getNameStr() == std::string("vsnprintf")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vectorArgs; Args.push_back(BCI); Args.push_back(getTagCounter()); @@ -1963,7 +1985,7 @@ CallInst *CINew = CallInst::Create(F, Args.begin(), Args.end()); CINew->insertAfter(I); } else if(F->getNameStr() == std::string("sprintf")) { - CastInst *BCI = BitCastInst::CreatePointerCast(CS.getArgument(0), VoidPtrTy, "", I); + Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I); std::vectorArgs; Args.push_back(BCI); CastInst *Size = CastInst::CreateIntegerCast(I, Int64Ty, false); @@ -2018,7 +2040,7 @@ TP.push_back(*ArgI); const FunctionType *FTy = FunctionType::get(FOldType->getReturnType(), TP, FOldType->isVarArg()); - CastInst *Func = CastInst::CreatePointerCast(I->getOperand(0), FTy->getPointerTo(), "", I); + Value *Func = castTo(I->getOperand(0), FTy->getPointerTo(), "", I); inst_iterator InsPt = inst_begin(I->getParent()->getParent()); CallSite CS = CallSite(I); @@ -2062,7 +2084,7 @@ bool TypeChecks::visitInputFunctionValue(Module &M, Value *V, Instruction *CI) { // Cast the pointer operand to i8* for the runtime function. - CastInst *BCI = BitCastInst::CreatePointerCast(V, VoidPtrTy, "", CI); + Value *BCI = castTo(V, VoidPtrTy, "", CI); const PointerType *PTy = dyn_cast(V->getType()); if(!PTy) return false; @@ -2093,7 +2115,7 @@ bool TypeChecks::visitLoadInst(Module &M, LoadInst &LI) { inst_iterator InsPt = inst_begin(LI.getParent()->getParent()); // Cast the pointer operand to i8* for the runtime function. - CastInst *BCI = BitCastInst::CreatePointerCast(LI.getPointerOperand(), VoidPtrTy, "", &LI); + Value *BCI = castTo(LI.getPointerOperand(), VoidPtrTy, "", &LI); Value *Size = ConstantInt::get(Int32Ty, getSize(LI.getType())); AllocaInst *AI = new AllocaInst(TypeTagTy, Size, "", &*InsPt); @@ -2128,7 +2150,7 @@ // AI - metadata // BCI - ptr // I - instruction whose uses to instrument -bool TypeChecks::visitUses(Instruction *I, Instruction *AI, Instruction *BCI) { +bool TypeChecks::visitUses(Instruction *I, Instruction *AI, Value *BCI) { for(Value::use_iterator II = I->use_begin(); II != I->use_end(); ++II) { if(DisablePtrCmpChecks) { if(isa(II)) { @@ -2145,7 +2167,7 @@ if(StoreInst *SI = dyn_cast(II)) { if(SI->getOperand(0) == I) { // Cast the pointer operand to i8* for the runtime function. - CastInst *BCI_Dest = BitCastInst::CreatePointerCast(SI->getPointerOperand(), VoidPtrTy, "", SI); + Value *BCI_Dest = castTo(SI->getPointerOperand(), VoidPtrTy, "", SI); std::vector Args; Args.push_back(BCI_Dest); @@ -2274,7 +2296,7 @@ return false; } // Cast the pointer operand to i8* for the runtime function. - CastInst *BCI = BitCastInst::CreatePointerCast(SI.getPointerOperand(), VoidPtrTy, "", &SI); + Value *BCI = castTo(SI.getPointerOperand(), VoidPtrTy, "", &SI); std::vector Args; Args.push_back(BCI); Modified: poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp?rev=136782&r1=136781&r2=136782&view=diff ============================================================================== --- poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp (original) +++ poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp Wed Aug 3 11:15:52 2011 @@ -96,12 +96,11 @@ inline uintptr_t maskAddress(void *ptr) { uintptr_t p = (uintptr_t)ptr; - if (p >= (uintptr_t)BASE + SIZE) p -= SIZE; + if(ptr < BASE) + return p; + else + return (p - (uintptr_t)SIZE); -#if DEBUG - assert(p <= SIZE && "Pointer out of range!"); -#endif - return p; } /** From stoklund at 2pi.dk Wed Aug 3 11:33:19 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 03 Aug 2011 16:33:19 -0000 Subject: [llvm-commits] [llvm] r136787 - in /llvm/trunk: lib/Target/X86/X86FloatingPoint.cpp test/CodeGen/X86/fp-stack-O0-crash.ll Message-ID: <20110803163319.5240D2A6C12C@llvm.org> Author: stoklund Date: Wed Aug 3 11:33:19 2011 New Revision: 136787 URL: http://llvm.org/viewvc/llvm-project?rev=136787&view=rev Log: Handle IMPLICIT_DEF instructions in X86FloatingPoint. This fixes PR10575. Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp llvm/trunk/test/CodeGen/X86/fp-stack-O0-crash.ll Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=136787&r1=136786&r2=136787&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Wed Aug 3 11:33:19 2011 @@ -406,6 +406,10 @@ if (MI->isCopy() && isFPCopy(MI)) FPInstClass = X86II::SpecialFP; + if (MI->isImplicitDef() && + X86::RFP80RegClass.contains(MI->getOperand(0).getReg())) + FPInstClass = X86II::SpecialFP; + if (FPInstClass == X86II::NotFP) continue; // Efficiently ignore non-fp insts! @@ -1369,6 +1373,15 @@ break; } + case TargetOpcode::IMPLICIT_DEF: { + // All FP registers must be explicitly defined, so load a 0 instead. + unsigned Reg = MI->getOperand(0).getReg() - X86::FP0; + DEBUG(dbgs() << "Emitting LD_F0 for implicit FP" << Reg << '\n'); + BuildMI(*MBB, I, MI->getDebugLoc(), TII->get(X86::LD_F0)); + pushReg(Reg); + break; + } + case X86::FpPOP_RETVAL: { // The FpPOP_RETVAL instruction is used after calls that return a value on // the floating point stack. We cannot model this with ST defs since CALL Modified: llvm/trunk/test/CodeGen/X86/fp-stack-O0-crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp-stack-O0-crash.ll?rev=136787&r1=136786&r2=136787&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fp-stack-O0-crash.ll (original) +++ llvm/trunk/test/CodeGen/X86/fp-stack-O0-crash.ll Wed Aug 3 11:33:19 2011 @@ -1,4 +1,4 @@ -; RUN: llc %s -O0 -fast-isel -regalloc=fast -o - +; RUN: llc %s -O0 -fast-isel -regalloc=fast -mcpu=i386 -o - ; PR4767 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" @@ -28,3 +28,22 @@ if.end: ; preds = %if.then, %cond.false, %cond.true ret void } + +; PR10575 +; This produces a FP0 = IMPLICIT_DEF instruction. +define void @__m_rankmerge_MOD_dindexmerge_() nounwind { +entry: + br label %"20" + +"20": ; preds = %"23", %entry + %0 = phi double [ undef, %entry ], [ %0, %"23" ] + %1 = phi double [ 0.000000e+00, %entry ], [ %2, %"23" ] + br i1 undef, label %"21", label %"23" + +"21": ; preds = %"20" + ret void + +"23": ; preds = %"20" + %2 = select i1 undef, double %0, double %1 + br label %"20" +} From raghesh.a at gmail.com Wed Aug 3 12:02:50 2011 From: raghesh.a at gmail.com (Raghesh Aloor) Date: Wed, 03 Aug 2011 17:02:50 -0000 Subject: [llvm-commits] [polly] r136789 - in /polly/trunk: include/polly/ScopInfo.h lib/CodeGeneration.cpp test/CodeGen/MemAccess/memaccess_codegen_simple.c test/CodeGen/MemAccess/memaccess_codegen_simple.ll test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop.transformed Message-ID: <20110803170250.BC43D2A6C12C@llvm.org> Author: raghesh Date: Wed Aug 3 12:02:50 2011 New Revision: 136789 URL: http://llvm.org/viewvc/llvm-project?rev=136789&view=rev Log: Memaccess: Codegeneration for a simple access function change Code is generated for a simple access function change imported from JSCOP file. An access of A[i] is changed to A[0]. The code for A[0] is generated directly without refering to isl function calls. Added: polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.c polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.ll polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop.transformed Modified: polly/trunk/include/polly/ScopInfo.h polly/trunk/lib/CodeGeneration.cpp Modified: polly/trunk/include/polly/ScopInfo.h URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=136789&r1=136788&r2=136789&view=diff ============================================================================== --- polly/trunk/include/polly/ScopInfo.h (original) +++ polly/trunk/include/polly/ScopInfo.h Wed Aug 3 12:02:50 2011 @@ -130,6 +130,11 @@ return BaseName; } + /// @brief Get the new access function imported from JSCOP file + isl_map *getNewAccessFunction() { + return newAccessRelation; + } + /// @brief Get the stride of this memory access in the specified domain /// subset. isl_set *getStride(const isl_set *domainSubset) const; Modified: polly/trunk/lib/CodeGeneration.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=136789&r1=136788&r2=136789&view=diff ============================================================================== --- polly/trunk/lib/CodeGeneration.cpp (original) +++ polly/trunk/lib/CodeGeneration.cpp Wed Aug 3 12:02:50 2011 @@ -314,9 +314,36 @@ return vector; } + /// @brief Get the new operand address according to the changed access in + /// JSCOP file. + Value *getNewAccessOperand(isl_map *newAccessRelation, Value *baseAddr, + const Value *OldOperand, ValueMapT &BBMap) { + unsigned accessIdx = 0; + Value *newOperand = Builder.CreateStructGEP(baseAddr, + accessIdx, "p_newarrayidx_"); + return newOperand; + } + + /// @brief Generate the operand address + Value *generateLocationAccessed(const Instruction *Inst, + const Value *pointer, ValueMapT &BBMap ) { + MemoryAccess &Access = statement.getAccessFor(Inst); + isl_map *newAccessRelation = Access.getNewAccessFunction(); + if (!newAccessRelation) { + Value *newPointer = getOperand(pointer, BBMap); + return newPointer; + } + + Value *baseAddr = const_cast(Access.getBaseAddr()); + Value *newPointer = getNewAccessOperand(newAccessRelation, baseAddr, + pointer, BBMap); + return newPointer; + } + Value *generateScalarLoad(const LoadInst *load, ValueMapT &BBMap) { const Value *pointer = load->getPointerOperand(); - Value *newPointer = getOperand(pointer, BBMap); + const Instruction *Inst = dyn_cast(load); + Value *newPointer = generateLocationAccessed(Inst, pointer, BBMap); Value *scalarLoad = Builder.CreateLoad(newPointer, load->getNameStr() + "_p_scalar_"); return scalarLoad; Added: polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.c URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.c?rev=136789&view=auto ============================================================================== --- polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.c (added) +++ polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.c Wed Aug 3 12:02:50 2011 @@ -0,0 +1,8 @@ +int A[100]; + +int memaccess_codegen_simple () { + for (int i = 0; i < 12; i++) + A[13] = A[i] + A[i-1]; + + return 0; +} Added: polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.ll URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.ll?rev=136789&view=auto ============================================================================== --- polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.ll (added) +++ polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple.ll Wed Aug 3 12:02:50 2011 @@ -0,0 +1,34 @@ +;RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-dir=`dirname %s` -polly-import-jscop-postfix=transformed -polly-codegen -instnamer %s -S | FileCheck %s +; ModuleID = 'memaccess_codegen_simple.ll' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-linux-gnu" + + at A = common global [100 x i32] zeroinitializer, align 4 + +define i32 @memaccess_codegen_simple() nounwind { +entry: + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %tmp1 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] + %tmp = add i32 %tmp1, -1 + %arrayidx4 = getelementptr [100 x i32]* @A, i32 0, i32 %tmp + %arrayidx = getelementptr [100 x i32]* @A, i32 0, i32 %tmp1 + %exitcond = icmp ne i32 %tmp1, 12 + br i1 %exitcond, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %tmp2 = load i32* %arrayidx, align 4 + %tmp5 = load i32* %arrayidx4, align 4 + %add = add nsw i32 %tmp2, %tmp5 + store i32 %add, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 13), align 4 + br label %for.inc + +for.inc: ; preds = %for.body + %inc = add nsw i32 %tmp1, 1 + br label %for.cond + +for.end: ; preds = %for.cond + ret i32 0 +} +; CHECK: load i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0) Added: polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%25for.cond---%25for.end.jscop?rev=136789&view=auto ============================================================================== --- polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop (added) +++ polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop Wed Aug 3 12:02:50 2011 @@ -0,0 +1,25 @@ +{ + "context" : "{ [] }", + "name" : "for.cond => for.end", + "statements" : [ + { + "accesses" : [ + { + "kind" : "read", + "relation" : "{ Stmt_for_body[i0] -> MemRef_A[i0] }" + }, + { + "kind" : "read", + "relation" : "{ Stmt_for_body[i0] -> MemRef_A[-1 + i0] }" + }, + { + "kind" : "write", + "relation" : "{ Stmt_for_body[i0] -> MemRef_A[13] }" + } + ], + "domain" : "{ Stmt_for_body[i0] : i0 >= 0 and i0 <= 11 }", + "name" : "Stmt_for_body", + "schedule" : "{ Stmt_for_body[i0] -> scattering[0, i0, 0] }" + } + ] +} Added: polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop.transformed URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%25for.cond---%25for.end.jscop.transformed?rev=136789&view=auto ============================================================================== --- polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop.transformed (added) +++ polly/trunk/test/CodeGen/MemAccess/memaccess_codegen_simple___%for.cond---%for.end.jscop.transformed Wed Aug 3 12:02:50 2011 @@ -0,0 +1,25 @@ +{ + "context" : "{ [] }", + "name" : "for.cond => for.end", + "statements" : [ + { + "accesses" : [ + { + "kind" : "read", + "relation" : "{ Stmt_for_body[i0] -> MemRef_A[0] }" + }, + { + "kind" : "read", + "relation" : "{ Stmt_for_body[i0] -> MemRef_A[-1 + i0] }" + }, + { + "kind" : "write", + "relation" : "{ Stmt_for_body[i0] -> MemRef_A[13] }" + } + ], + "domain" : "{ Stmt_for_body[i0] : i0 >= 0 and i0 <= 11 }", + "name" : "Stmt_for_body", + "schedule" : "{ Stmt_for_body[i0] -> scattering[0, i0, 0] }" + } + ] +} From dmalyshev at accesssoftek.com Wed Aug 3 12:03:56 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Wed, 3 Aug 2011 10:03:56 -0700 Subject: [llvm-commits] ELFObject Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE17F5319BD2@mail.accesssoftek.com> Hello everyone, Please review the new class: ELFObject - ELF object file wrapper. It's will be use in MCJIT dynamic linker. Patch attached Regards, Danil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110803/aab678ef/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: ELFObject-01.patch Type: application/octet-stream Size: 8953 bytes Desc: ELFObject-01.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110803/aab678ef/attachment.obj From wendling at apple.com Wed Aug 3 12:12:21 2011 From: wendling at apple.com (Bill Wendling) Date: Wed, 03 Aug 2011 10:12:21 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <86199D0A-5B2D-4315-BEE4-E8908579E7B9@apple.com> <312E007D-67A9-49C6-A441-64FCC321A517@apple.com> Message-ID: <237E6F02-5AF2-46B3-9D7D-3C3E233C393F@apple.com> On Aug 3, 2011, at 12:12 AM, John McCall wrote: > On Aug 2, 2011, at 11:48 PM, Bill Wendling wrote: >> On Aug 2, 2011, at 6:38 PM, John McCall wrote: >>> >>> I don't think this is true; the exceptions ABI strongly suggests that the >>> call to _Unwind_Resume should happen from the "landing pad", i.e. >>> from the function that unwinding stopped at. I would not be surprised >>> if some existing implementations broke if you "outlined" the call to >>> _Unwind_Resume, and I certainly see no value in supporting it. >>> >>> It should be undefined behavior to reach a resume and give it an >>> operand that does not correspond to the value of a landingpad >>> instruction from the same execution context. (That's a dynamic >>> constraint about the data content of the value, not an SSA >>> constraint about the form of the operand). >>> >> It strongly suggests, but it doesn't sound like a requirement to me. And after talking with Nick, I convinced myself that it is "okay" to have the _Unwind_Resume outside of the current function (I even did some tests). How he outlined it to me was: > > I agree that this is likely to work with Darwin's libUnwind as long as the > LSDA doesn't indicate a cleanup for the call to calls_resume(), or that > landing pad doesn't lead to an outlined _Unwind_Resume call. I am > less certain about SjLj unwinding, but it'll probably work there again. > I really see zero value in supporting this, though, and I do think it's > contrary to the intent of the ABI document. > It's more of a philosophical issue. LLVM's IR has always been flexible enough that you should be able to take some basic blocks and make a function out of them without changing the semantics of the program.[1] I'm assuming that this is why Chris asked this question. The value would be in having one less restriction on the IR. I like restrictions, but only if they are 100% necessary. -bw [1] Not 100% true (e.g., invoke), but close to true for most LLVM IR instructions. From isanbard at gmail.com Wed Aug 3 12:17:06 2011 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 03 Aug 2011 17:17:06 -0000 Subject: [llvm-commits] [llvm] r136790 - /llvm/trunk/docs/LangRef.html Message-ID: <20110803171707.552712A6C12C@llvm.org> Author: void Date: Wed Aug 3 12:17:06 2011 New Revision: 136790 URL: http://llvm.org/viewvc/llvm-project?rev=136790&view=rev Log: Explain how clauses are applied. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=136790&r1=136789&r2=136790&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Wed Aug 3 12:17:06 2011 @@ -6025,6 +6025,10 @@ calling conventions, how the personality function results are represented in LLVM IR is target specific.

    +

    The clauses are applied in order from top to bottom. If two + landingpad instructions are merged together through inlining, the + clauses from the calling function are prepended to the list of clauses.

    +

    The landingpad instruction has several restrictions:

      From jasonwkim at google.com Wed Aug 3 12:41:26 2011 From: jasonwkim at google.com (Jason Kim) Date: Wed, 3 Aug 2011 10:41:26 -0700 Subject: [llvm-commits] ELFObject In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE17F5319BD2@mail.accesssoftek.com> References: <6AE1604EE3EC5F4296C096518C6B77EE17F5319BD2@mail.accesssoftek.com> Message-ID: On Wed, Aug 3, 2011 at 10:03 AM, Danil Malyshev wrote: > Hello everyone,**** > > ** ** > > ** ** > > Please review the new class: ELFObject - ELF object file wrapper.**** > > It's will be use in MCJIT dynamic linker.**** > > Patch attached**** > > ** > Hi, after a cursory glance, I have a few questions - 1. What is the plan for this class? i.e. Is there a doc somewhere that describes ... 1. Which architecture is to be supported first? 2. How will you split off architecture specific details, such as .. 3. Relocations during JIT? 2. Is it intended to ever support 64 bit elf files directly? If so, you'll have to do something about the 32bit offset helpers below (for starters) and/or the class name (for clarity) If not, then should this class be called ELF32Object? Thanks! + + /// \brief Get the pointer to a byte with offset in the ELF object. + /// \param Offset - offset from a first byte in the ELF object. + const uint8_t *getOffset(unsigned Offset) const { + assert((Offset < Buffer->getBufferSize()) && + "Offset out of range!"); + return (const uint8_t*)Buffer->getBufferStart() + Offset; + } + + /// \brief Get the pointer to a string from the string section. + /// \param Offset - offset from a first byte in the string section. + /// \param SectionIndex - index of section in the section headers table. + const char *getStringAtOffset(unsigned Offset, unsigned SectionIndex) const { + return (const char*)getOffset(getSectionHeader(SectionIndex)->sh_offset) + + Offset; + } Thanks -jason ** > > ** ** > > Regards,**** > > Danil**** > > _______________________________________________ > 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/20110803/4d72c229/attachment.html From wendling at apple.com Wed Aug 3 12:42:21 2011 From: wendling at apple.com (Bill Wendling) Date: Wed, 03 Aug 2011 10:42:21 -0700 Subject: [llvm-commits] Newest LandingPad Patch Message-ID: <1D33093C-44C0-43BE-B5CD-9CF8F0907484@apple.com> This is the newest LandingPadInst patch. It incorporates the details from the discussions we've been having. In particular, it changes the grammar so that a "filter" clause can have a list of values (to keep the semantics of filters), while a "catch" clause may have only one value (since a catch clause with a list of values is semantically the same as a list of catches each with one value). Share and enjoy! -bw -------------- next part -------------- A non-text attachment was scrubbed... Name: landingpadinst.diff Type: application/octet-stream Size: 32773 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110803/1fc63682/attachment.obj -------------- next part -------------- From clattner at apple.com Wed Aug 3 13:07:57 2011 From: clattner at apple.com (Chris Lattner) Date: Wed, 03 Aug 2011 11:07:57 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <237E6F02-5AF2-46B3-9D7D-3C3E233C393F@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <86199D0A-5B2D-4315-BEE4-E8908579E7B9@apple.com> <312E007D-67A9-49C6-A441-64FCC321A517@apple.com> <237E6F02-5AF2-46B3-9D7D-3C3E233C393F@apple.com> Message-ID: <7D57C6BA-63AD-4159-BA6E-420D7EB433F4@apple.com> On Aug 3, 2011, at 10:12 AM, Bill Wendling wrote: >> I agree that this is likely to work with Darwin's libUnwind as long as the >> LSDA doesn't indicate a cleanup for the call to calls_resume(), or that >> landing pad doesn't lead to an outlined _Unwind_Resume call. I am >> less certain about SjLj unwinding, but it'll probably work there again. >> I really see zero value in supporting this, though, and I do think it's >> contrary to the intent of the ABI document. >> > It's more of a philosophical issue. LLVM's IR has always been flexible enough that you should be able to take some basic blocks and make a function out of them without changing the semantics of the program.[1] I'm assuming that this is why Chris asked this question. The value would be in having one less restriction on the IR. I like restrictions, but only if they are 100% necessary. > > -bw > > [1] Not 100% true (e.g., invoke), but close to true for most LLVM IR instructions. This also isn't true for VLA alloca's and other stuff. If an "outlined" resume is something that is reliable across platforms and that frontend authors can depend on, then we should allow it in LangRef. If it isn't, we shouldn't. -Chris From atrick at apple.com Wed Aug 3 13:28:21 2011 From: atrick at apple.com (Andrew Trick) Date: Wed, 03 Aug 2011 18:28:21 -0000 Subject: [llvm-commits] [llvm] r136795 - /llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <20110803182821.B37972A6C12E@llvm.org> Author: atrick Date: Wed Aug 3 13:28:21 2011 New Revision: 136795 URL: http://llvm.org/viewvc/llvm-project?rev=136795&view=rev Log: whitespace Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=136795&r1=136794&r2=136795&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Wed Aug 3 13:28:21 2011 @@ -213,7 +213,7 @@ // predecessors from outside of the loop, split the edge now. SmallVector ExitBlocks; L->getExitBlocks(ExitBlocks); - + SmallSetVector ExitBlockSet(ExitBlocks.begin(), ExitBlocks.end()); for (SmallSetVector::iterator I = ExitBlockSet.begin(), @@ -402,7 +402,7 @@ } assert(!LoopBlocks.empty() && "No edges coming in from outside the loop?"); - BasicBlock *NewBB = SplitBlockPredecessors(Exit, &LoopBlocks[0], + BasicBlock *NewBB = SplitBlockPredecessors(Exit, &LoopBlocks[0], LoopBlocks.size(), ".loopexit", this); @@ -467,23 +467,23 @@ if (&*BBI == SplitPreds[i]) return; } - + // If it isn't already after an outside block, move it after one. This is // always good as it makes the uncond branch from the outside block into a // fall-through. - + // Figure out *which* outside block to put this after. Prefer an outside // block that neighbors a BB actually in the loop. BasicBlock *FoundBB = 0; for (unsigned i = 0, e = SplitPreds.size(); i != e; ++i) { Function::iterator BBI = SplitPreds[i]; - if (++BBI != NewBB->getParent()->end() && + if (++BBI != NewBB->getParent()->end() && L->contains(BBI)) { FoundBB = SplitPreds[i]; break; } } - + // If our heuristic for a *good* bb to place this after doesn't find // anything, just pick something. It's likely better than leaving it within // the loop. @@ -544,7 +544,7 @@ // Make sure that NewBB is put someplace intelligent, which doesn't mess up // code layout too horribly. PlaceSplitBlockCarefully(NewBB, OuterLoopPreds, L); - + // Create the new outer loop. Loop *NewOuter = new Loop(); From atrick at apple.com Wed Aug 3 13:32:11 2011 From: atrick at apple.com (Andrew Trick) Date: Wed, 03 Aug 2011 18:32:11 -0000 Subject: [llvm-commits] [llvm] r136797 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Transforms/Utils/LoopSimplify.cpp lib/Transforms/Utils/LoopUnroll.cpp test/Transforms/LoopSimplify/preserve-scev.ll Message-ID: <20110803183211.425742A6C12E@llvm.org> Author: atrick Date: Wed Aug 3 13:32:11 2011 New Revision: 136797 URL: http://llvm.org/viewvc/llvm-project?rev=136797&view=rev Log: SCEV: Use AssertingVH to catch dangling BasicBlock* when passes forget to notify SCEV of a change. Add forgetLoop in a couple of those places. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp llvm/trunk/test/Transforms/LoopSimplify/preserve-scev.ll Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=136797&r1=136796&r2=136797&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Wed Aug 3 13:32:11 2011 @@ -264,7 +264,7 @@ /// ExitNotTakenInfo - Information about the number of times a particular /// loop exit may be reached before exiting the loop. struct ExitNotTakenInfo { - BasicBlock *ExitingBlock; + AssertingVH ExitingBlock; const SCEV *ExactNotTaken; PointerIntPair NextExit; Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=136797&r1=136796&r2=136797&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Wed Aug 3 13:32:11 2011 @@ -325,6 +325,14 @@ DEBUG(dbgs() << "LoopSimplify: Eliminating exiting block " << ExitingBlock->getName() << "\n"); + // If any reachable control flow within this loop has changed, notify + // ScalarEvolution. Currently assume the parent loop doesn't change + // (spliting edges doesn't count). If blocks, CFG edges, or other values + // in the parent loop change, then we need call to forgetLoop() for the + // parent instead. + if (SE) + SE->forgetLoop(L); + assert(pred_begin(ExitingBlock) == pred_end(ExitingBlock)); Changed = true; LI->removeBlock(ExitingBlock); Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=136797&r1=136796&r2=136797&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Wed Aug 3 13:32:11 2011 @@ -58,7 +58,8 @@ /// only has one predecessor, and that predecessor only has one successor. /// The LoopInfo Analysis that is passed will be kept consistent. /// Returns the new combined block. -static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI) { +static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI, + LPPassManager *LPM) { // Merge basic blocks into their predecessor if there is only one distinct // pred, and if there is only one distinct successor of the predecessor, and // if there are no PHI nodes. @@ -90,6 +91,12 @@ std::string OldName = BB->getName(); // Erase basic block from the function... + + // ScalarEvolution holds references to loop exit blocks. + if (ScalarEvolution *SE = LPM->getAnalysisIfAvailable()) { + if (Loop *L = LI->getLoopFor(BB)) + SE->forgetLoop(L); + } LI->removeBlock(BB); BB->eraseFromParent(); @@ -364,7 +371,7 @@ BranchInst *Term = cast(Latches[i]->getTerminator()); if (Term->isUnconditional()) { BasicBlock *Dest = Term->getSuccessor(0); - if (BasicBlock *Fold = FoldBlockIntoPredecessor(Dest, LI)) + if (BasicBlock *Fold = FoldBlockIntoPredecessor(Dest, LI, LPM)) std::replace(Latches.begin(), Latches.end(), Dest, Fold); } } Modified: llvm/trunk/test/Transforms/LoopSimplify/preserve-scev.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopSimplify/preserve-scev.ll?rev=136797&r1=136796&r2=136797&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LoopSimplify/preserve-scev.ll (original) +++ llvm/trunk/test/Transforms/LoopSimplify/preserve-scev.ll Wed Aug 3 13:32:11 2011 @@ -48,3 +48,91 @@ } declare void @foo() nounwind + +; Notify SCEV when removing an ExitingBlock. +; CHECK: @mergeExit +; CHECK: while.cond191: +; CHECK: br i1 %or.cond, label %while.body197 +; CHECK-NOT: land.rhs: +; CHECK: ret +define void @mergeExit(i32 %MapAttrCount) nounwind uwtable ssp { +entry: + br i1 undef, label %if.then124, label %if.end126 + +if.then124: ; preds = %entry + unreachable + +if.end126: ; preds = %entry + br i1 undef, label %while.body.lr.ph, label %if.end591 + +while.body.lr.ph: ; preds = %if.end126 + br i1 undef, label %if.end140, label %if.then137 + +if.then137: ; preds = %while.body.lr.ph + unreachable + +if.end140: ; preds = %while.body.lr.ph + br i1 undef, label %while.cond191.outer, label %if.then148 + +if.then148: ; preds = %if.end140 + unreachable + +while.cond191.outer: ; preds = %if.then205, %if.end140 + br label %while.cond191 + +while.cond191: ; preds = %while.body197, %while.cond191.outer + %CppIndex.0 = phi i32 [ %inc, %while.body197 ], [ undef, %while.cond191.outer ] + br i1 undef, label %land.rhs, label %if.then216 + +land.rhs: ; preds = %while.cond191 + %inc = add i32 %CppIndex.0, 1 + %cmp196 = icmp ult i32 %inc, %MapAttrCount + br i1 %cmp196, label %while.body197, label %if.then216 + +while.body197: ; preds = %land.rhs + br i1 undef, label %if.then205, label %while.cond191 + +if.then205: ; preds = %while.body197 + br label %while.cond191.outer + +if.then216: ; preds = %land.rhs, %while.cond191 + br i1 undef, label %if.else, label %if.then221 + +if.then221: ; preds = %if.then216 + unreachable + +if.else: ; preds = %if.then216 + br i1 undef, label %if.then266, label %if.end340 + +if.then266: ; preds = %if.else + switch i32 undef, label %if.else329 [ + i32 17, label %if.then285 + i32 19, label %if.then285 + i32 18, label %if.then285 + i32 15, label %if.then285 + ] + +if.then285: ; preds = %if.then266, %if.then266, %if.then266, %if.then266 + br i1 undef, label %if.then317, label %if.else324 + +if.then317: ; preds = %if.then285 + br label %if.end340 + +if.else324: ; preds = %if.then285 + unreachable + +if.else329: ; preds = %if.then266 + unreachable + +if.end340: ; preds = %if.then317, %if.else + unreachable + +if.end591: ; preds = %if.end126 + br i1 undef, label %cond.end, label %cond.false + +cond.false: ; preds = %if.end591 + unreachable + +cond.end: ; preds = %if.end591 + ret void +} From wendling at apple.com Wed Aug 3 13:35:29 2011 From: wendling at apple.com (Bill Wendling) Date: Wed, 03 Aug 2011 11:35:29 -0700 Subject: [llvm-commits] [Patch] Exception Handling Documentation In-Reply-To: <7D57C6BA-63AD-4159-BA6E-420D7EB433F4@apple.com> References: <2F957548-2AAD-4671-B4E6-3872A681AD26@apple.com> <9FBE9A25-1913-40C9-9D86-497FBC56AA0A@apple.com> <3666850A-DAEE-4956-B37B-FDECF86574B9@apple.com> <562837EC-C357-412A-9783-E1206300A4FB@apple.com> <4464D404-52D8-4EFE-89AA-0C7976030C98@apple.com> <72C8F66F-7F37-4444-9DE0-8B1DABEAD841@apple.com> <86199D0A-5B2D-4315-BEE4-E8908579E7B9@apple.com> <312E007D-67A9-49C6-A441-64FCC321A517@apple.com> <237E6F02-5AF2-46B3-9D7D-3C3E233C393F@apple.com> <7D57C6BA-63AD-4159-BA6E-420D7EB433F4@apple.com> Message-ID: On Aug 3, 2011, at 11:07 AM, Chris Lattner wrote: > On Aug 3, 2011, at 10:12 AM, Bill Wendling wrote: >>> I agree that this is likely to work with Darwin's libUnwind as long as the >>> LSDA doesn't indicate a cleanup for the call to calls_resume(), or that >>> landing pad doesn't lead to an outlined _Unwind_Resume call. I am >>> less certain about SjLj unwinding, but it'll probably work there again. >>> I really see zero value in supporting this, though, and I do think it's >>> contrary to the intent of the ABI document. >>> >> It's more of a philosophical issue. LLVM's IR has always been flexible enough that you should be able to take some basic blocks and make a function out of them without changing the semantics of the program.[1] I'm assuming that this is why Chris asked this question. The value would be in having one less restriction on the IR. I like restrictions, but only if they are 100% necessary. >> >> -bw >> >> [1] Not 100% true (e.g., invoke), but close to true for most LLVM IR instructions. > > This also isn't true for VLA alloca's and other stuff. If an "outlined" resume is something that is reliable across platforms and that frontend authors can depend on, then we should allow it in LangRef. If it isn't, we shouldn't. > Okay. Since there's doubt that all platforms support an "outlined" resume, and the EH doc strongly suggests that it shouldn't be outlined. I'll change the documentation to reflect this. -bw From isanbard at gmail.com Wed Aug 3 13:37:33 2011 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 03 Aug 2011 18:37:33 -0000 Subject: [llvm-commits] [llvm] r136799 - /llvm/trunk/docs/LangRef.html Message-ID: <20110803183733.50FFF2A6C12E@llvm.org> Author: void Date: Wed Aug 3 13:37:32 2011 New Revision: 136799 URL: http://llvm.org/viewvc/llvm-project?rev=136799&view=rev Log: Go back to the old definition. It's not clear that a 'resume' can be 'outlined' from the function with the landing pad for all platforms. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=136799&r1=136798&r2=136799&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Wed Aug 3 13:37:32 2011 @@ -3385,8 +3385,8 @@
      Arguments:

      The 'resume' instruction requires one argument, which must have the - same type as the result of the 'landingpad' instruction which - interrupted the unwinding.

      + same type as the result of any 'landingpad' instruction in the same + function.

      Semantics:

      The 'resume' instruction resumes propagation of an existing From rafael.espindola at gmail.com Wed Aug 3 13:45:47 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Wed, 03 Aug 2011 14:45:47 -0400 Subject: [llvm-commits] [patch] Add a C interface to PassManagerBuilder Message-ID: <4E39975B.8080103@gmail.com> The attached patch adds a C interface to PassManagerBuilder. It is missing the addExtension functionality since in the C api a pass is created and added to a pass manager in a single call. Is it OK? Cheers, Rafael -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: PassManagerBuilder.patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110803/9344652c/attachment.pl From bob.wilson at apple.com Wed Aug 3 14:04:43 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 03 Aug 2011 12:04:43 -0700 Subject: [llvm-commits] [llvm] r136759 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll In-Reply-To: <20110803012546.7B64E2A6C12C@llvm.org> References: <20110803012546.7B64E2A6C12C@llvm.org> Message-ID: <2B173DA3-FB73-45C5-960C-C4726E7EA7B9@apple.com> See comments below. I'm about to commit a revised version of this. On Aug 2, 2011, at 6:25 PM, Devang Patel wrote: > Author: dpatel > Date: Tue Aug 2 20:25:46 2011 > New Revision: 136759 > > URL: http://llvm.org/viewvc/llvm-project?rev=136759&view=rev > Log: > Use byte offset, instead of element number, to access merged global. > > Added: > llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll > Modified: > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=136759&r1=136758&r2=136759&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Aug 2 20:25:46 2011 > @@ -955,7 +955,8 @@ > static const ConstantExpr *getMergedGlobalExpr(const Value *V) { > const ConstantExpr *CE = dyn_cast_or_null(V); > if (!CE || CE->getNumOperands() != 3 || > - CE->getOpcode() != Instruction::GetElementPtr) > + CE->getOpcode() != Instruction::GetElementPtr || > + !isa(CE->getOperand(0)->getType())) This is checking the wrong thing. The first operand of a GEP is always a pointer, and there's already a check that it's a GlobalValue. What needs to be checked here is that it's a StructType because you're assuming that below. > return NULL; > > // First operand points to a global value. > @@ -974,6 +975,23 @@ > return CE; > } > > +// getMergedGlobalElementOffset - If CE is accessing a merged global > +// then find byte offset of the element accessed by CE. This must be > +// used only CE returned by getMergedGlobalExpr(). See above. > +static uint64_t getMergedGlobalElementOffset(const TargetData &TD, > + const ConstantExpr *CE) { > + assert (getMergedGlobalExpr(CE) && "This is not a merged global!"); > + uint64_t e = cast(CE->getOperand(2))->getZExtValue(); > + if (e == 0) return 0; > + > + uint64_t Offset = 0; > + const PointerType *PTy = dyn_cast(CE->getOperand(0)->getType()); > + const StructType *STy = dyn_cast(PTy->getElementType()); These should be casts, not dyn_casts. You're not checking if the dyn_casts succeed anyway. > + for (uint64_t i = 0; i != e; ++i) > + Offset += TD.getTypeAllocSize(STy->getElementType(i)); > + return Offset; > +} This should use TD.getIndexedOffset(). Again, I'm just going to make these changes myself, so no need to respond -- unless you disagree, of course. From bob.wilson at apple.com Wed Aug 3 14:42:51 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 03 Aug 2011 19:42:51 -0000 Subject: [llvm-commits] [llvm] r136802 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <20110803194251.A2BCE2A6C12C@llvm.org> Author: bwilson Date: Wed Aug 3 14:42:51 2011 New Revision: 136802 URL: http://llvm.org/viewvc/llvm-project?rev=136802&view=rev Log: Some revisions to Devang's change r136759 for merged global debug info. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=136802&r1=136801&r2=136802&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Aug 3 14:42:51 2011 @@ -955,12 +955,13 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) { const ConstantExpr *CE = dyn_cast_or_null(V); if (!CE || CE->getNumOperands() != 3 || - CE->getOpcode() != Instruction::GetElementPtr || - !isa(CE->getOperand(0)->getType())) + CE->getOpcode() != Instruction::GetElementPtr) return NULL; - // First operand points to a global value. - if (!isa(CE->getOperand(0))) + // First operand points to a global struct. + Value *Ptr = CE->getOperand(0); + if (!isa(Ptr) || + !isa(cast(Ptr->getType())->getElementType())) return NULL; // Second operand is zero. @@ -975,23 +976,6 @@ return CE; } -// getMergedGlobalElementOffset - If CE is accessing a merged global -// then find byte offset of the element accessed by CE. This must be -// used only CE returned by getMergedGlobalExpr(). See above. -static uint64_t getMergedGlobalElementOffset(const TargetData &TD, - const ConstantExpr *CE) { - assert (getMergedGlobalExpr(CE) && "This is not a merged global!"); - uint64_t e = cast(CE->getOperand(2))->getZExtValue(); - if (e == 0) return 0; - - uint64_t Offset = 0; - const PointerType *PTy = dyn_cast(CE->getOperand(0)->getType()); - const StructType *STy = dyn_cast(PTy->getElementType()); - for (uint64_t i = 0; i != e; ++i) - Offset += TD.getTypeAllocSize(STy->getElementType(i)); - return Offset; -} - /// constructGlobalVariableDIE - Construct global variable DIE. void DwarfDebug::constructGlobalVariableDIE(const MDNode *N) { DIGlobalVariable GV(N); @@ -1060,12 +1044,14 @@ else if (const ConstantExpr *CE = getMergedGlobalExpr(N->getOperand(11))) { // GV is a merged global. DIEBlock *Block = new (DIEValueAllocator) DIEBlock(); + Value *Ptr = CE->getOperand(0); TheCU->addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr); TheCU->addLabel(Block, 0, dwarf::DW_FORM_udata, - Asm->Mang->getSymbol(cast(CE->getOperand(0)))); + Asm->Mang->getSymbol(cast(Ptr))); TheCU->addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_constu); + SmallVector Idx(CE->op_begin()+1, CE->op_end()); TheCU->addUInt(Block, 0, dwarf::DW_FORM_udata, - getMergedGlobalElementOffset(Asm->getTargetData(), CE)); + Asm->getTargetData().getIndexedOffset(Ptr->getType(), Idx)); TheCU->addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus); TheCU->addBlock(VariableDIE, dwarf::DW_AT_location, 0, Block); } From benny.kra at googlemail.com Wed Aug 3 14:53:48 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 03 Aug 2011 19:53:48 -0000 Subject: [llvm-commits] [llvm] r136803 - in /llvm/trunk/lib: AsmParser/LLParser.cpp Target/X86/X86ISelLowering.cpp Message-ID: <20110803195348.6E57A2A6C12E@llvm.org> Author: d0k Date: Wed Aug 3 14:53:48 2011 New Revision: 136803 URL: http://llvm.org/viewvc/llvm-project?rev=136803&view=rev Log: Remove unused variables. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=136803&r1=136802&r2=136803&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Aug 3 14:53:48 2011 @@ -3258,7 +3258,6 @@ /// ::= 'resume' TypeAndValue bool LLParser::ParseResume(Instruction *&Inst, PerFunctionState &PFS) { Value *Exn; LocTy ExnLoc; - LocTy Loc = Lex.getLoc(); if (ParseTypeAndValue(Exn, ExnLoc, PFS)) return true; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=136803&r1=136802&r2=136803&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Aug 3 14:53:48 2011 @@ -5048,7 +5048,6 @@ SDValue X86TargetLowering::LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const { - DebugLoc dl = Op.getDebugLoc(); EVT ResVT = Op.getValueType(); assert(Op.getNumOperands() == 2); From isanbard at gmail.com Wed Aug 3 15:53:38 2011 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 03 Aug 2011 20:53:38 -0000 Subject: [llvm-commits] [llvm] r136811 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <20110803205338.78EBC2A6C12C@llvm.org> Author: void Date: Wed Aug 3 15:53:38 2011 New Revision: 136811 URL: http://llvm.org/viewvc/llvm-project?rev=136811&view=rev Log: Remove CreateUnwind from the IRBuillder. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=136811&r1=136810&r2=136811&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Aug 3 15:53:38 2011 @@ -475,10 +475,6 @@ Name); } - UnwindInst *CreateUnwind() { - return Insert(new UnwindInst(Context)); - } - ResumeInst *CreateResume(Value *Exn) { return Insert(ResumeInst::Create(Exn)); } From evan.cheng at apple.com Wed Aug 3 15:57:25 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 03 Aug 2011 13:57:25 -0700 Subject: [llvm-commits] if-conversion using mbpi In-Reply-To: References: Message-ID: <8AE870B9-18DD-4960-BD33-42058AF4679C@apple.com> Looks fine to me. Can you or Andy send me the entire test log? I want to make sure there aren't any hidden regressions. Thanks, Evan On Aug 2, 2011, at 1:23 PM, Jakub Staszak wrote: > Hello, > > This patch changes If-Conversion algorithm so it uses MachineBranchProbabilityInfo instead of its own heuristics. I (Andy) run SPEC tests on ARM machine and it looks that in a few cases we get 4-5% boost, without any bigger regressions. I had to change a few test however so they don't fail on "make check". Can you look at them at make sure it is fine? > > Thanks! > - Kuba > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jstaszak at apple.com Wed Aug 3 16:05:09 2011 From: jstaszak at apple.com (Jakub Staszak) Date: Wed, 03 Aug 2011 14:05:09 -0700 Subject: [llvm-commits] if-conversion using mbpi In-Reply-To: <8AE870B9-18DD-4960-BD33-42058AF4679C@apple.com> References: <8AE870B9-18DD-4960-BD33-42058AF4679C@apple.com> Message-ID: <4026C01D-11FA-4B3B-9705-9E26B5D5B98B@apple.com> These are numbers that Andy sent me. - Kuba -------------- next part -------------- A non-text attachment was scrubbed... Name: r136633-kuba-k95.numbers Type: application/octet-stream Size: 117983 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110803/1ef634c7/attachment-0001.obj -------------- next part -------------- On Aug 3, 2011, at 1:57 PM, Evan Cheng wrote: > Looks fine to me. Can you or Andy send me the entire test log? I want to make sure there aren't any hidden regressions. > > Thanks, > > Evan > > On Aug 2, 2011, at 1:23 PM, Jakub Staszak wrote: > >> Hello, >> >> This patch changes If-Conversion algorithm so it uses MachineBranchProbabilityInfo instead of its own heuristics. I (Andy) run SPEC tests on ARM machine and it looks that in a few cases we get 4-5% boost, without any bigger regressions. I had to change a few test however so they don't fail on "make check". Can you look at them at make sure it is fine? >> >> Thanks! >> - Kuba >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From eli.friedman at gmail.com Wed Aug 3 16:06:03 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 03 Aug 2011 21:06:03 -0000 Subject: [llvm-commits] [llvm] r136813 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <20110803210603.4FF832A6C12C@llvm.org> Author: efriedma Date: Wed Aug 3 16:06:02 2011 New Revision: 136813 URL: http://llvm.org/viewvc/llvm-project?rev=136813&view=rev Log: New approach to r136737: insert the necessary fences for atomic ops in platform-independent code, since a bunch of platforms (ARM, Mips, PPC, Alpha are the relevant targets here) need to do essentially the same thing. I think this completes the basic CodeGen for atomicrmw and cmpxchg. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=136813&r1=136812&r2=136813&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Aug 3 16:06:02 2011 @@ -714,6 +714,13 @@ return ShouldFoldAtomicFences; } + /// getInsertFencesFor - return whether the DAG builder should automatically + /// insert fences and reduce ordering for atomics. + /// + bool getInsertFencesForAtomic() const { + return InsertFencesForAtomic; + } + /// getPreIndexedAddressParts - returns true by value, base pointer and /// offset pointer and addressing mode by reference if the node's address /// can be legally represented as pre-indexed load / store address. @@ -1134,6 +1141,13 @@ ShouldFoldAtomicFences = fold; } + /// setInsertFencesForAtomic - Set if the the DAG builder should + /// automatically insert fences and reduce the order of atomic memory + /// operations to Monotonic. + void setInsertFencesForAtomic(bool fence) { + InsertFencesForAtomic = fence; + } + public: //===--------------------------------------------------------------------===// // Lowering methods - These methods must be implemented by targets so that @@ -1673,6 +1687,11 @@ /// combiner. bool ShouldFoldAtomicFences; + /// InsertFencesForAtomic - Whether the DAG builder should automatically + /// insert fences and reduce ordering for atomics. (This will be set for + /// for most architectures with weak memory ordering.) + bool InsertFencesForAtomic; + /// StackPointerRegisterToSaveRestore - If set to a physical register, this /// specifies the register that llvm.savestack/llvm.restorestack should save /// and restore. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=136813&r1=136812&r2=136813&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Aug 3 16:06:02 2011 @@ -3237,22 +3237,59 @@ DAG.setRoot(StoreNode); } +static SDValue InsertFenceForAtomic(SDValue Chain, AtomicOrdering Order, + bool Before, DebugLoc dl, + SelectionDAG &DAG, + const TargetLowering &TLI) { + // Fence, if necessary + if (Before) { + if (Order == AcquireRelease) + Order = Release; + else if (Order == Acquire || Order == Monotonic) + return Chain; + } else { + if (Order == AcquireRelease) + Order = Acquire; + else if (Order == Release || Order == Monotonic) + return Chain; + } + SDValue Ops[3]; + Ops[0] = Chain; + Ops[1] = DAG.getConstant(SequentiallyConsistent, TLI.getPointerTy()); + Ops[2] = DAG.getConstant(Order, TLI.getPointerTy()); + return DAG.getNode(ISD::ATOMIC_FENCE, dl, MVT::Other, Ops, 3); +} + void SelectionDAGBuilder::visitAtomicCmpXchg(const AtomicCmpXchgInst &I) { - SDValue Root = getRoot(); + DebugLoc dl = getCurDebugLoc(); + AtomicOrdering Order = I.getOrdering(); + + SDValue InChain = getRoot(); + + if (TLI.getInsertFencesForAtomic()) + InChain = InsertFenceForAtomic(InChain, Order, true, dl, DAG, TLI); + SDValue L = - DAG.getAtomic(ISD::ATOMIC_CMP_SWAP, getCurDebugLoc(), + DAG.getAtomic(ISD::ATOMIC_CMP_SWAP, dl, getValue(I.getCompareOperand()).getValueType().getSimpleVT(), - Root, + InChain, getValue(I.getPointerOperand()), getValue(I.getCompareOperand()), getValue(I.getNewValOperand()), MachinePointerInfo(I.getPointerOperand()), 0 /* Alignment */, I.getOrdering(), I.getSynchScope()); + + SDValue OutChain = L.getValue(1); + + if (TLI.getInsertFencesForAtomic()) + OutChain = InsertFenceForAtomic(OutChain, Order, false, dl, DAG, TLI); + setValue(&I, L); - DAG.setRoot(L.getValue(1)); + DAG.setRoot(OutChain); } void SelectionDAGBuilder::visitAtomicRMW(const AtomicRMWInst &I) { + DebugLoc dl = getCurDebugLoc(); ISD::NodeType NT; switch (I.getOperation()) { default: llvm_unreachable("Unknown atomicrmw operation"); return; @@ -3268,16 +3305,30 @@ case AtomicRMWInst::UMax: NT = ISD::ATOMIC_LOAD_UMAX; break; case AtomicRMWInst::UMin: NT = ISD::ATOMIC_LOAD_UMIN; break; } + AtomicOrdering Order = I.getOrdering(); + + SDValue InChain = getRoot(); + + if (TLI.getInsertFencesForAtomic()) + InChain = InsertFenceForAtomic(InChain, Order, true, dl, DAG, TLI); + SDValue L = - DAG.getAtomic(NT, getCurDebugLoc(), + DAG.getAtomic(NT, dl, getValue(I.getValOperand()).getValueType().getSimpleVT(), - getRoot(), + InChain, getValue(I.getPointerOperand()), getValue(I.getValOperand()), I.getPointerOperand(), 0 /* Alignment */, - I.getOrdering(), I.getSynchScope()); + TLI.getInsertFencesForAtomic() ? Monotonic : Order, + I.getSynchScope()); + + SDValue OutChain = L.getValue(1); + + if (TLI.getInsertFencesForAtomic()) + OutChain = InsertFenceForAtomic(OutChain, Order, false, dl, DAG, TLI); + setValue(&I, L); - DAG.setRoot(L.getValue(1)); + DAG.setRoot(OutChain); } void SelectionDAGBuilder::visitFence(const FenceInst &I) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=136813&r1=136812&r2=136813&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Aug 3 16:06:02 2011 @@ -617,6 +617,7 @@ PrefLoopAlignment = 0; MinStackArgumentAlignment = 1; ShouldFoldAtomicFences = false; + InsertFencesForAtomic = false; InitLibcallNames(LibcallRoutineNames); InitCmpLibcallCCs(CmpLibcallCCs); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=136813&r1=136812&r2=136813&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Aug 3 16:06:02 2011 @@ -602,18 +602,8 @@ // normally. setOperationAction(ISD::MEMBARRIER, MVT::Other, Custom); setOperationAction(ISD::ATOMIC_FENCE, MVT::Other, Custom); - setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_SWAP, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_ADD, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_SUB, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_AND, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_OR, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_XOR, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_NAND, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_MIN, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_MAX, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_UMIN, MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LOAD_UMAX, MVT::i32, Custom); + // Automatically insert fences (dmb ist) around ATOMIC_SWAP etc. + setInsertFencesForAtomic(true); } else { // Set them all for expansion, which will force libcalls. setOperationAction(ISD::MEMBARRIER, MVT::Other, Expand); @@ -2258,72 +2248,25 @@ DAG.getConstant(DMBOpt, MVT::i32)); } -static SDValue getFence(SDValue InChain, DebugLoc dl, SelectionDAG &DAG, - const ARMSubtarget *Subtarget) { + +static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG, + const ARMSubtarget *Subtarget) { + // FIXME: handle "fence singlethread" more efficiently. + DebugLoc dl = Op.getDebugLoc(); if (!Subtarget->hasDataBarrier()) { // Some ARMv6 cpus can support data barriers with an mcr instruction. // Thumb1 and pre-v6 ARM mode use a libcall instead and should never get // here. assert(Subtarget->hasV6Ops() && !Subtarget->isThumb() && "Unexpected ISD::MEMBARRIER encountered. Should be libcall!"); - return DAG.getNode(ARMISD::MEMBARRIER_MCR, dl, MVT::Other, InChain, + return DAG.getNode(ARMISD::MEMBARRIER_MCR, dl, MVT::Other, Op.getOperand(0), DAG.getConstant(0, MVT::i32)); } - return DAG.getNode(ARMISD::MEMBARRIER, dl, MVT::Other, InChain, + return DAG.getNode(ARMISD::MEMBARRIER, dl, MVT::Other, Op.getOperand(0), DAG.getConstant(ARM_MB::ISH, MVT::i32)); } -static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG, - const ARMSubtarget *Subtarget) { - // FIXME: handle "fence singlethread" more efficiently. - DebugLoc dl = Op.getDebugLoc(); - return getFence(Op.getOperand(0), dl, DAG, Subtarget); -} - -static SDValue LowerAtomicMemOp(SDValue Op, SelectionDAG &DAG, - const ARMSubtarget *Subtarget) { - DebugLoc dl = Op.getDebugLoc(); - int Order = cast(Op)->getOrdering(); - if (Order <= Monotonic) - return Op; - - SDValue InChain = Op.getOperand(0); - - // Fence, if necessary - if (Order == Release || Order >= AcquireRelease) - InChain = getFence(InChain, dl, DAG, Subtarget); - - // Rather than mess with target-specific nodes, use the target-indepedent - // node, and assume the DAGCombiner will not touch it post-legalize. - SDValue OutVal; - if (Op.getOpcode() == ISD::ATOMIC_CMP_SWAP) - OutVal = DAG.getAtomic(ISD::ATOMIC_CMP_SWAP, dl, - cast(Op)->getMemoryVT(), - InChain, Op.getOperand(1), Op.getOperand(2), - Op.getOperand(3), - cast(Op)->getMemOperand(), - Monotonic, - cast(Op)->getSynchScope()); - else - OutVal = DAG.getAtomic(Op.getOpcode(), dl, - cast(Op)->getMemoryVT(), - InChain, Op.getOperand(1), Op.getOperand(2), - cast(Op)->getMemOperand(), - Monotonic, - cast(Op)->getSynchScope()); - - SDValue OutChain = OutVal.getValue(1); - - // Fence, if necessary - if (Order == Acquire || Order >= AcquireRelease) - OutChain = getFence(OutChain, dl, DAG, Subtarget); - - SDValue Ops[2] = { OutVal, OutChain }; - return DAG.getMergeValues(Ops, 2, dl); -} - - static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget) { // ARM pre v5TE and Thumb1 does not have preload instructions. @@ -4882,18 +4825,6 @@ case ISD::VASTART: return LowerVASTART(Op, DAG); case ISD::MEMBARRIER: return LowerMEMBARRIER(Op, DAG, Subtarget); case ISD::ATOMIC_FENCE: return LowerATOMIC_FENCE(Op, DAG, Subtarget); - case ISD::ATOMIC_CMP_SWAP: - case ISD::ATOMIC_SWAP: - case ISD::ATOMIC_LOAD_ADD: - case ISD::ATOMIC_LOAD_SUB: - case ISD::ATOMIC_LOAD_AND: - case ISD::ATOMIC_LOAD_OR: - case ISD::ATOMIC_LOAD_XOR: - case ISD::ATOMIC_LOAD_NAND: - case ISD::ATOMIC_LOAD_MIN: - case ISD::ATOMIC_LOAD_MAX: - case ISD::ATOMIC_LOAD_UMIN: - case ISD::ATOMIC_LOAD_UMAX: return LowerAtomicMemOp(Op, DAG, Subtarget); case ISD::PREFETCH: return LowerPREFETCH(Op, DAG, Subtarget); case ISD::SINT_TO_FP: case ISD::UINT_TO_FP: return LowerINT_TO_FP(Op, DAG); Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=136813&r1=136812&r2=136813&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Wed Aug 3 16:06:02 2011 @@ -160,6 +160,8 @@ setMinFunctionAlignment(4); + setInsertFencesForAtomic(true); + computeRegisterProperties(); } Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=136813&r1=136812&r2=136813&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Wed Aug 3 16:06:02 2011 @@ -164,6 +164,8 @@ setOperationAction(ISD::MEMBARRIER, MVT::Other, Custom); setOperationAction(ISD::ATOMIC_FENCE, MVT::Other, Custom); + setInsertFencesForAtomic(true); + if (Subtarget->isSingleFloat()) setOperationAction(ISD::SELECT_CC, MVT::f64, Expand); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=136813&r1=136812&r2=136813&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Aug 3 16:06:02 2011 @@ -401,6 +401,8 @@ if (PPCSubTarget.isDarwin()) setPrefFunctionAlignment(4); + setInsertFencesForAtomic(true); + computeRegisterProperties(); } From evan.cheng at apple.com Wed Aug 3 16:07:02 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 03 Aug 2011 21:07:02 -0000 Subject: [llvm-commits] [llvm] r136814 - /llvm/trunk/tools/edis/EnhancedDisassembly.exports Message-ID: <20110803210702.202F02A6C12C@llvm.org> Author: evancheng Date: Wed Aug 3 16:07:01 2011 New Revision: 136814 URL: http://llvm.org/viewvc/llvm-project?rev=136814&view=rev Log: Kill the export list as well. Removed: llvm/trunk/tools/edis/EnhancedDisassembly.exports Removed: llvm/trunk/tools/edis/EnhancedDisassembly.exports URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/EnhancedDisassembly.exports?rev=136813&view=auto ============================================================================== --- llvm/trunk/tools/edis/EnhancedDisassembly.exports (original) +++ llvm/trunk/tools/edis/EnhancedDisassembly.exports (removed) @@ -1,36 +0,0 @@ -EDGetDisassembler -EDGetRegisterName -EDRegisterIsStackPointer -EDRegisterIsProgramCounter -EDCreateInsts -EDReleaseInst -EDInstByteSize -EDGetInstString -EDInstIsBranch -EDInstIsMove -EDBranchTargetID -EDMoveSourceID -EDMoveTargetID -EDNumTokens -EDGetToken -EDGetTokenString -EDOperandIndexForToken -EDTokenIsWhitespace -EDTokenIsPunctuation -EDTokenIsOpcode -EDTokenIsLiteral -EDTokenIsRegister -EDTokenIsNegativeLiteral -EDLiteralTokenAbsoluteValue -EDRegisterTokenValue -EDNumOperands -EDGetOperand -EDOperandIsRegister -EDOperandIsImmediate -EDOperandIsMemory -EDRegisterOperandValue -EDImmediateOperandValue -EDEvaluateOperand -EDBlockCreateInsts -EDBlockEvaluateOperand -EDBlockVisitTokens From jstaszak at apple.com Wed Aug 3 16:30:57 2011 From: jstaszak at apple.com (Jakub Staszak) Date: Wed, 03 Aug 2011 21:30:57 -0000 Subject: [llvm-commits] [llvm] r136816 - in /llvm/trunk: include/llvm/Analysis/BlockFrequencyInfo.h include/llvm/CodeGen/MachineBlockFrequencyInfo.h lib/Analysis/BlockFrequencyInfo.cpp lib/CodeGen/MachineBlockFrequencyInfo.cpp Message-ID: <20110803213057.57CE02A6C12C@llvm.org> Author: kuba Date: Wed Aug 3 16:30:57 2011 New Revision: 136816 URL: http://llvm.org/viewvc/llvm-project?rev=136816&view=rev Log: Add more constantness in BlockFrequencyInfo. Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h?rev=136816&r1=136815&r2=136816&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h Wed Aug 3 16:30:57 2011 @@ -46,7 +46,7 @@ /// that we should not rely on the value itself, but only on the comparison to /// the other block frequencies. We do this to avoid using of floating points. /// - BlockFrequency getBlockFreq(BasicBlock *BB); + BlockFrequency getBlockFreq(BasicBlock *BB) const; }; } Modified: llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h?rev=136816&r1=136815&r2=136816&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h Wed Aug 3 16:30:57 2011 @@ -46,7 +46,7 @@ /// that we should not rely on the value itself, but only on the comparison to /// the other block frequencies. We do this to avoid using of floating points. /// - BlockFrequency getBlockFreq(MachineBasicBlock *MBB); + BlockFrequency getBlockFreq(MachineBasicBlock *MBB) const; }; } Modified: llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp?rev=136816&r1=136815&r2=136816&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp (original) +++ llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp Wed Aug 3 16:30:57 2011 @@ -54,6 +54,6 @@ /// that we should not rely on the value itself, but only on the comparison to /// the other block frequencies. We do this to avoid using of floating points. /// -BlockFrequency BlockFrequencyInfo::getBlockFreq(BasicBlock *BB) { +BlockFrequency BlockFrequencyInfo::getBlockFreq(BasicBlock *BB) const { return BFI->getBlockFreq(BB); } Modified: llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp?rev=136816&r1=136815&r2=136816&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp Wed Aug 3 16:30:57 2011 @@ -55,6 +55,7 @@ /// that we should not rely on the value itself, but only on the comparison to /// the other block frequencies. We do this to avoid using of floating points. /// -BlockFrequency MachineBlockFrequencyInfo::getBlockFreq(MachineBasicBlock *MBB) { +BlockFrequency MachineBlockFrequencyInfo:: +getBlockFreq(MachineBasicBlock *MBB) const { return MBFI->getBlockFreq(MBB); } From resistor at mac.com Wed Aug 3 16:52:15 2011 From: resistor at mac.com (Owen Anderson) Date: Wed, 03 Aug 2011 21:52:15 -0000 Subject: [llvm-commits] [llvm] r136818 - /llvm/trunk/include/llvm/MC/MCInst.h Message-ID: <20110803215215.45C402A6C12C@llvm.org> Author: resistor Date: Wed Aug 3 16:52:15 2011 New Revision: 136818 URL: http://llvm.org/viewvc/llvm-project?rev=136818&view=rev Log: Add accessors for manipulating an MCInst's operands. Modified: llvm/trunk/include/llvm/MC/MCInst.h Modified: llvm/trunk/include/llvm/MC/MCInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInst.h?rev=136818&r1=136817&r2=136818&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCInst.h (original) +++ llvm/trunk/include/llvm/MC/MCInst.h Wed Aug 3 16:52:15 2011 @@ -145,6 +145,14 @@ } void clear() { Operands.clear(); } + size_t size() { return Operands.size(); } + + typedef SmallVector::iterator iterator; + iterator begin() { return Operands.begin(); } + iterator end() { return Operands.end(); } + iterator insert(iterator I, const MCOperand &Op) { + return Operands.insert(I, Op); + } void print(raw_ostream &OS, const MCAsmInfo *MAI) const; void dump() const; From evan.cheng at apple.com Wed Aug 3 17:16:12 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 03 Aug 2011 15:16:12 -0700 Subject: [llvm-commits] if-conversion using mbpi In-Reply-To: <4026C01D-11FA-4B3B-9705-9E26B5D5B98B@apple.com> References: <8AE870B9-18DD-4960-BD33-42058AF4679C@apple.com> <4026C01D-11FA-4B3B-9705-9E26B5D5B98B@apple.com> Message-ID: Please go ahead and commit the patch. Evan On Aug 3, 2011, at 2:05 PM, Jakub Staszak wrote: > These are numbers that Andy sent me. > > - Kuba > > On Aug 3, 2011, at 1:57 PM, Evan Cheng wrote: > >> Looks fine to me. Can you or Andy send me the entire test log? I want to make sure there aren't any hidden regressions. >> >> Thanks, >> >> Evan >> >> On Aug 2, 2011, at 1:23 PM, Jakub Staszak wrote: >> >>> Hello, >>> >>> This patch changes If-Conversion algorithm so it uses MachineBranchProbabilityInfo instead of its own heuristics. I (Andy) run SPEC tests on ARM machine and it looks that in a few cases we get 4-5% boost, without any bigger regressions. I had to change a few test however so they don't fail on "make check". Can you look at them at make sure it is fine? >>> >>> Thanks! >>> - Kuba >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > From tonic at nondot.org Wed Aug 3 17:17:57 2011 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 03 Aug 2011 22:17:57 -0000 Subject: [llvm-commits] [www] r136820 - /www/trunk/demo/index.cgi Message-ID: <20110803221757.C79552A6C12C@llvm.org> Author: tbrethou Date: Wed Aug 3 17:17:57 2011 New Revision: 136820 URL: http://llvm.org/viewvc/llvm-project?rev=136820&view=rev Log: Move demo page over to use clang only. Add dragon logo. Updated clang to 2.9. Modified: www/trunk/demo/index.cgi Modified: www/trunk/demo/index.cgi URL: http://llvm.org/viewvc/llvm-project/www/trunk/demo/index.cgi?rev=136820&r1=136819&r2=136820&view=diff ============================================================================== --- www/trunk/demo/index.cgi (original) +++ www/trunk/demo/index.cgi Wed Aug 3 17:17:57 2011 @@ -19,13 +19,11 @@ my $FORM_URL = 'index.cgi'; my $MAILADDR = 'sabre at nondot.org'; my $CONTACT_ADDRESS = 'Questions or comments? Email the LLVMdev mailing list.'; -my $LOGO_IMAGE_URL = 'cathead.png'; +my $LOGO_IMAGE_URL = '../img/DragonSmall.png'; my $TIMEOUTAMOUNT = 20; my @PREPENDPATHDIRS = - ( - '/opt/llvm-gcc-releases/llvm-gcc/bin', - '/opt/clang-releases/llvm/bin'); + ('/opt/clang-releases/llvm/bin'); my $defaultsrc = "#include \n#include \n\n" . "int factorial(int X) {\n if (X == 0) return 1;\n" . @@ -127,7 +125,7 @@

      - Try out LLVM 2.7 in your browser! + Try out LLVM 2.9 in your browser!
      @@ -141,7 +139,7 @@ my $currtime = time(); if ($locktime + 60 > $currtime) { print "This page is already in use by someone else at this "; - print "time, try reloading in a second or two. Meow!
      '\n"; + print "time, try reloading in a second or two.'\n"; exit 0; } } @@ -149,7 +147,7 @@ system("touch $ROOT/locked"); print <

      END @@ -187,7 +185,7 @@ print "Source language: ", $c->radio_group( -name => 'language', - -values => [ 'C', 'C++', 'Fortran' ], + -values => [ 'C', 'C++' ], -default => 'C' ), "

      "; @@ -240,14 +238,13 @@ $sanitycheckfail .= ' llvm-dis' if `llvm-dis --help 2>&1` !~ /ll disassembler/; - $sanitycheckfail .= ' llvm-gcc' - if ( `llvm-gcc --version 2>&1` !~ /Free Software Foundation/ ); - $sanitycheckfail .= ' llvm-ld' if `llvm-ld --help 2>&1` !~ /llvm linker/; $sanitycheckfail .= ' llvm-bcanalyzer' if `llvm-bcanalyzer --help 2>&1` !~ /bcanalyzer/; + $sanitycheckfail .= ' clang' + if `clang --version 2>&1` !~ /clang/; barf( "
      The demo page is currently unavailable. [tools: ($sanitycheckfail ) failed sanity check]" @@ -312,10 +309,10 @@ my %language_options = ( 'Java' => '', 'JO99' => '', - 'C' => '-fnested-functions', + 'C' => '', 'C++' => '', 'Fortran' => '', - 'preprocessed C' => '-fnested-functions', + 'preprocessed C' => '', 'preprocessed C++' => '' ); @@ -357,8 +354,8 @@ my $pid = $$; my $bytecodeFile = getname(".bc"); - my $outputFile = getname(".llvm-gcc.out"); - my $timerFile = getname(".llvm-gcc.time"); + my $outputFile = getname(".clang.out"); + my $timerFile = getname(".clang.time"); my $stats = ''; #$stats = "-Wa,--stats,--time-passes,--info-output-file=$timerFile" @@ -368,8 +365,8 @@ my $options = $language_options{ $c->param('language') }; $options .= " -O3" if $c->param('optlevel') ne "None"; - try_run( "llvm C/C++/Fortran front-end (llvm-gcc)", - "llvm-gcc -emit-llvm -msse3 -W -Wall $options $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1", + try_run( "llvm C/C++ front-end (clang)", + "clang -emit-llvm -msse3 -W -Wall $options $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1", $outputFile ); if ( $c->param('showstats') && -s $timerFile ) { From isanbard at gmail.com Wed Aug 3 17:18:21 2011 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 03 Aug 2011 22:18:21 -0000 Subject: [llvm-commits] [llvm] r136821 - in /llvm/trunk: docs/Passes.html docs/ReleaseNotes.html include/llvm-c/Transforms/IPO.h include/llvm/InitializePasses.h include/llvm/LinkAllPasses.h include/llvm/Transforms/IPO.h lib/Transforms/IPO/CMakeLists.txt lib/Transforms/IPO/IPO.cpp lib/Transforms/IPO/LowerSetJmp.cpp test/Transforms/LowerSetJmp/ tools/opt/opt.cpp Message-ID: <20110803221821.57D9F2A6C12C@llvm.org> Author: void Date: Wed Aug 3 17:18:20 2011 New Revision: 136821 URL: http://llvm.org/viewvc/llvm-project?rev=136821&view=rev Log: Remove the LowerSetJmp pass. It wasn't used effectively by any of the targets. This is some of my original LLVM code. *wipes tear* Removed: llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp llvm/trunk/test/Transforms/LowerSetJmp/ Modified: llvm/trunk/docs/Passes.html llvm/trunk/docs/ReleaseNotes.html llvm/trunk/include/llvm-c/Transforms/IPO.h llvm/trunk/include/llvm/InitializePasses.h llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Transforms/IPO.h llvm/trunk/lib/Transforms/IPO/CMakeLists.txt llvm/trunk/lib/Transforms/IPO/IPO.cpp llvm/trunk/tools/opt/opt.cpp Modified: llvm/trunk/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Passes.html?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/docs/Passes.html (original) +++ llvm/trunk/docs/Passes.html Wed Aug 3 17:18:20 2011 @@ -161,7 +161,6 @@ -loop-unswitchUnswitch loops -loweratomicLower atomic intrinsics to non-atomic form -lowerinvokeLower invoke and unwind, for unwindless code generators --lowersetjmpLower Set Jump -lowerswitchLower SwitchInst's to branches -mem2regPromote Memory to Register -memcpyoptMemCpy Optimization @@ -1478,35 +1477,6 @@

      - -lowersetjmp: Lower Set Jump -

      -
      -

      - Lowers setjmp and longjmp to use the LLVM invoke and unwind - instructions as necessary. -

      - -

      - Lowering of longjmp is fairly trivial. We replace the call with a - call to the LLVM library function __llvm_sjljeh_throw_longjmp(). - This unwinds the stack for us calling all of the destructors for - objects allocated on the stack. -

      - -

      - At a setjmp call, the basic block is split and the setjmp - removed. The calls in a function that have a setjmp are converted to - invoke where the except part checks to see if it's a longjmp - exception and, if so, if it's handled in the function. If it is, then it gets - the value returned by the longjmp and goes to where the basic block - was split. invoke instructions are handled in a similar fashion with - the original except block being executed if it isn't a longjmp - except that is handled by that function. -

      -
      - - -

      -lowerswitch: Lower SwitchInst's to branches

      Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Wed Aug 3 17:18:20 2011 @@ -576,14 +576,13 @@
      -

      If you're already an LLVM user or developer with out-of-tree changes based -on LLVM 2.9, this section lists some "gotchas" that you may run into upgrading -from the previous release.

      +

      If you're already an LLVM user or developer with out-of-tree changes based on + LLVM 2.9, this section lists some "gotchas" that you may run into upgrading + from the previous release.

        - +
      • The LowerSetJmp wasn't used effectively by any of the + targets and was removed.
      @@ -667,6 +666,9 @@ isn't used by the current front-ends. So this was removed during the exception handling rewrite. +
    • The LLVMAddLowerSetJmpPass function from the C API was removed + because the LowerSetJmp pass was removed.
    • +
    Modified: llvm/trunk/include/llvm-c/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Transforms/IPO.h?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm-c/Transforms/IPO.h Wed Aug 3 17:18:20 2011 @@ -48,9 +48,6 @@ /** See llvm::createIPConstantPropagationPass function. */ void LLVMAddIPConstantPropagationPass(LLVMPassManagerRef PM); -/** See llvm::createLowerSetJmpPass function. */ -void LLVMAddLowerSetJmpPass(LLVMPassManagerRef PM); - /** See llvm::createPruneEHPass function. */ void LLVMAddPruneEHPass(LLVMPassManagerRef PM); Modified: llvm/trunk/include/llvm/InitializePasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/include/llvm/InitializePasses.h (original) +++ llvm/trunk/include/llvm/InitializePasses.h Wed Aug 3 17:18:20 2011 @@ -143,7 +143,6 @@ void initializeLowerExpectIntrinsicPass(PassRegistry&); void initializeLowerIntrinsicsPass(PassRegistry&); void initializeLowerInvokePass(PassRegistry&); -void initializeLowerSetJmpPass(PassRegistry&); void initializeLowerSwitchPass(PassRegistry&); void initializeMachineBlockFrequencyInfoPass(PassRegistry&); void initializeMachineBranchProbabilityInfoPass(PassRegistry&); Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Wed Aug 3 17:18:20 2011 @@ -93,7 +93,6 @@ (void) llvm::createLoopRotatePass(); (void) llvm::createLowerExpectIntrinsicPass(); (void) llvm::createLowerInvokePass(); - (void) llvm::createLowerSetJmpPass(); (void) llvm::createLowerSwitchPass(); (void) llvm::createNoAAPass(); (void) llvm::createNoProfileInfoPass(); Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Wed Aug 3 17:18:20 2011 @@ -50,13 +50,6 @@ ModulePass *createStripDeadDebugInfoPass(); //===----------------------------------------------------------------------===// -/// 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. -/// -ModulePass *createLowerSetJmpPass(); - -//===----------------------------------------------------------------------===// /// createConstantMergePass - This function returns a new pass that merges /// duplicate global constants together into a single constant that is shared. /// This is useful because some passes (ie TraceValues) insert a lot of string Modified: llvm/trunk/lib/Transforms/IPO/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CMakeLists.txt?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Wed Aug 3 17:18:20 2011 @@ -13,7 +13,6 @@ Inliner.cpp Internalize.cpp LoopExtractor.cpp - LowerSetJmp.cpp MergeFunctions.cpp PartialInlining.cpp PassManagerBuilder.cpp Modified: llvm/trunk/lib/Transforms/IPO/IPO.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPO.cpp?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPO.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPO.cpp Wed Aug 3 17:18:20 2011 @@ -35,7 +35,6 @@ initializeLoopExtractorPass(Registry); initializeBlockExtractorPassPass(Registry); initializeSingleLoopExtractorPass(Registry); - initializeLowerSetJmpPass(Registry); initializeMergeFunctionsPass(Registry); initializePartialInlinerPass(Registry); initializePruneEHPass(Registry); @@ -86,10 +85,6 @@ unwrap(PM)->add(createIPConstantPropagationPass()); } -void LLVMAddLowerSetJmpPass(LLVMPassManagerRef PM) { - unwrap(PM)->add(createLowerSetJmpPass()); -} - void LLVMAddPruneEHPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createPruneEHPass()); } Removed: llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp?rev=136820&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp (removed) @@ -1,547 +0,0 @@ -//===- LowerSetJmp.cpp - Code pertaining to lowering set/long jumps -------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the lowering of setjmp and longjmp to use the -// LLVM invoke and unwind instructions as necessary. -// -// Lowering of longjmp is fairly trivial. We replace the call with a -// call to the LLVM library function "__llvm_sjljeh_throw_longjmp()". -// This unwinds the stack for us calling all of the destructors for -// objects allocated on the stack. -// -// At a setjmp call, the basic block is split and the setjmp removed. -// The calls in a function that have a setjmp are converted to invoke -// where the except part checks to see if it's a longjmp exception and, -// if so, if it's handled in the function. If it is, then it gets the -// value returned by the longjmp and goes to where the basic block was -// split. Invoke instructions are handled in a similar fashion with the -// original except block being executed if it isn't a longjmp except -// that is handled by that function. -// -//===----------------------------------------------------------------------===// - -//===----------------------------------------------------------------------===// -// FIXME: This pass doesn't deal with PHI statements just yet. That is, -// we expect this to occur before SSAification is done. This would seem -// to make sense, but in general, it might be a good idea to make this -// pass invokable via the "opt" command at will. -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "lowersetjmp" -#include "llvm/Transforms/IPO.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" -#include "llvm/LLVMContext.h" -#include "llvm/Module.h" -#include "llvm/Pass.h" -#include "llvm/Support/CallSite.h" -#include "llvm/Support/CFG.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/Transforms/Utils/Local.h" -#include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/ADT/Statistic.h" -#include -using namespace llvm; - -STATISTIC(LongJmpsTransformed, "Number of longjmps transformed"); -STATISTIC(SetJmpsTransformed , "Number of setjmps transformed"); -STATISTIC(CallsTransformed , "Number of calls invokified"); -STATISTIC(InvokesTransformed , "Number of invokes modified"); - -namespace { - //===--------------------------------------------------------------------===// - // LowerSetJmp pass implementation. - class LowerSetJmp : public ModulePass, public InstVisitor { - // LLVM library functions... - Constant *InitSJMap; // __llvm_sjljeh_init_setjmpmap - Constant *DestroySJMap; // __llvm_sjljeh_destroy_setjmpmap - Constant *AddSJToMap; // __llvm_sjljeh_add_setjmp_to_map - Constant *ThrowLongJmp; // __llvm_sjljeh_throw_longjmp - Constant *TryCatchLJ; // __llvm_sjljeh_try_catching_longjmp_exception - Constant *IsLJException; // __llvm_sjljeh_is_longjmp_exception - Constant *GetLJValue; // __llvm_sjljeh_get_longjmp_value - - typedef std::pair SwitchValuePair; - - // Keep track of those basic blocks reachable via a depth-first search of - // the CFG from a setjmp call. We only need to transform those "call" and - // "invoke" instructions that are reachable from the setjmp call site. - std::set DFSBlocks; - - // The setjmp map is going to hold information about which setjmps - // were called (each setjmp gets its own number) and with which - // buffer it was called. - std::map SJMap; - - // The rethrow basic block map holds the basic block to branch to if - // the exception isn't handled in the current function and needs to - // be rethrown. - std::map RethrowBBMap; - - // The preliminary basic block map holds a basic block that grabs the - // exception and determines if it's handled by the current function. - std::map PrelimBBMap; - - // The switch/value map holds a switch inst/call inst pair. The - // switch inst controls which handler (if any) gets called and the - // value is the value returned to that handler by the call to - // __llvm_sjljeh_get_longjmp_value. - std::map SwitchValMap; - - // A map of which setjmps we've seen so far in a function. - std::map SetJmpIDMap; - - AllocaInst* GetSetJmpMap(Function* Func); - BasicBlock* GetRethrowBB(Function* Func); - SwitchValuePair GetSJSwitch(Function* Func, BasicBlock* Rethrow); - - void TransformLongJmpCall(CallInst* Inst); - void TransformSetJmpCall(CallInst* Inst); - - bool IsTransformableFunction(StringRef Name); - public: - static char ID; // Pass identification, replacement for typeid - LowerSetJmp() : ModulePass(ID) { - initializeLowerSetJmpPass(*PassRegistry::getPassRegistry()); - } - - void visitCallInst(CallInst& CI); - void visitInvokeInst(InvokeInst& II); - void visitReturnInst(ReturnInst& RI); - void visitUnwindInst(UnwindInst& UI); - - bool runOnModule(Module& M); - bool doInitialization(Module& M); - }; -} // end anonymous namespace - -char LowerSetJmp::ID = 0; -INITIALIZE_PASS(LowerSetJmp, "lowersetjmp", "Lower Set Jump", false, false) - -// run - Run the transformation on the program. We grab the function -// prototypes for longjmp and setjmp. If they are used in the program, -// then we can go directly to the places they're at and transform them. -bool LowerSetJmp::runOnModule(Module& M) { - bool Changed = false; - - // These are what the functions are called. - Function* SetJmp = M.getFunction("llvm.setjmp"); - Function* LongJmp = M.getFunction("llvm.longjmp"); - - // This program doesn't have longjmp and setjmp calls. - if ((!LongJmp || LongJmp->use_empty()) && - (!SetJmp || SetJmp->use_empty())) return false; - - // Initialize some values and functions we'll need to transform the - // setjmp/longjmp functions. - doInitialization(M); - - if (SetJmp) { - for (Value::use_iterator B = SetJmp->use_begin(), E = SetJmp->use_end(); - B != E; ++B) { - BasicBlock* BB = cast(*B)->getParent(); - for (df_ext_iterator I = df_ext_begin(BB, DFSBlocks), - E = df_ext_end(BB, DFSBlocks); I != E; ++I) - /* empty */; - } - - while (!SetJmp->use_empty()) { - assert(isa(SetJmp->use_back()) && - "User of setjmp intrinsic not a call?"); - TransformSetJmpCall(cast(SetJmp->use_back())); - Changed = true; - } - } - - if (LongJmp) - while (!LongJmp->use_empty()) { - assert(isa(LongJmp->use_back()) && - "User of longjmp intrinsic not a call?"); - TransformLongJmpCall(cast(LongJmp->use_back())); - Changed = true; - } - - // Now go through the affected functions and convert calls and invokes - // to new invokes... - for (std::map::iterator - B = SJMap.begin(), E = SJMap.end(); B != E; ++B) { - Function* F = B->first; - for (Function::iterator BB = F->begin(), BE = F->end(); BB != BE; ++BB) - for (BasicBlock::iterator IB = BB->begin(), IE = BB->end(); IB != IE; ) { - visit(*IB++); - if (IB != BB->end() && IB->getParent() != BB) - break; // The next instruction got moved to a different block! - } - } - - DFSBlocks.clear(); - SJMap.clear(); - RethrowBBMap.clear(); - PrelimBBMap.clear(); - SwitchValMap.clear(); - SetJmpIDMap.clear(); - - return Changed; -} - -// doInitialization - For the lower long/setjmp pass, this ensures that a -// module contains a declaration for the intrisic functions we are going -// to call to convert longjmp and setjmp calls. -// -// This function is always successful, unless it isn't. -bool LowerSetJmp::doInitialization(Module& M) -{ - Type *SBPTy = Type::getInt8PtrTy(M.getContext()); - Type *SBPPTy = PointerType::getUnqual(SBPTy); - - // N.B. See llvm/runtime/GCCLibraries/libexception/SJLJ-Exception.h for - // a description of the following library functions. - - // void __llvm_sjljeh_init_setjmpmap(void**) - InitSJMap = M.getOrInsertFunction("__llvm_sjljeh_init_setjmpmap", - Type::getVoidTy(M.getContext()), - SBPPTy, (Type *)0); - // void __llvm_sjljeh_destroy_setjmpmap(void**) - DestroySJMap = M.getOrInsertFunction("__llvm_sjljeh_destroy_setjmpmap", - Type::getVoidTy(M.getContext()), - SBPPTy, (Type *)0); - - // void __llvm_sjljeh_add_setjmp_to_map(void**, void*, unsigned) - AddSJToMap = M.getOrInsertFunction("__llvm_sjljeh_add_setjmp_to_map", - Type::getVoidTy(M.getContext()), - SBPPTy, SBPTy, - Type::getInt32Ty(M.getContext()), - (Type *)0); - - // void __llvm_sjljeh_throw_longjmp(int*, int) - ThrowLongJmp = M.getOrInsertFunction("__llvm_sjljeh_throw_longjmp", - Type::getVoidTy(M.getContext()), SBPTy, - Type::getInt32Ty(M.getContext()), - (Type *)0); - - // unsigned __llvm_sjljeh_try_catching_longjmp_exception(void **) - TryCatchLJ = - M.getOrInsertFunction("__llvm_sjljeh_try_catching_longjmp_exception", - Type::getInt32Ty(M.getContext()), SBPPTy, (Type *)0); - - // bool __llvm_sjljeh_is_longjmp_exception() - IsLJException = M.getOrInsertFunction("__llvm_sjljeh_is_longjmp_exception", - Type::getInt1Ty(M.getContext()), - (Type *)0); - - // int __llvm_sjljeh_get_longjmp_value() - GetLJValue = M.getOrInsertFunction("__llvm_sjljeh_get_longjmp_value", - Type::getInt32Ty(M.getContext()), - (Type *)0); - return true; -} - -// IsTransformableFunction - Return true if the function name isn't one -// of the ones we don't want transformed. Currently, don't transform any -// "llvm.{setjmp,longjmp}" functions and none of the setjmp/longjmp error -// handling functions (beginning with __llvm_sjljeh_...they don't throw -// exceptions). -bool LowerSetJmp::IsTransformableFunction(StringRef Name) { - return !Name.startswith("__llvm_sjljeh_"); -} - -// TransformLongJmpCall - Transform a longjmp call into a call to the -// internal __llvm_sjljeh_throw_longjmp function. It then takes care of -// throwing the exception for us. -void LowerSetJmp::TransformLongJmpCall(CallInst* Inst) -{ - Type* SBPTy = Type::getInt8PtrTy(Inst->getContext()); - - // Create the call to "__llvm_sjljeh_throw_longjmp". This takes the - // same parameters as "longjmp", except that the buffer is cast to a - // char*. It returns "void", so it doesn't need to replace any of - // Inst's uses and doesn't get a name. - CastInst* CI = - new BitCastInst(Inst->getArgOperand(0), SBPTy, "LJBuf", Inst); - Value *Args[] = { CI, Inst->getArgOperand(1) }; - CallInst::Create(ThrowLongJmp, Args, "", Inst); - - SwitchValuePair& SVP = SwitchValMap[Inst->getParent()->getParent()]; - - // If the function has a setjmp call in it (they are transformed first) - // we should branch to the basic block that determines if this longjmp - // is applicable here. Otherwise, issue an unwind. - if (SVP.first) - BranchInst::Create(SVP.first->getParent(), Inst); - else - new UnwindInst(Inst->getContext(), Inst); - - // Remove all insts after the branch/unwind inst. Go from back to front to - // avoid replaceAllUsesWith if possible. - BasicBlock *BB = Inst->getParent(); - Instruction *Removed; - do { - Removed = &BB->back(); - // If the removed instructions have any users, replace them now. - if (!Removed->use_empty()) - Removed->replaceAllUsesWith(UndefValue::get(Removed->getType())); - Removed->eraseFromParent(); - } while (Removed != Inst); - - ++LongJmpsTransformed; -} - -// GetSetJmpMap - Retrieve (create and initialize, if necessary) the -// setjmp map. This map is going to hold information about which setjmps -// were called (each setjmp gets its own number) and with which buffer it -// was called. There can be only one! -AllocaInst* LowerSetJmp::GetSetJmpMap(Function* Func) -{ - if (SJMap[Func]) return SJMap[Func]; - - // Insert the setjmp map initialization before the first instruction in - // the function. - Instruction* Inst = Func->getEntryBlock().begin(); - assert(Inst && "Couldn't find even ONE instruction in entry block!"); - - // Fill in the alloca and call to initialize the SJ map. - Type *SBPTy = - Type::getInt8PtrTy(Func->getContext()); - AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst); - CallInst::Create(InitSJMap, Map, "", Inst); - return SJMap[Func] = Map; -} - -// GetRethrowBB - Only one rethrow basic block is needed per function. -// If this is a longjmp exception but not handled in this block, this BB -// performs the rethrow. -BasicBlock* LowerSetJmp::GetRethrowBB(Function* Func) -{ - if (RethrowBBMap[Func]) return RethrowBBMap[Func]; - - // The basic block we're going to jump to if we need to rethrow the - // exception. - BasicBlock* Rethrow = - BasicBlock::Create(Func->getContext(), "RethrowExcept", Func); - - // Fill in the "Rethrow" BB with a call to rethrow the exception. This - // is the last instruction in the BB since at this point the runtime - // should exit this function and go to the next function. - new UnwindInst(Func->getContext(), Rethrow); - return RethrowBBMap[Func] = Rethrow; -} - -// GetSJSwitch - Return the switch statement that controls which handler -// (if any) gets called and the value returned to that handler. -LowerSetJmp::SwitchValuePair LowerSetJmp::GetSJSwitch(Function* Func, - BasicBlock* Rethrow) -{ - if (SwitchValMap[Func].first) return SwitchValMap[Func]; - - BasicBlock* LongJmpPre = - BasicBlock::Create(Func->getContext(), "LongJmpBlkPre", Func); - - // Keep track of the preliminary basic block for some of the other - // transformations. - PrelimBBMap[Func] = LongJmpPre; - - // Grab the exception. - CallInst* Cond = CallInst::Create(IsLJException, "IsLJExcept", LongJmpPre); - - // The "decision basic block" gets the number associated with the - // setjmp call returning to switch on and the value returned by - // longjmp. - BasicBlock* DecisionBB = - BasicBlock::Create(Func->getContext(), "LJDecisionBB", Func); - - BranchInst::Create(DecisionBB, Rethrow, Cond, LongJmpPre); - - // Fill in the "decision" basic block. - CallInst* LJVal = CallInst::Create(GetLJValue, "LJVal", DecisionBB); - CallInst* SJNum = CallInst::Create(TryCatchLJ, GetSetJmpMap(Func), "SJNum", - DecisionBB); - - SwitchInst* SI = SwitchInst::Create(SJNum, Rethrow, 0, DecisionBB); - return SwitchValMap[Func] = SwitchValuePair(SI, LJVal); -} - -// TransformSetJmpCall - The setjmp call is a bit trickier to transform. -// We're going to convert all setjmp calls to nops. Then all "call" and -// "invoke" instructions in the function are converted to "invoke" where -// the "except" branch is used when returning from a longjmp call. -void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) -{ - BasicBlock* ABlock = Inst->getParent(); - Function* Func = ABlock->getParent(); - - // Add this setjmp to the setjmp map. - Type* SBPTy = - Type::getInt8PtrTy(Inst->getContext()); - CastInst* BufPtr = - new BitCastInst(Inst->getArgOperand(0), SBPTy, "SBJmpBuf", Inst); - Value *Args[] = { - GetSetJmpMap(Func), BufPtr, - ConstantInt::get(Type::getInt32Ty(Inst->getContext()), SetJmpIDMap[Func]++) - }; - CallInst::Create(AddSJToMap, Args, "", Inst); - - // We are guaranteed that there are no values live across basic blocks - // (because we are "not in SSA form" yet), but there can still be values live - // in basic blocks. Because of this, splitting the setjmp block can cause - // values above the setjmp to not dominate uses which are after the setjmp - // call. For all of these occasions, we must spill the value to the stack. - // - std::set InstrsAfterCall; - - // The call is probably very close to the end of the basic block, for the - // common usage pattern of: 'if (setjmp(...))', so keep track of the - // instructions after the call. - for (BasicBlock::iterator I = ++BasicBlock::iterator(Inst), E = ABlock->end(); - I != E; ++I) - InstrsAfterCall.insert(I); - - for (BasicBlock::iterator II = ABlock->begin(); - II != BasicBlock::iterator(Inst); ++II) - // Loop over all of the uses of instruction. If any of them are after the - // call, "spill" the value to the stack. - for (Value::use_iterator UI = II->use_begin(), E = II->use_end(); - UI != E; ++UI) { - User *U = *UI; - if (cast(U)->getParent() != ABlock || - InstrsAfterCall.count(cast(U))) { - DemoteRegToStack(*II); - break; - } - } - InstrsAfterCall.clear(); - - // Change the setjmp call into a branch statement. We'll remove the - // setjmp call in a little bit. No worries. - BasicBlock* SetJmpContBlock = ABlock->splitBasicBlock(Inst); - assert(SetJmpContBlock && "Couldn't split setjmp BB!!"); - - SetJmpContBlock->setName(ABlock->getName()+"SetJmpCont"); - - // Add the SetJmpContBlock to the set of blocks reachable from a setjmp. - DFSBlocks.insert(SetJmpContBlock); - - // This PHI node will be in the new block created from the - // splitBasicBlock call. - PHINode* PHI = PHINode::Create(Type::getInt32Ty(Inst->getContext()), 2, - "SetJmpReturn", Inst); - - // Coming from a call to setjmp, the return is 0. - PHI->addIncoming(Constant::getNullValue(Type::getInt32Ty(Inst->getContext())), - ABlock); - - // Add the case for this setjmp's number... - SwitchValuePair SVP = GetSJSwitch(Func, GetRethrowBB(Func)); - SVP.first->addCase(ConstantInt::get(Type::getInt32Ty(Inst->getContext()), - SetJmpIDMap[Func] - 1), - SetJmpContBlock); - - // Value coming from the handling of the exception. - PHI->addIncoming(SVP.second, SVP.second->getParent()); - - // Replace all uses of this instruction with the PHI node created by - // the eradication of setjmp. - Inst->replaceAllUsesWith(PHI); - Inst->eraseFromParent(); - - ++SetJmpsTransformed; -} - -// visitCallInst - This converts all LLVM call instructions into invoke -// instructions. The except part of the invoke goes to the "LongJmpBlkPre" -// that grabs the exception and proceeds to determine if it's a longjmp -// exception or not. -void LowerSetJmp::visitCallInst(CallInst& CI) -{ - if (CI.getCalledFunction()) - if (!IsTransformableFunction(CI.getCalledFunction()->getName()) || - CI.getCalledFunction()->isIntrinsic()) return; - - BasicBlock* OldBB = CI.getParent(); - - // If not reachable from a setjmp call, don't transform. - if (!DFSBlocks.count(OldBB)) return; - - BasicBlock* NewBB = OldBB->splitBasicBlock(CI); - assert(NewBB && "Couldn't split BB of \"call\" instruction!!"); - DFSBlocks.insert(NewBB); - NewBB->setName("Call2Invoke"); - - Function* Func = OldBB->getParent(); - - // Construct the new "invoke" instruction. - TerminatorInst* Term = OldBB->getTerminator(); - CallSite CS(&CI); - std::vector Params(CS.arg_begin(), CS.arg_end()); - InvokeInst* II = - InvokeInst::Create(CI.getCalledValue(), NewBB, PrelimBBMap[Func], - Params, CI.getName(), Term); - II->setCallingConv(CI.getCallingConv()); - II->setAttributes(CI.getAttributes()); - - // Replace the old call inst with the invoke inst and remove the call. - CI.replaceAllUsesWith(II); - CI.eraseFromParent(); - - // The old terminator is useless now that we have the invoke inst. - Term->eraseFromParent(); - ++CallsTransformed; -} - -// visitInvokeInst - Converting the "invoke" instruction is fairly -// straight-forward. The old exception part is replaced by a query asking -// if this is a longjmp exception. If it is, then it goes to the longjmp -// exception blocks. Otherwise, control is passed the old exception. -void LowerSetJmp::visitInvokeInst(InvokeInst& II) -{ - if (II.getCalledFunction()) - if (!IsTransformableFunction(II.getCalledFunction()->getName()) || - II.getCalledFunction()->isIntrinsic()) return; - - BasicBlock* BB = II.getParent(); - - // If not reachable from a setjmp call, don't transform. - if (!DFSBlocks.count(BB)) return; - - BasicBlock* ExceptBB = II.getUnwindDest(); - - Function* Func = BB->getParent(); - BasicBlock* NewExceptBB = BasicBlock::Create(II.getContext(), - "InvokeExcept", Func); - - // If this is a longjmp exception, then branch to the preliminary BB of - // the longjmp exception handling. Otherwise, go to the old exception. - CallInst* IsLJExcept = CallInst::Create(IsLJException, "IsLJExcept", - NewExceptBB); - - BranchInst::Create(PrelimBBMap[Func], ExceptBB, IsLJExcept, NewExceptBB); - - II.setUnwindDest(NewExceptBB); - ++InvokesTransformed; -} - -// visitReturnInst - We want to destroy the setjmp map upon exit from the -// function. -void LowerSetJmp::visitReturnInst(ReturnInst &RI) { - Function* Func = RI.getParent()->getParent(); - CallInst::Create(DestroySJMap, GetSetJmpMap(Func), "", &RI); -} - -// visitUnwindInst - We want to destroy the setjmp map upon exit from the -// function. -void LowerSetJmp::visitUnwindInst(UnwindInst &UI) { - Function* Func = UI.getParent()->getParent(); - CallInst::Create(DestroySJMap, GetSetJmpMap(Func), "", &UI); -} - -ModulePass *llvm::createLowerSetJmpPass() { - return new LowerSetJmp(); -} - Modified: llvm/trunk/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=136821&r1=136820&r2=136821&view=diff ============================================================================== --- llvm/trunk/tools/opt/opt.cpp (original) +++ llvm/trunk/tools/opt/opt.cpp Wed Aug 3 17:18:20 2011 @@ -431,8 +431,6 @@ static void AddStandardCompilePasses(PassManagerBase &PM) { PM.add(createVerifierPass()); // Verify that input is correct - addPass(PM, createLowerSetJmpPass()); // Lower llvm.setjmp/.longjmp - // If the -strip-debug command line option was specified, do it. if (StripDebug) addPass(PM, createStripSymbolsPass(true)); From bob.wilson at apple.com Wed Aug 3 17:23:43 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 03 Aug 2011 22:23:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r136822 - /llvm-gcc-4.2/trunk/gcc/Makefile.in Message-ID: <20110803222343.E20002A6C12C@llvm.org> Author: bwilson Date: Wed Aug 3 17:23:43 2011 New Revision: 136822 URL: http://llvm.org/viewvc/llvm-project?rev=136822&view=rev Log: Fix the Apple llvm-gcc build by adding an explicit reference to the PassManagerBuilder destructor to force it into libllvmgcc.dylib. That file was recently moved to libLLVMipo.a, which isn't pulled into the dylib otherwise. This is pretty gross, but we don't care much about llvm-gcc anymore. Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=136822&r1=136821&r2=136822&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Wed Aug 3 17:23:43 2011 @@ -1191,7 +1191,7 @@ _LLVMInitializeARMTargetMC \ _LLVMInitializeX86Target _LLVMInitializeX86AsmPrinter \ _LLVMInitializeX86TargetMC \ - + __ZN4llvm18PassManagerBuilderD1Ev endif # We use llvm-config to determine the libraries that we need to link in our From eli.friedman at gmail.com Wed Aug 3 17:24:45 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 3 Aug 2011 15:24:45 -0700 Subject: [llvm-commits] [www] r136820 - /www/trunk/demo/index.cgi In-Reply-To: <20110803221757.C79552A6C12C@llvm.org> References: <20110803221757.C79552A6C12C@llvm.org> Message-ID: On Wed, Aug 3, 2011 at 3:17 PM, Tanya Lattner wrote: > Author: tbrethou > Date: Wed Aug ?3 17:17:57 2011 > New Revision: 136820 > > URL: http://llvm.org/viewvc/llvm-project?rev=136820&view=rev > Log: > Move demo page over to use clang only. > Add dragon logo. > Updated clang to 2.9. > > Modified: > ? ?www/trunk/demo/index.cgi > > Modified: www/trunk/demo/index.cgi > URL: http://llvm.org/viewvc/llvm-project/www/trunk/demo/index.cgi?rev=136820&r1=136819&r2=136820&view=diff > ============================================================================== > --- www/trunk/demo/index.cgi (original) > +++ www/trunk/demo/index.cgi Wed Aug ?3 17:17:57 2011 > @@ -19,13 +19,11 @@ > ?my $FORM_URL ? ? ? ?= 'index.cgi'; > ?my $MAILADDR ? ? ? ?= 'sabre at nondot.org'; > ?my $CONTACT_ADDRESS = 'Questions or comments? ?Email the LLVMdev mailing list.'; > -my $LOGO_IMAGE_URL ?= 'cathead.png'; > +my $LOGO_IMAGE_URL ?= '../img/DragonSmall.png'; > ?my $TIMEOUTAMOUNT ? = 20; > > ?my @PREPENDPATHDIRS = > - ?( > - ? ?'/opt/llvm-gcc-releases/llvm-gcc/bin', > - ? ?'/opt/clang-releases/llvm/bin'); > + ? ?('/opt/clang-releases/llvm/bin'); > > ?my $defaultsrc = "#include \n#include \n\n" . > ? ? ? ? ? ? ? ? ?"int factorial(int X) {\n ?if (X == 0) return 1;\n" . > @@ -127,7 +125,7 @@ > ? > > ?
    > - ?Try out LLVM 2.7 in your browser! > + ?Try out LLVM 2.9 in your browser! > ?
    > > ?
    > @@ -141,7 +139,7 @@ > ? my $currtime = time(); > ? if ($locktime + 60 > $currtime) { > ? ? print "This page is already in use by someone else at this "; > - ? ?print "time, try reloading in a second or two. ?Meow!
    '\n"; > + ? ?print "time, try reloading in a second or two.'\n"; > ? ? exit 0; > ? } > ?} > @@ -149,7 +147,7 @@ > ?system("touch $ROOT/locked"); > > ?print < -Bitter Melon the cat says, paste a C/C++/Fortran program in the text box or > +Paste a C/C++ program in the text box or > ?upload one from your computer, and you can see LLVM compile it, meow!! Should a dragon really meow? :) Also, it appears that the default source code produces a warning: Output from llvm C/C++ front-end (clang) /tmp/webcompile/_4493_0.c:9:14: warning: unused parameter 'argc' [-Wunused-parameter] int main(int argc, char **argv) { ^ 1 diagnostic generated. -Eli From tonic at nondot.org Wed Aug 3 17:26:33 2011 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 03 Aug 2011 22:26:33 -0000 Subject: [llvm-commits] [www] r136824 - /www/trunk/demo/index.cgi Message-ID: <20110803222633.285442A6C12C@llvm.org> Author: tbrethou Date: Wed Aug 3 17:26:32 2011 New Revision: 136824 URL: http://llvm.org/viewvc/llvm-project?rev=136824&view=rev Log: No more cat sounds. Modified: www/trunk/demo/index.cgi Modified: www/trunk/demo/index.cgi URL: http://llvm.org/viewvc/llvm-project/www/trunk/demo/index.cgi?rev=136824&r1=136823&r2=136824&view=diff ============================================================================== --- www/trunk/demo/index.cgi (original) +++ www/trunk/demo/index.cgi Wed Aug 3 17:26:32 2011 @@ -148,7 +148,7 @@ print <

    END From tonic at nondot.org Wed Aug 3 17:27:49 2011 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 03 Aug 2011 22:27:49 -0000 Subject: [llvm-commits] [www] r136825 - /www/trunk/demo/index.cgi Message-ID: <20110803222749.A83152A6C12C@llvm.org> Author: tbrethou Date: Wed Aug 3 17:27:49 2011 New Revision: 136825 URL: http://llvm.org/viewvc/llvm-project?rev=136825&view=rev Log: Add Clang so people know we are using Clang. Modified: www/trunk/demo/index.cgi Modified: www/trunk/demo/index.cgi URL: http://llvm.org/viewvc/llvm-project/www/trunk/demo/index.cgi?rev=136825&r1=136824&r2=136825&view=diff ============================================================================== --- www/trunk/demo/index.cgi (original) +++ www/trunk/demo/index.cgi Wed Aug 3 17:27:49 2011 @@ -103,7 +103,7 @@ sub mailto { my ( $recipient, $body ) = @_; my $msg = - new Mail::Send( Subject => "LLVM Demo Page Run", To => $recipient ); + new Mail::Send( Subject => "LLVM/Clang Demo Page Run", To => $recipient ); my $fh = $msg->open(); print $fh $body; $fh->close(); @@ -116,7 +116,7 @@ - Try out LLVM in your browser! + Try out LLVM and Clang in your browser!