From geek4civic at gmail.com Mon Feb 21 00:04:23 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Mon, 21 Feb 2011 15:04:23 +0900 Subject: [llvm-commits] [Review Request] lib/Target/X86/X86FastISel.cpp: [PR6275] Fix for Win32's dllimport function. In-Reply-To: <8A78731B-4C5F-4308-BB04-B4146C54EC0B@apple.com> References: <8A78731B-4C5F-4308-BB04-B4146C54EC0B@apple.com> Message-ID: Applied in r126110 with updated testcase, thank you! From greened at obbligato.org Mon Feb 21 09:23:22 2011 From: greened at obbligato.org (David A. Greene) Date: Mon, 21 Feb 2011 09:23:22 -0600 Subject: [llvm-commits] [llvm] r125105 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: (Chris Lattner's message of "Thu, 17 Feb 2011 15:52:25 -0800") References: <20110208190442.036ED2A6C12C@llvm.org> <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> Message-ID: <8739nhmmxh.fsf@smith.obbligato.org> Chris Lattner writes: > On Feb 17, 2011, at 3:34 PM, David A. Greene wrote: >> For debugging purposes. Should I add this as a target option instead? > > What is the use case? Is this a temporary hack that will be removed later or something you intend to keep around forever? The use case is when trying to isolate misuse of 256-bit registers. A typical situation involves shuffles as the code to generate a 256-bit shuffle is more complex than the code for a 128-bit shuffle. In codes with many shuffles, a switch like this makes it easier to identify the offending shuffle. I'm fine taking it out for now. -Dave From baldrick at free.fr Mon Feb 21 10:27:37 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Feb 2011 16:27:37 -0000 Subject: [llvm-commits] [llvm] r126124 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp unittests/Transforms/Utils/Local.cpp Message-ID: <20110221162737.25AFB2A6C12C@llvm.org> Author: baldrick Date: Mon Feb 21 10:27:36 2011 New Revision: 126124 URL: http://llvm.org/viewvc/llvm-project?rev=126124&view=rev Log: Simplify RecursivelyDeleteDeadPHINode. The only functionality change should be that if the phi is used by a side-effect free instruction with no uses then the phi and the instruction now get zapped (checked by the unittest). Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp llvm/trunk/unittests/Transforms/Utils/Local.cpp Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=126124&r1=126123&r2=126124&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/Local.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/Local.cpp Mon Feb 21 10:27:36 2011 @@ -262,12 +262,13 @@ /// areAllUsesEqual - Check whether the uses of a value are all the same. /// This is similar to Instruction::hasOneUse() except this will also return -/// true when there are multiple uses that all refer to the same value. +/// true when there are no uses or multiple uses that all refer to the same +/// value. static bool areAllUsesEqual(Instruction *I) { Value::use_iterator UI = I->use_begin(); Value::use_iterator UE = I->use_end(); if (UI == UE) - return false; + return true; User *TheUse = *UI; for (++UI; UI != UE; ++UI) { @@ -283,34 +284,21 @@ /// delete it. If that makes any of its operands trivially dead, delete them /// too, recursively. Return true if the PHI node is actually deleted. bool llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) { - if (PN->use_empty()) { - PN->eraseFromParent(); - return true; - } - - // We can remove a PHI if it is on a cycle in the def-use graph - // where each node in the cycle has degree one, i.e. only one use, - // and is an instruction with no side effects. - if (!areAllUsesEqual(PN)) - return false; + SmallPtrSet Visited; + for (Instruction *I = PN; areAllUsesEqual(I) && !I->mayHaveSideEffects(); + I = cast(*I->use_begin())) { + if (I->use_empty()) + return RecursivelyDeleteTriviallyDeadInstructions(I); - bool Changed = false; - SmallPtrSet PHIs; - PHIs.insert(PN); - for (Instruction *I = cast(*PN->use_begin()); - areAllUsesEqual(I) && !I->mayHaveSideEffects(); - I = cast(*I->use_begin())) - // If we find a PHI more than once, we're on a cycle that + // If we find an instruction more than once, we're on a cycle that // won't prove fruitful. - if (PHINode *IP = dyn_cast(I)) - if (!PHIs.insert(IP)) { - // Break the cycle and delete the PHI and its operands. - IP->replaceAllUsesWith(UndefValue::get(IP->getType())); - (void)RecursivelyDeleteTriviallyDeadInstructions(IP); - Changed = true; - break; - } - return Changed; + if (!Visited.insert(I)) { + // Break the cycle and delete the instruction and its operands. + I->replaceAllUsesWith(UndefValue::get(I->getType())); + return RecursivelyDeleteTriviallyDeadInstructions(I); + } + } + return false; } /// SimplifyInstructionsInBlock - Scan the specified basic block and try to Modified: llvm/trunk/unittests/Transforms/Utils/Local.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Utils/Local.cpp?rev=126124&r1=126123&r2=126124&view=diff ============================================================================== --- llvm/trunk/unittests/Transforms/Utils/Local.cpp (original) +++ llvm/trunk/unittests/Transforms/Utils/Local.cpp Mon Feb 21 10:27:36 2011 @@ -47,6 +47,12 @@ EXPECT_TRUE(RecursivelyDeleteDeadPHINode(phi)); + builder.SetInsertPoint(bb0); + phi = builder.CreatePHI(Type::getInt32Ty(C)); + builder.CreateAdd(phi, phi); + + EXPECT_TRUE(RecursivelyDeleteDeadPHINode(phi)); + bb0->dropAllReferences(); bb1->dropAllReferences(); delete bb0; From gohman at apple.com Mon Feb 21 10:36:35 2011 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Feb 2011 08:36:35 -0800 Subject: [llvm-commits] [llvm] r126077 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp test/Transforms/LoopStrengthReduce/pr2570.ll unittests/Transforms/Utils/Local.cpp In-Reply-To: <4D60DA14.8040306@free.fr> References: <20110220083820.8ECB02A6C12D@llvm.org> <4D60DA14.8040306@free.fr> Message-ID: <17EFBB52-1FC5-480C-ADB9-1AA14E36A14B@apple.com> On Feb 20, 2011, at 1:08 AM, Duncan Sands wrote: > Hi Nick, > >> -bool >> -llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) { >> +bool llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) { >> // We can remove a PHI if it is on a cycle in the def-use graph >> // where each node in the cycle has degree one, i.e. only one use, >> // and is an instruction with no side effects. >> - if (!PN->hasOneUse()) >> + if (!areAllUsesEqual(PN)) >> return false; > > I know that it is not the fault of this patch, but it looks like > RecursivelyDeleteDeadPHINode will not delete phi nodes that have no uses. > Isn't that silly? Not really. Instcombine does a fine job deleting instructions with no uses already, and the two users of this function, indvars and lsr, don't create trivially dead phis. Dan From sabre at nondot.org Mon Feb 21 11:02:55 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Feb 2011 17:02:55 -0000 Subject: [llvm-commits] [llvm] r126125 - /llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Message-ID: <20110221170255.740922A6C12C@llvm.org> Author: lattner Date: Mon Feb 21 11:02:55 2011 New Revision: 126125 URL: http://llvm.org/viewvc/llvm-project?rev=126125&view=rev Log: fix a crasher in disabled code (on variable stride loops) Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=126125&r1=126124&r2=126125&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Mon Feb 21 11:02:55 2011 @@ -281,7 +281,7 @@ // TODO: Could also handle negative stride here someday, that will require // the validity check in mayLoopAccessLocation to be updated though. // Enable this to print exact negative strides. - if (0 && StoreSize == -Stride->getValue()->getValue()) { + if (0 && Stride && StoreSize == -Stride->getValue()->getValue()) { dbgs() << "NEGATIVE STRIDE: " << *SI << "\n"; dbgs() << "BB: " << *SI->getParent(); } From sabre at nondot.org Mon Feb 21 11:03:47 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Feb 2011 17:03:47 -0000 Subject: [llvm-commits] [llvm] r126126 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <20110221170347.4D9CA2A6C12C@llvm.org> Author: lattner Date: Mon Feb 21 11:03:47 2011 New Revision: 126126 URL: http://llvm.org/viewvc/llvm-project?rev=126126&view=rev Log: a serious "compare CSE" issue that is nontrivial to get right, but which is responsible for us doing really bad things to 256.bzip2. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=126126&r1=126125&r2=126126&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Feb 21 11:03:47 2011 @@ -1878,3 +1878,72 @@ ret //===---------------------------------------------------------------------===// + +The hot loop of 256.bzip2 contains code that looks a bit like this: + +int foo(char *P, char *Q, int x, int y) { + if (P[0] != Q[0]) + return P[0] < Q[0]; + if (P[1] != Q[1]) + return P[1] < Q[1]; + if (P[2] != Q[2]) + return P[2] < Q[2]; + return P[3] < Q[3]; +} + +In the real code, we get a lot more wrong than this. However, even in this +code we generate: + +_foo: ## @foo +## BB#0: ## %entry + movb (%rsi), %al + movb (%rdi), %cl + cmpb %al, %cl + je LBB0_2 +LBB0_1: ## %if.then + cmpb %al, %cl + jmp LBB0_5 +LBB0_2: ## %if.end + movb 1(%rsi), %al + movb 1(%rdi), %cl + cmpb %al, %cl + jne LBB0_1 +## BB#3: ## %if.end38 + movb 2(%rsi), %al + movb 2(%rdi), %cl + cmpb %al, %cl + jne LBB0_1 +## BB#4: ## %if.end60 + movb 3(%rdi), %al + cmpb 3(%rsi), %al +LBB0_5: ## %if.end60 + setl %al + movzbl %al, %eax + ret + +Note that we generate jumps to LBB0_1 which does a redundant compare. The +redundant compare also forces the register values to be live, which prevents +folding one of the loads into the compare. In contrast, GCC 4.2 produces: + +_foo: + movzbl (%rsi), %eax + cmpb %al, (%rdi) + jne L10 +L12: + movzbl 1(%rsi), %eax + cmpb %al, 1(%rdi) + jne L10 + movzbl 2(%rsi), %eax + cmpb %al, 2(%rdi) + jne L10 + movzbl 3(%rdi), %eax + cmpb 3(%rsi), %al +L10: + setl %al + movzbl %al, %eax + ret + +which is "perfect". + +//===---------------------------------------------------------------------===// + From yuri at rawbw.com Mon Feb 21 03:32:31 2011 From: yuri at rawbw.com (Yuri) Date: Mon, 21 Feb 2011 01:32:31 -0800 Subject: [llvm-commits] [LLVMdev] How to force stack alignment for particular target triple in JIT? In-Reply-To: <4D621962.8040001@free.fr> References: <4D61F548.4070506@rawbw.com> <4D621962.8040001@free.fr> Message-ID: <4D62312F.5090103@rawbw.com> On 02/20/2011 23:50, Duncan Sands wrote: > Hi Yuri, > > >> I get SEGV in gcc-compiled procedure in Solaris10-i386. This procedure >> is called from llvm JIT code. >> Exact instruction that crashes is this: movdqa %xmm0, 0x10(%esp) >> %esp is 8-aligned, and by definition of movdqa it expects 16-aligned stack. >> This leads me to believe that llvm uses wrong ABI when calling external >> procedures and doesn't align stack properly. >> >> llvm module executing in JIT has this target triple: i386-pc-solaris2.10 >> >> Isn't target triple supposed to set correct ABI including stack >> alignment? How to set the correct alignment for this triple? >> > it is, however as far as I can see nowhere in LLVM makes any important > decisions based on the triple containing "solaris". I suggest you try > to work out how the stack alignment is set for other operating systems > and send in a patch fixing the solaris case. > > Ciao, Duncan The attached patch fixes the problem for me. Though further changes will likely be needed for full Solaris ABI compatibility. Yuri -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: patch.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110221/ef99d6c5/attachment.txt From stuart at apple.com Mon Feb 21 11:27:17 2011 From: stuart at apple.com (Stuart Hastings) Date: Mon, 21 Feb 2011 17:27:17 -0000 Subject: [llvm-commits] [llvm] r126127 - in /llvm/trunk/lib: CodeGen/TargetLoweringObjectFileImpl.cpp MC/MCSectionMachO.cpp Message-ID: <20110221172717.C79962A6C12C@llvm.org> Author: stuart Date: Mon Feb 21 11:27:17 2011 New Revision: 126127 URL: http://llvm.org/viewvc/llvm-project?rev=126127&view=rev Log: Fix to correctly support attribute((section("__DATA, __common"))). Radar 9012638. Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/trunk/lib/MC/MCSectionMachO.cpp Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=126127&r1=126126&r2=126127&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon Feb 21 11:27:17 2011 @@ -630,7 +630,7 @@ Mangler *Mang, const TargetMachine &TM) const { // Parse the section specifier and create it if valid. StringRef Segment, Section; - unsigned TAA, StubSize; + unsigned TAA = (unsigned)MCSectionMachO::SECTION_ATTRIBUTES, StubSize = 0; std::string ErrorCode = MCSectionMachO::ParseSectionSpecifier(GV->getSection(), Segment, Section, TAA, StubSize); @@ -643,10 +643,19 @@ return DataSection; } + bool TAAWasSet = (TAA != MCSectionMachO::SECTION_ATTRIBUTES); + if (!TAAWasSet) + TAA = 0; // Sensible default if this is a new section. + // Get the section. const MCSectionMachO *S = getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind); + // If TAA wasn't set by ParseSectionSpecifier() above, + // use the value returned by getMachOSection() as a default. + if (!TAAWasSet) + TAA = S->getTypeAndAttributes(); + // Okay, now that we got the section, verify that the TAA & StubSize agree. // If the user declared multiple globals with different section flags, we need // to reject it here. Modified: llvm/trunk/lib/MC/MCSectionMachO.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionMachO.cpp?rev=126127&r1=126126&r2=126127&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCSectionMachO.cpp (original) +++ llvm/trunk/lib/MC/MCSectionMachO.cpp Mon Feb 21 11:27:17 2011 @@ -101,16 +101,16 @@ return; } - OS << ','; - unsigned SectionType = TAA & MCSectionMachO::SECTION_TYPE; assert(SectionType <= MCSectionMachO::LAST_KNOWN_SECTION_TYPE && "Invalid SectionType specified!"); - if (SectionTypeDescriptors[SectionType].AssemblerName) + if (SectionTypeDescriptors[SectionType].AssemblerName) { + OS << ','; OS << SectionTypeDescriptors[SectionType].AssemblerName; - else - OS << "<<" << SectionTypeDescriptors[SectionType].EnumName << ">>"; + } else + // If we have no name for the attribute, stop here. + return; // If we don't have any attributes, we're done. unsigned SectionAttrs = TAA & MCSectionMachO::SECTION_ATTRIBUTES; @@ -125,7 +125,9 @@ // Check each attribute to see if we have it. char Separator = ','; - for (unsigned i = 0; SectionAttrDescriptors[i].AttrFlag; ++i) { + for (unsigned i = 0; + SectionAttrs != 0 && SectionAttrDescriptors[i].AttrFlag; + ++i) { // Check to see if we have this attribute. if ((SectionAttrDescriptors[i].AttrFlag & SectionAttrs) == 0) continue; @@ -207,7 +209,6 @@ "between 1 and 16 characters"; // If there is no comma after the section, we're done. - TAA = 0; StubSize = 0; if (Comma.second.empty()) return ""; From baldrick at free.fr Mon Feb 21 11:32:05 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Feb 2011 17:32:05 -0000 Subject: [llvm-commits] [llvm] r126129 - in /llvm/trunk: include/llvm/Transforms/Utils/Local.h lib/Transforms/Utils/Local.cpp Message-ID: <20110221173205.F01A32A6C12E@llvm.org> Author: baldrick Date: Mon Feb 21 11:32:05 2011 New Revision: 126129 URL: http://llvm.org/viewvc/llvm-project?rev=126129&view=rev Log: If the phi node was used by an unreachable instruction that ends up using itself without going via a phi node then we could return false here in spite of making a change. Also, tweak the comment because this method can (and always could) return true without deleting the original phi node. For example, if the phi node was used by a read-only invoke instruction which is used by another phi node phi2 which is only used by and only uses the invoke, then phi2 would be deleted but not the invoke instruction and not the original phi node. Modified: llvm/trunk/include/llvm/Transforms/Utils/Local.h llvm/trunk/lib/Transforms/Utils/Local.cpp Modified: llvm/trunk/include/llvm/Transforms/Utils/Local.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Local.h?rev=126129&r1=126128&r2=126129&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/Local.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/Local.h Mon Feb 21 11:32:05 2011 @@ -60,7 +60,7 @@ /// dead PHI node, due to being a def-use chain of single-use nodes that /// either forms a cycle or is terminated by a trivially dead instruction, /// delete it. If that makes any of its operands trivially dead, delete them -/// too, recursively. Return true if the PHI node is actually deleted. +/// too, recursively. Return true if a change was made. bool RecursivelyDeleteDeadPHINode(PHINode *PN); Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=126129&r1=126128&r2=126129&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/Local.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/Local.cpp Mon Feb 21 11:32:05 2011 @@ -282,7 +282,7 @@ /// dead PHI node, due to being a def-use chain of single-use nodes that /// either forms a cycle or is terminated by a trivially dead instruction, /// delete it. If that makes any of its operands trivially dead, delete them -/// too, recursively. Return true if the PHI node is actually deleted. +/// too, recursively. Return true if a change was made. bool llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) { SmallPtrSet Visited; for (Instruction *I = PN; areAllUsesEqual(I) && !I->mayHaveSideEffects(); @@ -295,7 +295,8 @@ if (!Visited.insert(I)) { // Break the cycle and delete the instruction and its operands. I->replaceAllUsesWith(UndefValue::get(I->getType())); - return RecursivelyDeleteTriviallyDeadInstructions(I); + (void)RecursivelyDeleteTriviallyDeadInstructions(I); + return true; } } return false; From baldrick at free.fr Mon Feb 21 11:37:17 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Feb 2011 17:37:17 -0000 Subject: [llvm-commits] [llvm] r126130 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h Message-ID: <20110221173717.791192A6C12E@llvm.org> Author: baldrick Date: Mon Feb 21 11:37:17 2011 New Revision: 126130 URL: http://llvm.org/viewvc/llvm-project?rev=126130&view=rev Log: The stack should be 16 byte aligned on 32 bit solaris. Patch by Yuri. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=126130&r1=126129&r2=126130&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Feb 21 11:37:17 2011 @@ -342,9 +342,9 @@ assert((!Is64Bit || HasX86_64) && "64-bit code requested on a subtarget that doesn't support it!"); - // Stack alignment is 16 bytes on Darwin and Linux (both 32 and 64 bit) and - // for all 64-bit targets. - if (isTargetDarwin() || isTargetLinux() || Is64Bit) + // Stack alignment is 16 bytes on Darwin, Linux and Solaris (both 32 and 64 + // bit) and for all 64-bit targets. + if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || Is64Bit) stackAlignment = 16; if (StackAlignment) Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=126130&r1=126129&r2=126130&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Mon Feb 21 11:37:17 2011 @@ -166,6 +166,7 @@ bool hasVectorUAMem() const { return HasVectorUAMem; } bool isTargetDarwin() const { return TargetTriple.getOS() == Triple::Darwin; } + bool isTargetSolaris() const { return TargetTriple.getOS() == Triple::Solaris; } // ELF is a reasonably sane default and the only other X86 targets we // support are Darwin and Windows. Just use "not those". From baldrick at free.fr Mon Feb 21 11:41:26 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Feb 2011 18:41:26 +0100 Subject: [llvm-commits] [LLVMdev] How to force stack alignment for particular target triple in JIT? In-Reply-To: <4D62312F.5090103@rawbw.com> References: <4D61F548.4070506@rawbw.com> <4D621962.8040001@free.fr> <4D62312F.5090103@rawbw.com> Message-ID: <4D62A3C6.1000107@free.fr> Hi Yuri, > The attached patch fixes the problem for me. Though further changes will likely > be needed for full Solaris ABI compatibility. I applied this in commit 126130. Ciao, Duncan. From stuart at apple.com Mon Feb 21 12:08:40 2011 From: stuart at apple.com (Stuart Hastings) Date: Mon, 21 Feb 2011 18:08:40 -0000 Subject: [llvm-commits] [llvm] r126131 - /llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c Message-ID: <20110221180840.E8B342A6C12C@llvm.org> Author: stuart Date: Mon Feb 21 12:08:40 2011 New Revision: 126131 URL: http://llvm.org/viewvc/llvm-project?rev=126131&view=rev Log: Test case for r126127. Radar 9012638. Added: llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c Added: llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c?rev=126131&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c (added) +++ llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c Mon Feb 21 12:08:40 2011 @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S %s -o /dev/null +struct rtxc_snapshot { + int a, b, c, d; +}; +__attribute__ ((section("__DATA, __common"))) static struct rtxc_snapshot rtxc_log_A[4]; From clattner at apple.com Mon Feb 21 12:24:22 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Feb 2011 10:24:22 -0800 Subject: [llvm-commits] [llvm] r126131 - /llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c In-Reply-To: <20110221180840.E8B342A6C12C@llvm.org> References: <20110221180840.E8B342A6C12C@llvm.org> Message-ID: <0093811E-255A-435A-838E-9BF49A817BA8@apple.com> On Feb 21, 2011, at 10:08 AM, Stuart Hastings wrote: > Author: stuart > Date: Mon Feb 21 12:08:40 2011 > New Revision: 126131 > > URL: http://llvm.org/viewvc/llvm-project?rev=126131&view=rev > Log: > Test case for r126127. Radar 9012638. Hi Stuart, Please add frontend tests to the clang testsuite instead of test/FrontendC. -Chris > > Added: > llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c > > Added: llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c?rev=126131&view=auto > ============================================================================== > --- llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c (added) > +++ llvm/trunk/test/FrontendC/2011-02-21-DATA-common.c Mon Feb 21 12:08:40 2011 > @@ -0,0 +1,5 @@ > +// RUN: %llvmgcc -S %s -o /dev/null > +struct rtxc_snapshot { > + int a, b, c, d; > +}; > +__attribute__ ((section("__DATA, __common"))) static struct rtxc_snapshot rtxc_log_A[4]; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From richard at xmos.com Mon Feb 21 12:23:30 2011 From: richard at xmos.com (Richard Osborne) Date: Mon, 21 Feb 2011 18:23:30 -0000 Subject: [llvm-commits] [llvm] r126132 - in /llvm/trunk: include/llvm/IntrinsicsXCore.td lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/resources.ll Message-ID: <20110221182330.CB66A2A6C12C@llvm.org> Author: friedgold Date: Mon Feb 21 12:23:30 2011 New Revision: 126132 URL: http://llvm.org/viewvc/llvm-project?rev=126132&view=rev Log: Add XCore intrinsics for various instructions on ports. Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td llvm/trunk/test/CodeGen/XCore/resources.ll Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsXCore.td?rev=126132&r1=126131&r2=126132&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsXCore.td (original) +++ llvm/trunk/include/llvm/IntrinsicsXCore.td Mon Feb 21 12:23:30 2011 @@ -33,4 +33,14 @@ [NoCapture<0>]>; def int_xcore_setc : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], [NoCapture<0>]>; + def int_xcore_inshr : Intrinsic<[llvm_i32_ty],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; + def int_xcore_outshr : Intrinsic<[llvm_i32_ty],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; + def int_xcore_setpt : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; + def int_xcore_getts : Intrinsic<[llvm_i32_ty],[llvm_anyptr_ty], + [NoCapture<0>]>; + def int_xcore_syncr : Intrinsic<[],[llvm_anyptr_ty], + [NoCapture<0>]>; } Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=126132&r1=126131&r2=126132&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Mon Feb 21 12:23:30 2011 @@ -727,7 +727,7 @@ "neg $dst, $b", [(set GRRegs:$dst, (ineg GRRegs:$b))]>; -// TODO setd, eet, eef, getts, setpt, outshr, inshr, testwct, tinitpc, tinitdp, +// TODO setd, eet, eef, testwct, tinitpc, tinitdp, // tinitsp, tinitcp, tsetmr, sext (reg), zext (reg) let Constraints = "$src1 = $dst" in { let neverHasSideEffects = 1 in @@ -758,6 +758,14 @@ "getr $dst, $type", [(set GRRegs:$dst, (int_xcore_getr immUs:$type))]>; +def GETTS_2r : _F2R<(outs GRRegs:$dst), (ins GRRegs:$r), + "getts $dst, res[$r]", + [(set GRRegs:$dst, (int_xcore_getts GRRegs:$r))]>; + +def SETPT_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), + "setpt res[$r], $val", + [(int_xcore_setpt GRRegs:$r, GRRegs:$val)]>; + def OUTCT_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), "outct res[$r], $val", [(int_xcore_outct GRRegs:$r, GRRegs:$val)]>; @@ -774,6 +782,11 @@ "out res[$r], $val", [(int_xcore_out GRRegs:$r, GRRegs:$val)]>; +let Constraints = "$src = $dst" in +def OUTSHR_2r : _F2R<(outs GRRegs:$dst), (ins GRRegs:$r, GRRegs:$src), + "outshr res[$r], $src", + [(set GRRegs:$dst, (int_xcore_outshr GRRegs:$r, GRRegs:$src))]>; + def INCT_2r : _F2R<(outs GRRegs:$dst), (ins GRRegs:$r), "inct $dst, res[$r]", [(set GRRegs:$dst, (int_xcore_inct GRRegs:$r))]>; @@ -786,6 +799,11 @@ "in $dst, res[$r]", [(set GRRegs:$dst, (int_xcore_in GRRegs:$r))]>; +let Constraints = "$src = $dst" in +def INSHR_2r : _F2R<(outs GRRegs:$dst), (ins GRRegs:$r, GRRegs:$src), + "inshr $dst, res[$r]", + [(set GRRegs:$dst, (int_xcore_inshr GRRegs:$r, GRRegs:$src))]>; + def CHKCT_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), "chkct res[$r], $val", [(int_xcore_chkct GRRegs:$r, GRRegs:$val)]>; @@ -818,7 +836,7 @@ [(int_xcore_setc GRRegs:$r, GRRegs:$val)]>; // One operand short -// TODO edu, eeu, waitet, waitef, tstart, msync, mjoin, syncr, clrtp +// TODO edu, eeu, waitet, waitef, tstart, msync, mjoin, clrtp // setdp, setcp, setv, setev, kcall // dgetreg let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1 in @@ -859,6 +877,10 @@ [(XCoreBranchLink GRRegs:$addr)]>; } +def SYNCR_1r : _F1R<(outs), (ins GRRegs:$r), + "syncr res[$r]", + [(int_xcore_syncr GRRegs:$r)]>; + def FREER_1r : _F1R<(outs), (ins GRRegs:$r), "freer res[$r]", [(int_xcore_freer GRRegs:$r)]>; Modified: llvm/trunk/test/CodeGen/XCore/resources.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/resources.ll?rev=126132&r1=126131&r2=126132&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/resources.ll (original) +++ llvm/trunk/test/CodeGen/XCore/resources.ll Mon Feb 21 12:23:30 2011 @@ -11,6 +11,11 @@ declare void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 %value) declare void @llvm.xcore.setd.p1i8(i8 addrspace(1)* %r, i32 %value) declare void @llvm.xcore.setc.p1i8(i8 addrspace(1)* %r, i32 %value) +declare i32 @llvm.xcore.inshr.p1i8(i8 addrspace(1)* %r, i32 %value) +declare i32 @llvm.xcore.outshr.p1i8(i8 addrspace(1)* %r, i32 %value) +declare void @llvm.xcore.setpt.p1i8(i8 addrspace(1)* %r, i32 %value) +declare i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r) +declare void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r) define i8 addrspace(1)* @getr() { ; CHECK: getr: @@ -109,3 +114,38 @@ call void @llvm.xcore.setc.p1i8(i8 addrspace(1)* %r, i32 2) ret void } + +define i32 @inshr(i32 %value, i8 addrspace(1)* %r) { +; CHECK: inshr: +; CHECK: inshr r0, res[r1] + %result = call i32 @llvm.xcore.inshr.p1i8(i8 addrspace(1)* %r, i32 %value) + ret i32 %result +} + +define i32 @outshr(i32 %value, i8 addrspace(1)* %r) { +; CHECK: outshr: +; CHECK: outshr res[r1], r0 + %result = call i32 @llvm.xcore.outshr.p1i8(i8 addrspace(1)* %r, i32 %value) + ret i32 %result +} + +define void @setpt(i8 addrspace(1)* %r, i32 %value) { +; CHECK: setpt: +; CHECK: setpt res[r0], r1 + call void @llvm.xcore.setpt.p1i8(i8 addrspace(1)* %r, i32 %value) + ret void +} + +define i32 @getts(i8 addrspace(1)* %r) { +; CHECK: getts: +; CHECK: getts r0, res[r0] + %result = call i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r) + ret i32 %result +} + +define void @syncr(i8 addrspace(1)* %r) { +; CHECK: syncr: +; CHECK: syncr res[r0] + call void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r) + ret void +} From clattner at apple.com Mon Feb 21 12:30:23 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Feb 2011 10:30:23 -0800 Subject: [llvm-commits] [llvm] r125105 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <8739nhmmxh.fsf@smith.obbligato.org> References: <20110208190442.036ED2A6C12C@llvm.org> <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> <8739nhmmxh.fsf@smith.obbligato.org> Message-ID: On Feb 21, 2011, at 7:23 AM, David A. Greene wrote: > Chris Lattner writes: > >> On Feb 17, 2011, at 3:34 PM, David A. Greene wrote: >>> For debugging purposes. Should I add this as a target option instead? >> >> What is the use case? Is this a temporary hack that will be removed later or something you intend to keep around forever? > > The use case is when trying to isolate misuse of 256-bit registers. A > typical situation involves shuffles as the code to generate a 256-bit > shuffle is more complex than the code for a 128-bit shuffle. In codes > with many shuffles, a switch like this makes it easier to identify the > offending shuffle. Please do. Bugpoint is more general and pretty good at this sort of thing, -Chris From sabre at nondot.org Mon Feb 21 12:38:56 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Feb 2011 18:38:56 -0000 Subject: [llvm-commits] [llvm] r126135 - /llvm/trunk/Makefile.rules Message-ID: <20110221183856.A60992A6C12D@llvm.org> Author: lattner Date: Mon Feb 21 12:38:56 2011 New Revision: 126135 URL: http://llvm.org/viewvc/llvm-project?rev=126135&view=rev Log: Better OpenBSD support, patch by Amit Kulkarni. I have no way to test that this doesn't break gold, but it seems reasonable to me. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=126135&r1=126134&r2=126135&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Mon Feb 21 12:38:56 2011 @@ -973,7 +973,9 @@ $(Verb) echo "{" > $@ $(Verb) grep -q "\<" $< && echo " global:" >> $@ || : $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@ +ifneq ($(HOST_OS),OpenBSD) $(Verb) echo " local: *;" >> $@ +endif $(Verb) echo "};" >> $@ clean-local:: -$(Verb) $(RM) -f $(NativeExportsFile) From greened at obbligato.org Mon Feb 21 12:27:30 2011 From: greened at obbligato.org (David A. Greene) Date: Mon, 21 Feb 2011 12:27:30 -0600 Subject: [llvm-commits] [llvm] r125105 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: (Chris Lattner's message of "Mon, 21 Feb 2011 10:30:23 -0800") References: <20110208190442.036ED2A6C12C@llvm.org> <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> <8739nhmmxh.fsf@smith.obbligato.org> Message-ID: <87tyfxkzu5.fsf@smith.obbligato.org> Chris Lattner writes: >> The use case is when trying to isolate misuse of 256-bit registers. A >> typical situation involves shuffles as the code to generate a 256-bit >> shuffle is more complex than the code for a 128-bit shuffle. In codes >> with many shuffles, a switch like this makes it easier to identify the >> offending shuffle. > > Please do. Bugpoint is more general and pretty good at this sort of thing, I will remove it. The problem with Bugpoint is that it doesn't know how to switch among subtargets, so if you're trying to debug a codegen issue, it's often a manual process. -Dave From clattner at apple.com Mon Feb 21 13:14:41 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Feb 2011 11:14:41 -0800 Subject: [llvm-commits] [llvm] r125105 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <87tyfxkzu5.fsf@smith.obbligato.org> References: <20110208190442.036ED2A6C12C@llvm.org> <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> <8739nhmmxh.fsf@smith.obbligato.org> <87tyfxkzu5.fsf@smith.obbligato.org> Message-ID: <83E50280-72E4-4375-808E-E3B35A0F6D17@apple.com> On Feb 21, 2011, at 10:27 AM, David A. Greene wrote: > Chris Lattner writes: > >>> The use case is when trying to isolate misuse of 256-bit registers. A >>> typical situation involves shuffles as the code to generate a 256-bit >>> shuffle is more complex than the code for a 128-bit shuffle. In codes >>> with many shuffles, a switch like this makes it easier to identify the >>> offending shuffle. >> >> Please do. Bugpoint is more general and pretty good at this sort of thing, > > I will remove it. The problem with Bugpoint is that it doesn't know how > to switch among subtargets, so if you're trying to debug a codegen > issue, it's often a manual process. You can use things like: --tool-args -mattr=+avx -Chris From greened at obbligato.org Mon Feb 21 13:23:22 2011 From: greened at obbligato.org (David Greene) Date: Mon, 21 Feb 2011 19:23:22 -0000 Subject: [llvm-commits] [llvm] r126136 - /llvm/trunk/utils/llvmbuild Message-ID: <20110221192322.6F2322A6C12C@llvm.org> Author: greened Date: Mon Feb 21 13:23:22 2011 New Revision: 126136 URL: http://llvm.org/viewvc/llvm-project?rev=126136&view=rev Log: Add a convenience tool for doing comparison builds of the LLVM ecosystem. This is a handy utility for checking changes before committing them to the repository. Added: llvm/trunk/utils/llvmbuild (with props) Added: llvm/trunk/utils/llvmbuild URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvmbuild?rev=126136&view=auto ============================================================================== --- llvm/trunk/utils/llvmbuild (added) +++ llvm/trunk/utils/llvmbuild Mon Feb 21 13:23:22 2011 @@ -0,0 +1,706 @@ +#!/usr/bin/python3 +##===- utils/llvmbuild - Build the LLVM project ----------------*-python-*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +# +# This script builds many different flavors of the LLVM ecosystem. It +# will build LLVM, Clang, llvm-gcc, and dragonegg as well as run tests +# on them. This script is convenient to use to check builds and tests +# before committing changes to the upstream repository +# +# A typical source setup uses three trees and looks like this: +# +# official +# dragonegg +# trunk +# gcc +# trunk +# llvm +# trunk +# tools +# clang +# tags +# RELEASE_28 +# tools +# clang +# llvm-gcc +# trunk +# tags +# RELEASE_28 +# staging +# dragonegg +# trunk +# gcc +# trunk +# llvm +# trunk +# tools +# clang +# tags +# RELEASE_28 +# tools +# clang +# llvm-gcc +# trunk +# tags +# RELEASE_28 +# commit +# dragonegg +# trunk +# gcc +# trunk +# llvm +# trunk +# tools +# clang +# tags +# RELEASE_28 +# tools +# clang +# llvm-gcc +# trunk +# tags +# RELEASE_28 +# +# "gcc" above is the upstream FSF gcc and "gcc/trunk" refers to the +# 4.5 branch as discussed in the dragonegg build guide. +# +# In a typical workflow, the "official" tree always contains unchanged +# sources from the main LLVM project repositories. The "staging" tree +# is where local work is done. A set of changes resides there waiting +# to be moved upstream. The "commit" tree is where changes from +# "staging" make their way upstream. Individual incremental changes +# from "staging" are applied to "commit" and committed upstream after +# a successful build and test run. A successful build is one in which +# testing results in no more failures than seen in the testing of the +# "official" tree. +# +# A build may be invoked as such: +# +# llvmbuild --src=~/llvm/commit --src=~/llvm/staging +# --src=~/llvm/official --branch=trunk --branch=tags/RELEASE_28 +# --build=debug --build=release --build=paranoid +# --prefix=/home/greened/install --builddir=/home/greened/build +# +# This will build the LLVM ecosystem, including LLVM, Clang, llvm-gcc, +# gcc 4.5 and dragonegg, putting build results in ~/build and +# installing tools in ~/install. llvmbuild creates separate build and +# install directories for each source/branch/build flavor. In the +# above example, llvmbuild will build debug, release and paranoid +# (debug+checks) flavors of the trunk and RELEASE_28 branches from +# each source tree (official, staging and commit) for a total of +# eighteen builds. All builds will be run in parallel. +# +# The user may control parallelism via the --jobs and --threads +# switches. --jobs tells llvmbuild the maximum total number of builds +# to activate in parallel. The user may think of it as equivalent to +# the GNU make -j switch. --threads tells llvmbuild how many worker +# threads to use to accomplish those builds. If --threads is less +# than --jobs, --threads workers will be launched and each one will +# pick a source/branch/flavor combination to build. Then llvmbuild +# will invoke GNU make with -j (--jobs / --threads) to use up the +# remaining job capacity. Once a worker is finished with a build, it +# will pick another combination off the list and start building it. +# +##===----------------------------------------------------------------------===## + +import optparse +import os +import sys +import threading +import queue +import logging +import traceback +import subprocess +import re + +# TODO: Use shutil.which when it is available (3.2 or later) +def find_executable(executable, path=None): + """Try to find 'executable' in the directories listed in 'path' (a + string listing directories separated by 'os.pathsep'; defaults to + os.environ['PATH']). Returns the complete filename or None if not + found + """ + if path is None: + path = os.environ['PATH'] + paths = path.split(os.pathsep) + extlist = [''] + if os.name == 'os2': + (base, ext) = os.path.splitext(executable) + # executable files on OS/2 can have an arbitrary extension, but + # .exe is automatically appended if no dot is present in the name + if not ext: + executable = executable + ".exe" + elif sys.platform == 'win32': + pathext = os.environ['PATHEXT'].lower().split(os.pathsep) + (base, ext) = os.path.splitext(executable) + if ext.lower() not in pathext: + extlist = pathext + for ext in extlist: + execname = executable + ext + if os.path.isfile(execname): + return execname + else: + for p in paths: + f = os.path.join(p, execname) + if os.path.isfile(f): + return f + else: + return None + +def is_executable(fpath): + return os.path.exists(fpath) and os.access(fpath, os.X_OK) + +def add_options(parser): + parser.add_option("-v", "--verbose", action="store_true", + default=False, + help=("Output informational messages" + " [default: %default]")) + parser.add_option("--src", action="append", + help=("Top-level source directory [default: %default]")) + parser.add_option("--build", action="append", default=["debug"], + help=("Build types to run [default: %default]")) + parser.add_option("--branch", action="append", + help=("Source branch to build [default: %default]")) + parser.add_option("--cc", default=find_executable("cc"), + help=("The C compiler to use [default: %default]")) + parser.add_option("--cxx", default=find_executable("c++"), + help=("The C++ compiler to use [default: %default]")) + parser.add_option("--threads", default=4, type="int", + help=("The number of worker threads to use " + "[default: %default]")) + parser.add_option("--jobs", "-j", default=8, type="int", + help=("The number of simultaneous build jobs " + "[default: %default]")) + parser.add_option("--prefix", + help=("Root install directory [default: %default]")) + parser.add_option("--builddir", + help=("Root build directory [default: %default]")) + return + +def check_options(parser, options, valid_builds): + # See if we're building valid flavors. + for build in options.build: + if (build not in valid_builds): + parser.error("'" + build + "' is not a valid build flavor " + + str(valid_builds)) + + # See if we can find source directories. + for src in options.src: + for component in ["llvm", "llvm-gcc", "gcc", "dragonegg"]: + compsrc = src + "/" + component + if (not os.path.isdir(compsrc)): + parser.error("'" + compsrc + "' does not exist") + if (options.branch is not None): + for branch in options.branch: + if (not os.path.isdir(os.path.join(compsrc, branch))): + parser.error("'" + os.path.join(compsrc, branch) + + "' does not exist") + + # See if we can find the compilers + options.cc = find_executable(options.cc) + options.cxx = find_executable(options.cxx) + + return + +# Find a unique short name for the given set of paths. This searches +# back through path components until it finds unique component names +# among all given paths. +def get_path_abbrevs(paths): + # Find the number of common starting characters in the last component + # of the paths. + unique_paths = list(paths) + + class NotFoundException(Exception): pass + + # Find a unique component of each path. + unique_bases = unique_paths[:] + found = 0 + while len(unique_paths) > 0: + bases = [os.path.basename(src) for src in unique_paths] + components = { c for c in bases } + # Account for single entry in paths. + if len(components) > 1 or len(components) == len(bases): + # We found something unique. + for c in components: + if bases.count(c) == 1: + index = bases.index(c) + unique_bases[index] = c + # Remove the corresponding path from the set under + # consideration. + unique_paths[index] = None + unique_paths = [ p for p in unique_paths if p is not None ] + unique_paths = [os.path.dirname(src) for src in unique_paths] + + if len(unique_paths) > 0: + raise NotFoundException() + + abbrevs = dict(zip(paths, [base for base in unique_bases])) + + return abbrevs + +# Given a set of unique names, find a short character sequence that +# uniquely identifies them. +def get_short_abbrevs(unique_bases): + # Find a unique start character for each path base. + my_unique_bases = unique_bases[:] + unique_char_starts = unique_bases[:] + while len(my_unique_bases) > 0: + for start, char_tuple in enumerate(zip(*[base + for base in my_unique_bases])): + chars = { c for c in char_tuple } + # Account for single path. + if len(chars) > 1 or len(chars) == len(char_tuple): + # We found something unique. + for c in chars: + if char_tuple.count(c) == 1: + index = char_tuple.index(c) + unique_char_starts[index] = start + # Remove the corresponding path from the set under + # consideration. + my_unique_bases[index] = None + my_unique_bases = [ b for b in my_unique_bases + if b is not None ] + break + + if len(my_unique_bases) > 0: + raise NotFoundException() + + abbrevs = [abbrev[start_index:start_index+3] + for abbrev, start_index + in zip([base for base in unique_bases], + [index for index in unique_char_starts])] + + abbrevs = dict(zip(unique_bases, abbrevs)) + + return abbrevs + +class Builder(threading.Thread): + class ExecutableNotFound(Exception): pass + class FileNotExecutable(Exception): pass + + def __init__(self, work_queue, jobs, cc, cxx, build_abbrev, source_abbrev, + branch_abbrev, build_prefix, install_prefix): + super().__init__() + self.work_queue = work_queue + self.jobs = jobs + self.cc = cc + self.cxx = cxx + self.build_abbrev = build_abbrev + self.source_abbrev = source_abbrev + self.branch_abbrev = branch_abbrev + self.build_prefix = build_prefix + self.install_prefix = install_prefix + self.component_abbrev = dict( + llvm="llvm", + llvm_gcc="lgcc", + llvm2="llv2", + gcc="ugcc", + dagonegg="degg") + def run(self): + while True: + try: + source, branch, build = self.work_queue.get() + self.dobuild(source, branch, build) + except: + traceback.print_exc() + finally: + self.work_queue.task_done() + + def execute(self, command, execdir, env, component): + prefix = self.component_abbrev[component.replace("-", "_")] + pwd = os.getcwd() + if not os.path.exists(execdir): + os.makedirs(execdir) + + for key, value in env.items(): + os.environ[key] = value + + self.logger.debug("[" + prefix + "] " + "env " + str(env) + " " + + " ".join(command)); + + try: + proc = subprocess.Popen(command, + cwd=execdir, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + + line = proc.stdout.readline() + while line: + self.logger.info("[" + prefix + "] " + + str(line, "utf-8").rstrip()) + line = proc.stdout.readline() + + except: + traceback.print_exc() + + for key, value in env.items(): + os.environ.pop(key) + + # Get a list of C++ include directories to pass to clang. + def get_includes(self): + # Assume we're building with g++ for now. + command = [self.cxx] + command += ["-v", "-x", "c++", "/dev/null", "-fsyntax-only"] + includes = [] + self.logger.debug(command) + try: + proc = subprocess.Popen(command, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + + gather = False + line = proc.stdout.readline() + while line: + self.logger.debug(line) + if re.search("End of search list", str(line)) is not None: + self.logger.debug("Stop Gather") + gather = False + if gather: + includes.append(str(line, "utf-8").strip()) + if re.search("#include <...> search starts", str(line)) is not None: + self.logger.debug("Start Gather") + gather = True + line = proc.stdout.readline() + except: + traceback.print_exc() + self.logger.debug(includes) + return includes + + def dobuild(self, source, branch, build): + build_suffix = "" + + ssabbrev = get_short_abbrevs([ab for ab in self.source_abbrev.values()]) + + if branch is not None: + sbabbrev = get_short_abbrevs([ab for ab in self.branch_abbrev.values()]) + + prefix = "[" + ssabbrev[self.source_abbrev[source]] + "-" + sbabbrev[self.branch_abbrev[branch]] + "-" + self.build_abbrev[build] + "]" + self.install_prefix += "/" + self.source_abbrev[source] + "/" + branch + "/" + build + build_suffix += self.source_abbrev[source] + "/" + branch + "/" + build + else: + prefix = "[" + ssabbrev[self.source_abbrev[source]] + "-" + self.build_abbrev[build] + "]" + self.install_prefix += "/" + self.source_abbrev[source] + "/" + build + build_suffix += "/" + self.source_abbrev[source] + "/" + build + + self.logger = logging.getLogger(prefix) + + self.logger.debug(self.install_prefix) + + # Assume we're building with gcc for now. + cxxincludes = self.get_includes() + cxxroot = cxxincludes[0] + cxxarch = os.path.basename(cxxincludes[1]) + + configure_flags = dict( + llvm=dict(debug=["--prefix=" + self.install_prefix, + "--with-cxx-include-root=" + cxxroot, + "--with-cxx-include-arch=" + cxxarch], + release=["--prefix=" + self.install_prefix, + "--enable-optimized", + "--with-cxx-include-root=" + cxxroot, + "--with-cxx-include-arch=" + cxxarch], + paranoid=["--prefix=" + self.install_prefix, + "--enable-expensive-checks", + "--with-cxx-include-root=" + cxxroot, + "--with-cxx-include-arch=" + cxxarch]), + llvm_gcc=dict(debug=["--prefix=" + self.install_prefix, + "--enable-checking", + "--program-prefix=llvm-", + "--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix, + "--enable-languages=c,c++,fortran"], + release=["--prefix=" + self.install_prefix, + "--program-prefix=llvm-", + "--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix, + "--enable-languages=c,c++,fortran"], + paranoid=["--prefix=" + self.install_prefix, + "--enable-checking", + "--program-prefix=llvm-", + "--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix, + "--enable-languages=c,c++,fortran"]), + llvm2=dict(debug=["--prefix=" + self.install_prefix, + "--with-llvmgccdir=" + self.install_prefix + "/bin", + "--with-cxx-include-root=" + cxxroot, + "--with-cxx-include-arch=" + cxxarch], + release=["--prefix=" + self.install_prefix, + "--enable-optimized", + "--with-llvmgccdir=" + self.install_prefix + "/bin", + "--with-cxx-include-root=" + cxxroot, + "--with-cxx-include-arch=" + cxxarch], + paranoid=["--prefix=" + self.install_prefix, + "--enable-expensive-checks", + "--with-llvmgccdir=" + self.install_prefix + "/bin", + "--with-cxx-include-root=" + cxxroot, + "--with-cxx-include-arch=" + cxxarch]), + gcc=dict(debug=["--prefix=" + self.install_prefix, + "--enable-checking"], + release=["--prefix=" + self.install_prefix], + paranoid=["--prefix=" + self.install_prefix, + "--enable-checking"]), + dragonegg=dict(debug=[], + release=[], + paranoid=[])) + + configure_env = dict( + llvm=dict(debug=dict(CC=self.cc, + CXX=self.cxx), + release=dict(CC=self.cc, + CXX=self.cxx), + paranoid=dict(CC=self.cc, + CXX=self.cxx)), + llvm_gcc=dict(debug=dict(CC=self.cc, + CXX=self.cxx), + release=dict(CC=self.cc, + CXX=self.cxx), + paranoid=dict(CC=self.cc, + CXX=self.cxx)), + llvm2=dict(debug=dict(CC=self.cc, + CXX=self.cxx), + release=dict(CC=self.cc, + CXX=self.cxx), + paranoid=dict(CC=self.cc, + CXX=self.cxx)), + gcc=dict(debug=dict(CC=self.cc, + CXX=self.cxx), + release=dict(CC=self.cc, + CXX=self.cxx), + paranoid=dict(CC=self.cc, + CXX=self.cxx)), + dragonegg=dict(debug=dict(CC=self.cc, + CXX=self.cxx), + release=dict(CC=self.cc, + CXX=self.cxx), + paranoid=dict(CC=self.cc, + CXX=self.cxx))) + + make_flags = dict( + llvm=dict(debug=["-j" + str(self.jobs)], + release=["-j" + str(self.jobs)], + paranoid=["-j" + str(self.jobs)]), + llvm_gcc=dict(debug=["-j" + str(self.jobs), + "bootstrap"], + release=["-j" + str(self.jobs), + "bootstrap"], + paranoid=["-j" + str(self.jobs), + "bootstrap"]), + llvm2=dict(debug=["-j" + str(self.jobs)], + release=["-j" + str(self.jobs)], + paranoid=["-j" + str(self.jobs)]), + gcc=dict(debug=["-j" + str(self.jobs), + "bootstrap"], + release=["-j" + str(self.jobs), + "bootstrap"], + paranoid=["-j" + str(self.jobs), + "bootstrap"]), + dragonegg=dict(debug=["-j" + str(self.jobs)], + release=["-j" + str(self.jobs)], + paranoid=["-j" + str(self.jobs)])) + + make_env = dict( + llvm=dict(debug=dict(), + release=dict(), + paranoid=dict()), + llvm_gcc=dict(debug=dict(), + release=dict(), + paranoid=dict()), + llvm2=dict(debug=dict(), + release=dict(), + paranoid=dict()), + gcc=dict(debug=dict(), + release=dict(), + paranoid=dict()), + dragonegg=dict(debug=dict(GCC=self.install_prefix + "/bin/gcc", + LLVM_CONFIG=self.install_prefix + "/bin/llvm-config"), + release=dict(GCC=self.install_prefix + "/bin/gcc", + LLVM_CONFIG=self.install_prefix + "/bin/llvm-config"), + paranoid=dict(GCC=self.install_prefix + "/bin/gcc", + LLVM_CONFIG=self.install_prefix + "/bin/llvm-config"))) + + make_install_flags = dict( + llvm=dict(debug=["install"], + release=["install"], + paranoid=["install"]), + llvm_gcc=dict(debug=["install"], + release=["install"], + paranoid=["install"]), + llvm2=dict(debug=["install"], + release=["install"], + paranoid=["install"]), + gcc=dict(debug=["install"], + release=["install"], + paranoid=["install"]), + dragonegg=dict(debug=["install"], + release=["install"], + paranoid=["install"])) + + make_install_env = dict( + llvm=dict(debug=dict(), + release=dict(), + paranoid=dict()), + llvm_gcc=dict(debug=dict(), + release=dict(), + paranoid=dict()), + llvm2=dict(debug=dict(), + release=dict(), + paranoid=dict()), + gcc=dict(debug=dict(), + release=dict(), + paranoid=dict()), + dragonegg=dict(debug=dict(), + release=dict(), + paranoid=dict())) + + make_check_flags = dict( + llvm=dict(debug=["check"], + release=["check"], + paranoid=["check"]), + llvm_gcc=dict(debug=["check"], + release=["check"], + paranoid=["check"]), + llvm2=dict(debug=["check"], + release=["check"], + paranoid=["check"]), + gcc=dict(debug=["check"], + release=["check"], + paranoid=["check"]), + dragonegg=dict(debug=["check"], + release=["check"], + paranoid=["check"])) + + make_check_env = dict( + llvm=dict(debug=dict(), + release=dict(), + paranoid=dict()), + llvm_gcc=dict(debug=dict(), + release=dict(), + paranoid=dict()), + llvm2=dict(debug=dict(), + release=dict(), + paranoid=dict()), + gcc=dict(debug=dict(), + release=dict(), + paranoid=dict()), + dragonegg=dict(debug=dict(), + release=dict(), + paranoid=dict())) + + for component in ["llvm", "llvm-gcc", "llvm2", "gcc", "dragonegg"]: + comp = component[:] + + srcdir = source + "/" + comp.rstrip("2") + builddir = self.build_prefix + "/" + comp + "/" + build_suffix + installdir = self.install_prefix + + if (branch is not None): + srcdir += "/" + branch + + self.logger.info("Configuring " + component + " in " + builddir) + self.configure(component, srcdir, builddir, + configure_flags[comp.replace("-", "_")][build], + configure_env[comp.replace("-", "_")][build]) + + self.logger.info("Building " + component + " in " + builddir) + self.make(component, srcdir, builddir, + make_flags[comp.replace("-", "_")][build], + make_env[comp.replace("-", "_")][build]) + + self.logger.info("Installing " + component + " in " + installdir) + self.make(component, srcdir, builddir, + make_install_flags[comp.replace("-", "_")][build], + make_install_env[comp.replace("-", "_")][build]) + + self.logger.info("Testing " + component + " in " + builddir) + self.make(component, srcdir, builddir, + make_check_flags[comp.replace("-", "_")][build], + make_check_env[comp.replace("-", "_")][build]) + + + def configure(self, component, srcdir, builddir, flags, env): + configure_files = dict( + llvm=[(srcdir + "/configure", builddir + "/Makefile")], + llvm_gcc=[(srcdir + "/configure", builddir + "/Makefile"), + (srcdir + "/gcc/configure", builddir + "/gcc/Makefile")], + llvm2=[(srcdir + "/configure", builddir + "/Makefile")], + gcc=[(srcdir + "/configure", builddir + "/Makefile"), + (srcdir + "/gcc/configure", builddir + "/gcc/Makefile")], + dragonegg=[()]) + + doconfig = False + for conf, mf in configure_files[component.replace("-", "_")]: + if os.path.exists(conf) and os.path.exists(mf): + confstat = os.stat(conf) + makestat = os.stat(mf) + if confstat.st_mtime > makestat.st_mtime: + doconfig = True + break + else: + doconfig = True + break + + if not doconfig: + return + + program = srcdir + "/configure" + if not is_executable(program): + return + + args = [program] + args += ["--verbose"] + args += flags + self.execute(args, builddir, env, component) + + def make(self, component, srcdir, builddir, flags, env): + program = find_executable("make") + if program is None: + raise ExecutableNotFound + + if not is_executable(program): + raise FileNotExecutable + + args = [program] + args += flags + self.execute(args, builddir, env, component) + +# Global constants +build_abbrev = dict(debug="dbg", release="opt", paranoid="par") + +# Parse options +parser = optparse.OptionParser(version="%prog 1.0") +add_options(parser) +(options, args) = parser.parse_args() +check_options(parser, options, build_abbrev.keys()); + +if options.verbose: + logging.basicConfig(level=logging.DEBUG, + format='%(name)-13s: %(message)s') +else: + logging.basicConfig(level=logging.INFO, + format='%(name)-13s: %(message)s') + +source_abbrev = get_path_abbrevs(set(options.src)) +branch_abbrev = get_path_abbrevs(set(options.branch)) + +work_queue = queue.Queue() + +for t in range(options.threads): + jobs = options.jobs // options.threads + builder = Builder(work_queue, jobs, options.cc.strip(), options.cxx.strip(), + build_abbrev, source_abbrev, branch_abbrev, + options.builddir.strip(), options.prefix.strip()) + builder.daemon = True + builder.start() + +for build in set(options.build): + for source in set(options.src): + if options.branch is not None: + for branch in set(options.branch): + work_queue.put((source, branch, build)) + else: + work_queue.put((source, None, build)) + +work_queue.join() Propchange: llvm/trunk/utils/llvmbuild ------------------------------------------------------------------------------ svn:executable = * From dpatel at apple.com Mon Feb 21 13:46:15 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Feb 2011 11:46:15 -0800 Subject: [llvm-commits] [lto][patch] Remove weak attempt of tracking symbols defined in module level assembly In-Reply-To: <44FEF8AD-1BAA-4457-A8FD-F39BD58937ED@apple.com> References: <4D604EBE.4050807@gmail.com> <4D607DDA.6040102@gmail.com> <44FEF8AD-1BAA-4457-A8FD-F39BD58937ED@apple.com> Message-ID: <7096E2BD-667F-4947-84F7-B62DDC4A1306@apple.com> On Feb 20, 2011, at 10:40 AM, Chris Lattner wrote: > On Feb 19, 2011, at 6:35 PM, Rafael ?vila de Esp?ndola wrote: > >>> I agree that the heuristic is a gross hack, but this will break >>> building llvm itself with LTO, since the JIT defines a symbol (for >>> the compilation callback) in file scope inline asm. >> >> Why would this break the build? If a symbol is not present in the IL but >> shows up in the final .o produce by LTO, the linker should still put in >> in the binary. If linker runs its own dead code strip pass then it may rip this out unless it is informed about it in advance. Usually, linker keeps track of symbols not to through out and everything else disappears. This patch may not be the most elegant, but if a linker queries about symbols defined in a llvm::Module then that query should appropriately include module asm symbols such that the linker can make sense of their names. - Devang > I don't know. Devang, you added this code to get llvm to build with LTO, do you remember? Can we just rip it out? From stuart at apple.com Mon Feb 21 15:07:07 2011 From: stuart at apple.com (Stuart Hastings) Date: Mon, 21 Feb 2011 21:07:07 -0000 Subject: [llvm-commits] [llvm] r126141 - /llvm/trunk/lib/MC/MCSectionMachO.cpp Message-ID: <20110221210707.840FC2A6C12C@llvm.org> Author: stuart Date: Mon Feb 21 15:07:07 2011 New Revision: 126141 URL: http://llvm.org/viewvc/llvm-project?rev=126141&view=rev Log: End the line if we return early. Radar 9012638. Modified: llvm/trunk/lib/MC/MCSectionMachO.cpp Modified: llvm/trunk/lib/MC/MCSectionMachO.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionMachO.cpp?rev=126141&r1=126140&r2=126141&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCSectionMachO.cpp (original) +++ llvm/trunk/lib/MC/MCSectionMachO.cpp Mon Feb 21 15:07:07 2011 @@ -108,9 +108,11 @@ if (SectionTypeDescriptors[SectionType].AssemblerName) { OS << ','; OS << SectionTypeDescriptors[SectionType].AssemblerName; - } else + } else { // If we have no name for the attribute, stop here. + OS << '\n'; return; + } // If we don't have any attributes, we're done. unsigned SectionAttrs = TAA & MCSectionMachO::SECTION_ATTRIBUTES; From joerg at britannica.bec.de Mon Feb 21 15:15:23 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Mon, 21 Feb 2011 22:15:23 +0100 Subject: [llvm-commits] Support for fld (%edx) alias for flds Message-ID: <20110221211523.GA18751@britannica.bec.de> Hi all, Bug#8687 is about recognising fld (%edx) as alias for flds (%edx) like GNU as does. The attached patch does that and also adds the usual regression tests. Joerg -------------- next part -------------- A non-text attachment was scrubbed... Name: fld.diff Type: text/x-diff Size: 2316 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110221/2df5d3ab/attachment.bin From scallanan at apple.com Mon Feb 21 15:55:05 2011 From: scallanan at apple.com (Sean Callanan) Date: Mon, 21 Feb 2011 21:55:05 -0000 Subject: [llvm-commits] [llvm] r126147 - in /llvm/trunk/lib/Target/X86/Disassembler: X86Disassembler.cpp X86DisassemblerDecoder.h Message-ID: <20110221215505.AEDE92A6C12C@llvm.org> Author: spyffe Date: Mon Feb 21 15:55:05 2011 New Revision: 126147 URL: http://llvm.org/viewvc/llvm-project?rev=126147&view=rev Log: Fixed a bug in the X86 disassembler where a member of the X86 instruction decode structure was being interpreted as being in units of bits, although it is actually stored in units of bytes. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp?rev=126147&r1=126146&r2=126147&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp Mon Feb 21 15:55:05 2011 @@ -168,16 +168,16 @@ switch (insn.displacementSize) { default: break; - case 8: + case 1: type = TYPE_MOFFS8; break; - case 16: + case 2: type = TYPE_MOFFS16; break; - case 32: + case 4: type = TYPE_MOFFS32; break; - case 64: + case 8: type = TYPE_MOFFS64; break; } Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h?rev=126147&r1=126146&r2=126147&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Mon Feb 21 15:55:05 2011 @@ -399,7 +399,7 @@ /* The segment override type */ SegmentOverride segmentOverride; - /* Sizes of various critical pieces of data */ + /* Sizes of various critical pieces of data, in bytes */ uint8_t registerSize; uint8_t addressSize; uint8_t displacementSize; From nicholas at mxc.ca Mon Feb 21 16:18:36 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 21 Feb 2011 14:18:36 -0800 Subject: [llvm-commits] [llvm] r126124 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp unittests/Transforms/Utils/Local.cpp In-Reply-To: <20110221162737.25AFB2A6C12C@llvm.org> References: <20110221162737.25AFB2A6C12C@llvm.org> Message-ID: <4D62E4BC.7070401@mxc.ca> Duncan Sands wrote: > Author: baldrick > Date: Mon Feb 21 10:27:36 2011 > New Revision: 126124 > > URL: http://llvm.org/viewvc/llvm-project?rev=126124&view=rev > Log: > Simplify RecursivelyDeleteDeadPHINode. The only functionality change > should be that if the phi is used by a side-effect free instruction with > no uses then the phi and the instruction now get zapped (checked by the > unittest). > > Modified: > llvm/trunk/lib/Transforms/Utils/Local.cpp > llvm/trunk/unittests/Transforms/Utils/Local.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=126124&r1=126123&r2=126124&view=diff > ============================================================================== > --- llvm/trunk/lib/Transforms/Utils/Local.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/Local.cpp Mon Feb 21 10:27:36 2011 > @@ -262,12 +262,13 @@ > > /// areAllUsesEqual - Check whether the uses of a value are all the same. > /// This is similar to Instruction::hasOneUse() except this will also return > -/// true when there are multiple uses that all refer to the same value. > +/// true when there are no uses or multiple uses that all refer to the same > +/// value. > static bool areAllUsesEqual(Instruction *I) { > Value::use_iterator UI = I->use_begin(); > Value::use_iterator UE = I->use_end(); > if (UI == UE) > - return false; > + return true; > > User *TheUse = *UI; > for (++UI; UI != UE; ++UI) { > @@ -283,34 +284,21 @@ > /// delete it. If that makes any of its operands trivially dead, delete them > /// too, recursively. Return true if the PHI node is actually deleted. > bool llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) { > - if (PN->use_empty()) { > - PN->eraseFromParent(); > - return true; > - } > - > - // We can remove a PHI if it is on a cycle in the def-use graph > - // where each node in the cycle has degree one, i.e. only one use, > - // and is an instruction with no side effects. > - if (!areAllUsesEqual(PN)) > - return false; > + SmallPtrSet Visited; > + for (Instruction *I = PN; areAllUsesEqual(I)&& !I->mayHaveSideEffects(); > + I = cast(*I->use_begin())) { > + if (I->use_empty()) > + return RecursivelyDeleteTriviallyDeadInstructions(I); > > - bool Changed = false; > - SmallPtrSet PHIs; > - PHIs.insert(PN); > - for (Instruction *I = cast(*PN->use_begin()); > - areAllUsesEqual(I)&& !I->mayHaveSideEffects(); > - I = cast(*I->use_begin())) > - // If we find a PHI more than once, we're on a cycle that > + // If we find an instruction more than once, we're on a cycle that > // won't prove fruitful. > - if (PHINode *IP = dyn_cast(I)) > - if (!PHIs.insert(IP)) { > - // Break the cycle and delete the PHI and its operands. > - IP->replaceAllUsesWith(UndefValue::get(IP->getType())); > - (void)RecursivelyDeleteTriviallyDeadInstructions(IP); > - Changed = true; > - break; > - } > - return Changed; > + if (!Visited.insert(I)) { > + // Break the cycle and delete the instruction and its operands. > + I->replaceAllUsesWith(UndefValue::get(I->getType())); > + return RecursivelyDeleteTriviallyDeadInstructions(I); return RecursivelyDeleteTriviallyDeadInstructions(I) || Changed; ? Nick > + } > + } > + return false; > } > > /// SimplifyInstructionsInBlock - Scan the specified basic block and try to > > Modified: llvm/trunk/unittests/Transforms/Utils/Local.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Utils/Local.cpp?rev=126124&r1=126123&r2=126124&view=diff > ============================================================================== > --- llvm/trunk/unittests/Transforms/Utils/Local.cpp (original) > +++ llvm/trunk/unittests/Transforms/Utils/Local.cpp Mon Feb 21 10:27:36 2011 > @@ -47,6 +47,12 @@ > > EXPECT_TRUE(RecursivelyDeleteDeadPHINode(phi)); > > + builder.SetInsertPoint(bb0); > + phi = builder.CreatePHI(Type::getInt32Ty(C)); > + builder.CreateAdd(phi, phi); > + > + EXPECT_TRUE(RecursivelyDeleteDeadPHINode(phi)); > + > bb0->dropAllReferences(); > bb1->dropAllReferences(); > delete bb0; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From stoklund at 2pi.dk Mon Feb 21 17:09:46 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 21 Feb 2011 23:09:46 -0000 Subject: [llvm-commits] [llvm] r126151 - in /llvm/trunk/lib/CodeGen: RegAllocGreedy.cpp SplitKit.cpp SplitKit.h Message-ID: <20110221230946.8773A2A6C12C@llvm.org> Author: stoklund Date: Mon Feb 21 17:09:46 2011 New Revision: 126151 URL: http://llvm.org/viewvc/llvm-project?rev=126151&view=rev Log: Add SplitKit::isOriginalEndpoint and use it to force live range splitting to terminate. An original endpoint is an instruction that killed or defined the original live range before any live ranges were split. When splitting global live ranges, avoid creating local live ranges without any original endpoints. We may still create global live ranges without original endpoints, but such a range won't be split again, and live range splitting still terminates. 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=126151&r1=126150&r2=126151&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Mon Feb 21 17:09:46 2011 @@ -426,8 +426,13 @@ if (!IntI.valid()) break; // Not live in, but before the first use. - if (IntI.start() < BI.FirstUse) + if (IntI.start() < BI.FirstUse) { BC.Entry = SpillPlacement::PrefSpill; + // If the block contains a kill from an earlier split, never split + // again in the same block. + if (!BI.LiveThrough && !SA->isOriginalEndpoint(BI.Kill)) + BC.Entry = SpillPlacement::MustSpill; + } } // Does interference overlap the uses in the entry segment @@ -458,8 +463,12 @@ IntI.advanceTo(BI.LastUse); if (!IntI.valid()) break; - if (IntI.start() < Stop) + if (IntI.start() < Stop) { BC.Exit = SpillPlacement::PrefSpill; + // Avoid splitting twice in the same block. + if (!BI.LiveThrough && !SA->isOriginalEndpoint(BI.Def)) + BC.Exit = SpillPlacement::MustSpill; + } } } } Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=126151&r1=126150&r2=126151&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Mon Feb 21 17:09:46 2011 @@ -167,6 +167,20 @@ } } +bool SplitAnalysis::isOriginalEndpoint(SlotIndex Idx) const { + unsigned OrigReg = VRM.getOriginal(CurLI->reg); + const LiveInterval &Orig = LIS.getInterval(OrigReg); + assert(!Orig.empty() && "Splitting empty interval?"); + LiveInterval::const_iterator I = Orig.find(Idx); + + // Range containing Idx should begin at Idx. + if (I != Orig.end() && I->start <= Idx) + return I->start == Idx; + + // Range does not contain Idx, previous must end at Idx. + return I != Orig.begin() && (--I)->end == Idx; +} + void SplitAnalysis::print(const BlockPtrSet &B, raw_ostream &OS) const { for (BlockPtrSet::const_iterator I = B.begin(), E = B.end(); I != E; ++I) { unsigned count = UsingBlocks.lookup(*I); Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=126151&r1=126150&r2=126151&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Mon Feb 21 17:09:46 2011 @@ -125,6 +125,13 @@ return UsingBlocks.lookup(MBB); } + /// isOriginalEndpoint - Return true if the original live range was killed or + /// (re-)defined at Idx. Idx should be the 'def' slot for a normal kill/def, + /// and 'use' for an early-clobber def. + /// This can be used to recognize code inserted by earlier live range + /// splitting. + bool isOriginalEndpoint(SlotIndex Idx) const; + typedef SmallPtrSet BlockPtrSet; // Print a set of blocks with use counts. From aggarwa4 at illinois.edu Mon Feb 21 17:20:09 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Mon, 21 Feb 2011 23:20:09 -0000 Subject: [llvm-commits] [poolalloc] r126154 - /poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Message-ID: <20110221232009.39FEF2A6C12C@llvm.org> Author: aggarwa4 Date: Mon Feb 21 17:20:09 2011 New Revision: 126154 URL: http://llvm.org/viewvc/llvm-project?rev=126154&view=rev Log: Use unsigned variable to index arguments. Modified: poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Modified: poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp?rev=126154&r1=126153&r2=126154&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp (original) +++ poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Mon Feb 21 17:20:09 2011 @@ -68,7 +68,7 @@ continue; if(F->getReturnType() != CI->getType()) continue; - int arg_count = 1; + unsigned arg_count = 1; bool change = true; for (Function::arg_iterator ii = F->arg_begin(), ee = F->arg_end();ii != ee; ++ii,arg_count++) { if(ii->getType() != CI->getOperand(arg_count)->getType()) { From dpatel at apple.com Mon Feb 21 17:21:26 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Feb 2011 23:21:26 -0000 Subject: [llvm-commits] [llvm] r126155 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/MBlaze/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ Message-ID: <20110221232127.0138C2A6C12C@llvm.org> Author: dpatel Date: Mon Feb 21 17:21:26 2011 New Revision: 126155 URL: http://llvm.org/viewvc/llvm-project?rev=126155&view=rev Log: Revert r124611 - "Keep track of incoming argument's location while emitting LiveIns." In other words, do not keep track of argument's location. The debugger (gdb) is not prepared to see line table entries for arguments. For the debugger, "second" line table entry marks beginning of function body. This requires some coordination with debugger to get this working. - The debugger needs to be aware of prolog_end attribute attached with line table entries. - The compiler needs to accurately mark prolog_end in line table entries (at -O0 and at -O1+) Removed: llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Feb 21 17:21:26 2011 @@ -281,7 +281,7 @@ /// addLiveIn - Add the specified physical register as a live-in value and /// create a corresponding virtual register for it. - unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC, DebugLoc DL); + unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC); //===--------------------------------------------------------------------===// // BasicBlock accessor functions. Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Mon Feb 21 17:21:26 2011 @@ -17,8 +17,6 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/IndexedMap.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/Support/DebugLoc.h" #include namespace llvm { @@ -66,10 +64,7 @@ /// stored in the second element. std::vector > LiveIns; std::vector LiveOuts; - - /// LiveInLocs - Keep track of location livein registers. - DenseMap LiveInLocs; - + MachineRegisterInfo(const MachineRegisterInfo&); // DO NOT IMPLEMENT void operator=(const MachineRegisterInfo&); // DO NOT IMPLEMENT public: @@ -276,12 +271,7 @@ LiveIns.push_back(std::make_pair(Reg, vreg)); } void addLiveOut(unsigned Reg) { LiveOuts.push_back(Reg); } - - /// addLiveInLoc - Keep track of location info for live in reg. - void addLiveInLoc(unsigned VReg, DebugLoc DL) { - LiveInLocs[VReg] = DL; - } - + // Iteration support for live in/out sets. These sets are kept in sorted // order by their register number. typedef std::vector >::const_iterator Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Feb 21 17:21:26 2011 @@ -396,8 +396,7 @@ /// addLiveIn - Add the specified physical register as a live-in value and /// create a corresponding virtual register for it. unsigned MachineFunction::addLiveIn(unsigned PReg, - const TargetRegisterClass *RC, - DebugLoc DL) { + const TargetRegisterClass *RC) { MachineRegisterInfo &MRI = getRegInfo(); unsigned VReg = MRI.getLiveInVirtReg(PReg); if (VReg) { @@ -406,7 +405,6 @@ } VReg = MRI.createVirtualRegister(RC); MRI.addLiveIn(PReg, VReg); - MRI.addLiveInLoc(VReg, DL); return VReg; } Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Mon Feb 21 17:21:26 2011 @@ -210,15 +210,8 @@ LiveIns.erase(LiveIns.begin() + i); --i; --e; } else { - DebugLoc DL; - // If there is a location for this live in then use it. - DenseMap::iterator DLI = - LiveInLocs.find(LiveIns[i].second); - if (DLI != LiveInLocs.end()) - DL = DLI->second; - // Emit a copy. - BuildMI(*EntryMBB, EntryMBB->begin(), DL, + BuildMI(*EntryMBB, EntryMBB->begin(), DebugLoc(), TII.get(TargetOpcode::COPY), LiveIns[i].second) .addReg(LiveIns[i].first); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Mon Feb 21 17:21:26 2011 @@ -348,7 +348,7 @@ SDValue getControlRoot(); DebugLoc getCurDebugLoc() const { return CurDebugLoc; } - void setCurDebugLoc(DebugLoc dl){ CurDebugLoc = dl; } + unsigned getSDNodeOrder() const { return SDNodeOrder; } void CopyValueToVirtualRegister(const Value *V, unsigned Reg); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 21 17:21:26 2011 @@ -851,17 +851,8 @@ PrepareEHLandingPad(); // Lower any arguments needed in this block if this is the entry block. - if (LLVMBB == &Fn.getEntryBlock()) { - for (BasicBlock::const_iterator DBI = LLVMBB->begin(), DBE = LLVMBB->end(); - DBI != DBE; ++DBI) { - if (const DbgInfoIntrinsic *DI = dyn_cast(DBI)) { - const DebugLoc DL = DI->getDebugLoc(); - SDB->setCurDebugLoc(DL); - break; - } - } + if (LLVMBB == &Fn.getEntryBlock()) LowerArguments(LLVMBB); - } // Before doing SelectionDAG ISel, see if FastISel has been requested. if (FastIS) { Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Feb 21 17:21:26 2011 @@ -2236,7 +2236,7 @@ RC = ARM::GPRRegisterClass; // Transform the arguments stored in physical registers into virtual ones. - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); SDValue ArgValue = DAG.getCopyFromReg(Root, dl, Reg, MVT::i32); SDValue ArgValue2; @@ -2250,7 +2250,7 @@ MachinePointerInfo::getFixedStack(FI), false, false, 0); } else { - Reg = MF.addLiveIn(NextVA.getLocReg(), RC, dl); + Reg = MF.addLiveIn(NextVA.getLocReg(), RC); ArgValue2 = DAG.getCopyFromReg(Root, dl, Reg, MVT::i32); } @@ -2331,7 +2331,7 @@ llvm_unreachable("RegVT not supported by FORMAL_ARGUMENTS Lowering"); // Transform the arguments in physical registers into virtual ones. - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, RegVT); } @@ -2408,7 +2408,7 @@ else RC = ARM::GPRRegisterClass; - unsigned VReg = MF.addLiveIn(GPRArgRegs[NumGPRs], RC, dl); + unsigned VReg = MF.addLiveIn(GPRArgRegs[NumGPRs], RC); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -2897,7 +2897,7 @@ } // Return LR, which contains the return address. Mark it an implicit live-in. - unsigned Reg = MF.addLiveIn(ARM::LR, getRegClassFor(MVT::i32), dl); + unsigned Reg = MF.addLiveIn(ARM::LR, getRegClassFor(MVT::i32)); return DAG.getCopyFromReg(DAG.getEntryNode(), dl, Reg, VT); } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Feb 21 17:21:26 2011 @@ -1219,7 +1219,7 @@ FuncInfo->setVarArgsFrameIndex( MFI->CreateFixedObject(StackSlotSize, ArgOffset, true)); SDValue FIN = DAG.getFrameIndex(FuncInfo->getVarArgsFrameIndex(), PtrVT); - unsigned VReg = MF.addLiveIn(ArgRegs[ArgRegIdx], &SPU::R32CRegClass, dl); + unsigned VReg = MF.addLiveIn(ArgRegs[ArgRegIdx], &SPU::R32CRegClass); SDValue ArgVal = DAG.getRegister(VReg, MVT::v16i8); SDValue Store = DAG.getStore(Chain, dl, ArgVal, FIN, MachinePointerInfo(), false, false, 0); Modified: llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp Mon Feb 21 17:21:26 2011 @@ -907,7 +907,7 @@ // Transform the arguments stored on // physical registers into virtual ones - unsigned Reg = MF.addLiveIn(ArgRegEnd, RC, dl); + unsigned Reg = MF.addLiveIn(ArgRegEnd, RC); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, RegVT); // If this is an 8 or 16-bit value, it has been passed promoted @@ -973,7 +973,7 @@ for (; Start <= End; ++Start, ++StackLoc) { unsigned Reg = MBlazeRegisterInfo::getRegisterFromNumbering(Start); - unsigned LiveReg = MF.addLiveIn(Reg, RC, dl); + unsigned LiveReg = MF.addLiveIn(Reg, RC); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, LiveReg, MVT::i32); int FI = MFI->CreateFixedObject(4, 0, true); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Feb 21 17:21:26 2011 @@ -1597,7 +1597,7 @@ } // Transform the arguments stored in physical registers into virtual ones. - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, ValVT); InVals.push_back(ArgValue); @@ -1689,7 +1689,7 @@ // Get an existing live-in vreg, or add a new one. unsigned VReg = MF.getRegInfo().getLiveInVirtReg(GPArgRegs[GPRIndex]); if (!VReg) - VReg = MF.addLiveIn(GPArgRegs[GPRIndex], &PPC::GPRCRegClass, dl); + VReg = MF.addLiveIn(GPArgRegs[GPRIndex], &PPC::GPRCRegClass); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -1708,7 +1708,7 @@ // Get an existing live-in vreg, or add a new one. unsigned VReg = MF.getRegInfo().getLiveInVirtReg(FPArgRegs[FPRIndex]); if (!VReg) - VReg = MF.addLiveIn(FPArgRegs[FPRIndex], &PPC::F8RCRegClass, dl); + VReg = MF.addLiveIn(FPArgRegs[FPRIndex], &PPC::F8RCRegClass); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::f64); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -1872,7 +1872,7 @@ InVals.push_back(FIN); if (ObjSize==1 || ObjSize==2) { if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getTruncStore(Val.getValue(1), dl, Val, FIN, MachinePointerInfo(), @@ -1891,7 +1891,7 @@ // to memory. ArgVal will be address of the beginning of // the object. if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); int FI = MFI->CreateFixedObject(PtrByteSize, ArgOffset, true); SDValue FIN = DAG.getFrameIndex(FI, PtrVT); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); @@ -1914,7 +1914,7 @@ case MVT::i32: if (!isPPC64) { if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32); ++GPR_idx; } else { @@ -1928,7 +1928,7 @@ // FALLTHROUGH case MVT::i64: // PPC64 if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass, dl); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i64); if (ObjectVT == MVT::i32) { @@ -1966,9 +1966,9 @@ unsigned VReg; if (ObjectVT == MVT::f32) - VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F4RCRegClass, dl); + VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F4RCRegClass); else - VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F8RCRegClass, dl); + VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F8RCRegClass); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, ObjectVT); ++FPR_idx; @@ -1986,7 +1986,7 @@ // Note that vector arguments in registers don't reserve stack space, // except in varargs functions. if (VR_idx != Num_VR_Regs) { - unsigned VReg = MF.addLiveIn(VR[VR_idx], &PPC::VRRCRegClass, dl); + unsigned VReg = MF.addLiveIn(VR[VR_idx], &PPC::VRRCRegClass); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, ObjectVT); if (isVarArg) { while ((ArgOffset % 16) != 0) { @@ -2064,9 +2064,9 @@ unsigned VReg; if (isPPC64) - VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass, dl); + VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass); else - VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); + VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Feb 21 17:21:26 2011 @@ -203,7 +203,7 @@ false, false, 0); } else { unsigned loReg = MF.addLiveIn(NextVA.getLocReg(), - &SP::IntRegsRegClass, dl); + &SP::IntRegsRegClass); LoVal = DAG.getCopyFromReg(Chain, dl, loReg, MVT::i32); } SDValue WholeValue = Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=126155&r1=126154&r2=126155&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 21 17:21:26 2011 @@ -1713,7 +1713,7 @@ else llvm_unreachable("Unknown argument type!"); - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, RegVT); // If this is an 8 or 16-bit value, it is really passed promoted to 32 @@ -1845,7 +1845,7 @@ SDValue FIN = DAG.getNode(ISD::ADD, dl, getPointerTy(), RSFIN, DAG.getIntPtrConstant(Offset)); unsigned VReg = MF.addLiveIn(GPR64ArgRegs[NumIntRegs], - X86::GR64RegisterClass, dl); + X86::GR64RegisterClass); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i64); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -1861,7 +1861,7 @@ SmallVector SaveXMMOps; SaveXMMOps.push_back(Chain); - unsigned AL = MF.addLiveIn(X86::AL, X86::GR8RegisterClass, dl); + unsigned AL = MF.addLiveIn(X86::AL, X86::GR8RegisterClass); SDValue ALVal = DAG.getCopyFromReg(DAG.getEntryNode(), dl, AL, MVT::i8); SaveXMMOps.push_back(ALVal); @@ -1872,7 +1872,7 @@ for (; NumXMMRegs != TotalNumXMMRegs; ++NumXMMRegs) { unsigned VReg = MF.addLiveIn(XMMArgRegs64Bit[NumXMMRegs], - X86::VR128RegisterClass, dl); + X86::VR128RegisterClass); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::v4f32); SaveXMMOps.push_back(Val); } Removed: llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll?rev=126154&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll (original) +++ llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll (removed) @@ -1,84 +0,0 @@ -; RUN: llc < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -target triple = "x86_64-apple-darwin10.0.0" - - at str = internal constant [3 x i8] c"Hi\00" - -define void @foo() nounwind ssp { -entry: - %puts = tail call i32 @puts(i8* getelementptr inbounds ([3 x i8]* @str, i64 0, i64 0)) - ret void, !dbg !17 -} - -; CHECK: arg.c:5:14 - -define i32 @main(i32 %argc, i8** nocapture %argv) nounwind ssp { -entry: - tail call void @llvm.dbg.value(metadata !{i32 %argc}, i64 0, metadata !9), !dbg !19 - tail call void @llvm.dbg.value(metadata !{i8** %argv}, i64 0, metadata !10), !dbg !20 - %cmp = icmp sgt i32 %argc, 1, !dbg !21 - br i1 %cmp, label %cond.end, label %for.body.lr.ph, !dbg !21 - -cond.end: ; preds = %entry - %arrayidx = getelementptr inbounds i8** %argv, i64 1, !dbg !21 - %tmp2 = load i8** %arrayidx, align 8, !dbg !21, !tbaa !22 - %call = tail call i32 (...)* @atoi(i8* %tmp2) nounwind, !dbg !21 - tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !16), !dbg !21 - tail call void @llvm.dbg.value(metadata !25, i64 0, metadata !14), !dbg !26 - %cmp57 = icmp sgt i32 %call, 0, !dbg !26 - br i1 %cmp57, label %for.body.lr.ph, label %for.end, !dbg !26 - -for.body.lr.ph: ; preds = %entry, %cond.end - %cond10 = phi i32 [ %call, %cond.end ], [ 300, %entry ] - br label %for.body - -for.body: ; preds = %for.body, %for.body.lr.ph - %i.08 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ] - %puts.i = tail call i32 @puts(i8* getelementptr inbounds ([3 x i8]* @str, i64 0, i64 0)) nounwind - %inc = add nsw i32 %i.08, 1, !dbg !27 - %exitcond = icmp eq i32 %inc, %cond10 - br i1 %exitcond, label %for.end, label %for.body, !dbg !26 - -for.end: ; preds = %for.body, %cond.end - ret i32 0, !dbg !29 -} - -declare i32 @atoi(...) - -declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone - -declare i32 @puts(i8* nocapture) nounwind - -!llvm.dbg.sp = !{!0, !5} -!llvm.dbg.lv.main = !{!9, !10, !14, !16} - -!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, void ()* @foo} ; [ DW_TAG_subprogram ] -!1 = metadata !{i32 589865, metadata !"arg.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] -!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"arg.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 124504)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] -!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] -!4 = metadata !{null} -!5 = metadata !{i32 589870, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"", metadata !1, i32 6, metadata !6, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32, i8**)* @main} ; [ DW_TAG_subprogram ] -!6 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] -!7 = metadata !{metadata !8} -!8 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] -!9 = metadata !{i32 590081, metadata !5, metadata !"argc", metadata !1, i32 5, metadata !8, i32 0} ; [ DW_TAG_arg_variable ] -!10 = metadata !{i32 590081, metadata !5, metadata !"argv", metadata !1, i32 5, metadata !11, i32 0} ; [ DW_TAG_arg_variable ] -!11 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !12} ; [ DW_TAG_pointer_type ] -!12 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !13} ; [ DW_TAG_pointer_type ] -!13 = metadata !{i32 589860, metadata !2, metadata !"char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] -!14 = metadata !{i32 590080, metadata !15, metadata !"i", metadata !1, i32 7, metadata !8, i32 0} ; [ DW_TAG_auto_variable ] -!15 = metadata !{i32 589835, metadata !5, i32 6, i32 1, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] -!16 = metadata !{i32 590080, metadata !15, metadata !"iterations", metadata !1, i32 8, metadata !8, i32 0} ; [ DW_TAG_auto_variable ] -!17 = metadata !{i32 4, i32 1, metadata !18, null} -!18 = metadata !{i32 589835, metadata !0, i32 2, i32 12, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] -!19 = metadata !{i32 5, i32 14, metadata !5, null} -!20 = metadata !{i32 5, i32 26, metadata !5, null} -!21 = metadata !{i32 8, i32 51, metadata !15, null} -!22 = metadata !{metadata !"any pointer", metadata !23} -!23 = metadata !{metadata !"omnipotent char", metadata !24} -!24 = metadata !{metadata !"Simple C/C++ TBAA", null} -!25 = metadata !{i32 0} -!26 = metadata !{i32 9, i32 2, metadata !15, null} -!27 = metadata !{i32 9, i32 30, metadata !28, null} -!28 = metadata !{i32 589835, metadata !15, i32 9, i32 2, metadata !1, i32 2} ; [ DW_TAG_lexical_block ] -!29 = metadata !{i32 12, i32 9, metadata !15, null} From aggarwa4 at illinois.edu Mon Feb 21 17:22:03 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Mon, 21 Feb 2011 23:22:03 -0000 Subject: [llvm-commits] [poolalloc] r126156 - in /poolalloc/trunk/test: TEST.types.Makefile TEST.types.report Message-ID: <20110221232203.B2A1C2A6C12C@llvm.org> Author: aggarwa4 Date: Mon Feb 21 17:22:03 2011 New Revision: 126156 URL: http://llvm.org/viewvc/llvm-project?rev=126156&view=rev Log: More stats. Modified: poolalloc/trunk/test/TEST.types.Makefile poolalloc/trunk/test/TEST.types.report Modified: poolalloc/trunk/test/TEST.types.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.Makefile?rev=126156&r1=126155&r2=126156&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.Makefile (original) +++ poolalloc/trunk/test/TEST.types.Makefile Mon Feb 21 17:22:03 2011 @@ -13,6 +13,9 @@ # Pathname to poolalloc object tree PADIR := $(LLVM_OBJ_ROOT)/projects/poolalloc +# Bits of runtime to improve analysis +PA_PRE_RT := $(PADIR)/$(CONFIGURATION)/lib/libpa_pre_rt.bca + # Pathame to the DSA pass dynamic library DSA_SO := $(PADIR)/$(CONFIGURATION)/lib/libLLVMDataStructure$(SHLIBEXT) ASSIST_SO := $(PADIR)/$(CONFIGURATION)/lib/libAssistDS$(SHLIBEXT) @@ -38,8 +41,16 @@ Output/%.llvm1.bc: Output/%.linked1.bc $(LLVM_LDDPROG) -$(RUNTOOLSAFELY) $(LLVMLD) -disable-opt $(SAFE_OPTS) -info-output-file=$(CURDIR)/$@.info -stats -time-passes $(LLVMLD_FLAGS) $< -lc $(LIBS) -o Output/$*.llvm1 +$(PROGRAMS_TO_TEST:%=Output/%.temp1.bc): \ +Output/%.temp1.bc: Output/%.llvm1.bc + -$(RUNTOOLSAFELY) $(LLVMLD) -disable-opt $(SAFE_OPTS) -link-as-library $< $(PA_PRE_RT) -o $@ + $(PROGRAMS_TO_TEST:%=Output/%.opt.bc): \ Output/%.opt.bc: Output/%.llvm1.bc $(LOPT) $(ASSIST_SO) + -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -simplifygep -die -mergegep -die -globaldce -simplifycfg -deadargelim -arg-simplify -varargsfunc -deadargelim -globaldce -die -simplifycfg -stats -time-passes $< -f -o $@ + +$(PROGRAMS_TO_TEST:%=Output/%.temp2.bc): \ +Output/%.temp2.bc: Output/%.temp1.bc $(LOPT) $(ASSIST_SO) -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -mergegep -die -globaldce -stats -time-passes $< -f -o $@ $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ @@ -108,6 +119,12 @@ @/bin/echo -n "STD_LIB_FOLD: " >> $@ - at grep 'Number of nodes folded in std lib' $@.time.1 >> $@ @echo >> $@ + @/bin/echo -n "I2PB: " >> $@ + - at grep 'Number of inttoptr used only in cmp' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "I2PS: " >> $@ + - at grep 'Number of inttoptr from ptrtoint' $@.time.1 >> $@ + @echo >> $@ @# Emit timing data. @/bin/echo -n "TIME: " >> $@ - at grep ' Local Data Structure' $@.time.1 >> $@ @@ -128,6 +145,9 @@ @/bin/echo -n "VARARGS_CALLS: " >> $@ - at grep 'Number of Calls Simplified' $<.info >> $@ @echo >> $@ + @/bin/echo -n "ARG_SMPL: " >> $@ + - at grep 'Number of Args changeable' $<.info >> $@ + @echo >> $@ @/bin/echo -n "CALLS1: " >> $@ - at grep 'Number of calls that could not be resolved' $@.time.1 >> $@ @echo >> $@ Modified: poolalloc/trunk/test/TEST.types.report URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.report?rev=126156&r1=126155&r2=126156&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.report (original) +++ poolalloc/trunk/test/TEST.types.report Mon Feb 21 17:22:03 2011 @@ -160,8 +160,11 @@ # Nodes Folded [], ["VAFUNC", "VARARGS_CALLS: *([0-9]+)"], + ["ARGSMPL", "ARG_SMPL: *([0-9]+)"], ["FUNCSPEC", "CLONED_FUNCSPEC: *([0-9]+)"], ["INDCLONE", "CLONED_INDCLONE: *([0-9]+)"], ["StdLibFold", "STD_LIB_FOLD: *([0-9]+)"], + ["I2PB", "I2PB: *([0-9]+)"], + ["I2PS", "I2PS: *([0-9]+)"], ["Calls", "CALLS1: *([0-9]+)"], ); From joerg at bec.de Mon Feb 21 17:25:42 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Mon, 21 Feb 2011 23:25:42 -0000 Subject: [llvm-commits] [llvm] r126157 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp test/MC/ELF/relocation-pc.s Message-ID: <20110221232542.2B4A32A6C12C@llvm.org> Author: joerg Date: Mon Feb 21 17:25:41 2011 New Revision: 126157 URL: http://llvm.org/viewvc/llvm-project?rev=126157&view=rev Log: Handle FK_PCRel_1 and add a test case for this and FK_PCRel_4. Added: llvm/trunk/test/MC/ELF/relocation-pc.s Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=126157&r1=126156&r2=126157&view=diff ============================================================================== --- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Feb 21 17:25:41 2011 @@ -1732,6 +1732,10 @@ assert(Modifier == MCSymbolRefExpr::VK_None); Type = ELF::R_X86_64_PC16; break; + case FK_PCRel_1: + assert(Modifier == MCSymbolRefExpr::VK_None); + Type = ELF::R_X86_64_PC8; + break; } } else { switch ((unsigned)Fixup.getKind()) { Added: llvm/trunk/test/MC/ELF/relocation-pc.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-pc.s?rev=126157&view=auto ============================================================================== --- llvm/trunk/test/MC/ELF/relocation-pc.s (added) +++ llvm/trunk/test/MC/ELF/relocation-pc.s Mon Feb 21 17:25:41 2011 @@ -0,0 +1,33 @@ +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s + +// Test that we produce the correct relocation. + + loope 0 # R_X86_64_PC8 + jmp -256 # R_X86_64_PC32 + +// CHECK: # Section 0x00000007 +// CHECK-NEXT: (('sh_name', 0x0000002c) # '.rela.text' +// CHECK-NEXT: ('sh_type', 0x00000004) +// CHECK-NEXT: ('sh_flags', 0x00000000) +// CHECK-NEXT: ('sh_addr', 0x00000000) +// CHECK-NEXT: ('sh_offset', 0x000000e8) +// CHECK-NEXT: ('sh_size', 0x00000030) +// CHECK-NEXT: ('sh_link', 0x00000005) +// CHECK-NEXT: ('sh_info', 0x00000001) +// CHECK-NEXT: ('sh_addralign', 0x00000008) +// CHECK-NEXT: ('sh_entsize', 0x00000018) +// CHECK-NEXT: ('_relocations', [ +// CHECK-NEXT: # Relocation 0x00000000 +// CHECK-NEXT: (('r_offset', 0x00000001) +// CHECK-NEXT: ('r_sym', 0x00000000) +// CHECK-NEXT: ('r_type', 0x0000000f) +// CHECK-NEXT: ('r_addend', 0x00000000) +// CHECK-NEXT: ), +// CHECK-NEXT: # Relocation 0x00000001 +// CHECK-NEXT: (('r_offset', 0x00000003) +// CHECK-NEXT: ('r_sym', 0x00000000) +// CHECK-NEXT: ('r_type', 0x00000002) +// CHECK-NEXT: ('r_addend', 0x00000000) +// CHECK-NEXT: ), +// CHECK-NEXT: ]) +// CHECK-NEXT: ), From evan.cheng at apple.com Mon Feb 21 17:39:48 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Feb 2011 23:39:48 -0000 Subject: [llvm-commits] [llvm] r126158 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp Message-ID: <20110221233948.631CD2A6C12C@llvm.org> Author: evancheng Date: Mon Feb 21 17:39:48 2011 New Revision: 126158 URL: http://llvm.org/viewvc/llvm-project?rev=126158&view=rev Log: Add more debugging output. Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=126158&r1=126157&r2=126158&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Mon Feb 21 17:39:48 2011 @@ -501,10 +501,11 @@ MachineBasicBlock *SuccBB, MachineBasicBlock *PredBB) { CommonTailLen = ComputeCommonTailLength(MBB1, MBB2, I1, I2); - MachineFunction *MF = MBB1->getParent(); - if (CommonTailLen == 0) return false; + DEBUG(dbgs() << "Common tail length of BB#" << MBB1->getNumber() + << " and BB#" << MBB2->getNumber() << " is " << CommonTailLen + << '\n'); // It's almost always profitable to merge any number of non-terminator // instructions with the block that falls through into the common successor. @@ -541,6 +542,7 @@ // we don't have to split a block. At worst we will be introducing 1 new // branch instruction, which is likely to be smaller than the 2 // instructions that would be deleted in the merge. + MachineFunction *MF = MBB1->getParent(); if (EffectiveTailLen >= 2 && MF->getFunction()->hasFnAttr(Attribute::OptimizeForSize) && (I1 == MBB1->begin() || I2 == MBB2->begin())) From evan.cheng at apple.com Mon Feb 21 17:40:48 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Feb 2011 23:40:48 -0000 Subject: [llvm-commits] [llvm] r126159 - /llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Message-ID: <20110221234048.200342A6C12C@llvm.org> Author: evancheng Date: Mon Feb 21 17:40:47 2011 New Revision: 126159 URL: http://llvm.org/viewvc/llvm-project?rev=126159&view=rev Log: Skipping over debugvalue instructions to determine whether the split spot is in a IT block. rdar://9030770 Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=126159&r1=126158&r2=126159&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Mon Feb 21 17:40:47 2011 @@ -95,6 +95,9 @@ bool Thumb2InstrInfo::isLegalToSplitMBBAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const { + while (MBBI->isDebugValue()) + ++MBBI; + unsigned PredReg = 0; return llvm::getITInstrPredicate(MBBI, PredReg) == ARMCC::AL; } From rafael.espindola at gmail.com Mon Feb 21 17:54:53 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Mon, 21 Feb 2011 18:54:53 -0500 Subject: [llvm-commits] [lto][patch] Remove weak attempt of tracking symbols defined in module level assembly In-Reply-To: <7096E2BD-667F-4947-84F7-B62DDC4A1306@apple.com> References: <4D604EBE.4050807@gmail.com> <4D607DDA.6040102@gmail.com> <44FEF8AD-1BAA-4457-A8FD-F39BD58937ED@apple.com> <7096E2BD-667F-4947-84F7-B62DDC4A1306@apple.com> Message-ID: <4D62FB4D.8010605@gmail.com> On 2011-02-21 14:46, Devang Patel wrote: > > On Feb 20, 2011, at 10:40 AM, Chris Lattner wrote: > >> On Feb 19, 2011, at 6:35 PM, Rafael ?vila de Esp?ndola wrote: >> >>>> I agree that the heuristic is a gross hack, but this will >>>> break building llvm itself with LTO, since the JIT defines a >>>> symbol (for the compilation callback) in file scope inline >>>> asm. >>> >>> Why would this break the build? If a symbol is not present in the >>> IL but shows up in the final .o produce by LTO, the linker should >>> still put in in the binary. > > If linker runs its own dead code strip pass then it may rip this out > unless it is informed about it in advance. Usually, linker keeps > track of symbols not to through out and everything else disappears. > > This patch may not be the most elegant, but if a linker queries about > symbols defined in a llvm::Module then that query should > appropriately include module asm symbols such that the linker can > make sense of their names. OK, so it is a limitation of the Apple linker. Given that this produces wrong (and more confusing) results in the example I posted, would it be OK for this to be conditional on a Mach-O target until we switch libLTO to use MC? > - Devang > Cheers, Rafael From echristo at apple.com Mon Feb 21 17:52:19 2011 From: echristo at apple.com (Eric Christopher) Date: Mon, 21 Feb 2011 23:52:19 -0000 Subject: [llvm-commits] [llvm] r126163 - in /llvm/trunk: lib/CodeGen/TargetLoweringObjectFileImpl.cpp test/CodeGen/X86/non-globl-eh-frame.ll Message-ID: <20110221235219.E5ED22A6C12C@llvm.org> Author: echristo Date: Mon Feb 21 17:52:19 2011 New Revision: 126163 URL: http://llvm.org/viewvc/llvm-project?rev=126163&view=rev Log: Revert r125960, it's breaking darwin10 bootstrap. Removed: llvm/trunk/test/CodeGen/X86/non-globl-eh-frame.ll Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=126163&r1=126162&r2=126163&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon Feb 21 17:52:19 2011 @@ -441,11 +441,15 @@ Triple T(((LLVMTargetMachine&)TM).getTargetTriple()); if (T.getOS() == Triple::Darwin) { - unsigned MajNum = T.getDarwinMajorNumber(); - if (MajNum == 7 || MajNum == 8) // 10.3 Panther, 10.4 Tiger + switch (T.getDarwinMajorNumber()) { + case 7: // 10.3 Panther. + case 8: // 10.4 Tiger. CommDirectiveSupportsAlignment = false; - if (MajNum > 9) // 10.6 SnowLeopard - IsFunctionEHSymbolGlobal = false; + break; + case 9: // 10.5 Leopard. + case 10: // 10.6 SnowLeopard. + break; + } } TargetLoweringObjectFile::Initialize(Ctx, TM); Removed: llvm/trunk/test/CodeGen/X86/non-globl-eh-frame.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/non-globl-eh-frame.ll?rev=126162&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/non-globl-eh-frame.ll (original) +++ llvm/trunk/test/CodeGen/X86/non-globl-eh-frame.ll (removed) @@ -1,24 +0,0 @@ -; RUN: llc < %s -mtriple x86_64-apple-darwin10 -march x86 | not grep {{.globl\[\[:space:\]\]*__Z4funcv.eh}} -; RUN: llc < %s -mtriple x86_64-apple-darwin9 -march x86 | FileCheck %s -check-prefix=DARWIN9 - -%struct.__pointer_type_info_pseudo = type { %struct.__type_info_pseudo, i32, %"struct.std::type_info"* } -%struct.__type_info_pseudo = type { i8*, i8* } -%"struct.std::type_info" = type opaque - - at .str = private constant [12 x i8] c"hello world\00", align 1 - at _ZTIPc = external constant %struct.__pointer_type_info_pseudo - -define void @_Z4funcv() noreturn optsize ssp { -entry: - %0 = tail call i8* @__cxa_allocate_exception(i64 8) nounwind - %1 = bitcast i8* %0 to i8** - store i8* getelementptr inbounds ([12 x i8]* @.str, i64 0, i64 0), i8** %1, align 8 - tail call void @__cxa_throw(i8* %0, i8* bitcast (%struct.__pointer_type_info_pseudo* @_ZTIPc to i8*), void (i8*)* null) noreturn - unreachable -} - -; DARWIN9: .globl __Z4funcv.eh - -declare i8* @__cxa_allocate_exception(i64) nounwind - -declare void @__cxa_throw(i8*, i8*, void (i8*)*) noreturn From dpatel at apple.com Mon Feb 21 18:01:17 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Feb 2011 16:01:17 -0800 Subject: [llvm-commits] [lto][patch] Remove weak attempt of tracking symbols defined in module level assembly In-Reply-To: <4D62FB4D.8010605@gmail.com> References: <4D604EBE.4050807@gmail.com> <4D607DDA.6040102@gmail.com> <44FEF8AD-1BAA-4457-A8FD-F39BD58937ED@apple.com> <7096E2BD-667F-4947-84F7-B62DDC4A1306@apple.com> <4D62FB4D.8010605@gmail.com> Message-ID: <09C46774-7E09-4421-AFBA-FA6A4AFC8612@apple.com> On Feb 21, 2011, at 3:54 PM, Rafael ?vila de Esp?ndola wrote: > On 2011-02-21 14:46, Devang Patel wrote: >> >> On Feb 20, 2011, at 10:40 AM, Chris Lattner wrote: >> >>> On Feb 19, 2011, at 6:35 PM, Rafael ?vila de Esp?ndola wrote: >>> >>>>> I agree that the heuristic is a gross hack, but this will >>>>> break building llvm itself with LTO, since the JIT defines a >>>>> symbol (for the compilation callback) in file scope inline >>>>> asm. >>>> >>>> Why would this break the build? If a symbol is not present in the >>>> IL but shows up in the final .o produce by LTO, the linker should >>>> still put in in the binary. >> >> If linker runs its own dead code strip pass then it may rip this out >> unless it is informed about it in advance. Usually, linker keeps >> track of symbols not to through out and everything else disappears. >> >> This patch may not be the most elegant, but if a linker queries about >> symbols defined in a llvm::Module then that query should >> appropriately include module asm symbols such that the linker can >> make sense of their names. > > OK, so it is a limitation of the Apple linker. I may have missed some context here, but why is it a bug anywhere to include asm global in symbols list ? The symbols list is the list of the symbols linker would normally find in .o file if LTO is not used. - Devang > > Given that this produces wrong (and more confusing) results in the > example I posted, would it be OK for this to be conditional on a Mach-O > target until we switch libLTO to use MC? > >> - Devang >> > > Cheers, > Rafael From rafael.espindola at gmail.com Mon Feb 21 18:07:36 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Mon, 21 Feb 2011 19:07:36 -0500 Subject: [llvm-commits] [lto][patch] Remove weak attempt of tracking symbols defined in module level assembly In-Reply-To: <09C46774-7E09-4421-AFBA-FA6A4AFC8612@apple.com> References: <4D604EBE.4050807@gmail.com> <4D607DDA.6040102@gmail.com> <44FEF8AD-1BAA-4457-A8FD-F39BD58937ED@apple.com> <7096E2BD-667F-4947-84F7-B62DDC4A1306@apple.com> <4D62FB4D.8010605@gmail.com> <09C46774-7E09-4421-AFBA-FA6A4AFC8612@apple.com> Message-ID: <4D62FE48.4030605@gmail.com> > I may have missed some context here, but why is it a bug anywhere to > include asm global in symbols list ? The symbols list is the list of > the symbols linker would normally find in .o file if LTO is not > used. It is not a bug to include it, if the included symbol is correct :-) In a build of firefox I was seeing symbols whose names would start with a tab. A reduced testcase is module asm "\09.if\093 < 10" module asm "\09.globl\09_ZN14nsXPTCStubBase5Stub3Ev" module asm "\09.endif" While we can always push the hack a bit further, I don't see a way to get this right in general other then using MC. Since that is more work than I can do right now and since the hack doesn't add a lot of value on ELF, I would like to disable it for now unless we have a Mach-O target. > - Devang Cheers, Rafael From clattner at apple.com Mon Feb 21 18:16:30 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Feb 2011 16:16:30 -0800 Subject: [llvm-commits] [llvm] r126147 - in /llvm/trunk/lib/Target/X86/Disassembler: X86Disassembler.cpp X86DisassemblerDecoder.h In-Reply-To: <20110221215505.AEDE92A6C12C@llvm.org> References: <20110221215505.AEDE92A6C12C@llvm.org> Message-ID: On Feb 21, 2011, at 1:55 PM, Sean Callanan wrote: > Author: spyffe > Date: Mon Feb 21 15:55:05 2011 > New Revision: 126147 > > URL: http://llvm.org/viewvc/llvm-project?rev=126147&view=rev > Log: > Fixed a bug in the X86 disassembler where a member of the > X86 instruction decode structure was being interpreted as > being in units of bits, although it is actually stored in > units of bytes. Hi Sean, Please add a testcase to llvm/test/MC/Disassembler/X86/ -Chris > > Modified: > llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp > llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h > > Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp?rev=126147&r1=126146&r2=126147&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp (original) > +++ llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp Mon Feb 21 15:55:05 2011 > @@ -168,16 +168,16 @@ > switch (insn.displacementSize) { > default: > break; > - case 8: > + case 1: > type = TYPE_MOFFS8; > break; > - case 16: > + case 2: > type = TYPE_MOFFS16; > break; > - case 32: > + case 4: > type = TYPE_MOFFS32; > break; > - case 64: > + case 8: > type = TYPE_MOFFS64; > break; > } > > Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h?rev=126147&r1=126146&r2=126147&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h (original) > +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Mon Feb 21 15:55:05 2011 > @@ -399,7 +399,7 @@ > /* The segment override type */ > SegmentOverride segmentOverride; > > - /* Sizes of various critical pieces of data */ > + /* Sizes of various critical pieces of data, in bytes */ > uint8_t registerSize; > uint8_t addressSize; > uint8_t displacementSize; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Feb 21 18:18:35 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Feb 2011 16:18:35 -0800 Subject: [llvm-commits] Support for fld (%edx) alias for flds In-Reply-To: <20110221211523.GA18751@britannica.bec.de> References: <20110221211523.GA18751@britannica.bec.de> Message-ID: On Feb 21, 2011, at 1:15 PM, Joerg Sonnenberger wrote: > Hi all, > Bug#8687 is about recognising > fld (%edx) > as alias for > flds (%edx) > like GNU as does. The attached patch does that and also adds the usual > regression tests. Hi Joerg, This is a case where we are intentionally differing from GAS, since GAS's behavior here is nonsensical. GAS also accepts things like "add $4, (%rax)". Randomly picking a size for an ambiguous instruction is not a good idea when it affects the semantics of the instruction. -Chris From clattner at apple.com Mon Feb 21 18:19:49 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Feb 2011 16:19:49 -0800 Subject: [llvm-commits] [lto][patch] Remove weak attempt of tracking symbols defined in module level assembly In-Reply-To: <4D62FB4D.8010605@gmail.com> References: <4D604EBE.4050807@gmail.com> <4D607DDA.6040102@gmail.com> <44FEF8AD-1BAA-4457-A8FD-F39BD58937ED@apple.com> <7096E2BD-667F-4947-84F7-B62DDC4A1306@apple.com> <4D62FB4D.8010605@gmail.com> Message-ID: <9EC3D60E-8D7B-4D5B-8345-F87B71DF239E@apple.com> On Feb 21, 2011, at 3:54 PM, Rafael ?vila de Esp?ndola wrote: >> This patch may not be the most elegant, but if a linker queries about >> symbols defined in a llvm::Module then that query should >> appropriately include module asm symbols such that the linker can >> make sense of their names. > > OK, so it is a limitation of the Apple linker. > > Given that this produces wrong (and more confusing) results in the > example I posted, would it be OK for this to be conditional on a Mach-O > target until we switch libLTO to use MC? Yes, that's fine with me. -Chris From grosbach at apple.com Mon Feb 21 18:38:35 2011 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 21 Feb 2011 16:38:35 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110217000959.GD23813@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> <20110217000959.GD23813@britannica.bec.de> Message-ID: <89935293-B95C-4FD0-ACF4-52ADA584A652@apple.com> On Feb 16, 2011, at 4:09 PM, Joerg Sonnenberger wrote: > On Wed, Feb 16, 2011 at 01:55:20PM -0800, Jim Grosbach wrote: >> Brackets have well-defined meaning in lots of asm dialects (memory references, etc). Overloading that to mean something else in expressions is dubious at best. >> >> For example, >> ldr r0, [r5] >> >> Is that an expression referring to a symbol named r5, or is it an indirect memory reference via register 5? > > How is > ldr r0, (r5) > interpreted in this context? AT&T syntax for x86 and quite a few other > platforms consider those to be equivalent. That's an expression for ARM. What x86 does isn't really relevant in this context, as ARM assembly syntax has little to do with x86. -Jim ps., please CC me, not just respond to the list. Otherwise it's not unlikely I'll miss responses. From rafael.espindola at gmail.com Mon Feb 21 18:35:18 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 22 Feb 2011 00:35:18 -0000 Subject: [llvm-commits] [llvm] r126165 - in /llvm/trunk: lib/Target/X86/X86InstrFormats.td lib/Target/X86/X86InstrInfo.h lib/Target/X86/X86InstrSystem.td lib/Target/X86/X86MCCodeEmitter.cpp test/MC/X86/x86-64.s utils/TableGen/X86RecognizableInstr.cpp Message-ID: <20110222003518.E1D8D2A6C12C@llvm.org> Author: rafael Date: Mon Feb 21 18:35:18 2011 New Revision: 126165 URL: http://llvm.org/viewvc/llvm-project?rev=126165&view=rev Log: Implement xgetbv and xsetbv. Patch by Jai Menon. Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/lib/Target/X86/X86InstrSystem.td llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp llvm/trunk/test/MC/X86/x86-64.s llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=126165&r1=126164&r2=126165&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Mon Feb 21 18:35:18 2011 @@ -41,6 +41,8 @@ def MRM_F9 : Format<42>; def RawFrmImm8 : Format<43>; def RawFrmImm16 : Format<44>; +def MRM_D0 : Format<45>; +def MRM_D1 : Format<46>; // ImmType - This specifies the immediate type used by an instruction. This is // part of the ad-hoc solution used to emit machine instruction encodings by our Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=126165&r1=126164&r2=126165&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Mon Feb 21 18:35:18 2011 @@ -311,6 +311,8 @@ MRM_F0 = 40, MRM_F8 = 41, MRM_F9 = 42, + MRM_D0 = 45, + MRM_D1 = 46, /// RawFrmImm8 - This is used for the ENTER instruction, which has two /// immediates, the first of which is a 16-bit immediate (specified by @@ -577,6 +579,8 @@ case X86II::MRM_F0: case X86II::MRM_F8: case X86II::MRM_F9: + case X86II::MRM_D0: + case X86II::MRM_D1: return -1; } } Modified: llvm/trunk/lib/Target/X86/X86InstrSystem.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSystem.td?rev=126165&r1=126164&r2=126165&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSystem.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSystem.td Mon Feb 21 18:35:18 2011 @@ -388,3 +388,8 @@ def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB; def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", []>, TB; +let Defs = [RDX, RAX], Uses = [RCX] in + def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB; + +let Uses = [RDX, RAX, RCX] in + def XSETBV : I<0x01, MRM_D1, (outs), (ins), "xsetbv", []>, TB; Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=126165&r1=126164&r2=126165&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Mon Feb 21 18:35:18 2011 @@ -979,6 +979,14 @@ EmitByte(BaseOpcode, CurByte, OS); EmitByte(0xF9, CurByte, OS); break; + case X86II::MRM_D0: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xD0, CurByte, OS); + break; + case X86II::MRM_D1: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xD1, CurByte, OS); + break; } // If there is a remaining operand, it must be a trailing immediate. Emit it Modified: llvm/trunk/test/MC/X86/x86-64.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-64.s?rev=126165&r1=126164&r2=126165&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86-64.s (original) +++ llvm/trunk/test/MC/X86/x86-64.s Mon Feb 21 18:35:18 2011 @@ -942,3 +942,7 @@ // PR8946 movdqu %xmm0, %xmm1 // CHECK: movdqu %xmm0, %xmm1 # encoding: [0xf3,0x0f,0x6f,0xc8] + +// PR8935 +xgetbv // CHECK: xgetbv # encoding: [0x0f,0x01,0xd0] +xsetbv // CHECK: xsetbv # encoding: [0x0f,0x01,0xd1] Modified: llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp?rev=126165&r1=126164&r2=126165&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp (original) +++ llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Mon Feb 21 18:35:18 2011 @@ -34,7 +34,9 @@ MAP(E8, 39) \ MAP(F0, 40) \ MAP(F8, 41) \ - MAP(F9, 42) + MAP(F9, 42) \ + MAP(D0, 45) \ + MAP(D1, 46) // A clone of X86 since we can't depend on something that is generated. namespace X86Local { From dpatel at apple.com Mon Feb 21 18:43:31 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Feb 2011 16:43:31 -0800 Subject: [llvm-commits] [lto][patch] Remove weak attempt of tracking symbols defined in module level assembly In-Reply-To: <4D62FE48.4030605@gmail.com> References: <4D604EBE.4050807@gmail.com> <4D607DDA.6040102@gmail.com> <44FEF8AD-1BAA-4457-A8FD-F39BD58937ED@apple.com> <7096E2BD-667F-4947-84F7-B62DDC4A1306@apple.com> <4D62FB4D.8010605@gmail.com> <09C46774-7E09-4421-AFBA-FA6A4AFC8612@apple.com> <4D62FE48.4030605@gmail.com> Message-ID: On Feb 21, 2011, at 4:07 PM, Rafael ?vila de Esp?ndola wrote: >> I may have missed some context here, but why is it a bug anywhere to >> include asm global in symbols list ? The symbols list is the list of >> the symbols linker would normally find in .o file if LTO is not >> used. > > It is not a bug to include it, if the included symbol is correct :-) > > In a build of firefox I was seeing symbols whose names would start with > a tab. A reduced testcase is > > module asm "\09.if\093 < 10" > module asm "\09.globl\09_ZN14nsXPTCStubBase5Stub3Ev" > module asm "\09.endif" > > While we can always push the hack a bit further, I don't see a way to > get this right in general other then using MC. Since that is more work > than I can do right now and since the hack doesn't add a lot of value on > ELF, I would like to disable it for now unless we have a Mach-O target. Ok. - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110221/2264fcd1/attachment.html From grosbach at apple.com Mon Feb 21 18:43:34 2011 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 21 Feb 2011 16:43:34 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110217000829.GC23813@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> <4D5C5CD0.1080703@gmail.com> <20110217000829.GC23813@britannica.bec.de> Message-ID: <7D36755B-29D2-470C-BA6B-7769705259A0@apple.com> On Feb 16, 2011, at 4:08 PM, Joerg Sonnenberger wrote: > >> Joerg, how common are assembly files with [] in them? If common, can you >> code a patch making [] conditional on x86(-64) ELF? > > Why not just make the function virtual and let platforms that can't > accept the default behavior overwrite it? I actually think that quite a > few platforms GNU as support don't distinguish between [] and () as the > patch implements. That's mandating opt-out from all targets that don't want the behavior, which is the opposite of how this sort of thing should be. The default behaviour should be those bits that all targets want. If there's additional stuff necessary for a target, that logic should be specific for the targets that want it. -Jim From joerg at bec.de Mon Feb 21 18:43:07 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Tue, 22 Feb 2011 00:43:07 -0000 Subject: [llvm-commits] [llvm] r126168 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td test/MC/X86/x86-32.s test/MC/X86/x86-64.s Message-ID: <20110222004307.856002A6C12C@llvm.org> Author: joerg Date: Mon Feb 21 18:43:07 2011 New Revision: 126168 URL: http://llvm.org/viewvc/llvm-project?rev=126168&view=rev Log: Recognize loopz and loopnz as aliases for loope and loopne. >From Dimitry Andric. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/test/MC/X86/x86-32.s llvm/trunk/test/MC/X86/x86-64.s Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=126168&r1=126167&r2=126168&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Mon Feb 21 18:43:07 2011 @@ -1296,6 +1296,9 @@ def : MnemonicAlias<"leavel", "leave">, Requires<[In32BitMode]>; def : MnemonicAlias<"leaveq", "leave">, Requires<[In64BitMode]>; +def : MnemonicAlias<"loopz", "loope">; +def : MnemonicAlias<"loopnz", "loopne">; + def : MnemonicAlias<"pop", "popl">, Requires<[In32BitMode]>; def : MnemonicAlias<"pop", "popq">, Requires<[In64BitMode]>; def : MnemonicAlias<"popf", "popfl">, Requires<[In32BitMode]>; Modified: llvm/trunk/test/MC/X86/x86-32.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-32.s?rev=126168&r1=126167&r2=126168&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86-32.s (original) +++ llvm/trunk/test/MC/X86/x86-32.s Mon Feb 21 18:43:07 2011 @@ -808,3 +808,11 @@ // CHECK: ud2b // CHECK: encoding: [0x0f,0xb9] ud2b + +// CHECK: loope 0 +// CHECK: encoding: [0xe1,A] + loopz 0 + +// CHECK: loopne 0 +// CHECK: encoding: [0xe0,A] + loopnz 0 Modified: llvm/trunk/test/MC/X86/x86-64.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-64.s?rev=126168&r1=126167&r2=126168&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86-64.s (original) +++ llvm/trunk/test/MC/X86/x86-64.s Mon Feb 21 18:43:07 2011 @@ -946,3 +946,11 @@ // PR8935 xgetbv // CHECK: xgetbv # encoding: [0x0f,0x01,0xd0] xsetbv // CHECK: xsetbv # encoding: [0x0f,0x01,0xd1] + +// CHECK: loope 0 +// CHECK: encoding: [0xe1,A] + loopz 0 + +// CHECK: loopne 0 +// CHECK: encoding: [0xe0,A] + loopnz 0 From zwarich at apple.com Mon Feb 21 18:46:22 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Tue, 22 Feb 2011 00:46:22 -0000 Subject: [llvm-commits] [llvm] r126169 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <20110222004622.3F9352A6C12D@llvm.org> Author: zwarich Date: Mon Feb 21 18:46:22 2011 New Revision: 126169 URL: http://llvm.org/viewvc/llvm-project?rev=126169&view=rev Log: Have isel visit blocks in reverse postorder rather than an undefined order. This allows for the information propagated across basic blocks to be merged at phis. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126169&r1=126168&r2=126169&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 21 18:46:22 2011 @@ -49,6 +49,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/Statistic.h" #include using namespace llvm; @@ -832,8 +833,10 @@ FastIS = TLI.createFastISel(*FuncInfo); // Iterate over all basic blocks in the function. - for (Function::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) { - const BasicBlock *LLVMBB = &*I; + ReversePostOrderTraversal RPOT(&Fn); + for (ReversePostOrderTraversal::rpo_iterator + I = RPOT.begin(), E = RPOT.end(); I != E; ++I) { + const BasicBlock *LLVMBB = *I; #ifndef NDEBUG CheckLineNumbers(LLVMBB); #endif From zwarich at apple.com Mon Feb 21 18:46:27 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Tue, 22 Feb 2011 00:46:27 -0000 Subject: [llvm-commits] [llvm] r126170 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/phi-constants.ll Message-ID: <20110222004628.187B02A6C12C@llvm.org> Author: zwarich Date: Mon Feb 21 18:46:27 2011 New Revision: 126170 URL: http://llvm.org/viewvc/llvm-project?rev=126170&view=rev Log: Merge information about the number of zero, one, and sign bits of live-out registers at phis. This enables us to eliminate a lot of pointless zexts during the DAGCombine phase. This fixes . Added: llvm/trunk/test/CodeGen/X86/phi-constants.ll Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126170&r1=126169&r2=126170&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Mon Feb 21 18:46:27 2011 @@ -101,14 +101,30 @@ #endif struct LiveOutInfo { - unsigned NumSignBits; + unsigned NumSignBits : 31; + bool IsValid : 1; APInt KnownOne, KnownZero; - LiveOutInfo() : NumSignBits(0), KnownOne(1, 0), KnownZero(1, 0) {} + LiveOutInfo() : NumSignBits(0), IsValid(false), KnownOne(1, 0), + KnownZero(1, 0) {} }; /// LiveOutRegInfo - Information about live out vregs. IndexedMap LiveOutRegInfo; + /// VisitedBBs - Basic blocks that have been visited by reverse postorder. + DenseSet VisitedBBs; + + /// AllPredsVisited - Tracks whether all predecessors of the current basic + /// block have already been visited. + bool AllPredsVisited; + + /// PHIDestRegs - Virtual registers that are the destinations of PHIs. + DenseSet PHIDestRegs; + + /// PHISrcToDestMap - Maps the virtual register defining a PHI's source to the + /// virtual register defining its destination. + DenseMap PHISrcToDestMap; + /// PHINodesToUpdate - A list of phi instructions whose operand list will /// be updated after processing the current basic block. /// TODO: This isn't per-function state, it's per-basic-block state. But Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=126170&r1=126169&r2=126170&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Mon Feb 21 18:46:27 2011 @@ -127,10 +127,13 @@ for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) { // Mark values used outside their block as exported, by allocating // a virtual register for them. - if (isUsedOutsideOfDefiningBlock(I)) + if (!EnableFastISel && isa(I)) { + PHIDestRegs.insert(InitializeRegForValue(I)); + } else if (isUsedOutsideOfDefiningBlock(I)) { if (!isa(I) || !StaticAllocaMap.count(cast(I))) InitializeRegForValue(I); + } // Collect llvm.dbg.declare information. This is done now instead of // during the initial isel pass through the IR so that it is done @@ -219,6 +222,9 @@ CatchInfoFound.clear(); #endif LiveOutRegInfo.clear(); + VisitedBBs.clear(); + PHIDestRegs.clear(); + PHISrcToDestMap.clear(); ArgDbgValues.clear(); ByValArgFrameIndexMap.clear(); RegFixups.clear(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=126170&r1=126169&r2=126170&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Feb 21 18:46:27 2011 @@ -644,7 +644,10 @@ !RegisterVT.isInteger() || RegisterVT.isVector() || !FuncInfo.LiveOutRegInfo.inBounds(Regs[Part+i])) continue; - + + if (FuncInfo.PHIDestRegs.count(Regs[Part+i]) && !FuncInfo.AllPredsVisited) + continue; + const FunctionLoweringInfo::LiveOutInfo &LOI = FuncInfo.LiveOutRegInfo[Regs[Part+i]]; @@ -6466,6 +6469,9 @@ } } + if (!EnableFastISel) + FuncInfo.PHISrcToDestMap[Reg] = FuncInfo.ValueMap[PN]; + // Remember that this register needs to added to the machine PHI node as // the input for this MBB. SmallVector ValueVTs; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126170&r1=126169&r2=126170&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 21 18:46:27 2011 @@ -471,6 +471,13 @@ if (!TargetRegisterInfo::isVirtualRegister(DestReg)) continue; + bool IsPHI = false; + DenseMap::const_iterator It = FuncInfo->PHISrcToDestMap.find(DestReg); + if (It != FuncInfo->PHISrcToDestMap.end()) { + IsPHI = true; + DestReg = It->second; + } + // Ignore non-scalar or non-integer values. SDValue Src = N->getOperand(2); EVT SrcVT = Src.getValueType(); @@ -482,14 +489,27 @@ CurDAG->ComputeMaskedBits(Src, Mask, KnownZero, KnownOne); // Only install this information if it tells us something. - if (NumSignBits != 1 || KnownZero != 0 || KnownOne != 0) { - FuncInfo->LiveOutRegInfo.grow(DestReg); + if (!IsPHI && NumSignBits == 1 && KnownZero == 0 && KnownOne == 0) + continue; + + FuncInfo->LiveOutRegInfo.grow(DestReg); + FunctionLoweringInfo::LiveOutInfo &LOI = FuncInfo->LiveOutRegInfo[DestReg]; + + // If this is a PHI and there is existing information, merge it with the + // information from this block. + if (IsPHI && LOI.IsValid) { FunctionLoweringInfo::LiveOutInfo &LOI = FuncInfo->LiveOutRegInfo[DestReg]; - LOI.NumSignBits = NumSignBits; - LOI.KnownOne = KnownOne; - LOI.KnownZero = KnownZero; + LOI.NumSignBits = std::min(LOI.NumSignBits, NumSignBits); + LOI.KnownOne &= KnownOne; + LOI.KnownZero &= KnownZero; + continue; } + + LOI.NumSignBits = NumSignBits; + LOI.KnownOne = KnownOne; + LOI.KnownZero = KnownZero; + LOI.IsValid = true; } while (!Worklist.empty()); } @@ -840,6 +860,21 @@ #ifndef NDEBUG CheckLineNumbers(LLVMBB); #endif + + if (EnableFastISel) { + FuncInfo->AllPredsVisited = false; + } else { + FuncInfo->AllPredsVisited = true; + for (const_pred_iterator PI = pred_begin(LLVMBB), PE = pred_end(LLVMBB); + PI != PE; ++PI) { + if (!FuncInfo->VisitedBBs.count(*PI)) { + FuncInfo->AllPredsVisited = false; + break; + } + } + FuncInfo->VisitedBBs.insert(LLVMBB); + } + FuncInfo->MBB = FuncInfo->MBBMap[LLVMBB]; FuncInfo->InsertPt = FuncInfo->MBB->getFirstNonPHI(); Added: llvm/trunk/test/CodeGen/X86/phi-constants.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/phi-constants.ll?rev=126170&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/phi-constants.ll (added) +++ llvm/trunk/test/CodeGen/X86/phi-constants.ll Mon Feb 21 18:46:27 2011 @@ -0,0 +1,35 @@ +; RUN: llc < %s -march=x86-64 | FileCheck %s + +%"class.std::bitset" = type { [8 x i8] } + +define zeroext i1 @_Z3fooPjmS_mRSt6bitsetILm32EE(i32* nocapture %a, i64 %asize, i32* nocapture %b, i64 %bsize, %"class.std::bitset"* %bits) nounwind readonly ssp noredzone { +entry: + %tmp.i.i.i.i = bitcast %"class.std::bitset"* %bits to i64* + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] + %conv = zext i32 %0 to i64 + %cmp = icmp eq i64 %conv, %bsize + br i1 %cmp, label %return, label %for.body + +for.body: ; preds = %for.cond + %arrayidx = getelementptr inbounds i32* %b, i64 %conv + %tmp5 = load i32* %arrayidx, align 4 + %conv6 = zext i32 %tmp5 to i64 + %rem.i.i.i.i = and i64 %conv6, 63 + %tmp3.i = load i64* %tmp.i.i.i.i, align 8 + %shl.i.i = shl i64 1, %rem.i.i.i.i + %and.i = and i64 %shl.i.i, %tmp3.i + %cmp.i = icmp eq i64 %and.i, 0 + br i1 %cmp.i, label %for.inc, label %return + +for.inc: ; preds = %for.body + %inc = add i32 %0, 1 + br label %for.cond + +return: ; preds = %for.body, %for.cond +; CHECK-NOT: and + %retval.0 = phi i1 [ true, %for.body ], [ false, %for.cond ] + ret i1 %retval.0 +} From zwarich at apple.com Mon Feb 21 19:00:10 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Tue, 22 Feb 2011 01:00:10 -0000 Subject: [llvm-commits] [llvm] r126171 - /llvm/trunk/utils/valgrind/i386-pc-linux-gnu.supp Message-ID: <20110222010010.EEE682A6C12C@llvm.org> Author: zwarich Date: Mon Feb 21 19:00:10 2011 New Revision: 126171 URL: http://llvm.org/viewvc/llvm-project?rev=126171&view=rev Log: Eliminate valgrind warnings from Python on the 32-bit as well. Modified: llvm/trunk/utils/valgrind/i386-pc-linux-gnu.supp Modified: llvm/trunk/utils/valgrind/i386-pc-linux-gnu.supp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/valgrind/i386-pc-linux-gnu.supp?rev=126171&r1=126170&r2=126171&view=diff ============================================================================== --- llvm/trunk/utils/valgrind/i386-pc-linux-gnu.supp (original) +++ llvm/trunk/utils/valgrind/i386-pc-linux-gnu.supp Mon Feb 21 19:00:10 2011 @@ -12,19 +12,19 @@ { ADDRESS_IN_RANGE/Invalid read of size 4 Memcheck:Addr4 - obj:/usr/bin/python2.5 + obj:/usr/bin/python* } { ADDRESS_IN_RANGE/Invalid read of size 4 Memcheck:Value4 - obj:/usr/bin/python2.5 + obj:/usr/bin/python* } { ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value Memcheck:Cond - obj:/usr/bin/python2.5 + obj:/usr/bin/python* } { @@ -37,5 +37,5 @@ We don't care if python leaks Memcheck:Leak fun:malloc - obj:/usr/bin/python2.5 + obj:/usr/bin/python* } From stoklund at 2pi.dk Mon Feb 21 19:06:31 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 21 Feb 2011 17:06:31 -0800 Subject: [llvm-commits] [llvm] r126159 - /llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp In-Reply-To: <20110221234048.200342A6C12C@llvm.org> References: <20110221234048.200342A6C12C@llvm.org> Message-ID: On Feb 21, 2011, at 3:40 PM, Evan Cheng wrote: > Author: evancheng > Date: Mon Feb 21 17:40:47 2011 > New Revision: 126159 > > URL: http://llvm.org/viewvc/llvm-project?rev=126159&view=rev > Log: > Skipping over debugvalue instructions to determine whether the split spot is in a IT block. rdar://9030770 > > Modified: > llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp > > Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=126159&r1=126158&r2=126159&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) > +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Mon Feb 21 17:40:47 2011 > @@ -95,6 +95,9 @@ > bool > Thumb2InstrInfo::isLegalToSplitMBBAt(MachineBasicBlock &MBB, > MachineBasicBlock::iterator MBBI) const { > + while (MBBI->isDebugValue()) > + ++MBBI; > + Does this work if the last instruction in the basic block is a DBG_VALUE? From aggarwa4 at illinois.edu Mon Feb 21 19:10:53 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Tue, 22 Feb 2011 01:10:53 -0000 Subject: [llvm-commits] [poolalloc] r126173 - /poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp Message-ID: <20110222011053.9D77F2A6C12C@llvm.org> Author: aggarwa4 Date: Mon Feb 21 19:10:53 2011 New Revision: 126173 URL: http://llvm.org/viewvc/llvm-project?rev=126173&view=rev Log: A pass to help DSA. If a function takes an argument that is only used in cmp instructions, and is passed both int and pointer, make a helper function to cast to the correct type. Added: poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp Added: poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp?rev=126173&view=auto ============================================================================== --- poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp (added) +++ poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp Mon Feb 21 19:10:53 2011 @@ -0,0 +1,144 @@ +//===-- FuncSpec.cpp - Clone Functions With Constant Function Ptr Args ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "argsimpl" + +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Debug.h" + +#include +#include +#include + +using namespace llvm; + +STATISTIC(numTransformable, "Number of Args changeable"); +namespace { + static void simplify(Function *I, unsigned arg_count, const Type* type) { + for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); + ui != ue; ++ui) { + if (Constant *C = dyn_cast(ui)) { + if (ConstantExpr *CE = dyn_cast(C)) { + if (CE->getOpcode() == Instruction::BitCast) { + if(CE->getOperand(0) == I) { + for(Value::use_iterator uii = CE->use_begin(), uee = CE->use_end(); + uii != uee; ) { + if (CallInst* CI = dyn_cast(uii)) { + ++uii; + if(CI->getCalledValue() == CE) { + if(I->getReturnType() == CI->getType()){ + if(I->arg_size() == (CI->getNumOperands()-1)){ + unsigned arg_count1 = 1; + bool change = true; + for (Function::arg_iterator ii1 = I->arg_begin(), ee1 = I->arg_end();ii1 != ee1; ++ii1,arg_count1++) { + if(ii1->getType() != CI->getOperand(arg_count1)->getType()) { + if(arg_count1 == (arg_count + 1)) { + continue; + } + change = false; + break; + } + } + if(change){ + std::vectorTP; + for(unsigned c = 1; cgetNumOperands();c++) { + TP.push_back(CI->getOperand(c)->getType()); + } + const FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false); + + Module *M = I->getParent(); + Function *NewF = Function::Create(NewFTy, + GlobalValue::InternalLinkage, + "argbounce", + M); + std::vector fargs; + for(Function::arg_iterator ai = NewF->arg_begin(), ae= NewF->arg_end(); ai != ae; ++ai) { + fargs.push_back(ai); + ai->setName("arg"); + } + Value *CastedVal; + BasicBlock* entryBB = BasicBlock::Create (M->getContext(), "entry", NewF); + if(type->isIntegerTy()){ + CastedVal = new PtrToIntInst(fargs.at(arg_count), type, "castd", entryBB); + } else { + CastedVal = new BitCastInst(fargs.at(arg_count), type, "castd", entryBB); + } + SmallVector Args; + for(Function::arg_iterator ai = NewF->arg_begin(), ae= NewF->arg_end(); ai != ae; ++ai) { + if(ai->getArgNo() == arg_count) + Args.push_back(CastedVal); + else + Args.push_back(ai); + } + + CallInst * CallI = CallInst::Create(I,Args.begin(), Args.end(),"", entryBB); + if(CallI->getType()->isVoidTy()) + ReturnInst::Create(M->getContext(), entryBB); + else + ReturnInst::Create(M->getContext(), CallI, entryBB); + //new BitCastInst(fargs.at(ii->getArgNo()), ii->getType(), "test", entryBB); + //new UnreachableInst (M.getContext(), entryBB); + + CI->setCalledFunction(NewF); + numTransformable++; + } + } + } + } + } else { + ++uii; + } + } + } + } + } + } + } + + } + class ArgSimplify : public ModulePass { + public: + static char ID; + ArgSimplify() : ModulePass(&ID) {} + bool runOnModule(Module& M) { + for (Module::iterator I = M.begin(); I != M.end(); ++I) { + if (!I->isDeclaration() && !I->mayBeOverridden()) { + if(I->getNameStr() == "main") + continue; + std::vector Args; + for (Function::arg_iterator ii = I->arg_begin(), ee = I->arg_end(); + ii != ee; ++ii) { + bool change = true; + for(Value::use_iterator ui = ii->use_begin(), ue = ii->use_end(); + ui != ue; ++ui) { + if(!isa(ui)){ + change = false; + break; + } + } + if(change){ + simplify(I, ii->getArgNo(), ii->getType()); + } + } + } + } + + return true; + } + }; +} + +char ArgSimplify::ID = 0; +static RegisterPass +X("arg-simplify", "Specialize for Conditional Arguments"); From echristo at apple.com Mon Feb 21 19:37:10 2011 From: echristo at apple.com (Eric Christopher) Date: Tue, 22 Feb 2011 01:37:10 -0000 Subject: [llvm-commits] [llvm] r126176 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Message-ID: <20110222013711.0BF252A6C12C@llvm.org> Author: echristo Date: Mon Feb 21 19:37:10 2011 New Revision: 126176 URL: http://llvm.org/viewvc/llvm-project?rev=126176&view=rev Log: Only use blx for external function calls on thumb, these could be fixed up by the dynamic linker, but it's better to use the correct instruction to begin with. Fixes rdar://9011034 Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=126176&r1=126175&r2=126176&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Mon Feb 21 19:37:10 2011 @@ -172,6 +172,7 @@ unsigned ARMMaterializeGV(const GlobalValue *GV, EVT VT); unsigned ARMMoveToFPReg(EVT VT, unsigned SrcReg); unsigned ARMMoveToIntReg(EVT VT, unsigned SrcReg); + unsigned ARMSelectCallOp(const GlobalValue *GV); // Call handling routines. private: @@ -1633,6 +1634,25 @@ return true; } +unsigned ARMFastISel::ARMSelectCallOp(const GlobalValue *GV) { + + // Depend our opcode for thumb on whether or not we're targeting an + // externally callable function. For libcalls we'll just pass a NULL GV + // in here. + bool isExternal = false; + if (!GV || GV->hasExternalLinkage()) isExternal = true; + + // Darwin needs the r9 versions of the opcodes. + bool isDarwin = Subtarget->isTargetDarwin(); + if (isThumb && isExternal) { + return isDarwin ? ARM::tBLXi_r9 : ARM::tBLXi; + } else if (isThumb) { + return isDarwin ? ARM::tBLr9 : ARM::tBL; + } else { + return isDarwin ? ARM::BLr9 : ARM::BL; + } +} + // A quick function that will emit a call for a named libcall in F with the // vector of passed arguments for the Instruction in I. We can assume that we // can emit a call for any libcall we can produce. This is an abridged version @@ -1694,20 +1714,17 @@ // Issue the call, BLXr9 for darwin, BLX otherwise. This uses V5 ops. // TODO: Turn this into the table of arm call ops. MachineInstrBuilder MIB; - unsigned CallOpc; - if(isThumb) { - CallOpc = Subtarget->isTargetDarwin() ? ARM::tBLXi_r9 : ARM::tBLXi; + unsigned CallOpc = ARMSelectCallOp(NULL); + if(isThumb) // Explicitly adding the predicate here. MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(CallOpc))) .addExternalSymbol(TLI.getLibcallName(Call)); - } else { - CallOpc = Subtarget->isTargetDarwin() ? ARM::BLr9 : ARM::BL; + else // Explicitly adding the predicate here. MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(CallOpc)) .addExternalSymbol(TLI.getLibcallName(Call))); - } // Add implicit physical register uses to the call. for (unsigned i = 0, e = RegArgs.size(); i != e; ++i) @@ -1813,21 +1830,18 @@ // Issue the call, BLXr9 for darwin, BLX otherwise. This uses V5 ops. // TODO: Turn this into the table of arm call ops. MachineInstrBuilder MIB; - unsigned CallOpc; + unsigned CallOpc = ARMSelectCallOp(GV); // Explicitly adding the predicate here. - if(isThumb) { - CallOpc = Subtarget->isTargetDarwin() ? ARM::tBLXi_r9 : ARM::tBLXi; + if(isThumb) // Explicitly adding the predicate here. MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(CallOpc))) .addGlobalAddress(GV, 0, 0); - } else { - CallOpc = Subtarget->isTargetDarwin() ? ARM::BLr9 : ARM::BL; + else // Explicitly adding the predicate here. MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(CallOpc)) .addGlobalAddress(GV, 0, 0)); - } // Add implicit physical register uses to the call. for (unsigned i = 0, e = RegArgs.size(); i != e; ++i) From scallanan at apple.com Mon Feb 21 20:05:53 2011 From: scallanan at apple.com (Sean Callanan) Date: Tue, 22 Feb 2011 02:05:53 -0000 Subject: [llvm-commits] [llvm] r126180 - /llvm/trunk/test/lit.cfg Message-ID: <20110222020553.D51352A6C12C@llvm.org> Author: spyffe Date: Mon Feb 21 20:05:53 2011 New Revision: 126180 URL: http://llvm.org/viewvc/llvm-project?rev=126180&view=rev Log: Fixed lit.cfg to no longer recognize the old edis name as needing expansion. This tool was been replaced by llvm-mc long ago. Modified: llvm/trunk/test/lit.cfg Modified: llvm/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=126180&r1=126179&r2=126180&view=diff ============================================================================== --- llvm/trunk/test/lit.cfg (original) +++ llvm/trunk/test/lit.cfg Mon Feb 21 20:05:53 2011 @@ -176,7 +176,7 @@ # Don't match 'bugpoint-' or 'clang-'. # Don't match '/clang'. for pattern in [r"\bbugpoint\b(?!-)", r"(? Author: spyffe Date: Mon Feb 21 20:09:15 2011 New Revision: 126181 URL: http://llvm.org/viewvc/llvm-project?rev=126181&view=rev Log: Fixed llvm-mc in edis mode to use the result of operand.evaluate as an error code, not as the contents of the operand. Modified: llvm/trunk/tools/llvm-mc/Disassembler.cpp Modified: llvm/trunk/tools/llvm-mc/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/Disassembler.cpp?rev=126181&r1=126180&r2=126181&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/Disassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/Disassembler.cpp Mon Feb 21 20:09:15 2011 @@ -328,7 +328,10 @@ uint64_t evaluatedResult; void *Arg[] = { disassembler, &Out }; - evaluatedResult = operand->evaluate(evaluatedResult, verboseEvaluator, Arg); + if (operand->evaluate(evaluatedResult, verboseEvaluator, Arg)) { + errs() << "error: Couldn't evaluate an operand\n"; + return -1; + } Out << "=" << evaluatedResult << " "; } From scallanan at apple.com Mon Feb 21 20:19:19 2011 From: scallanan at apple.com (Sean Callanan) Date: Tue, 22 Feb 2011 02:19:19 -0000 Subject: [llvm-commits] [llvm] r126182 - /llvm/trunk/test/MC/Disassembler/X86/enhanced.txt Message-ID: <20110222021919.25B662A6C12C@llvm.org> Author: spyffe Date: Mon Feb 21 20:19:18 2011 New Revision: 126182 URL: http://llvm.org/viewvc/llvm-project?rev=126182&view=rev Log: Added a testcase for the enhanced disassembly bug fixed in r126147, where a field in the X86 decode structure was being read as bits, not bytes. Added: llvm/trunk/test/MC/Disassembler/X86/enhanced.txt Added: llvm/trunk/test/MC/Disassembler/X86/enhanced.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/X86/enhanced.txt?rev=126182&view=auto ============================================================================== --- llvm/trunk/test/MC/Disassembler/X86/enhanced.txt (added) +++ llvm/trunk/test/MC/Disassembler/X86/enhanced.txt Mon Feb 21 20:19:18 2011 @@ -0,0 +1,4 @@ +# RUN: llvm-mc --edis %s -triple=x86_64-apple-darwin9 |& FileCheck %s + +# CHECK: [o:jne][w: ][0-p:-][0-l:10=10]
0:[RIP/111](pc)=18446744073709551606 +0x0f 0x85 0xf6 0xff 0xff 0xff From geek4civic at gmail.com Mon Feb 21 20:23:10 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 11:23:10 +0900 Subject: [llvm-commits] [Review request][Win64] Use pushq/popq GPRs in function prologue/epilogue In-Reply-To: References: Message-ID: Ping. On Fri, Feb 18, 2011 at 2:02 PM, NAKAMURA Takumi wrote: > Ping. > > It would also resolve potential issue if other x86-64 targets had a > new calling conversions to preserve XMMs. > > ...Takumi > > > On Mon, Feb 7, 2011 at 8:49 PM, NAKAMURA Takumi wrote: >> Anton, >> >> I attached an updated patch, refined and comments added, thank you. >> It is at; https://github.com/chapuni/LLVM/commit/8da7419f8170e5a11063eb8e992ecb1ad40f9f6a >> >> >> On the github, Anton wrote; >>> View Commit: https://github.com/chapuni/LLVM/commit/d719f1b1ba5f01823e00904c1599adf356089a1d >> >>> This will pessimize non-win64 targets. Basically, the problem is that you cannot use pushq/popq for high xmm regs, which are callee-saved on win64-only (but not on linux / darwin, for example). >> >> I thought the patch does not affect to non-win64 targets, but it might >> be dubious to check whether regs are GPR or not. >> I rewrote checking expressions. >> >> I am sorry if I missed your point. >> >>> Another problem is function prologue emission. Have you verified that you always have proper stack frame? Even in case when high xmm regs (xmm5, etc.) are spilled? >> >> As far as spiller emits in order [pushq GPRs...] and [mov xmm to fp], >> and restorer emits in order [mov xmm from fp] and [popq GPRs], >> emitPrologue() and emitEpilogue() will emit adjusting %rsp onto proper place. >> And I can expect spiller can place XMMs i128 aligned. >> >> ; for example >> define void @foo() nounwind { >> entry: >> ?tail call void (...)* @bar() nounwind >> ?tail call void asm sideeffect "nop", >> "~{si},~{di},~{xmm13},~{xmm11},~{xmm15},~{dirflag},~{fpsr},~{flags}"() >> nounwind >> ?ret void >> } >> declare void @bar(...) >> >> #### -mtriple=x86_64-mingw32 >> foo: >> ? ? ? ?pushq ? %rsi >> ? ? ? ?pushq ? %rdi >> ? ? ? ?subq ? ?$88, %rsp >> ? ? ? ?movaps ?%xmm15, 32(%rsp) ? ? ? ?# 16-byte Spill >> ? ? ? ?movaps ?%xmm13, 48(%rsp) ? ? ? ?# 16-byte Spill >> ? ? ? ?movaps ?%xmm11, 64(%rsp) ? ? ? ?# 16-byte Spill >> ? ? ? ?callq ? bar >> ? ? ? ?#APP >> ? ? ? ?nop >> ? ? ? ?#NO_APP >> ? ? ? ?movaps ?64(%rsp), %xmm11 ? ? ? ?# 16-byte Reload >> ? ? ? ?movaps ?48(%rsp), %xmm13 ? ? ? ?# 16-byte Reload >> ? ? ? ?movaps ?32(%rsp), %xmm15 ? ? ? ?# 16-byte Reload >> ? ? ? ?addq ? ?$88, %rsp >> ? ? ? ?popq ? ?%rdi >> ? ? ? ?popq ? ?%rsi >> ? ? ? ?ret >> >> And also, I have checked to build clang by 3 stage. >> (x64-clang can build and test clang and llvm) >> >> >> ...Takumi >> > From zwarich at apple.com Mon Feb 21 21:24:53 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Tue, 22 Feb 2011 03:24:53 -0000 Subject: [llvm-commits] [llvm] r126185 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/phi-constants.ll Message-ID: <20110222032453.2A8012A6C12C@llvm.org> Author: zwarich Date: Mon Feb 21 21:24:52 2011 New Revision: 126185 URL: http://llvm.org/viewvc/llvm-project?rev=126185&view=rev Log: Roll out r126169 and r126170 in an attempt to fix the selfhost bot. Removed: llvm/trunk/test/CodeGen/X86/phi-constants.ll Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126185&r1=126184&r2=126185&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Mon Feb 21 21:24:52 2011 @@ -101,30 +101,14 @@ #endif struct LiveOutInfo { - unsigned NumSignBits : 31; - bool IsValid : 1; + unsigned NumSignBits; APInt KnownOne, KnownZero; - LiveOutInfo() : NumSignBits(0), IsValid(false), KnownOne(1, 0), - KnownZero(1, 0) {} + LiveOutInfo() : NumSignBits(0), KnownOne(1, 0), KnownZero(1, 0) {} }; /// LiveOutRegInfo - Information about live out vregs. IndexedMap LiveOutRegInfo; - /// VisitedBBs - Basic blocks that have been visited by reverse postorder. - DenseSet VisitedBBs; - - /// AllPredsVisited - Tracks whether all predecessors of the current basic - /// block have already been visited. - bool AllPredsVisited; - - /// PHIDestRegs - Virtual registers that are the destinations of PHIs. - DenseSet PHIDestRegs; - - /// PHISrcToDestMap - Maps the virtual register defining a PHI's source to the - /// virtual register defining its destination. - DenseMap PHISrcToDestMap; - /// PHINodesToUpdate - A list of phi instructions whose operand list will /// be updated after processing the current basic block. /// TODO: This isn't per-function state, it's per-basic-block state. But Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=126185&r1=126184&r2=126185&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Mon Feb 21 21:24:52 2011 @@ -127,13 +127,10 @@ for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) { // Mark values used outside their block as exported, by allocating // a virtual register for them. - if (!EnableFastISel && isa(I)) { - PHIDestRegs.insert(InitializeRegForValue(I)); - } else if (isUsedOutsideOfDefiningBlock(I)) { + if (isUsedOutsideOfDefiningBlock(I)) if (!isa(I) || !StaticAllocaMap.count(cast(I))) InitializeRegForValue(I); - } // Collect llvm.dbg.declare information. This is done now instead of // during the initial isel pass through the IR so that it is done @@ -222,9 +219,6 @@ CatchInfoFound.clear(); #endif LiveOutRegInfo.clear(); - VisitedBBs.clear(); - PHIDestRegs.clear(); - PHISrcToDestMap.clear(); ArgDbgValues.clear(); ByValArgFrameIndexMap.clear(); RegFixups.clear(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=126185&r1=126184&r2=126185&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Feb 21 21:24:52 2011 @@ -644,10 +644,7 @@ !RegisterVT.isInteger() || RegisterVT.isVector() || !FuncInfo.LiveOutRegInfo.inBounds(Regs[Part+i])) continue; - - if (FuncInfo.PHIDestRegs.count(Regs[Part+i]) && !FuncInfo.AllPredsVisited) - continue; - + const FunctionLoweringInfo::LiveOutInfo &LOI = FuncInfo.LiveOutRegInfo[Regs[Part+i]]; @@ -6469,9 +6466,6 @@ } } - if (!EnableFastISel) - FuncInfo.PHISrcToDestMap[Reg] = FuncInfo.ValueMap[PN]; - // Remember that this register needs to added to the machine PHI node as // the input for this MBB. SmallVector ValueVTs; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126185&r1=126184&r2=126185&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 21 21:24:52 2011 @@ -49,7 +49,6 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/Statistic.h" #include using namespace llvm; @@ -471,13 +470,6 @@ if (!TargetRegisterInfo::isVirtualRegister(DestReg)) continue; - bool IsPHI = false; - DenseMap::const_iterator It = FuncInfo->PHISrcToDestMap.find(DestReg); - if (It != FuncInfo->PHISrcToDestMap.end()) { - IsPHI = true; - DestReg = It->second; - } - // Ignore non-scalar or non-integer values. SDValue Src = N->getOperand(2); EVT SrcVT = Src.getValueType(); @@ -489,27 +481,14 @@ CurDAG->ComputeMaskedBits(Src, Mask, KnownZero, KnownOne); // Only install this information if it tells us something. - if (!IsPHI && NumSignBits == 1 && KnownZero == 0 && KnownOne == 0) - continue; - - FuncInfo->LiveOutRegInfo.grow(DestReg); - FunctionLoweringInfo::LiveOutInfo &LOI = FuncInfo->LiveOutRegInfo[DestReg]; - - // If this is a PHI and there is existing information, merge it with the - // information from this block. - if (IsPHI && LOI.IsValid) { + if (NumSignBits != 1 || KnownZero != 0 || KnownOne != 0) { + FuncInfo->LiveOutRegInfo.grow(DestReg); FunctionLoweringInfo::LiveOutInfo &LOI = FuncInfo->LiveOutRegInfo[DestReg]; - LOI.NumSignBits = std::min(LOI.NumSignBits, NumSignBits); - LOI.KnownOne &= KnownOne; - LOI.KnownZero &= KnownZero; - continue; + LOI.NumSignBits = NumSignBits; + LOI.KnownOne = KnownOne; + LOI.KnownZero = KnownZero; } - - LOI.NumSignBits = NumSignBits; - LOI.KnownOne = KnownOne; - LOI.KnownZero = KnownZero; - LOI.IsValid = true; } while (!Worklist.empty()); } @@ -853,28 +832,11 @@ FastIS = TLI.createFastISel(*FuncInfo); // Iterate over all basic blocks in the function. - ReversePostOrderTraversal RPOT(&Fn); - for (ReversePostOrderTraversal::rpo_iterator - I = RPOT.begin(), E = RPOT.end(); I != E; ++I) { - const BasicBlock *LLVMBB = *I; + for (Function::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) { + const BasicBlock *LLVMBB = &*I; #ifndef NDEBUG CheckLineNumbers(LLVMBB); #endif - - if (EnableFastISel) { - FuncInfo->AllPredsVisited = false; - } else { - FuncInfo->AllPredsVisited = true; - for (const_pred_iterator PI = pred_begin(LLVMBB), PE = pred_end(LLVMBB); - PI != PE; ++PI) { - if (!FuncInfo->VisitedBBs.count(*PI)) { - FuncInfo->AllPredsVisited = false; - break; - } - } - FuncInfo->VisitedBBs.insert(LLVMBB); - } - FuncInfo->MBB = FuncInfo->MBBMap[LLVMBB]; FuncInfo->InsertPt = FuncInfo->MBB->getFirstNonPHI(); Removed: llvm/trunk/test/CodeGen/X86/phi-constants.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/phi-constants.ll?rev=126184&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/phi-constants.ll (original) +++ llvm/trunk/test/CodeGen/X86/phi-constants.ll (removed) @@ -1,35 +0,0 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s - -%"class.std::bitset" = type { [8 x i8] } - -define zeroext i1 @_Z3fooPjmS_mRSt6bitsetILm32EE(i32* nocapture %a, i64 %asize, i32* nocapture %b, i64 %bsize, %"class.std::bitset"* %bits) nounwind readonly ssp noredzone { -entry: - %tmp.i.i.i.i = bitcast %"class.std::bitset"* %bits to i64* - br label %for.cond - -for.cond: ; preds = %for.inc, %entry - %0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] - %conv = zext i32 %0 to i64 - %cmp = icmp eq i64 %conv, %bsize - br i1 %cmp, label %return, label %for.body - -for.body: ; preds = %for.cond - %arrayidx = getelementptr inbounds i32* %b, i64 %conv - %tmp5 = load i32* %arrayidx, align 4 - %conv6 = zext i32 %tmp5 to i64 - %rem.i.i.i.i = and i64 %conv6, 63 - %tmp3.i = load i64* %tmp.i.i.i.i, align 8 - %shl.i.i = shl i64 1, %rem.i.i.i.i - %and.i = and i64 %shl.i.i, %tmp3.i - %cmp.i = icmp eq i64 %and.i, 0 - br i1 %cmp.i, label %for.inc, label %return - -for.inc: ; preds = %for.body - %inc = add i32 %0, 1 - br label %for.cond - -return: ; preds = %for.body, %for.cond -; CHECK-NOT: and - %retval.0 = phi i1 [ true, %for.body ], [ false, %for.cond ] - ret i1 %retval.0 -} From atrick at apple.com Tue Feb 22 00:52:56 2011 From: atrick at apple.com (Andrew Trick) Date: Tue, 22 Feb 2011 06:52:56 -0000 Subject: [llvm-commits] [llvm] r126190 - in /llvm/trunk: lib/CodeGen/VirtRegRewriter.cpp test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll Message-ID: <20110222065256.869732A6C12C@llvm.org> Author: atrick Date: Tue Feb 22 00:52:56 2011 New Revision: 126190 URL: http://llvm.org/viewvc/llvm-project?rev=126190&view=rev Log: VirtRegRewriter assertion fix. Apparently it's ok for multiple operands to "kill" the same register. Fixes PR9237. Added: llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=126190&r1=126189&r2=126190&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 22 00:52:56 2011 @@ -478,7 +478,8 @@ if (!RegKills[KReg]) return; - assert(KillOps[KReg] == KillOp && "invalid superreg kill flags"); + assert(KillOps[KReg]->getParent() == KillOp->getParent() && + "invalid superreg kill flags"); KillOps[KReg] = NULL; RegKills.reset(KReg); @@ -487,7 +488,8 @@ for (const unsigned *SR = TRI->getSubRegisters(KReg); *SR; ++SR) { DEBUG(dbgs() << " Resurrect subreg " << TRI->getName(*SR) << "\n"); - assert(KillOps[*SR] == KillOp && "invalid subreg kill flags"); + assert(KillOps[*SR]->getParent() == KillOp->getParent() && + "invalid subreg kill flags"); KillOps[*SR] = NULL; RegKills.reset(*SR); } Added: llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll?rev=126190&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll (added) +++ llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll Tue Feb 22 00:52:56 2011 @@ -0,0 +1,50 @@ +; RUN: llc < %s -O2 -march=x86 -mtriple=i386-pc-linux-gnu -relocation-model=pic | FileCheck %s +; PR9237: Assertion in VirtRegRewriter.cpp, ResurrectConfirmedKill +; `KillOps[*SR] == KillOp && "invalid subreg kill flags"' + +%t = type { i32 } + +define i32 @foo(%t* %s) nounwind { +entry: + br label %if.then735 + +if.then735: + %call747 = call i32 undef(%t* %s, i8* null, i8* undef, i32 128, i8* undef, i32 516) nounwind + br i1 undef, label %if.then751, label %if.then758 + +if.then751: + unreachable + +if.then758: + %add761 = add i32 %call747, 4 + %add763 = add i32 %add761, %call747 + %add.ptr768 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add761 + br i1 undef, label %cond.false783, label %cond.true771 + +cond.true771: + %call782 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) + br label %cond.end791 + +; CHECK: calll __memmove_chk +cond.false783: + %call.i1035 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) nounwind + br label %cond.end791 + +cond.end791: + %conv801 = trunc i32 %call747 to i8 + %add.ptr822.sum = add i32 %call747, 3 + %arrayidx833 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add.ptr822.sum + store i8 %conv801, i8* %arrayidx833, align 1 + %cmp841 = icmp eq i8* undef, null + br i1 %cmp841, label %if.end849, label %if.then843 + +if.then843: + unreachable + +if.end849: + %call921 = call i32 undef(%t* %s, i8* undef, i8* undef, i32 %add763) nounwind + unreachable + +} + +declare i8* @__memmove_chk(i8*, i8*, i32, i32) nounwind From evan.cheng at apple.com Tue Feb 22 00:59:08 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Feb 2011 22:59:08 -0800 Subject: [llvm-commits] [llvm] r126190 - in /llvm/trunk: lib/CodeGen/VirtRegRewriter.cpp test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll In-Reply-To: <20110222065256.869732A6C12C@llvm.org> References: <20110222065256.869732A6C12C@llvm.org> Message-ID: On Feb 21, 2011, at 10:52 PM, Andrew Trick wrote: > Author: atrick > Date: Tue Feb 22 00:52:56 2011 > New Revision: 126190 > > URL: http://llvm.org/viewvc/llvm-project?rev=126190&view=rev > Log: > VirtRegRewriter assertion fix. > Apparently it's ok for multiple operands to "kill" the same register. It is? Evan > Fixes PR9237. > > Added: > llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll > Modified: > llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp > > Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=126190&r1=126189&r2=126190&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) > +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 22 00:52:56 2011 > @@ -478,7 +478,8 @@ > if (!RegKills[KReg]) > return; > > - assert(KillOps[KReg] == KillOp && "invalid superreg kill flags"); > + assert(KillOps[KReg]->getParent() == KillOp->getParent() && > + "invalid superreg kill flags"); > KillOps[KReg] = NULL; > RegKills.reset(KReg); > > @@ -487,7 +488,8 @@ > for (const unsigned *SR = TRI->getSubRegisters(KReg); *SR; ++SR) { > DEBUG(dbgs() << " Resurrect subreg " << TRI->getName(*SR) << "\n"); > > - assert(KillOps[*SR] == KillOp && "invalid subreg kill flags"); > + assert(KillOps[*SR]->getParent() == KillOp->getParent() && > + "invalid subreg kill flags"); > KillOps[*SR] = NULL; > RegKills.reset(*SR); > } > > Added: llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll?rev=126190&view=auto > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll (added) > +++ llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll Tue Feb 22 00:52:56 2011 > @@ -0,0 +1,50 @@ > +; RUN: llc < %s -O2 -march=x86 -mtriple=i386-pc-linux-gnu -relocation-model=pic | FileCheck %s > +; PR9237: Assertion in VirtRegRewriter.cpp, ResurrectConfirmedKill > +; `KillOps[*SR] == KillOp && "invalid subreg kill flags"' > + > +%t = type { i32 } > + > +define i32 @foo(%t* %s) nounwind { > +entry: > + br label %if.then735 > + > +if.then735: > + %call747 = call i32 undef(%t* %s, i8* null, i8* undef, i32 128, i8* undef, i32 516) nounwind > + br i1 undef, label %if.then751, label %if.then758 > + > +if.then751: > + unreachable > + > +if.then758: > + %add761 = add i32 %call747, 4 > + %add763 = add i32 %add761, %call747 > + %add.ptr768 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add761 > + br i1 undef, label %cond.false783, label %cond.true771 > + > +cond.true771: > + %call782 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) > + br label %cond.end791 > + > +; CHECK: calll __memmove_chk > +cond.false783: > + %call.i1035 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) nounwind > + br label %cond.end791 > + > +cond.end791: > + %conv801 = trunc i32 %call747 to i8 > + %add.ptr822.sum = add i32 %call747, 3 > + %arrayidx833 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add.ptr822.sum > + store i8 %conv801, i8* %arrayidx833, align 1 > + %cmp841 = icmp eq i8* undef, null > + br i1 %cmp841, label %if.end849, label %if.then843 > + > +if.then843: > + unreachable > + > +if.end849: > + %call921 = call i32 undef(%t* %s, i8* undef, i8* undef, i32 %add763) nounwind > + unreachable > + > +} > + > +declare i8* @__memmove_chk(i8*, i8*, i32, i32) nounwind > > > _______________________________________________ > 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 Tue Feb 22 00:58:35 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Feb 2011 06:58:35 -0000 Subject: [llvm-commits] [llvm] r126191 - in /llvm/trunk: lib/Target/ARM/ARMSubtarget.cpp test/CodeGen/ARM/available_externally.ll Message-ID: <20110222065835.159F72A6C12C@llvm.org> Author: evancheng Date: Tue Feb 22 00:58:34 2011 New Revision: 126191 URL: http://llvm.org/viewvc/llvm-project?rev=126191&view=rev Log: available_externally (hidden or not) GVs are always accessed via stubs. rdar://9027648. Added: llvm/trunk/test/CodeGen/ARM/available_externally.ll Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=126191&r1=126190&r2=126191&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Tue Feb 22 00:58:34 2011 @@ -171,7 +171,9 @@ // Materializable GVs (in JIT lazy compilation mode) do not require an extra // load from stub. - bool isDecl = GV->isDeclaration() && !GV->isMaterializable(); + bool isDecl = GV->hasAvailableExternallyLinkage(); + if (GV->isDeclaration() && !GV->isMaterializable()) + isDecl = true; if (!isTargetDarwin()) { // Extra load is needed for all externally visible. Added: llvm/trunk/test/CodeGen/ARM/available_externally.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/available_externally.ll?rev=126191&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/available_externally.ll (added) +++ llvm/trunk/test/CodeGen/ARM/available_externally.ll Tue Feb 22 00:58:34 2011 @@ -0,0 +1,16 @@ +; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=pic | FileCheck %s +; rdar://9027648 + + at A = available_externally hidden constant i32 1 + at B = external hidden constant i32 + +define i32 @t1() { + %tmp = load i32* @A + store i32 %tmp, i32* @B + ret i32 %tmp +} + +; CHECK: L_A$non_lazy_ptr: +; CHECK-NEXT: .long _A +; CHECK: L_B$non_lazy_ptr: +; CHECK-NEXT: .long _B From evan.cheng at apple.com Tue Feb 22 01:07:59 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Feb 2011 07:07:59 -0000 Subject: [llvm-commits] [llvm] r126192 - /llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Message-ID: <20110222070759.A38462A6C12C@llvm.org> Author: evancheng Date: Tue Feb 22 01:07:59 2011 New Revision: 126192 URL: http://llvm.org/viewvc/llvm-project?rev=126192&view=rev Log: Guard against de-referencing MBB.end(). Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=126192&r1=126191&r2=126192&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Tue Feb 22 01:07:59 2011 @@ -95,8 +95,11 @@ bool Thumb2InstrInfo::isLegalToSplitMBBAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const { - while (MBBI->isDebugValue()) + while (MBBI->isDebugValue()) { ++MBBI; + if (MBBI == MBB.end()) + return false; + } unsigned PredReg = 0; return llvm::getITInstrPredicate(MBBI, PredReg) == ARMCC::AL; From evan.cheng at apple.com Tue Feb 22 01:12:06 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Feb 2011 23:12:06 -0800 Subject: [llvm-commits] [llvm] r126159 - /llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp In-Reply-To: References: <20110221234048.200342A6C12C@llvm.org> Message-ID: <3FD081CB-AF27-43CD-9827-1E6322F5C562@apple.com> On Feb 21, 2011, at 5:06 PM, Jakob Stoklund Olesen wrote: > > On Feb 21, 2011, at 3:40 PM, Evan Cheng wrote: > >> Author: evancheng >> Date: Mon Feb 21 17:40:47 2011 >> New Revision: 126159 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=126159&view=rev >> Log: >> Skipping over debugvalue instructions to determine whether the split spot is in a IT block. rdar://9030770 >> >> Modified: >> llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp >> >> Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=126159&r1=126158&r2=126159&view=diff >> ============================================================================== >> --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Mon Feb 21 17:40:47 2011 >> @@ -95,6 +95,9 @@ >> bool >> Thumb2InstrInfo::isLegalToSplitMBBAt(MachineBasicBlock &MBB, >> MachineBasicBlock::iterator MBBI) const { >> + while (MBBI->isDebugValue()) >> + ++MBBI; >> + > > Does this work if the last instruction in the basic block is a DBG_VALUE? > Fixed: r126192. Evan > From geek4civic at gmail.com Tue Feb 22 01:18:55 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:18:55 -0000 Subject: [llvm-commits] [llvm] r126194 - /llvm/trunk/test/CodeGen/X86/red-zone.ll Message-ID: <20110222071855.EC9F72A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:18:55 2011 New Revision: 126194 URL: http://llvm.org/viewvc/llvm-project?rev=126194&view=rev Log: test/CodeGen/X86/red-zone.ll: Add explicit -mtriple=x86_64-linux. Redzone is not applicable on Win64. Modified: llvm/trunk/test/CodeGen/X86/red-zone.ll Modified: llvm/trunk/test/CodeGen/X86/red-zone.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/red-zone.ll?rev=126194&r1=126193&r2=126194&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/red-zone.ll (original) +++ llvm/trunk/test/CodeGen/X86/red-zone.ll Tue Feb 22 01:18:55 2011 @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s ; First without noredzone. ; CHECK: f0: From geek4civic at gmail.com Tue Feb 22 01:19:03 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:19:03 -0000 Subject: [llvm-commits] [llvm] r126195 - /llvm/trunk/test/CodeGen/X86/vec_cast.ll Message-ID: <20110222071904.08FC82A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:19:03 2011 New Revision: 126195 URL: http://llvm.org/viewvc/llvm-project?rev=126195&view=rev Log: test/CodeGen/X86/vec_cast.ll: Mark as XFAIL: migw,win32 for workaround of PR8311. Modified: llvm/trunk/test/CodeGen/X86/vec_cast.ll Modified: llvm/trunk/test/CodeGen/X86/vec_cast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_cast.ll?rev=126195&r1=126194&r2=126195&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_cast.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_cast.ll Tue Feb 22 01:19:03 2011 @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86-64 -mcpu=core2 - +; PR8311 +; XFAIL: mingw,win32 define <8 x i32> @a(<8 x i16> %a) nounwind { %c = sext <8 x i16> %a to <8 x i32> From geek4civic at gmail.com Tue Feb 22 01:19:12 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:19:12 -0000 Subject: [llvm-commits] [llvm] r126196 - /llvm/trunk/test/CodeGen/X86/add.ll Message-ID: <20110222071912.5ECA32A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:19:12 2011 New Revision: 126196 URL: http://llvm.org/viewvc/llvm-project?rev=126196&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/add.ll Modified: llvm/trunk/test/CodeGen/X86/add.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add.ll?rev=126196&r1=126195&r2=126196&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/add.ll (original) +++ llvm/trunk/test/CodeGen/X86/add.ll Tue Feb 22 01:19:12 2011 @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 -; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=X64 ; The immediate can be encoded in a smaller way if the ; instruction is a sub instead of an add. @@ -43,7 +44,7 @@ ; X32-NEXT: jo ; X64: test4: -; X64: addl %esi, %edi +; X64: addl %e[[A1:si|dx]], %e[[A0:di|cx]] ; X64-NEXT: jo } @@ -66,7 +67,7 @@ ; X32-NEXT: jb ; X64: test5: -; X64: addl %esi, %edi +; X64: addl %e[[A1]], %e[[A0]] ; X64-NEXT: jb } @@ -87,8 +88,8 @@ ; X32-NEXT: ret ; X64: test6: -; X64: shlq $32, %rsi -; X64: leaq (%rsi,%rdi), %rax +; X64: shlq $32, %r[[A1]] +; X64: leaq (%r[[A1]],%r[[A0]]), %rax ; X64: ret } @@ -98,7 +99,7 @@ } ; X64: test7: -; X64: addl %esi, %eax +; X64: addl %e[[A1]], %eax ; X64-NEXT: setb %dl ; X64-NEXT: ret From geek4civic at gmail.com Tue Feb 22 01:19:20 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:19:20 -0000 Subject: [llvm-commits] [llvm] r126197 - /llvm/trunk/test/CodeGen/X86/break-sse-dep.ll Message-ID: <20110222071920.948382A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:19:20 2011 New Revision: 126197 URL: http://llvm.org/viewvc/llvm-project?rev=126197&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/break-sse-dep.ll Modified: llvm/trunk/test/CodeGen/X86/break-sse-dep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/break-sse-dep.ll?rev=126197&r1=126196&r2=126197&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/break-sse-dep.ll (original) +++ llvm/trunk/test/CodeGen/X86/break-sse-dep.ll Tue Feb 22 01:19:20 2011 @@ -1,9 +1,10 @@ -; RUN: llc < %s -march=x86-64 -mattr=+sse2 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse2 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse2 | FileCheck %s define double @t1(float* nocapture %x) nounwind readonly ssp { entry: ; CHECK: t1: -; CHECK: movss (%rdi), %xmm0 +; CHECK: movss ([[A0:%rdi|%rcx]]), %xmm0 ; CHECK: cvtss2sd %xmm0, %xmm0 %0 = load float* %x, align 4 @@ -14,7 +15,7 @@ define float @t2(double* nocapture %x) nounwind readonly ssp optsize { entry: ; CHECK: t2: -; CHECK: cvtsd2ss (%rdi), %xmm0 +; CHECK: cvtsd2ss ([[A0]]), %xmm0 %0 = load double* %x, align 8 %1 = fptrunc double %0 to float ret float %1 @@ -23,7 +24,7 @@ define float @squirtf(float* %x) nounwind { entry: ; CHECK: squirtf: -; CHECK: movss (%rdi), %xmm0 +; CHECK: movss ([[A0]]), %xmm0 ; CHECK: sqrtss %xmm0, %xmm0 %z = load float* %x %t = call float @llvm.sqrt.f32(float %z) @@ -33,7 +34,7 @@ define double @squirt(double* %x) nounwind { entry: ; CHECK: squirt: -; CHECK: movsd (%rdi), %xmm0 +; CHECK: movsd ([[A0]]), %xmm0 ; CHECK: sqrtsd %xmm0, %xmm0 %z = load double* %x %t = call double @llvm.sqrt.f64(double %z) @@ -43,7 +44,7 @@ define float @squirtf_size(float* %x) nounwind optsize { entry: ; CHECK: squirtf_size: -; CHECK: sqrtss (%rdi), %xmm0 +; CHECK: sqrtss ([[A0]]), %xmm0 %z = load float* %x %t = call float @llvm.sqrt.f32(float %z) ret float %t @@ -52,7 +53,7 @@ define double @squirt_size(double* %x) nounwind optsize { entry: ; CHECK: squirt_size: -; CHECK: sqrtsd (%rdi), %xmm0 +; CHECK: sqrtsd ([[A0]]), %xmm0 %z = load double* %x %t = call double @llvm.sqrt.f64(double %z) ret double %t From geek4civic at gmail.com Tue Feb 22 01:19:28 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:19:28 -0000 Subject: [llvm-commits] [llvm] r126198 - /llvm/trunk/test/CodeGen/X86/codegen-prepare-extload.ll Message-ID: <20110222071928.B4FFA2A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:19:28 2011 New Revision: 126198 URL: http://llvm.org/viewvc/llvm-project?rev=126198&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/codegen-prepare-extload.ll Modified: llvm/trunk/test/CodeGen/X86/codegen-prepare-extload.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/codegen-prepare-extload.ll?rev=126198&r1=126197&r2=126198&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/codegen-prepare-extload.ll (original) +++ llvm/trunk/test/CodeGen/X86/codegen-prepare-extload.ll Tue Feb 22 01:19:28 2011 @@ -1,10 +1,11 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win64 | FileCheck %s ; rdar://7304838 ; CodeGenPrepare should move the zext into the block with the load ; so that SelectionDAG can select it with the load. -; CHECK: movzbl (%rdi), %eax +; CHECK: movzbl ({{%rdi|%rcx}}), %eax define void @foo(i8* %p, i32* %q) { entry: From geek4civic at gmail.com Tue Feb 22 01:19:37 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:19:37 -0000 Subject: [llvm-commits] [llvm] r126199 - /llvm/trunk/test/CodeGen/X86/constant-pool-sharing.ll Message-ID: <20110222071937.9C5FA2A6C12D@llvm.org> Author: chapuni Date: Tue Feb 22 01:19:37 2011 New Revision: 126199 URL: http://llvm.org/viewvc/llvm-project?rev=126199&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/constant-pool-sharing.ll Modified: llvm/trunk/test/CodeGen/X86/constant-pool-sharing.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/constant-pool-sharing.ll?rev=126199&r1=126198&r2=126199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/constant-pool-sharing.ll (original) +++ llvm/trunk/test/CodeGen/X86/constant-pool-sharing.ll Tue Feb 22 01:19:37 2011 @@ -1,11 +1,12 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; llc should share constant pool entries between this integer vector ; and this floating-point vector since they have the same encoding. ; CHECK: LCPI0_0(%rip), %xmm0 -; CHECK: movaps %xmm0, (%rdi) -; CHECK: movaps %xmm0, (%rsi) +; CHECK: movaps %xmm0, ({{%rdi|%rcx}}) +; CHECK: movaps %xmm0, ({{%rsi|%rdx}}) define void @foo(<4 x i32>* %p, <4 x float>* %q, i1 %t) nounwind { entry: From geek4civic at gmail.com Tue Feb 22 01:19:46 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:19:46 -0000 Subject: [llvm-commits] [llvm] r126200 - /llvm/trunk/test/CodeGen/X86/ctpop-combine.ll Message-ID: <20110222071946.303222A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:19:46 2011 New Revision: 126200 URL: http://llvm.org/viewvc/llvm-project?rev=126200&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/ctpop-combine.ll Modified: llvm/trunk/test/CodeGen/X86/ctpop-combine.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ctpop-combine.ll?rev=126200&r1=126199&r2=126200&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/ctpop-combine.ll (original) +++ llvm/trunk/test/CodeGen/X86/ctpop-combine.ll Tue Feb 22 01:19:46 2011 @@ -9,7 +9,7 @@ %conv = zext i1 %cmp to i32 ret i32 %conv ; CHECK: test1: -; CHECK: leaq -1(%rdi) +; CHECK: leaq -1([[A0:%rdi|%rcx]]) ; CHECK-NEXT: testq ; CHECK-NEXT: setne ; CHECK: ret @@ -22,7 +22,7 @@ %conv = zext i1 %cmp to i32 ret i32 %conv ; CHECK: test2: -; CHECK: leaq -1(%rdi) +; CHECK: leaq -1([[A0]]) ; CHECK-NEXT: testq ; CHECK-NEXT: sete ; CHECK: ret From geek4civic at gmail.com Tue Feb 22 01:19:54 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:19:54 -0000 Subject: [llvm-commits] [llvm] r126201 - /llvm/trunk/test/CodeGen/X86/fast-isel-cmp-branch.ll Message-ID: <20110222071954.E59082A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:19:54 2011 New Revision: 126201 URL: http://llvm.org/viewvc/llvm-project?rev=126201&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/fast-isel-cmp-branch.ll Modified: llvm/trunk/test/CodeGen/X86/fast-isel-cmp-branch.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-cmp-branch.ll?rev=126201&r1=126200&r2=126201&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-cmp-branch.ll (original) +++ llvm/trunk/test/CodeGen/X86/fast-isel-cmp-branch.ll Tue Feb 22 01:19:54 2011 @@ -1,13 +1,14 @@ -; RUN: llc -O0 -march=x86-64 -asm-verbose=false < %s | FileCheck %s +; RUN: llc -O0 -mtriple=x86_64-linux -asm-verbose=false < %s | FileCheck %s +; RUN: llc -O0 -mtriple=x86_64-win32 -asm-verbose=false < %s | FileCheck %s ; rdar://8337108 ; Fast-isel shouldn't try to look through the compare because it's in a ; different basic block, so its operands aren't necessarily exported ; for cross-block usage. -; CHECK: movb %al, 7(%rsp) +; CHECK: movb %al, [[OFS:[0-9]*]](%rsp) ; CHECK: callq {{_?}}bar -; CHECK: movb 7(%rsp), %al +; CHECK: movb [[OFS]](%rsp), %al declare void @bar() From geek4civic at gmail.com Tue Feb 22 01:20:02 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:20:02 -0000 Subject: [llvm-commits] [llvm] r126202 - /llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll Message-ID: <20110222072002.BC44C2A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:20:02 2011 New Revision: 126202 URL: http://llvm.org/viewvc/llvm-project?rev=126202&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll Modified: llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll?rev=126202&r1=126201&r2=126202&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll (original) +++ llvm/trunk/test/CodeGen/X86/fast-isel-gep.ll Tue Feb 22 01:20:02 2011 @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 -O0 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux -O0 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 -O0 | FileCheck %s --check-prefix=X64 ; RUN: llc < %s -march=x86 -O0 | FileCheck %s --check-prefix=X32 ; GEP indices are interpreted as signed integers, so they @@ -13,8 +14,8 @@ ; X32: ret ; X64: test1: -; X64: movslq %edi, %rax -; X64: movl (%rsi,%rax,4), %eax +; X64: movslq %e[[A0:di|cx]], %rax +; X64: movl (%r[[A1:si|dx]],%rax,4), %eax ; X64: ret } @@ -27,7 +28,7 @@ ; X32: ret ; X64: test2: -; X64: movl (%rsi,%rdi,4), %eax +; X64: movl (%r[[A1]],%r[[A0]],4), %eax ; X64: ret } @@ -47,7 +48,7 @@ ; X32: ret ; X64: test3: -; X64: movb -2(%rdi), %al +; X64: movb -2(%r[[A0]]), %al ; X64: ret } @@ -80,9 +81,9 @@ %v11 = add i64 %B, %v10 ret i64 %v11 ; X64: test5: -; X64: movslq %esi, %rax -; X64-NEXT: movq (%rdi,%rax), %rax -; X64-NEXT: addq %rdx, %rax +; X64: movslq %e[[A1]], %rax +; X64-NEXT: movq (%r[[A0]],%rax), %rax +; X64-NEXT: addq %{{rdx|r8}}, %rax ; X64-NEXT: ret } From geek4civic at gmail.com Tue Feb 22 01:20:10 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:20:10 -0000 Subject: [llvm-commits] [llvm] r126203 - /llvm/trunk/test/CodeGen/X86/gather-addresses.ll Message-ID: <20110222072010.845512A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:20:10 2011 New Revision: 126203 URL: http://llvm.org/viewvc/llvm-project?rev=126203&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/gather-addresses.ll Modified: llvm/trunk/test/CodeGen/X86/gather-addresses.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/gather-addresses.ll?rev=126203&r1=126202&r2=126203&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/gather-addresses.ll (original) +++ llvm/trunk/test/CodeGen/X86/gather-addresses.ll Tue Feb 22 01:20:10 2011 @@ -1,20 +1,21 @@ -; RUN: llc -march=x86-64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-win32 < %s | FileCheck %s ; rdar://7398554 ; When doing vector gather-scatter index calculation with 32-bit indices, ; bounce the vector off of cache rather than shuffling each individual ; element out of the index vector. -; CHECK: andps (%rdx), %xmm0 -; CHECK: movaps %xmm0, -24(%rsp) -; CHECK: movslq -24(%rsp), %rax -; CHECK: movsd (%rdi,%rax,8), %xmm0 -; CHECK: movslq -20(%rsp), %rax -; CHECK: movhpd (%rdi,%rax,8), %xmm0 -; CHECK: movslq -16(%rsp), %rax -; CHECK: movsd (%rdi,%rax,8), %xmm1 -; CHECK: movslq -12(%rsp), %rax -; CHECK: movhpd (%rdi,%rax,8), %xmm1 +; CHECK: andps ([[H:%rdx|%r8]]), %xmm0 +; CHECK: movaps %xmm0, {{(-24)?}}(%rsp) +; CHECK: movslq {{(-24)?}}(%rsp), %rax +; CHECK: movsd ([[P:%rdi|%rcx]],%rax,8), %xmm0 +; CHECK: movslq {{-20|4}}(%rsp), %rax +; CHECK: movhpd ([[P]],%rax,8), %xmm0 +; CHECK: movslq {{-16|8}}(%rsp), %rax +; CHECK: movsd ([[P]],%rax,8), %xmm1 +; CHECK: movslq {{-12|12}}(%rsp), %rax +; CHECK: movhpd ([[P]],%rax,8), %xmm1 define <4 x double> @foo(double* %p, <4 x i32>* %i, <4 x i32>* %h) nounwind { %a = load <4 x i32>* %i From geek4civic at gmail.com Tue Feb 22 01:20:18 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:20:18 -0000 Subject: [llvm-commits] [llvm] r126204 - /llvm/trunk/test/CodeGen/X86/i128-ret.ll Message-ID: <20110222072018.E0C4A2A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:20:18 2011 New Revision: 126204 URL: http://llvm.org/viewvc/llvm-project?rev=126204&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/i128-ret.ll Modified: llvm/trunk/test/CodeGen/X86/i128-ret.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/i128-ret.ll?rev=126204&r1=126203&r2=126204&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/i128-ret.ll (original) +++ llvm/trunk/test/CodeGen/X86/i128-ret.ll Tue Feb 22 01:20:18 2011 @@ -1,5 +1,7 @@ -; RUN: llc < %s -march=x86-64 | grep {movq 8(%rdi), %rdx} -; RUN: llc < %s -march=x86-64 | grep {movq (%rdi), %rax} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s +; CHECK: movq ([[A0:%rdi|%rcx]]), %rax +; CHECK: movq 8([[A0]]), %rdx define i128 @test(i128 *%P) { %A = load i128* %P From geek4civic at gmail.com Tue Feb 22 01:20:26 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:20:26 -0000 Subject: [llvm-commits] [llvm] r126205 - /llvm/trunk/test/CodeGen/X86/lea.ll Message-ID: <20110222072027.003E92A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:20:26 2011 New Revision: 126205 URL: http://llvm.org/viewvc/llvm-project?rev=126205&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/lea.ll Modified: llvm/trunk/test/CodeGen/X86/lea.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/lea.ll?rev=126205&r1=126204&r2=126205&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/lea.ll (original) +++ llvm/trunk/test/CodeGen/X86/lea.ll Tue Feb 22 01:20:26 2011 @@ -1,11 +1,12 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s define i32 @test1(i32 %x) nounwind { %tmp1 = shl i32 %x, 3 %tmp2 = add i32 %tmp1, 7 ret i32 %tmp2 ; CHECK: test1: -; CHECK: leal 7(,%rdi,8), %eax +; CHECK: leal 7(,[[A0:%rdi|%rcx]],8), %eax } @@ -27,8 +28,8 @@ bb2: ret i32 %x_offs ; CHECK: test2: -; CHECK: leal -5(%rdi), %eax +; CHECK: leal -5([[A0]]), %eax ; CHECK: andl $-4, %eax ; CHECK: negl %eax -; CHECK: leal -4(%rdi,%rax), %eax +; CHECK: leal -4([[A0]],%rax), %eax } From geek4civic at gmail.com Tue Feb 22 01:20:35 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:20:35 -0000 Subject: [llvm-commits] [llvm] r126206 - /llvm/trunk/test/CodeGen/X86/lsr-overflow.ll Message-ID: <20110222072035.8EAAE2A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:20:35 2011 New Revision: 126206 URL: http://llvm.org/viewvc/llvm-project?rev=126206&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/lsr-overflow.ll Modified: llvm/trunk/test/CodeGen/X86/lsr-overflow.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/lsr-overflow.ll?rev=126206&r1=126205&r2=126206&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/lsr-overflow.ll (original) +++ llvm/trunk/test/CodeGen/X86/lsr-overflow.ll Tue Feb 22 01:20:35 2011 @@ -1,10 +1,11 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; The comparison uses the pre-inc value, which could lead LSR to ; try to compute -INT64_MIN. ; CHECK: movabsq $-9223372036854775808, %rax -; CHECK: cmpq %rax, %rbx +; CHECK: cmpq %rax, ; CHECK: sete %al declare i64 @bar() From geek4civic at gmail.com Tue Feb 22 01:20:44 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:20:44 -0000 Subject: [llvm-commits] [llvm] r126207 - /llvm/trunk/test/CodeGen/X86/lsr-reuse-trunc.ll Message-ID: <20110222072044.3AF352A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:20:44 2011 New Revision: 126207 URL: http://llvm.org/viewvc/llvm-project?rev=126207&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/lsr-reuse-trunc.ll Modified: llvm/trunk/test/CodeGen/X86/lsr-reuse-trunc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/lsr-reuse-trunc.ll?rev=126207&r1=126206&r2=126207&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/lsr-reuse-trunc.ll (original) +++ llvm/trunk/test/CodeGen/X86/lsr-reuse-trunc.ll Tue Feb 22 01:20:44 2011 @@ -1,12 +1,13 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; Full strength reduction wouldn't reduce register pressure, so LSR should ; stick with indexing here. -; CHECK: movaps (%rsi,%rax,4), %xmm3 -; CHECK: movaps %xmm3, (%rdi,%rax,4) +; CHECK: movaps (%{{rsi|rdx}},%rax,4), %xmm3 +; CHECK: movaps %xmm3, (%{{rdi|rcx}},%rax,4) ; CHECK: addq $4, %rax -; CHECK: cmpl %eax, (%rdx) +; CHECK: cmpl %eax, (%{{rdx|r8}}) ; CHECK-NEXT: jg define void @vvfloorf(float* nocapture %y, float* nocapture %x, i32* nocapture %n) nounwind { From geek4civic at gmail.com Tue Feb 22 01:20:52 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:20:52 -0000 Subject: [llvm-commits] [llvm] r126208 - /llvm/trunk/test/CodeGen/X86/memcmp.ll Message-ID: <20110222072052.D79AA2A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:20:52 2011 New Revision: 126208 URL: http://llvm.org/viewvc/llvm-project?rev=126208&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/memcmp.ll Modified: llvm/trunk/test/CodeGen/X86/memcmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/memcmp.ll?rev=126208&r1=126207&r2=126208&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/memcmp.ll (original) +++ llvm/trunk/test/CodeGen/X86/memcmp.ll Tue Feb 22 01:20:52 2011 @@ -1,4 +1,5 @@ -; RUN: llc %s -o - -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; This tests codegen time inlining/optimization of memcmp ; rdar://6480398 @@ -20,8 +21,8 @@ return: ; preds = %entry ret void ; CHECK: memcmp2: -; CHECK: movw (%rdi), %ax -; CHECK: cmpw (%rsi), %ax +; CHECK: movw ([[A0:%rdi|%rcx]]), %ax +; CHECK: cmpw ([[A1:%rsi|%rdx]]), %ax } define void @memcmp2a(i8* %X, i32* nocapture %P) nounwind { @@ -37,7 +38,7 @@ return: ; preds = %entry ret void ; CHECK: memcmp2a: -; CHECK: cmpw $28527, (%rdi) +; CHECK: cmpw $28527, ([[A0]]) } @@ -54,8 +55,8 @@ return: ; preds = %entry ret void ; CHECK: memcmp4: -; CHECK: movl (%rdi), %eax -; CHECK: cmpl (%rsi), %eax +; CHECK: movl ([[A0]]), %eax +; CHECK: cmpl ([[A1]]), %eax } define void @memcmp4a(i8* %X, i32* nocapture %P) nounwind { @@ -71,7 +72,7 @@ return: ; preds = %entry ret void ; CHECK: memcmp4a: -; CHECK: cmpl $1869573999, (%rdi) +; CHECK: cmpl $1869573999, ([[A0]]) } define void @memcmp8(i8* %X, i8* %Y, i32* nocapture %P) nounwind { @@ -87,8 +88,8 @@ return: ; preds = %entry ret void ; CHECK: memcmp8: -; CHECK: movq (%rdi), %rax -; CHECK: cmpq (%rsi), %rax +; CHECK: movq ([[A0]]), %rax +; CHECK: cmpq ([[A1]]), %rax } define void @memcmp8a(i8* %X, i32* nocapture %P) nounwind { @@ -105,6 +106,6 @@ ret void ; CHECK: memcmp8a: ; CHECK: movabsq $8029759185026510694, %rax -; CHECK: cmpq %rax, (%rdi) +; CHECK: cmpq %rax, ([[A0]]) } From geek4civic at gmail.com Tue Feb 22 01:21:01 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:01 -0000 Subject: [llvm-commits] [llvm] r126209 - /llvm/trunk/test/CodeGen/X86/movgs.ll Message-ID: <20110222072101.3D7432A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:01 2011 New Revision: 126209 URL: http://llvm.org/viewvc/llvm-project?rev=126209&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/movgs.ll Modified: llvm/trunk/test/CodeGen/X86/movgs.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/movgs.ll?rev=126209&r1=126208&r2=126209&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/movgs.ll (original) +++ llvm/trunk/test/CodeGen/X86/movgs.ll Tue Feb 22 01:21:01 2011 @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86 -mattr=sse41 | FileCheck %s --check-prefix=X32 -; RUN: llc < %s -march=x86-64 -mattr=sse41 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux -mattr=sse41 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 -mattr=sse41 | FileCheck %s --check-prefix=X64 define i32 @test1() nounwind readonly { entry: @@ -30,7 +31,7 @@ ; X32: calll *%gs:(%eax) ; X64: test2: -; X64: callq *%gs:(%rdi) +; X64: callq *%gs:([[A0:%rdi|%rcx]]) @@ -50,7 +51,7 @@ ; X32: ret ; X64: pmovsxwd_1: -; X64: pmovsxwd %gs:(%rdi), %xmm0 +; X64: pmovsxwd %gs:([[A0]]), %xmm0 ; X64: ret } From geek4civic at gmail.com Tue Feb 22 01:21:09 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:09 -0000 Subject: [llvm-commits] [llvm] r126210 - /llvm/trunk/test/CodeGen/X86/optimize-max-3.ll Message-ID: <20110222072109.1E9F02A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:08 2011 New Revision: 126210 URL: http://llvm.org/viewvc/llvm-project?rev=126210&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/optimize-max-3.ll Modified: llvm/trunk/test/CodeGen/X86/optimize-max-3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/optimize-max-3.ll?rev=126210&r1=126209&r2=126210&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/optimize-max-3.ll (original) +++ llvm/trunk/test/CodeGen/X86/optimize-max-3.ll Tue Feb 22 01:21:08 2011 @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux -asm-verbose=false | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 -asm-verbose=false | FileCheck %s ; LSR's OptimizeMax should eliminate the select (max). @@ -40,13 +41,13 @@ ; CHECK: jle ; CHECK-NOT: cmov -; CHECK: xorl %edi, %edi +; CHECK: xorl {{%edi, %edi|%ecx, %ecx}} ; CHECK-NEXT: align ; CHECK-NEXT: BB1_2: ; CHECK-NEXT: callq -; CHECK-NEXT: incl %ebx -; CHECK-NEXT: cmpl %r14d, %ebx -; CHECK-NEXT: movq %rax, %rdi +; CHECK-NEXT: incl [[BX:%ebx|%esi]] +; CHECK-NEXT: cmpl [[R14:%r14d|%edi]], [[BX]] +; CHECK-NEXT: movq %rax, %r{{di|cx}} ; CHECK-NEXT: jl define void @_Z18GenerateStatusPagei(i32 %jobs_to_display) nounwind { From geek4civic at gmail.com Tue Feb 22 01:21:17 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:17 -0000 Subject: [llvm-commits] [llvm] r126211 - /llvm/trunk/test/CodeGen/X86/pr9127.ll Message-ID: <20110222072117.8DE3E2A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:17 2011 New Revision: 126211 URL: http://llvm.org/viewvc/llvm-project?rev=126211&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. On @foobar(double %d, double* %x), AMD64: (%xmm0, %rdi) Win64: (%xmm0, %rdx) (not %rcx!) Modified: llvm/trunk/test/CodeGen/X86/pr9127.ll Modified: llvm/trunk/test/CodeGen/X86/pr9127.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr9127.ll?rev=126211&r1=126210&r2=126211&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pr9127.ll (original) +++ llvm/trunk/test/CodeGen/X86/pr9127.ll Tue Feb 22 01:21:17 2011 @@ -1,4 +1,5 @@ -; RUN: llc -march=x86-64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-win32 < %s | FileCheck %s define i8 @foobar(double %d, double* %x) { entry: @@ -9,4 +10,4 @@ } ; test that the load is folded. -; CHECK: ucomisd (%rdi), %xmm0 +; CHECK: ucomisd (%{{rdi|rdx}}), %xmm0 From geek4civic at gmail.com Tue Feb 22 01:21:25 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:25 -0000 Subject: [llvm-commits] [llvm] r126212 - /llvm/trunk/test/CodeGen/X86/remat-mov-0.ll Message-ID: <20110222072125.97CD02A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:25 2011 New Revision: 126212 URL: http://llvm.org/viewvc/llvm-project?rev=126212&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/remat-mov-0.ll Modified: llvm/trunk/test/CodeGen/X86/remat-mov-0.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/remat-mov-0.ll?rev=126212&r1=126211&r2=126212&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/remat-mov-0.ll (original) +++ llvm/trunk/test/CodeGen/X86/remat-mov-0.ll Tue Feb 22 01:21:25 2011 @@ -1,12 +1,13 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; CodeGen should remat the zero instead of spilling it. declare void @foo(i64 %p) ; CHECK: bar: -; CHECK: xorl %edi, %edi -; CHECK: xorl %edi, %edi +; CHECK: xorl %e[[A0:di|cx]], %e +; CHECK: xorl %e[[A0]], %e[[A0]] define void @bar() nounwind { call void @foo(i64 0) call void @foo(i64 0) @@ -14,8 +15,8 @@ } ; CHECK: bat: -; CHECK: movq $-1, %rdi -; CHECK: movq $-1, %rdi +; CHECK: movq $-1, %r[[A0]] +; CHECK: movq $-1, %r[[A0]] define void @bat() nounwind { call void @foo(i64 -1) call void @foo(i64 -1) @@ -23,8 +24,8 @@ } ; CHECK: bau: -; CHECK: movl $1, %edi -; CHECK: movl $1, %edi +; CHECK: movl $1, %e[[A0]] +; CHECK: movl $1, %e[[A0]] define void @bau() nounwind { call void @foo(i64 1) call void @foo(i64 1) From geek4civic at gmail.com Tue Feb 22 01:21:33 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:33 -0000 Subject: [llvm-commits] [llvm] r126213 - /llvm/trunk/test/CodeGen/X86/test-shrink.ll Message-ID: <20110222072133.C51612A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:33 2011 New Revision: 126213 URL: http://llvm.org/viewvc/llvm-project?rev=126213&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/test-shrink.ll Modified: llvm/trunk/test/CodeGen/X86/test-shrink.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/test-shrink.ll?rev=126213&r1=126212&r2=126213&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/test-shrink.ll (original) +++ llvm/trunk/test/CodeGen/X86/test-shrink.ll Tue Feb 22 01:21:33 2011 @@ -1,8 +1,9 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s --check-prefix=CHECK-64 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=CHECK-64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=CHECK-64 ; RUN: llc < %s -march=x86 | FileCheck %s --check-prefix=CHECK-32 ; CHECK-64: g64xh: -; CHECK-64: testb $8, %ah +; CHECK-64: testb $8, {{%ah|%ch}} ; CHECK-64: ret ; CHECK-32: g64xh: ; CHECK-32: testb $8, %ah @@ -19,7 +20,7 @@ ret void } ; CHECK-64: g64xl: -; CHECK-64: testb $8, %dil +; CHECK-64: testb $8, [[A0L:%dil|%cl]] ; CHECK-64: ret ; CHECK-32: g64xl: ; CHECK-32: testb $8, %al @@ -36,7 +37,7 @@ ret void } ; CHECK-64: g32xh: -; CHECK-64: testb $8, %ah +; CHECK-64: testb $8, {{%ah|%ch}} ; CHECK-64: ret ; CHECK-32: g32xh: ; CHECK-32: testb $8, %ah @@ -53,7 +54,7 @@ ret void } ; CHECK-64: g32xl: -; CHECK-64: testb $8, %dil +; CHECK-64: testb $8, [[A0L]] ; CHECK-64: ret ; CHECK-32: g32xl: ; CHECK-32: testb $8, %al @@ -70,7 +71,7 @@ ret void } ; CHECK-64: g16xh: -; CHECK-64: testb $8, %ah +; CHECK-64: testb $8, {{%ah|%ch}} ; CHECK-64: ret ; CHECK-32: g16xh: ; CHECK-32: testb $8, %ah @@ -87,7 +88,7 @@ ret void } ; CHECK-64: g16xl: -; CHECK-64: testb $8, %dil +; CHECK-64: testb $8, [[A0L]] ; CHECK-64: ret ; CHECK-32: g16xl: ; CHECK-32: testb $8, %al @@ -104,7 +105,7 @@ ret void } ; CHECK-64: g64x16: -; CHECK-64: testw $-32640, %di +; CHECK-64: testw $-32640, %[[A0W:di|cx]] ; CHECK-64: ret ; CHECK-32: g64x16: ; CHECK-32: testw $-32640, %ax @@ -121,7 +122,7 @@ ret void } ; CHECK-64: g32x16: -; CHECK-64: testw $-32640, %di +; CHECK-64: testw $-32640, %[[A0W]] ; CHECK-64: ret ; CHECK-32: g32x16: ; CHECK-32: testw $-32640, %ax @@ -138,7 +139,7 @@ ret void } ; CHECK-64: g64x32: -; CHECK-64: testl $268468352, %edi +; CHECK-64: testl $268468352, %e[[A0W]] ; CHECK-64: ret ; CHECK-32: g64x32: ; CHECK-32: testl $268468352, %eax From geek4civic at gmail.com Tue Feb 22 01:21:42 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:42 -0000 Subject: [llvm-commits] [llvm] r126214 - /llvm/trunk/test/CodeGen/X86/use-add-flags.ll Message-ID: <20110222072142.961FA2A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:42 2011 New Revision: 126214 URL: http://llvm.org/viewvc/llvm-project?rev=126214&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/use-add-flags.ll Modified: llvm/trunk/test/CodeGen/X86/use-add-flags.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/use-add-flags.ll?rev=126214&r1=126213&r2=126214&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/use-add-flags.ll (original) +++ llvm/trunk/test/CodeGen/X86/use-add-flags.ll Tue Feb 22 01:21:42 2011 @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 -o - | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; Reuse the flags value from the add instructions instead of emitting separate ; testl instructions. @@ -6,9 +7,9 @@ ; Use the flags on the add. ; CHECK: test1: -; CHECK: addl (%rdi), %esi -; CHECK-NEXT: movl %edx, %eax -; CHECK-NEXT: cmovnsl %ecx, %eax +; CHECK: addl (%r[[A0:di|cx]]), {{%esi|%edx}} +; CHECK-NEXT: movl {{%edx|%r8d}}, %eax +; CHECK-NEXT: cmovnsl {{%ecx|%r9d}}, %eax ; CHECK-NEXT: ret define i32 @test1(i32* %x, i32 %y, i32 %a, i32 %b) nounwind { @@ -25,7 +26,7 @@ ; other use. A simple test is better. ; CHECK: test2: -; CHECK: testb $16, %dil +; CHECK: testb $16, {{%dil|%cl}} define void @test2(i32 %x) nounwind { %y = and i32 %x, 16 @@ -41,7 +42,7 @@ ; Do use the flags result of the and here, since the and has another use. ; CHECK: test3: -; CHECK: andl $16, %edi +; CHECK: andl $16, %e[[A0]] ; CHECK-NEXT: jne define void @test3(i32 %x) nounwind { From geek4civic at gmail.com Tue Feb 22 01:21:51 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:51 -0000 Subject: [llvm-commits] [llvm] r126215 - /llvm/trunk/test/CodeGen/X86/vec_shuffle-37.ll Message-ID: <20110222072151.366D42A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:51 2011 New Revision: 126215 URL: http://llvm.org/viewvc/llvm-project?rev=126215&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-37.ll Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-37.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-37.ll?rev=126215&r1=126214&r2=126215&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-37.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-37.ll Tue Feb 22 01:21:51 2011 @@ -1,9 +1,10 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; RUN: llc -O0 < %s -march=x86 -mcpu=core2 | FileCheck %s --check-prefix=CHECK_O0 define <4 x i32> @t00(<4 x i32>* %a0) nounwind ssp { entry: -; CHECK: movaps (%rdi), %xmm0 +; CHECK: movaps ({{%rdi|%rcx}}), %xmm0 ; CHECK-NEXT: movaps %xmm0, %xmm1 ; CHECK-NEXT: movlps (%rax), %xmm1 ; CHECK-NEXT: shufps $36, %xmm1, %xmm0 From geek4civic at gmail.com Tue Feb 22 01:21:59 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 07:21:59 -0000 Subject: [llvm-commits] [llvm] r126216 - /llvm/trunk/test/CodeGen/X86/xor.ll Message-ID: <20110222072200.02E462A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 01:21:59 2011 New Revision: 126216 URL: http://llvm.org/viewvc/llvm-project?rev=126216&view=rev Log: Relax expressions and add explicit triplets -linux and -win32. Modified: llvm/trunk/test/CodeGen/X86/xor.ll Modified: llvm/trunk/test/CodeGen/X86/xor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor.ll?rev=126216&r1=126215&r2=126216&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/xor.ll (original) +++ llvm/trunk/test/CodeGen/X86/xor.ll Tue Feb 22 01:21:59 2011 @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s -check-prefix=X32 -; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=X64 ; Though it is undefined, we want xor undef,undef to produce zero. define <4 x i32> @test1() nounwind { @@ -28,9 +29,9 @@ ret i32 %tmp4 ; X64: test3: -; X64: notl %esi -; X64: andl %edi, %esi -; X64: movl %esi, %eax +; X64: notl [[A1:%esi|%edx]] +; X64: andl [[A0:%edi|%ecx]], [[A1]] +; X64: movl [[A1]], %eax ; X64: shrl %eax ; X64: ret From atrick at apple.com Tue Feb 22 01:37:36 2011 From: atrick at apple.com (Andrew Trick) Date: Mon, 21 Feb 2011 23:37:36 -0800 Subject: [llvm-commits] [llvm] r126190 - in /llvm/trunk: lib/CodeGen/VirtRegRewriter.cpp test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll In-Reply-To: References: <20110222065256.869732A6C12C@llvm.org> Message-ID: <06D9DEF7-C18A-472D-B0AD-FF3EBBDE8305@apple.com> On Feb 21, 2011, at 10:59 PM, Evan Cheng wrote: > > On Feb 21, 2011, at 10:52 PM, Andrew Trick wrote: > >> Author: atrick >> Date: Tue Feb 22 00:52:56 2011 >> New Revision: 126190 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=126190&view=rev >> Log: >> VirtRegRewriter assertion fix. >> Apparently it's ok for multiple operands to "kill" the same register. > > It is? > > Evan Prior to the standard spiller, we have: MOV8mr %vreg34, 1, %noreg, 3, %noreg, %vreg34:sub_8bit; mem:ST1[%arrayidx833] GR32_ABCD:%vreg34 Before rewriting we have: %EAX = MOV32rm , 1, %noreg, 0, %noreg; mem:LD4[FixedStack0] MOV8mr %EAX, 1, %noreg, 3, %noreg, %AL; mem:ST1[%arrayidx833] After rewriting: %EAX = MOV32rm , 1, %noreg, 0, %noreg; mem:LD4[FixedStack0] MOV8mr %EAX, 1, %noreg, 3, %noreg, %AL; mem:ST1[%arrayidx833] It seems valid enough to me for a combination of passes that will hopefully soon be deprecated. I'm honestly not sure yet what the ideal rules should be for subreg kill flags. -Andy > >> Fixes PR9237. >> >> Added: >> llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll >> Modified: >> llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp >> >> Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=126190&r1=126189&r2=126190&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) >> +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 22 00:52:56 2011 >> @@ -478,7 +478,8 @@ >> if (!RegKills[KReg]) >> return; >> >> - assert(KillOps[KReg] == KillOp && "invalid superreg kill flags"); >> + assert(KillOps[KReg]->getParent() == KillOp->getParent() && >> + "invalid superreg kill flags"); >> KillOps[KReg] = NULL; >> RegKills.reset(KReg); >> >> @@ -487,7 +488,8 @@ >> for (const unsigned *SR = TRI->getSubRegisters(KReg); *SR; ++SR) { >> DEBUG(dbgs() << " Resurrect subreg " << TRI->getName(*SR) << "\n"); >> >> - assert(KillOps[*SR] == KillOp && "invalid subreg kill flags"); >> + assert(KillOps[*SR]->getParent() == KillOp->getParent() && >> + "invalid subreg kill flags"); >> KillOps[*SR] = NULL; >> RegKills.reset(*SR); >> } >> >> Added: llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll?rev=126190&view=auto >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll (added) >> +++ llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll Tue Feb 22 00:52:56 2011 >> @@ -0,0 +1,50 @@ >> +; RUN: llc < %s -O2 -march=x86 -mtriple=i386-pc-linux-gnu -relocation-model=pic | FileCheck %s >> +; PR9237: Assertion in VirtRegRewriter.cpp, ResurrectConfirmedKill >> +; `KillOps[*SR] == KillOp && "invalid subreg kill flags"' >> + >> +%t = type { i32 } >> + >> +define i32 @foo(%t* %s) nounwind { >> +entry: >> + br label %if.then735 >> + >> +if.then735: >> + %call747 = call i32 undef(%t* %s, i8* null, i8* undef, i32 128, i8* undef, i32 516) nounwind >> + br i1 undef, label %if.then751, label %if.then758 >> + >> +if.then751: >> + unreachable >> + >> +if.then758: >> + %add761 = add i32 %call747, 4 >> + %add763 = add i32 %add761, %call747 >> + %add.ptr768 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add761 >> + br i1 undef, label %cond.false783, label %cond.true771 >> + >> +cond.true771: >> + %call782 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) >> + br label %cond.end791 >> + >> +; CHECK: calll __memmove_chk >> +cond.false783: >> + %call.i1035 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) nounwind >> + br label %cond.end791 >> + >> +cond.end791: >> + %conv801 = trunc i32 %call747 to i8 >> + %add.ptr822.sum = add i32 %call747, 3 >> + %arrayidx833 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add.ptr822.sum >> + store i8 %conv801, i8* %arrayidx833, align 1 >> + %cmp841 = icmp eq i8* undef, null >> + br i1 %cmp841, label %if.end849, label %if.then843 >> + >> +if.then843: >> + unreachable >> + >> +if.end849: >> + %call921 = call i32 undef(%t* %s, i8* undef, i8* undef, i32 %add763) nounwind >> + unreachable >> + >> +} >> + >> +declare i8* @__memmove_chk(i8*, i8*, i32, i32) nounwind >> >> >> _______________________________________________ >> 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/20110221/ca7d319a/attachment.html From baldrick at free.fr Tue Feb 22 01:43:33 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Feb 2011 08:43:33 +0100 Subject: [llvm-commits] [llvm] r126124 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp unittests/Transforms/Utils/Local.cpp In-Reply-To: <4D62E4BC.7070401@mxc.ca> References: <20110221162737.25AFB2A6C12C@llvm.org> <4D62E4BC.7070401@mxc.ca> Message-ID: <4D636925.2020505@free.fr> Hi Nick, >> - if (PHINode *IP = dyn_cast(I)) >> - if (!PHIs.insert(IP)) { >> - // Break the cycle and delete the PHI and its operands. >> - IP->replaceAllUsesWith(UndefValue::get(IP->getType())); >> - (void)RecursivelyDeleteTriviallyDeadInstructions(IP); >> - Changed = true; >> - break; >> - } >> - return Changed; >> + if (!Visited.insert(I)) { >> + // Break the cycle and delete the instruction and its operands. >> + I->replaceAllUsesWith(UndefValue::get(I->getType())); >> + return RecursivelyDeleteTriviallyDeadInstructions(I); > > return RecursivelyDeleteTriviallyDeadInstructions(I) || Changed; ? I changed this to unconditionally return true shortly afterwards. Note that the RAUW always makes a change because I is known to have at least one use at this point. Ciao, Duncan. From evan.cheng at apple.com Tue Feb 22 01:58:50 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Feb 2011 23:58:50 -0800 Subject: [llvm-commits] [llvm] r126190 - in /llvm/trunk: lib/CodeGen/VirtRegRewriter.cpp test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll In-Reply-To: <06D9DEF7-C18A-472D-B0AD-FF3EBBDE8305@apple.com> References: <20110222065256.869732A6C12C@llvm.org> <06D9DEF7-C18A-472D-B0AD-FF3EBBDE8305@apple.com> Message-ID: <975998C3-B38B-4798-AC2E-3D4EB9B69E92@apple.com> On Feb 21, 2011, at 11:37 PM, Andrew Trick wrote: > On Feb 21, 2011, at 10:59 PM, Evan Cheng wrote: >> >> On Feb 21, 2011, at 10:52 PM, Andrew Trick wrote: >> >>> Author: atrick >>> Date: Tue Feb 22 00:52:56 2011 >>> New Revision: 126190 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=126190&view=rev >>> Log: >>> VirtRegRewriter assertion fix. >>> Apparently it's ok for multiple operands to "kill" the same register. >> >> It is? >> >> Evan > > Prior to the standard spiller, we have: > MOV8mr %vreg34, 1, %noreg, 3, %noreg, %vreg34:sub_8bit; mem:ST1[%arrayidx833] GR32_ABCD:%vreg34 > > Before rewriting we have: > %EAX = MOV32rm , 1, %noreg, 0, %noreg; mem:LD4[FixedStack0] > MOV8mr %EAX, 1, %noreg, 3, %noreg, %AL; mem:ST1[%arrayidx833] The *right* representation is for EAX being the only kill. But I agree it's hard to eliminate the extra kill. Evan > > After rewriting: > %EAX = MOV32rm , 1, %noreg, 0, %noreg; mem:LD4[FixedStack0] > MOV8mr %EAX, 1, %noreg, 3, %noreg, %AL; mem:ST1[%arrayidx833] > > It seems valid enough to me for a combination of passes that will hopefully soon be deprecated. I'm honestly not sure yet what the ideal rules should be for subreg kill flags. > > -Andy > >> >>> Fixes PR9237. >>> >>> Added: >>> llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll >>> Modified: >>> llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp >>> >>> Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=126190&r1=126189&r2=126190&view=diff >>> ============================================================================== >>> --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 22 00:52:56 2011 >>> @@ -478,7 +478,8 @@ >>> if (!RegKills[KReg]) >>> return; >>> >>> - assert(KillOps[KReg] == KillOp && "invalid superreg kill flags"); >>> + assert(KillOps[KReg]->getParent() == KillOp->getParent() && >>> + "invalid superreg kill flags"); >>> KillOps[KReg] = NULL; >>> RegKills.reset(KReg); >>> >>> @@ -487,7 +488,8 @@ >>> for (const unsigned *SR = TRI->getSubRegisters(KReg); *SR; ++SR) { >>> DEBUG(dbgs() << " Resurrect subreg " << TRI->getName(*SR) << "\n"); >>> >>> - assert(KillOps[*SR] == KillOp && "invalid subreg kill flags"); >>> + assert(KillOps[*SR]->getParent() == KillOp->getParent() && >>> + "invalid subreg kill flags"); >>> KillOps[*SR] = NULL; >>> RegKills.reset(*SR); >>> } >>> >>> Added: llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll?rev=126190&view=auto >>> ============================================================================== >>> --- llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll (added) >>> +++ llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll Tue Feb 22 00:52:56 2011 >>> @@ -0,0 +1,50 @@ >>> +; RUN: llc < %s -O2 -march=x86 -mtriple=i386-pc-linux-gnu -relocation-model=pic | FileCheck %s >>> +; PR9237: Assertion in VirtRegRewriter.cpp, ResurrectConfirmedKill >>> +; `KillOps[*SR] == KillOp && "invalid subreg kill flags"' >>> + >>> +%t = type { i32 } >>> + >>> +define i32 @foo(%t* %s) nounwind { >>> +entry: >>> + br label %if.then735 >>> + >>> +if.then735: >>> + %call747 = call i32 undef(%t* %s, i8* null, i8* undef, i32 128, i8* undef, i32 516) nounwind >>> + br i1 undef, label %if.then751, label %if.then758 >>> + >>> +if.then751: >>> + unreachable >>> + >>> +if.then758: >>> + %add761 = add i32 %call747, 4 >>> + %add763 = add i32 %add761, %call747 >>> + %add.ptr768 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add761 >>> + br i1 undef, label %cond.false783, label %cond.true771 >>> + >>> +cond.true771: >>> + %call782 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) >>> + br label %cond.end791 >>> + >>> +; CHECK: calll __memmove_chk >>> +cond.false783: >>> + %call.i1035 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) nounwind >>> + br label %cond.end791 >>> + >>> +cond.end791: >>> + %conv801 = trunc i32 %call747 to i8 >>> + %add.ptr822.sum = add i32 %call747, 3 >>> + %arrayidx833 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add.ptr822.sum >>> + store i8 %conv801, i8* %arrayidx833, align 1 >>> + %cmp841 = icmp eq i8* undef, null >>> + br i1 %cmp841, label %if.end849, label %if.then843 >>> + >>> +if.then843: >>> + unreachable >>> + >>> +if.end849: >>> + %call921 = call i32 undef(%t* %s, i8* undef, i8* undef, i32 %add763) nounwind >>> + unreachable >>> + >>> +} >>> + >>> +declare i8* @__memmove_chk(i8*, i8*, i32, i32) nounwind >>> >>> >>> _______________________________________________ >>> 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/20110221/8f589038/attachment.html From jaykang10 at imrc.kist.re.kr Tue Feb 22 02:22:10 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Tue, 22 Feb 2011 17:22:10 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> Hi llvm-commits members I think Fold() function on TargetFolder class is only called when creating constant expression. When return value 'Constant *CF' from ConstantFoldConstantExpression() function on Fold() is different from argument 'CE', argument 'CE' is old and redundant and this 'CE' increases use count of its operands. so I think redundant 'CE' has to be removed as follows: Index: include/llvm/Support/TargetFolder.h =================================================================== --- include/llvm/Support/TargetFolder.h (revision 126080) +++ include/llvm/Support/TargetFolder.h (working copy) @@ -34,8 +34,11 @@ /// Fold - Fold the constant using target specific information. Constant *Fold(Constant *C) const { if (ConstantExpr *CE = dyn_cast(C)) - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { + if (CF != CE) + CE->destroyConstant(); return CF; + } return C; } Please review the attached patch. Thank you, Jin-Gu Kang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110222/ad7d797b/attachment.html -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Fold_Patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110222/ad7d797b/attachment.pl From geek4civic at gmail.com Tue Feb 22 02:22:54 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 22 Feb 2011 08:22:54 -0000 Subject: [llvm-commits] [llvm] r126217 - /llvm/trunk/test/CodeGen/X86/vec_cast.ll Message-ID: <20110222082254.73A902A6C12C@llvm.org> Author: chapuni Date: Tue Feb 22 02:22:54 2011 New Revision: 126217 URL: http://llvm.org/viewvc/llvm-project?rev=126217&view=rev Log: Revert r126195, "test/CodeGen/X86/vec_cast.ll: Mark as XFAIL: migw,win32 for workaround of PR8311." It seems it affected configuration --target=i686-pc-mingw32, I don't know and will investigate why. Modified: llvm/trunk/test/CodeGen/X86/vec_cast.ll Modified: llvm/trunk/test/CodeGen/X86/vec_cast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_cast.ll?rev=126217&r1=126216&r2=126217&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_cast.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_cast.ll Tue Feb 22 02:22:54 2011 @@ -1,6 +1,5 @@ ; RUN: llc < %s -march=x86-64 -mcpu=core2 -; PR8311 -; XFAIL: mingw,win32 + define <8 x i32> @a(<8 x i16> %a) nounwind { %c = sext <8 x i16> %a to <8 x i32> From baldrick at free.fr Tue Feb 22 02:35:55 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Feb 2011 09:35:55 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> Message-ID: <4D63756B.8090201@free.fr> Hi Jin Gu Kang, > --- include/llvm/Support/TargetFolder.h (revision 126080) > +++ include/llvm/Support/TargetFolder.h (working copy) > @@ -34,8 +34,11 @@ > /// Fold - Fold the constant using target specific information. > Constant *Fold(Constant *C) const { > if (ConstantExpr *CE = dyn_cast(C)) > - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) > + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { > + if (CF != CE) > + CE->destroyConstant(); this is wrong. Constants are global and uniqued: if someone creates a constant, eg: 27, any later attempt to create an identical constant (27) returns the same constant as was created earlier, not a new one. This means that you can check if constants are identical by comparing their pointer values. It also means that you can't free a constant like your patch does without first proving that it is not being used anywhere. Ciao, Duncan. From zwarich at apple.com Tue Feb 22 02:54:30 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Tue, 22 Feb 2011 08:54:30 -0000 Subject: [llvm-commits] [llvm] r126218 - in /llvm/trunk: include/llvm/CodeGen/MachineConstantPool.h lib/CodeGen/MachineFunction.cpp Message-ID: <20110222085430.3A7CE2A6C12D@llvm.org> Author: zwarich Date: Tue Feb 22 02:54:30 2011 New Revision: 126218 URL: http://llvm.org/viewvc/llvm-project?rev=126218&view=rev Log: MachineConstantPoolValues are not uniqued, so they need to be freed if they share entries. Add a DenseSet to MachineConstantPool for the MachineCPVs that it owns. This will hopefully fix the MC/ARM/elf-reloc-01.ll failure on the leaks bots. Modified: llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h llvm/trunk/lib/CodeGen/MachineFunction.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h?rev=126218&r1=126217&r2=126218&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h Tue Feb 22 02:54:30 2011 @@ -16,6 +16,7 @@ #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H +#include "llvm/ADT/DenseSet.h" #include #include #include @@ -130,6 +131,8 @@ const TargetData *TD; ///< The machine's TargetData. unsigned PoolAlignment; ///< The alignment for the pool. std::vector Constants; ///< The pool of constants. + /// MachineConstantPoolValues that use an existing MachineConstantPoolEntry. + DenseSet MachineCPVsSharingEntries; public: /// @brief The only constructor. explicit MachineConstantPool(const TargetData *td) Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=126218&r1=126217&r2=126218&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Tue Feb 22 02:54:30 2011 @@ -644,6 +644,10 @@ for (unsigned i = 0, e = Constants.size(); i != e; ++i) if (Constants[i].isMachineConstantPoolEntry()) delete Constants[i].Val.MachineCPVal; + for (DenseSet::iterator I = + MachineCPVsSharingEntries.begin(), E = MachineCPVsSharingEntries.end(); + I != E; ++I) + delete *I; } /// CanShareConstantPoolEntry - Test whether the given two constants @@ -721,8 +725,10 @@ // // FIXME, this could be made much more efficient for large constant pools. int Idx = V->getExistingMachineCPValue(this, Alignment); - if (Idx != -1) + if (Idx != -1) { + MachineCPVsSharingEntries.insert(V); return (unsigned)Idx; + } Constants.push_back(MachineConstantPoolEntry(V, Alignment)); return Constants.size()-1; From jaykang10 at imrc.kist.re.kr Tue Feb 22 03:07:33 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Tue, 22 Feb 2011 18:07:33 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D637A95.10109@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> OK. I unstand :) I send modified patch Index: include/llvm/Support/TargetFolder.h =================================================================== --- include/llvm/Support/TargetFolder.h (revision 126080) +++ include/llvm/Support/TargetFolder.h (working copy) @@ -34,8 +34,12 @@ /// Fold - Fold the constant using target specific information. Constant *Fold(Constant *C) const { if (ConstantExpr *CE = dyn_cast(C)) - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { + if (CF != CE) + if (CE->use_empty()) + CE->destroyConstant(); return CF; + } return C; } ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Tuesday, February 22, 2011 5:57 PM To: Jin Gu Kang Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > Argument of Fold() is as follows: > file: include/llvm/Support/TargetFolder.h on llvm-2.8 > Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, > unsigned NumIdx) const { > return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); > } > > Newly made ConstantExpr is argument of Fold() function. It may not really be new, that's the point. Ciao, Duncan. > --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) > so if Fold() function make new folded ConstantExpr, I think > previous created ConstantExpr is redundant. > > ________________________________________ > From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 5:35 PM > To: llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> --- include/llvm/Support/TargetFolder.h (revision 126080) >> +++ include/llvm/Support/TargetFolder.h (working copy) >> @@ -34,8 +34,11 @@ >> /// Fold - Fold the constant using target specific information. >> Constant *Fold(Constant *C) const { >> if (ConstantExpr *CE = dyn_cast(C)) >> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >> + if (CF != CE) >> + CE->destroyConstant(); > > this is wrong. Constants are global and uniqued: if someone creates a constant, > eg: 27, any later attempt to create an identical constant (27) returns the same > constant as was created earlier, not a new one. This means that you can check > if constants are identical by comparing their pointer values. It also means > that you can't free a constant like your patch does without first proving that > it is not being used anywhere. > > Ciao, Duncan. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Fold_Patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110222/4d199dd0/attachment-0001.pl From baldrick at free.fr Tue Feb 22 03:22:29 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Feb 2011 10:22:29 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> Message-ID: <4D638055.6080201@free.fr> Hi Jin Gu Kang, > OK. I unstand :) > > I send modified patch I think this is pointless. Unused constants can be created in many places, so concentrating on one makes no sense. If you want to get rid of them it would be better to add a pass that looks at all constants and zaps those that are unused. For all I know maybe some pass does this already. Ciao, Duncan. > > Index: include/llvm/Support/TargetFolder.h > =================================================================== > --- include/llvm/Support/TargetFolder.h (revision 126080) > +++ include/llvm/Support/TargetFolder.h (working copy) > @@ -34,8 +34,12 @@ > /// Fold - Fold the constant using target specific information. > Constant *Fold(Constant *C) const { > if (ConstantExpr *CE = dyn_cast(C)) > - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) > + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { > + if (CF != CE) > + if (CE->use_empty()) > + CE->destroyConstant(); > return CF; > + } > return C; > } > > > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 5:57 PM > To: Jin Gu Kang > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > >> Argument of Fold() is as follows: >> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >> unsigned NumIdx) const { >> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >> } >> >> Newly made ConstantExpr is argument of Fold() function. > > It may not really be new, that's the point. > > Ciao, Duncan. > >> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >> so if Fold() function make new folded ConstantExpr, I think >> previous created ConstantExpr is redundant. >> >> ________________________________________ >> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:35 PM >> To: llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >> Hi Jin Gu Kang, >> >>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>> +++ include/llvm/Support/TargetFolder.h (working copy) >>> @@ -34,8 +34,11 @@ >>> /// Fold - Fold the constant using target specific information. >>> Constant *Fold(Constant *C) const { >>> if (ConstantExpr *CE = dyn_cast(C)) >>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>> + if (CF != CE) >>> + CE->destroyConstant(); >> >> this is wrong. Constants are global and uniqued: if someone creates a constant, >> eg: 27, any later attempt to create an identical constant (27) returns the same >> constant as was created earlier, not a new one. This means that you can check >> if constants are identical by comparing their pointer values. It also means >> that you can't free a constant like your patch does without first proving that >> it is not being used anywhere. >> >> Ciao, Duncan. >> _______________________________________________ >> 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 Feb 22 03:31:09 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Feb 2011 01:31:09 -0800 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> Message-ID: <4D63825D.8020803@mxc.ca> Jin Gu Kang wrote: > OK. I unstand :) > > I send modified patch > > Index: include/llvm/Support/TargetFolder.h > =================================================================== > --- include/llvm/Support/TargetFolder.h (revision 126080) > +++ include/llvm/Support/TargetFolder.h (working copy) > @@ -34,8 +34,12 @@ > /// Fold - Fold the constant using target specific information. > Constant *Fold(Constant *C) const { > if (ConstantExpr *CE = dyn_cast(C)) > - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) > + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { > + if (CF != CE) > + if (CE->use_empty()) Still no; just because its use-list is empty, doesn't mean that some piece of code doesn't have local variable "Constant *C = ..." holding that ConstantExpr. As strange as it sounds, constants, types and metadata can only be cleaned up by llvm_shutdown (or, if you're using llvm as a library then the creator of the LLVMContext who knows everything about what state llvm is in, can prove that it's safe to delete constants). This isn't theoretical, either. The target folder is used by the IRBuilder which in turn is used by many passes to emit new IR. Nick PS. There's one exception, but it doesn't matter; the bitcode reader has a private subclass of Constant which it uses to creates placeholder constants. Since those can never escape the bitcode reader itself, it knows that it's safe to delete them. > + CE->destroyConstant(); > return CF; > + } > return C; > } > > > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 5:57 PM > To: Jin Gu Kang > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > >> Argument of Fold() is as follows: >> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >> unsigned NumIdx) const { >> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >> } >> >> Newly made ConstantExpr is argument of Fold() function. > > It may not really be new, that's the point. > > Ciao, Duncan. > >> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >> so if Fold() function make new folded ConstantExpr, I think >> previous created ConstantExpr is redundant. >> >> ________________________________________ >> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:35 PM >> To: llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >> Hi Jin Gu Kang, >> >>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>> +++ include/llvm/Support/TargetFolder.h (working copy) >>> @@ -34,8 +34,11 @@ >>> /// Fold - Fold the constant using target specific information. >>> Constant *Fold(Constant *C) const { >>> if (ConstantExpr *CE = dyn_cast(C)) >>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>> + if (CF != CE) >>> + CE->destroyConstant(); >> >> this is wrong. Constants are global and uniqued: if someone creates a constant, >> eg: 27, any later attempt to create an identical constant (27) returns the same >> constant as was created earlier, not a new one. This means that you can check >> if constants are identical by comparing their pointer values. It also means >> that you can't free a constant like your patch does without first proving that >> it is not being used anywhere. >> >> Ciao, Duncan. >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jaykang10 at imrc.kist.re.kr Tue Feb 22 04:10:15 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Tue, 22 Feb 2011 19:10:15 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D638055.6080201@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF3@base.imrc.kist.re.kr> OK. I see. I found wrong use count of value caused by useless ConstantExpr, so reported this issue. :) Thanks your comment. Jin-Gu Kang ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Tuesday, February 22, 2011 6:22 PM To: Jin Gu Kang Cc: llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Hi Jin Gu Kang, > OK. I unstand :) > > I send modified patch I think this is pointless. Unused constants can be created in many places, so concentrating on one makes no sense. If you want to get rid of them it would be better to add a pass that looks at all constants and zaps those that are unused. For all I know maybe some pass does this already. Ciao, Duncan. > > Index: include/llvm/Support/TargetFolder.h > =================================================================== > --- include/llvm/Support/TargetFolder.h (revision 126080) > +++ include/llvm/Support/TargetFolder.h (working copy) > @@ -34,8 +34,12 @@ > /// Fold - Fold the constant using target specific information. > Constant *Fold(Constant *C) const { > if (ConstantExpr *CE = dyn_cast(C)) > - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) > + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { > + if (CF != CE) > + if (CE->use_empty()) > + CE->destroyConstant(); > return CF; > + } > return C; > } > > > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 5:57 PM > To: Jin Gu Kang > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > >> Argument of Fold() is as follows: >> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >> unsigned NumIdx) const { >> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >> } >> >> Newly made ConstantExpr is argument of Fold() function. > > It may not really be new, that's the point. > > Ciao, Duncan. > >> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >> so if Fold() function make new folded ConstantExpr, I think >> previous created ConstantExpr is redundant. >> >> ________________________________________ >> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:35 PM >> To: llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >> Hi Jin Gu Kang, >> >>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>> +++ include/llvm/Support/TargetFolder.h (working copy) >>> @@ -34,8 +34,11 @@ >>> /// Fold - Fold the constant using target specific information. >>> Constant *Fold(Constant *C) const { >>> if (ConstantExpr *CE = dyn_cast(C)) >>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>> + if (CF != CE) >>> + CE->destroyConstant(); >> >> this is wrong. Constants are global and uniqued: if someone creates a constant, >> eg: 27, any later attempt to create an identical constant (27) returns the same >> constant as was created earlier, not a new one. This means that you can check >> if constants are identical by comparing their pointer values. It also means >> that you can't free a constant like your patch does without first proving that >> it is not being used anywhere. >> >> Ciao, Duncan. >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jaykang10 at imrc.kist.re.kr Tue Feb 22 04:57:00 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Tue, 22 Feb 2011 19:57:00 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D638055.6080201@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> Hi Duncan I forgot to ask a question about wrong use count. Making ConstantExpr for GetElementPtr is following: Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, unsigned NumIdx) const { return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); } When argument 'C' is bitcast ConstantExpr on above code, SymbolicallyEvaluateGEP() function under Fold() function changes bitcast ConstantExpr to bitcast ConstantExpr's operand(0) using stripPointerCasts() and makes new GEP using it This increases use count of bitcast ConstantExpr's operand(0). (I tested that bitcast ConstantExpr's operand(0) is global variable for struct type with initializer.) If some passes use information of use count for value, wrong use count may cause wrong pass. To solve this issue, I thought that if first argument of GetElementPtr ConstantExpratter is bitcast ConstantExpr and it is useless after making GetElementPtr ConstantExpr, it has to be removed because of wrong use count. what do you think about wrong use count? P.S llvm passes which remove useless ConstantExpr are likely to be often called before each pass which uses information of use count. Thanks, Jin-Gu Kang ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Tuesday, February 22, 2011 6:22 PM To: Jin Gu Kang Cc: llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Hi Jin Gu Kang, > OK. I unstand :) > > I send modified patch I think this is pointless. Unused constants can be created in many places, so concentrating on one makes no sense. If you want to get rid of them it would be better to add a pass that looks at all constants and zaps those that are unused. For all I know maybe some pass does this already. Ciao, Duncan. > > Index: include/llvm/Support/TargetFolder.h > =================================================================== > --- include/llvm/Support/TargetFolder.h (revision 126080) > +++ include/llvm/Support/TargetFolder.h (working copy) > @@ -34,8 +34,12 @@ > /// Fold - Fold the constant using target specific information. > Constant *Fold(Constant *C) const { > if (ConstantExpr *CE = dyn_cast(C)) > - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) > + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { > + if (CF != CE) > + if (CE->use_empty()) > + CE->destroyConstant(); > return CF; > + } > return C; > } > > > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 5:57 PM > To: Jin Gu Kang > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > >> Argument of Fold() is as follows: >> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >> unsigned NumIdx) const { >> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >> } >> >> Newly made ConstantExpr is argument of Fold() function. > > It may not really be new, that's the point. > > Ciao, Duncan. > >> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >> so if Fold() function make new folded ConstantExpr, I think >> previous created ConstantExpr is redundant. >> >> ________________________________________ >> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:35 PM >> To: llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >> Hi Jin Gu Kang, >> >>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>> +++ include/llvm/Support/TargetFolder.h (working copy) >>> @@ -34,8 +34,11 @@ >>> /// Fold - Fold the constant using target specific information. >>> Constant *Fold(Constant *C) const { >>> if (ConstantExpr *CE = dyn_cast(C)) >>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>> + if (CF != CE) >>> + CE->destroyConstant(); >> >> this is wrong. Constants are global and uniqued: if someone creates a constant, >> eg: 27, any later attempt to create an identical constant (27) returns the same >> constant as was created earlier, not a new one. This means that you can check >> if constants are identical by comparing their pointer values. It also means >> that you can't free a constant like your patch does without first proving that >> it is not being used anywhere. >> >> Ciao, Duncan. >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Tue Feb 22 05:21:54 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Feb 2011 12:21:54 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> Message-ID: <4D639C52.2060401@free.fr> Hi Jin Gu Kang, > I forgot to ask a question about wrong use count. > > Making ConstantExpr for GetElementPtr is following: > Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, > unsigned NumIdx) const { > return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); > } > > When argument 'C' is bitcast ConstantExpr on above code, > SymbolicallyEvaluateGEP() function under Fold() function changes bitcast ConstantExpr > to bitcast ConstantExpr's operand(0) using stripPointerCasts() and makes new GEP using it > This increases use count of bitcast ConstantExpr's operand(0). > (I tested that bitcast ConstantExpr's operand(0) is global variable for struct type with initializer.) > If some passes use information of use count for value, wrong use count may cause wrong pass. first note this only impacts constants and not instructions. Passes which work on constants need to be aware of the possibility that constants may have uses that are themselves unused. See SafeToDestroyConstant in GlobalOpt.cpp for an example of how one pass deals with this issue. > To solve this issue, I thought that if first argument of GetElementPtr ConstantExpratter is bitcast > ConstantExpr and it is useless after making GetElementPtr ConstantExpr, it has to be removed > because of wrong use count. > > what do you think about wrong use count? It is not wrong, it is correct because the constant indeed has that many uses. Ciao, Duncan. > > P.S > llvm passes which remove useless ConstantExpr are likely to be often called before each pass which uses > information of use count. > > Thanks, > Jin-Gu Kang > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 6:22 PM > To: Jin Gu Kang > Cc: llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> OK. I unstand :) >> >> I send modified patch > > I think this is pointless. Unused constants can be created in many places, so > concentrating on one makes no sense. If you want to get rid of them it would > be better to add a pass that looks at all constants and zaps those that are > unused. For all I know maybe some pass does this already. > > Ciao, Duncan. > >> >> Index: include/llvm/Support/TargetFolder.h >> =================================================================== >> --- include/llvm/Support/TargetFolder.h (revision 126080) >> +++ include/llvm/Support/TargetFolder.h (working copy) >> @@ -34,8 +34,12 @@ >> /// Fold - Fold the constant using target specific information. >> Constant *Fold(Constant *C) const { >> if (ConstantExpr *CE = dyn_cast(C)) >> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >> + if (CF != CE) >> + if (CE->use_empty()) >> + CE->destroyConstant(); >> return CF; >> + } >> return C; >> } >> >> >> ________________________________________ >> From: Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:57 PM >> To: Jin Gu Kang >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >>> Argument of Fold() is as follows: >>> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >>> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >>> unsigned NumIdx) const { >>> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >>> } >>> >>> Newly made ConstantExpr is argument of Fold() function. >> >> It may not really be new, that's the point. >> >> Ciao, Duncan. >> >>> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >>> so if Fold() function make new folded ConstantExpr, I think >>> previous created ConstantExpr is redundant. >>> >>> ________________________________________ >>> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >>> Sent: Tuesday, February 22, 2011 5:35 PM >>> To: llvm-commits at cs.uiuc.edu >>> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >>> >>> Hi Jin Gu Kang, >>> >>>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>>> +++ include/llvm/Support/TargetFolder.h (working copy) >>>> @@ -34,8 +34,11 @@ >>>> /// Fold - Fold the constant using target specific information. >>>> Constant *Fold(Constant *C) const { >>>> if (ConstantExpr *CE = dyn_cast(C)) >>>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>>> + if (CF != CE) >>>> + CE->destroyConstant(); >>> >>> this is wrong. Constants are global and uniqued: if someone creates a constant, >>> eg: 27, any later attempt to create an identical constant (27) returns the same >>> constant as was created earlier, not a new one. This means that you can check >>> if constants are identical by comparing their pointer values. It also means >>> that you can't free a constant like your patch does without first proving that >>> it is not being used anywhere. >>> >>> Ciao, Duncan. >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jaykang10 at imrc.kist.re.kr Tue Feb 22 06:09:47 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Tue, 22 Feb 2011 21:09:47 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D639C52.2060401@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr>, <4D639C52.2060401@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> I thought useless ConstantExpr makes useless Use information for its constant operands and they causes inefficient behavior when we use functions like replaceAllUsesWith() because of wrong Use inforamtion. so I thought redundant ConstantExpr has to be removed immediately. --- include/llvm/Support/TargetFolder.h (revision 126080) +++ include/llvm/Support/TargetFolder.h (working copy) @@ -34,8 +34,11 @@ /// Fold - Fold the constant using target specific information. Constant *Fold(Constant *C) const { if (ConstantExpr *CE = dyn_cast(C)) - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { + if (CF != CE) + CE->destroyConstant(); return CF; + } return C; } Thanks, Jin-Gu Kang ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Tuesday, February 22, 2011 8:21 PM To: Jin Gu Kang Cc: llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Hi Jin Gu Kang, > I forgot to ask a question about wrong use count. > > Making ConstantExpr for GetElementPtr is following: > Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, > unsigned NumIdx) const { > return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); > } > > When argument 'C' is bitcast ConstantExpr on above code, > SymbolicallyEvaluateGEP() function under Fold() function changes bitcast ConstantExpr > to bitcast ConstantExpr's operand(0) using stripPointerCasts() and makes new GEP using it > This increases use count of bitcast ConstantExpr's operand(0). > (I tested that bitcast ConstantExpr's operand(0) is global variable for struct type with initializer.) > If some passes use information of use count for value, wrong use count may cause wrong pass. first note this only impacts constants and not instructions. Passes which work on constants need to be aware of the possibility that constants may have uses that are themselves unused. See SafeToDestroyConstant in GlobalOpt.cpp for an example of how one pass deals with this issue. > To solve this issue, I thought that if first argument of GetElementPtr ConstantExpratter is bitcast > ConstantExpr and it is useless after making GetElementPtr ConstantExpr, it has to be removed > because of wrong use count. > > what do you think about wrong use count? It is not wrong, it is correct because the constant indeed has that many uses. Ciao, Duncan. > > P.S > llvm passes which remove useless ConstantExpr are likely to be often called before each pass which uses > information of use count. > > Thanks, > Jin-Gu Kang > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 6:22 PM > To: Jin Gu Kang > Cc: llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> OK. I unstand :) >> >> I send modified patch > > I think this is pointless. Unused constants can be created in many places, so > concentrating on one makes no sense. If you want to get rid of them it would > be better to add a pass that looks at all constants and zaps those that are > unused. For all I know maybe some pass does this already. > > Ciao, Duncan. > >> >> Index: include/llvm/Support/TargetFolder.h >> =================================================================== >> --- include/llvm/Support/TargetFolder.h (revision 126080) >> +++ include/llvm/Support/TargetFolder.h (working copy) >> @@ -34,8 +34,12 @@ >> /// Fold - Fold the constant using target specific information. >> Constant *Fold(Constant *C) const { >> if (ConstantExpr *CE = dyn_cast(C)) >> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >> + if (CF != CE) >> + if (CE->use_empty()) >> + CE->destroyConstant(); >> return CF; >> + } >> return C; >> } >> >> >> ________________________________________ >> From: Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:57 PM >> To: Jin Gu Kang >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >>> Argument of Fold() is as follows: >>> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >>> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >>> unsigned NumIdx) const { >>> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >>> } >>> >>> Newly made ConstantExpr is argument of Fold() function. >> >> It may not really be new, that's the point. >> >> Ciao, Duncan. >> >>> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >>> so if Fold() function make new folded ConstantExpr, I think >>> previous created ConstantExpr is redundant. >>> >>> ________________________________________ >>> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >>> Sent: Tuesday, February 22, 2011 5:35 PM >>> To: llvm-commits at cs.uiuc.edu >>> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >>> >>> Hi Jin Gu Kang, >>> >>>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>>> +++ include/llvm/Support/TargetFolder.h (working copy) >>>> @@ -34,8 +34,11 @@ >>>> /// Fold - Fold the constant using target specific information. >>>> Constant *Fold(Constant *C) const { >>>> if (ConstantExpr *CE = dyn_cast(C)) >>>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>>> + if (CF != CE) >>>> + CE->destroyConstant(); >>> >>> this is wrong. Constants are global and uniqued: if someone creates a constant, >>> eg: 27, any later attempt to create an identical constant (27) returns the same >>> constant as was created earlier, not a new one. This means that you can check >>> if constants are identical by comparing their pointer values. It also means >>> that you can't free a constant like your patch does without first proving that >>> it is not being used anywhere. >>> >>> Ciao, Duncan. >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Tue Feb 22 06:22:17 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Feb 2011 13:22:17 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr>, <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> Message-ID: <4D63AA79.60904@free.fr> Hi Jin Gu Kang, > I thought useless ConstantExpr makes useless Use information for its constant operands and > they causes inefficient behavior when we use functions like replaceAllUsesWith() > because of wrong Use inforamtion. I doubt there is any measurable compile time impact due to this effect. Did you see one? Ciao, Duncan. From jaykang10 at imrc.kist.re.kr Tue Feb 22 06:55:44 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Tue, 22 Feb 2011 21:55:44 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D63AA79.60904@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr>, <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr>, <4D63AA79.60904@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> Functions like replaceAllUsesWith() is used as following: file: gcc/llvm-backend.cpp on llvm-gcc-4.2 void emit_global_to_llvm(tree decl) { ... if (GV->getType()->getElementType() != Init->getType()) { GV->removeFromParent(); GlobalVariable *NGV = new GlobalVariable(*TheModule, Init->getType(), GV->isConstant(), GV->getLinkage(), 0, GV->getName()); ... GV->replaceAllUsesWith(TheFolder->CreateBitCast(NGV, GV->getType())); ... } llvm-gcc makes new Global variable when Global variable's type is different from intializer's type and All Uses which use previous Global Variable are changed to new Global variable. If we makes useless ConstantExpr with previous Global variable, replaceAllUsesWith() function will change useless ConstantExpr's previous Global variable to new Global variable. I think it is inefficient. Thanks, Jin-Gu Kang ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Tuesday, February 22, 2011 9:22 PM To: Jin Gu Kang Cc: llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Hi Jin Gu Kang, > I thought useless ConstantExpr makes useless Use information for its constant operands and > they causes inefficient behavior when we use functions like replaceAllUsesWith() > because of wrong Use inforamtion. I doubt there is any measurable compile time impact due to this effect. Did you see one? Ciao, Duncan. From baldrick at free.fr Tue Feb 22 07:21:49 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Feb 2011 14:21:49 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr>, <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr>, <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> Message-ID: <4D63B86D.7000203@free.fr> Hi Jin Gu Kang, > If we makes useless ConstantExpr with previous Global variable, > replaceAllUsesWith() function will change useless ConstantExpr's previous Global variable > to new Global variable. I think it is inefficient. as you discovered, avoiding this is much more subtle than it appears. If a trivial change could deal with it, then I would be happy to make that change. But this is not the case, which then raises the question: is it worth spending time working on if there is in fact no measurable compile time impact? If you want to speed up compilation there are much better places to start. Ciao, Duncan. From jaykang10 at imrc.kist.re.kr Tue Feb 22 07:47:30 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Tue, 22 Feb 2011 22:47:30 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D63B86D.7000203@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr>, <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr>, <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr>, <4D63B86D.7000203@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr> replaceAllUsesWith() is an example. :) I don't know all of passes which use inforamtion of Use. so I would like to know whether this issue is trivial or not. I think view of you and other llvm-commiters are right. Thanks, Jin-Gu Kang ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Tuesday, February 22, 2011 10:21 PM To: Jin Gu Kang Cc: llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Hi Jin Gu Kang, > If we makes useless ConstantExpr with previous Global variable, > replaceAllUsesWith() function will change useless ConstantExpr's previous Global variable > to new Global variable. I think it is inefficient. as you discovered, avoiding this is much more subtle than it appears. If a trivial change could deal with it, then I would be happy to make that change. But this is not the case, which then raises the question: is it worth spending time working on if there is in fact no measurable compile time impact? If you want to speed up compilation there are much better places to start. Ciao, Duncan. From baldrick at free.fr Tue Feb 22 08:01:01 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Feb 2011 15:01:01 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr>, <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr>, <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr>, <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr> Message-ID: <4D63C19D.8020709@free.fr> Hi Jin Gu Kang, > replaceAllUsesWith() is an example. :) > > I don't know all of passes which use inforamtion of Use. > so I would like to know whether this issue is trivial or not. > > I think view of you and other llvm-commiters are right. there are usually many many more instructions than constants. Thus an issue like this that only concerns constants has almost certainly no compile time impact whatsoever. Ciao, Duncan. From ofv at wanadoo.es Tue Feb 22 09:40:20 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Tue, 22 Feb 2011 15:40:20 -0000 Subject: [llvm-commits] [llvm] r126224 - in /llvm/trunk: cmake/modules/AddLLVM.cmake cmake/modules/CMakeLists.txt cmake/modules/LLVM.cmake tools/llvm-config/CMakeLists.txt Message-ID: <20110222154021.0DA0F2A6C12C@llvm.org> Author: ofv Date: Tue Feb 22 09:40:20 2011 New Revision: 126224 URL: http://llvm.org/viewvc/llvm-project?rev=126224&view=rev Log: CMake: remove unnecessary variable. Modified: llvm/trunk/cmake/modules/AddLLVM.cmake llvm/trunk/cmake/modules/CMakeLists.txt llvm/trunk/cmake/modules/LLVM.cmake llvm/trunk/tools/llvm-config/CMakeLists.txt Modified: llvm/trunk/cmake/modules/AddLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=126224&r1=126223&r2=126224&view=diff ============================================================================== --- llvm/trunk/cmake/modules/AddLLVM.cmake (original) +++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Feb 22 09:40:20 2011 @@ -5,7 +5,6 @@ llvm_process_sources( ALL_FILES ${ARGN} ) add_library( ${name} ${ALL_FILES} ) set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} ) - set_property( GLOBAL APPEND PROPERTY LLVM_LIB_TARGETS ${name} ) if( LLVM_COMMON_DEPENDS ) add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) endif( LLVM_COMMON_DEPENDS ) Modified: llvm/trunk/cmake/modules/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CMakeLists.txt?rev=126224&r1=126223&r2=126224&view=diff ============================================================================== --- llvm/trunk/cmake/modules/CMakeLists.txt (original) +++ llvm/trunk/cmake/modules/CMakeLists.txt Tue Feb 22 09:40:20 2011 @@ -1,7 +1,6 @@ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/share/llvm/cmake") get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS) -get_property(llvm_lib_targets GLOBAL PROPERTY LLVM_LIB_TARGETS) configure_file( LLVM.cmake Modified: llvm/trunk/cmake/modules/LLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVM.cmake?rev=126224&r1=126223&r2=126224&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVM.cmake (original) +++ llvm/trunk/cmake/modules/LLVM.cmake Tue Feb 22 09:40:20 2011 @@ -6,8 +6,6 @@ set_property( GLOBAL PROPERTY LLVM_LIBS "@llvm_libs@") -set(llvm_lib_targets @llvm_lib_targets@) - set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@) set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@) Modified: llvm/trunk/tools/llvm-config/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/CMakeLists.txt?rev=126224&r1=126223&r2=126224&view=diff ============================================================================== --- llvm/trunk/tools/llvm-config/CMakeLists.txt (original) +++ llvm/trunk/tools/llvm-config/CMakeLists.txt Tue Feb 22 09:40:20 2011 @@ -124,8 +124,7 @@ add_custom_target(llvm-config.target ALL DEPENDS ${LLVM_CONFIG}) -get_property(llvm_lib_targets GLOBAL PROPERTY LLVM_LIB_TARGETS) -add_dependencies(llvm-config.target ${llvm_lib_targets}) +add_dependencies( llvm-config.target ${llvm_libs} ) # Make sure that llvm-config builds before the llvm tools, so we have # LibDeps.txt and can use it for updating the hard-coded library From stoklund at 2pi.dk Tue Feb 22 10:04:29 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Feb 2011 08:04:29 -0800 Subject: [llvm-commits] [llvm] r126190 - in /llvm/trunk: lib/CodeGen/VirtRegRewriter.cpp test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll In-Reply-To: <975998C3-B38B-4798-AC2E-3D4EB9B69E92@apple.com> References: <20110222065256.869732A6C12C@llvm.org> <06D9DEF7-C18A-472D-B0AD-FF3EBBDE8305@apple.com> <975998C3-B38B-4798-AC2E-3D4EB9B69E92@apple.com> Message-ID: On Feb 21, 2011, at 11:58 PM, Evan Cheng wrote: > > On Feb 21, 2011, at 11:37 PM, Andrew Trick wrote: > >>>> Apparently it's ok for multiple operands to "kill" the same register. >>> >>> It is? >>> >>> Evan >> >> Prior to the standard spiller, we have: >> MOV8mr %vreg34, 1, %noreg, 3, %noreg, %vreg34:sub_8bit; mem:ST1[%arrayidx833] GR32_ABCD:%vreg34 >> >> Before rewriting we have: >> %EAX = MOV32rm , 1, %noreg, 0, %noreg; mem:LD4[FixedStack0] >> MOV8mr %EAX, 1, %noreg, 3, %noreg, %AL; mem:ST1[%arrayidx833] > > The *right* representation is for EAX being the only kill. But I agree it's hard to eliminate the extra kill. The machine code verifier also accepts the second kill flag as optional. If we want a stricter format, we should perhaps consider requiring all operands to have kill flags. That way, you can tell from any operand if its instruction kills the register. /jakob From ajclinto at gmail.com Tue Feb 22 10:11:06 2011 From: ajclinto at gmail.com (Andrew Clinton) Date: Tue, 22 Feb 2011 11:11:06 -0500 Subject: [llvm-commits] Patch to delete loops with multiple exiting blocks In-Reply-To: References: Message-ID: Any takers? On Sun, Feb 20, 2011 at 12:28 PM, Andrew Clinton wrote: > This is a simple patch to improve the loop-delete pass so that it will > delete loops with multiple exiting blocks (but still a single exit). > From joerg at bec.de Tue Feb 22 10:53:11 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Tue, 22 Feb 2011 16:53:11 -0000 Subject: [llvm-commits] [llvm] r126225 - /llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Message-ID: <20110222165311.4FBE22A6C12C@llvm.org> Author: joerg Date: Tue Feb 22 10:53:11 2011 New Revision: 126225 URL: http://llvm.org/viewvc/llvm-project?rev=126225&view=rev Log: Bug#9172: Don't use static in file scope, use an attribute on the parser. Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=126225&r1=126224&r2=126225&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Tue Feb 22 10:53:11 2011 @@ -30,9 +30,10 @@ bool ParseSectionSwitch(StringRef Section, unsigned Type, unsigned Flags, SectionKind Kind); + bool SeenIdent; public: - ELFAsmParser() {} + ELFAsmParser() : SeenIdent(false) {} virtual void Initialize(MCAsmParser &Parser) { // Call the base implementation. @@ -456,13 +457,12 @@ SectionKind::getReadOnly(), 1, ""); - static bool First = true; - getStreamer().PushSection(); getStreamer().SwitchSection(Comment); - if (First) + if (!SeenIdent) { getStreamer().EmitIntValue(0, 1); - First = false; + SeenIdent = true; + } getStreamer().EmitBytes(Data, 0); getStreamer().EmitIntValue(0, 1); getStreamer().PopSection(); From rdivacky at freebsd.org Tue Feb 22 11:30:05 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Tue, 22 Feb 2011 17:30:05 -0000 Subject: [llvm-commits] [llvm] r126226 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h Message-ID: <20110222173005.5A9022A6C12C@llvm.org> Author: rdivacky Date: Tue Feb 22 11:30:05 2011 New Revision: 126226 URL: http://llvm.org/viewvc/llvm-project?rev=126226&view=rev Log: Stack alignment is 16 bytes on FreeBSD/i386 too. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=126226&r1=126225&r2=126226&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Feb 22 11:30:05 2011 @@ -342,9 +342,10 @@ assert((!Is64Bit || HasX86_64) && "64-bit code requested on a subtarget that doesn't support it!"); - // Stack alignment is 16 bytes on Darwin, Linux and Solaris (both 32 and 64 - // bit) and for all 64-bit targets. - if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || Is64Bit) + // Stack alignment is 16 bytes on Darwin, FreeBSD, Linux and Solaris (both + // 32 and 64 bit) and for all 64-bit targets. + if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() || + isTargetSolaris() || Is64Bit) stackAlignment = 16; if (StackAlignment) Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=126226&r1=126225&r2=126226&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Feb 22 11:30:05 2011 @@ -166,6 +166,7 @@ bool hasVectorUAMem() const { return HasVectorUAMem; } bool isTargetDarwin() const { return TargetTriple.getOS() == Triple::Darwin; } + bool isTargetFreeBSD() const { return TargetTriple.getOS() == Triple::FreeBSD; } bool isTargetSolaris() const { return TargetTriple.getOS() == Triple::Solaris; } // ELF is a reasonably sane default and the only other X86 targets we From dpatel at apple.com Tue Feb 22 12:56:12 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Feb 2011 18:56:12 -0000 Subject: [llvm-commits] [llvm] r126231 - in /llvm/trunk: include/llvm/Analysis/DIBuilder.h lib/Analysis/DIBuilder.cpp Message-ID: <20110222185612.BFFC32A6C12C@llvm.org> Author: dpatel Date: Tue Feb 22 12:56:12 2011 New Revision: 126231 URL: http://llvm.org/viewvc/llvm-project?rev=126231&view=rev Log: Follow LLVM coding style. clang uses DBuilder, so it requries corresponding change. Modified: llvm/trunk/include/llvm/Analysis/DIBuilder.h llvm/trunk/lib/Analysis/DIBuilder.cpp Modified: llvm/trunk/include/llvm/Analysis/DIBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DIBuilder.h?rev=126231&r1=126230&r2=126231&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DIBuilder.h (original) +++ llvm/trunk/include/llvm/Analysis/DIBuilder.h Tue Feb 22 12:56:12 2011 @@ -58,7 +58,7 @@ const MDNode *getCU() { return TheCU; } enum ComplexAddrKind { OpPlus=1, OpDeref }; - /// CreateCompileUnit - A CompileUnit provides an anchor for all debugging + /// createCompileUnit - A CompileUnit provides an anchor for all debugging /// information generated during this instance of compilation. /// @param Lang Source programming language, eg. dwarf::DW_LANG_C99 /// @param File File name @@ -72,67 +72,67 @@ /// by a tool analyzing generated debugging information. /// @param RV This indicates runtime version for languages like /// Objective-C. - void CreateCompileUnit(unsigned Lang, StringRef File, StringRef Dir, + void createCompileUnit(unsigned Lang, StringRef File, StringRef Dir, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RV); - /// CreateFile - Create a file descriptor to hold debugging information + /// createFile - Create a file descriptor to hold debugging information /// for a file. - DIFile CreateFile(StringRef Filename, StringRef Directory); + DIFile createFile(StringRef Filename, StringRef Directory); - /// CreateEnumerator - Create a single enumerator value. - DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val); + /// createEnumerator - Create a single enumerator value. + DIEnumerator createEnumerator(StringRef Name, uint64_t Val); - /// CreateBasicType - Create debugging information entry for a basic + /// createBasicType - Create debugging information entry for a basic /// type. /// @param Name Type name. /// @param SizeInBits Size of the type. /// @param AlignInBits Type alignment. /// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float. - DIType CreateBasicType(StringRef Name, uint64_t SizeInBits, + DIType createBasicType(StringRef Name, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding); - /// CreateQualifiedType - Create debugging information entry for a qualified + /// createQualifiedType - Create debugging information entry for a qualified /// type, e.g. 'const int'. /// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type /// @param FromTy Base Type. - DIType CreateQualifiedType(unsigned Tag, DIType FromTy); + DIType createQualifiedType(unsigned Tag, DIType FromTy); - /// CreatePointerType - Create debugging information entry for a pointer. + /// createPointerType - Create debugging information entry for a pointer. /// @param PointeeTy Type pointed by this pointer. /// @param SizeInBits Size. /// @param AlignInBits Alignment. (optional) /// @param Name Pointer type name. (optional) - DIType CreatePointerType(DIType PointeeTy, uint64_t SizeInBits, + DIType createPointerType(DIType PointeeTy, uint64_t SizeInBits, uint64_t AlignInBits = 0, StringRef Name = StringRef()); - /// CreateReferenceType - Create debugging information entry for a c++ + /// createReferenceType - Create debugging information entry for a c++ /// style reference. - DIType CreateReferenceType(DIType RTy); + DIType createReferenceType(DIType RTy); - /// CreateTypedef - Create debugging information entry for a typedef. + /// createTypedef - Create debugging information entry for a typedef. /// @param Ty Original type. /// @param Name Typedef name. /// @param File File where this type is defined. /// @param LineNo Line number. - DIType CreateTypedef(DIType Ty, StringRef Name, DIFile File, + DIType createTypedef(DIType Ty, StringRef Name, DIFile File, unsigned LineNo); - /// CreateFriend - Create debugging information entry for a 'friend'. - DIType CreateFriend(DIType Ty, DIType FriendTy); + /// createFriend - Create debugging information entry for a 'friend'. + DIType createFriend(DIType Ty, DIType FriendTy); - /// CreateInheritance - Create debugging information entry to establish + /// createInheritance - Create debugging information entry to establish /// inheritance relationship between two types. /// @param Ty Original type. /// @param BaseTy Base type. Ty is inherits from base. /// @param BaseOffset Base offset. /// @param Flags Flags to describe inheritance attribute, /// e.g. private - DIType CreateInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset, + DIType createInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset, unsigned Flags); - /// CreateMemberType - Create debugging information entry for a member. + /// createMemberType - Create debugging information entry for a member. /// @param Name Member name. /// @param File File where this member is defined. /// @param LineNo Line number. @@ -141,12 +141,12 @@ /// @param OffsetInBits Member offset. /// @param Flags Flags to encode member attribute, e.g. private /// @param Ty Parent type. - DIType CreateMemberType(StringRef Name, DIFile File, + DIType createMemberType(StringRef Name, DIFile File, unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, DIType Ty); - /// CreateClassType - Create debugging information entry for a class. + /// createClassType - Create debugging information entry for a class. /// @param Scope Scope in which this class is defined. /// @param Name class name. /// @param File File where this member is defined. @@ -161,14 +161,14 @@ /// DW_AT_containing_type. See DWARF documentation /// for more info. /// @param TemplateParms Template type parameters. - DIType CreateClassType(DIDescriptor Scope, StringRef Name, DIFile File, + DIType createClassType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom, DIArray Elements, MDNode *VTableHolder = 0, MDNode *TemplateParms = 0); - /// CreateStructType - Create debugging information entry for a struct. + /// createStructType - Create debugging information entry for a struct. /// @param Scope Scope in which this struct is defined. /// @param Name Struct name. /// @param File File where this member is defined. @@ -178,12 +178,12 @@ /// @param Flags Flags to encode member attribute, e.g. private /// @param Elements Struct elements. /// @param RunTimeLang Optional parameter, Objective-C runtime version. - DIType CreateStructType(DIDescriptor Scope, StringRef Name, DIFile File, + DIType createStructType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, DIArray Elements, unsigned RunTimeLang = 0); - /// CreateUnionType - Create debugging information entry for an union. + /// createUnionType - Create debugging information entry for an union. /// @param Scope Scope in which this union is defined. /// @param Name Union name. /// @param File File where this member is defined. @@ -193,12 +193,12 @@ /// @param Flags Flags to encode member attribute, e.g. private /// @param Elements Union elements. /// @param RunTimeLang Optional parameter, Objective-C runtime version. - DIType CreateUnionType(DIDescriptor Scope, StringRef Name, DIFile File, + DIType createUnionType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, DIArray Elements, unsigned RunTimeLang = 0); - /// CreateTemplateTypeParameter - Create debugging information for template + /// createTemplateTypeParameter - Create debugging information for template /// type parameter. /// @param Scope Scope in which this type is defined. /// @param Name Type parameter name. @@ -207,11 +207,11 @@ /// @param LineNo Line number. /// @param ColumnNo Column Number. DITemplateTypeParameter - CreateTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty, + createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty, MDNode *File = 0, unsigned LineNo = 0, unsigned ColumnNo = 0); - /// CreateTemplateValueParameter - Create debugging information for template + /// createTemplateValueParameter - Create debugging information for template /// value parameter. /// @param Scope Scope in which this type is defined. /// @param Name Value parameter name. @@ -221,28 +221,28 @@ /// @param LineNo Line number. /// @param ColumnNo Column Number. DITemplateValueParameter - CreateTemplateValueParameter(DIDescriptor Scope, StringRef Name, DIType Ty, + createTemplateValueParameter(DIDescriptor Scope, StringRef Name, DIType Ty, uint64_t Value, MDNode *File = 0, unsigned LineNo = 0, unsigned ColumnNo = 0); - /// CreateArrayType - Create debugging information entry for an array. + /// createArrayType - Create debugging information entry for an array. /// @param Size Array size. /// @param AlignInBits Alignment. /// @param Ty Element type. /// @param Subscripts Subscripts. - DIType CreateArrayType(uint64_t Size, uint64_t AlignInBits, + DIType createArrayType(uint64_t Size, uint64_t AlignInBits, DIType Ty, DIArray Subscripts); - /// CreateVectorType - Create debugging information entry for a vector type. + /// createVectorType - Create debugging information entry for a vector type. /// @param Size Array size. /// @param AlignInBits Alignment. /// @param Ty Element type. /// @param Subscripts Subscripts. - DIType CreateVectorType(uint64_t Size, uint64_t AlignInBits, + DIType createVectorType(uint64_t Size, uint64_t AlignInBits, DIType Ty, DIArray Subscripts); - /// CreateEnumerationType - Create debugging information entry for an + /// createEnumerationType - Create debugging information entry for an /// enumeration. /// @param Scope Scope in which this enumeration is defined. /// @param Name Union name. @@ -251,40 +251,40 @@ /// @param SizeInBits Member size. /// @param AlignInBits Member alignment. /// @param Elements Enumeration elements. - DIType CreateEnumerationType(DIDescriptor Scope, StringRef Name, + DIType createEnumerationType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, DIArray Elements); - /// CreateSubroutineType - Create subroutine type. + /// createSubroutineType - Create subroutine type. /// @param File File in which this subroutine is defined. /// @param ParamterTypes An array of subroutine parameter types. This /// includes return type at 0th index. - DIType CreateSubroutineType(DIFile File, DIArray ParameterTypes); + DIType createSubroutineType(DIFile File, DIArray ParameterTypes); - /// CreateArtificialType - Create a new DIType with "artificial" flag set. - DIType CreateArtificialType(DIType Ty); + /// createArtificialType - Create a new DIType with "artificial" flag set. + DIType createArtificialType(DIType Ty); - /// CreateTemporaryType - Create a temporary forward-declared type. - DIType CreateTemporaryType(); - DIType CreateTemporaryType(DIFile F); + /// createTemporaryType - Create a temporary forward-declared type. + DIType createTemporaryType(); + DIType createTemporaryType(DIFile F); - /// RetainType - Retain DIType in a module even if it is not referenced + /// retainType - Retain DIType in a module even if it is not referenced /// through debug info anchors. - void RetainType(DIType T); + void retainType(DIType T); - /// CreateUnspecifiedParameter - Create unspeicified type descriptor + /// createUnspecifiedParameter - Create unspeicified type descriptor /// for a subroutine type. - DIDescriptor CreateUnspecifiedParameter(); + DIDescriptor createUnspecifiedParameter(); - /// GetOrCreateArray - Get a DIArray, create one if required. - DIArray GetOrCreateArray(Value *const *Elements, unsigned NumElements); + /// getOrCreateArray - Get a DIArray, create one if required. + DIArray getOrCreateArray(Value *const *Elements, unsigned NumElements); - /// GetOrCreateSubrange - Create a descriptor for a value range. This + /// getOrCreateSubrange - Create a descriptor for a value range. This /// implicitly uniques the values returned. - DISubrange GetOrCreateSubrange(int64_t Lo, int64_t Hi); + DISubrange getOrCreateSubrange(int64_t Lo, int64_t Hi); - /// CreateGlobalVariable - Create a new descriptor for the specified global. + /// createGlobalVariable - Create a new descriptor for the specified global. /// @param Name Name of the variable. /// @param File File where this variable is defined. /// @param LineNo Line number. @@ -293,11 +293,11 @@ /// externally visible or not. /// @param Val llvm::Value of the variable. DIGlobalVariable - CreateGlobalVariable(StringRef Name, DIFile File, unsigned LineNo, + createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo, DIType Ty, bool isLocalToUnit, llvm::Value *Val); - /// CreateStaticVariable - Create a new descriptor for the specified + /// createStaticVariable - Create a new descriptor for the specified /// variable. /// @param Conext Variable scope. /// @param Name Name of the variable. @@ -309,12 +309,12 @@ /// externally visible or not. /// @param Val llvm::Value of the variable. DIGlobalVariable - CreateStaticVariable(DIDescriptor Context, StringRef Name, + createStaticVariable(DIDescriptor Context, StringRef Name, StringRef LinkageName, DIFile File, unsigned LineNo, DIType Ty, bool isLocalToUnit, llvm::Value *Val); - /// CreateLocalVariable - Create a new descriptor for the specified + /// createLocalVariable - Create a new descriptor for the specified /// local variable. /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or /// DW_TAG_arg_variable. @@ -326,14 +326,14 @@ /// @param AlwaysPreserve Boolean. Set to true if debug info for this /// variable should be preserved in optimized build. /// @param Flags Flags, e.g. artificial variable. - DIVariable CreateLocalVariable(unsigned Tag, DIDescriptor Scope, + DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNo, DIType Ty, bool AlwaysPreserve = false, unsigned Flags = 0); - /// CreateComplexVariable - Create a new descriptor for the specified + /// createComplexVariable - Create a new descriptor for the specified /// variable which has a complex address expression for its address. /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or /// DW_TAG_arg_variable. @@ -344,12 +344,12 @@ /// @param Ty Variable Type /// @param Addr A pointer to a vector of complex address operations. /// @param NumAddr Num of address operations in the vector. - DIVariable CreateComplexVariable(unsigned Tag, DIDescriptor Scope, + DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope, StringRef Name, DIFile F, unsigned LineNo, DIType Ty, Value *const *Addr, unsigned NumAddr); - /// CreateFunction - Create a new descriptor for the specified subprogram. + /// createFunction - Create a new descriptor for the specified subprogram. /// See comments in DISubprogram for descriptions of these fields. /// @param Scope Function scope. /// @param Name Function name. @@ -363,7 +363,7 @@ /// This flags are used to emit dwarf attributes. /// @param isOptimized True if optimization is ON. /// @param Fn llvm::Function pointer. - DISubprogram CreateFunction(DIDescriptor Scope, StringRef Name, + DISubprogram createFunction(DIDescriptor Scope, StringRef Name, StringRef LinkageName, DIFile File, unsigned LineNo, DIType Ty, bool isLocalToUnit, @@ -372,7 +372,7 @@ bool isOptimized = false, Function *Fn = 0); - /// CreateMethod - Create a new descriptor for the specified C++ method. + /// createMethod - Create a new descriptor for the specified C++ method. /// See comments in DISubprogram for descriptions of these fields. /// @param Scope Function scope. /// @param Name Function name. @@ -390,7 +390,7 @@ /// This flags are used to emit dwarf attributes. /// @param isOptimized True if optimization is ON. /// @param Fn llvm::Function pointer. - DISubprogram CreateMethod(DIDescriptor Scope, StringRef Name, + DISubprogram createMethod(DIDescriptor Scope, StringRef Name, StringRef LinkageName, DIFile File, unsigned LineNo, DIType Ty, bool isLocalToUnit, @@ -401,55 +401,55 @@ bool isOptimized = false, Function *Fn = 0); - /// CreateNameSpace - This creates new descriptor for a namespace + /// createNameSpace - This creates new descriptor for a namespace /// with the specified parent scope. /// @param Scope Namespace scope /// @param Name Name of this namespace /// @param File Source file /// @param LineNo Line number - DINameSpace CreateNameSpace(DIDescriptor Scope, StringRef Name, + DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNo); - /// CreateLexicalBlock - This creates a descriptor for a lexical block + /// createLexicalBlock - This creates a descriptor for a lexical block /// with the specified parent context. /// @param Scope Parent lexical scope. /// @param File Source file /// @param Line Line number /// @param Col Column number - DILexicalBlock CreateLexicalBlock(DIDescriptor Scope, DIFile File, + DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File, unsigned Line, unsigned Col); - /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call. + /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call. /// @param Storage llvm::Value of the variable /// @param VarInfo Variable's debug info descriptor. /// @param InsertAtEnd Location for the new intrinsic. - Instruction *InsertDeclare(llvm::Value *Storage, DIVariable VarInfo, + Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo, BasicBlock *InsertAtEnd); - /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call. + /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call. /// @param Storage llvm::Value of the variable /// @param VarInfo Variable's debug info descriptor. /// @param InsertBefore Location for the new intrinsic. - Instruction *InsertDeclare(llvm::Value *Storage, DIVariable VarInfo, + Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo, Instruction *InsertBefore); - /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. + /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. /// @param Val llvm::Value of the variable /// @param Offset Offset /// @param VarInfo Variable's debug info descriptor. /// @param InsertAtEnd Location for the new intrinsic. - Instruction *InsertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset, + Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset, DIVariable VarInfo, BasicBlock *InsertAtEnd); - /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. + /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. /// @param Val llvm::Value of the variable /// @param Offset Offset /// @param VarInfo Variable's debug info descriptor. /// @param InsertBefore Location for the new intrinsic. - Instruction *InsertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset, + Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset, DIVariable VarInfo, Instruction *InsertBefore); Modified: llvm/trunk/lib/Analysis/DIBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DIBuilder.cpp?rev=126231&r1=126230&r2=126231&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DIBuilder.cpp (original) +++ llvm/trunk/lib/Analysis/DIBuilder.cpp Tue Feb 22 12:56:12 2011 @@ -31,9 +31,9 @@ DIBuilder::DIBuilder(Module &m) : M(m), VMContext(M.getContext()), TheCU(0), DeclareFn(0), ValueFn(0) {} -/// CreateCompileUnit - A CompileUnit provides an anchor for all debugging +/// createCompileUnit - A CompileUnit provides an anchor for all debugging /// information generated during this instance of compilation. -void DIBuilder::CreateCompileUnit(unsigned Lang, StringRef Filename, +void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename, StringRef Directory, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RunTimeVer) { @@ -53,9 +53,9 @@ TheCU = DICompileUnit(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateFile - Create a file descriptor to hold debugging information +/// createFile - Create a file descriptor to hold debugging information /// for a file. -DIFile DIBuilder::CreateFile(StringRef Filename, StringRef Directory) { +DIFile DIBuilder::createFile(StringRef Filename, StringRef Directory) { assert(TheCU && "Unable to create DW_TAG_file_type without CompileUnit"); Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_file_type), @@ -66,8 +66,8 @@ return DIFile(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateEnumerator - Create a single enumerator value. -DIEnumerator DIBuilder::CreateEnumerator(StringRef Name, uint64_t Val) { +/// createEnumerator - Create a single enumerator value. +DIEnumerator DIBuilder::createEnumerator(StringRef Name, uint64_t Val) { Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_enumerator), MDString::get(VMContext, Name), @@ -76,9 +76,9 @@ return DIEnumerator(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateBasicType - Create debugging information entry for a basic +/// createBasicType - Create debugging information entry for a basic /// type, e.g 'char'. -DIType DIBuilder::CreateBasicType(StringRef Name, uint64_t SizeInBits, +DIType DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding) { // Basic types are encoded in DIBasicType format. Line number, filename, @@ -98,9 +98,9 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateQaulifiedType - Create debugging information entry for a qualified +/// createQaulifiedType - Create debugging information entry for a qualified /// type, e.g. 'const int'. -DIType DIBuilder::CreateQualifiedType(unsigned Tag, DIType FromTy) { +DIType DIBuilder::createQualifiedType(unsigned Tag, DIType FromTy) { // Qualified types are encoded in DIDerivedType format. Value *Elts[] = { GetTagConstant(VMContext, Tag), @@ -117,8 +117,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreatePointerType - Create debugging information entry for a pointer. -DIType DIBuilder::CreatePointerType(DIType PointeeTy, uint64_t SizeInBits, +/// createPointerType - Create debugging information entry for a pointer. +DIType DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits, uint64_t AlignInBits, StringRef Name) { // Pointer types are encoded in DIDerivedType format. Value *Elts[] = { @@ -136,8 +136,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateReferenceType - Create debugging information entry for a reference. -DIType DIBuilder::CreateReferenceType(DIType RTy) { +/// createReferenceType - Create debugging information entry for a reference. +DIType DIBuilder::createReferenceType(DIType RTy) { // References are encoded in DIDerivedType format. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_reference_type), @@ -154,8 +154,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateTypedef - Create debugging information entry for a typedef. -DIType DIBuilder::CreateTypedef(DIType Ty, StringRef Name, DIFile File, +/// createTypedef - Create debugging information entry for a typedef. +DIType DIBuilder::createTypedef(DIType Ty, StringRef Name, DIFile File, unsigned LineNo) { // typedefs are encoded in DIDerivedType format. assert(Ty.Verify() && "Invalid typedef type!"); @@ -174,8 +174,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateFriend - Create debugging information entry for a 'friend'. -DIType DIBuilder::CreateFriend(DIType Ty, DIType FriendTy) { +/// createFriend - Create debugging information entry for a 'friend'. +DIType DIBuilder::createFriend(DIType Ty, DIType FriendTy) { // typedefs are encoded in DIDerivedType format. assert(Ty.Verify() && "Invalid type!"); assert(FriendTy.Verify() && "Invalid friend type!"); @@ -194,9 +194,9 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateInheritance - Create debugging information entry to establish +/// createInheritance - Create debugging information entry to establish /// inheritnace relationship between two types. -DIType DIBuilder::CreateInheritance(DIType Ty, DIType BaseTy, +DIType DIBuilder::createInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset, unsigned Flags) { // TAG_inheritance is encoded in DIDerivedType format. Value *Elts[] = { @@ -214,8 +214,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateMemberType - Create debugging information entry for a member. -DIType DIBuilder::CreateMemberType(StringRef Name, +/// createMemberType - Create debugging information entry for a member. +DIType DIBuilder::createMemberType(StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, @@ -236,8 +236,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateClassType - Create debugging information entry for a class. -DIType DIBuilder::CreateClassType(DIDescriptor Context, StringRef Name, +/// createClassType - Create debugging information entry for a class. +DIType DIBuilder::createClassType(DIDescriptor Context, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, @@ -263,10 +263,10 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateTemplateTypeParameter - Create debugging information for template +/// createTemplateTypeParameter - Create debugging information for template /// type parameter. DITemplateTypeParameter -DIBuilder::CreateTemplateTypeParameter(DIDescriptor Context, StringRef Name, +DIBuilder::createTemplateTypeParameter(DIDescriptor Context, StringRef Name, DIType Ty, MDNode *File, unsigned LineNo, unsigned ColumnNo) { Value *Elts[] = { @@ -282,10 +282,10 @@ array_lengthof(Elts))); } -/// CreateTemplateValueParameter - Create debugging information for template +/// createTemplateValueParameter - Create debugging information for template /// value parameter. DITemplateValueParameter -DIBuilder::CreateTemplateValueParameter(DIDescriptor Context, StringRef Name, +DIBuilder::createTemplateValueParameter(DIDescriptor Context, StringRef Name, DIType Ty, uint64_t Val, MDNode *File, unsigned LineNo, unsigned ColumnNo) { @@ -303,8 +303,8 @@ array_lengthof(Elts))); } -/// CreateStructType - Create debugging information entry for a struct. -DIType DIBuilder::CreateStructType(DIDescriptor Context, StringRef Name, +/// createStructType - Create debugging information entry for a struct. +DIType DIBuilder::createStructType(DIDescriptor Context, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, DIArray Elements, @@ -328,8 +328,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateUnionType - Create debugging information entry for an union. -DIType DIBuilder::CreateUnionType(DIDescriptor Scope, StringRef Name, +/// createUnionType - Create debugging information entry for an union. +DIType DIBuilder::createUnionType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, @@ -353,8 +353,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateSubroutineType - Create subroutine type. -DIType DIBuilder::CreateSubroutineType(DIFile File, DIArray ParameterTypes) { +/// createSubroutineType - Create subroutine type. +DIType DIBuilder::createSubroutineType(DIFile File, DIArray ParameterTypes) { // TAG_subroutine_type is encoded in DICompositeType format. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_subroutine_type), @@ -374,9 +374,9 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateEnumerationType - Create debugging information entry for an +/// createEnumerationType - Create debugging information entry for an /// enumeration. -DIType DIBuilder::CreateEnumerationType(DIDescriptor Scope, StringRef Name, +DIType DIBuilder::createEnumerationType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, DIArray Elements) { @@ -402,8 +402,8 @@ return DIType(Node); } -/// CreateArrayType - Create debugging information entry for an array. -DIType DIBuilder::CreateArrayType(uint64_t Size, uint64_t AlignInBits, +/// createArrayType - Create debugging information entry for an array. +DIType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits, DIType Ty, DIArray Subscripts) { // TAG_array_type is encoded in DICompositeType format. Value *Elts[] = { @@ -424,8 +424,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateVectorType - Create debugging information entry for a vector. -DIType DIBuilder::CreateVectorType(uint64_t Size, uint64_t AlignInBits, +/// createVectorType - Create debugging information entry for a vector. +DIType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits, DIType Ty, DIArray Subscripts) { // TAG_vector_type is encoded in DICompositeType format. Value *Elts[] = { @@ -446,8 +446,8 @@ return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// CreateArtificialType - Create a new DIType with "artificial" flag set. -DIType DIBuilder::CreateArtificialType(DIType Ty) { +/// createArtificialType - Create a new DIType with "artificial" flag set. +DIType DIBuilder::createArtificialType(DIType Ty) { if (Ty.isArtificial()) return Ty; @@ -470,24 +470,24 @@ return DIType(MDNode::get(VMContext, Elts.data(), Elts.size())); } -/// RetainType - Retain DIType in a module even if it is not referenced +/// retainType - Retain DIType in a module even if it is not referenced /// through debug info anchors. -void DIBuilder::RetainType(DIType T) { +void DIBuilder::retainType(DIType T) { NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.ty"); NMD->addOperand(T); } -/// CreateUnspecifiedParameter - Create unspeicified type descriptor +/// createUnspecifiedParameter - Create unspeicified type descriptor /// for the subroutine type. -DIDescriptor DIBuilder::CreateUnspecifiedParameter() { +DIDescriptor DIBuilder::createUnspecifiedParameter() { Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_parameters) }; return DIDescriptor(MDNode::get(VMContext, &Elts[0], 1)); } -/// CreateTemporaryType - Create a temporary forward-declared type. -DIType DIBuilder::CreateTemporaryType() { +/// createTemporaryType - Create a temporary forward-declared type. +DIType DIBuilder::createTemporaryType() { // Give the temporary MDNode a tag. It doesn't matter what tag we // use here as long as DIType accepts it. Value *Elts[] = { GetTagConstant(VMContext, DW_TAG_base_type) }; @@ -495,8 +495,8 @@ return DIType(Node); } -/// CreateTemporaryType - Create a temporary forward-declared type. -DIType DIBuilder::CreateTemporaryType(DIFile F) { +/// createTemporaryType - Create a temporary forward-declared type. +DIType DIBuilder::createTemporaryType(DIFile F) { // Give the temporary MDNode a tag. It doesn't matter what tag we // use here as long as DIType accepts it. Value *Elts[] = { @@ -509,8 +509,8 @@ return DIType(Node); } -/// GetOrCreateArray - Get a DIArray, create one if required. -DIArray DIBuilder::GetOrCreateArray(Value *const *Elements, unsigned NumElements) { +/// getOrCreateArray - Get a DIArray, create one if required. +DIArray DIBuilder::getOrCreateArray(Value *const *Elements, unsigned NumElements) { if (NumElements == 0) { Value *Null = llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)); return DIArray(MDNode::get(VMContext, &Null, 1)); @@ -518,9 +518,9 @@ return DIArray(MDNode::get(VMContext, Elements, NumElements)); } -/// GetOrCreateSubrange - Create a descriptor for a value range. This +/// getOrCreateSubrange - Create a descriptor for a value range. This /// implicitly uniques the values returned. -DISubrange DIBuilder::GetOrCreateSubrange(int64_t Lo, int64_t Hi) { +DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Hi) { Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_subrange_type), ConstantInt::get(Type::getInt64Ty(VMContext), Lo), @@ -530,9 +530,9 @@ return DISubrange(MDNode::get(VMContext, &Elts[0], 3)); } -/// CreateGlobalVariable - Create a new descriptor for the specified global. +/// createGlobalVariable - Create a new descriptor for the specified global. DIGlobalVariable DIBuilder:: -CreateGlobalVariable(StringRef Name, DIFile F, unsigned LineNumber, +createGlobalVariable(StringRef Name, DIFile F, unsigned LineNumber, DIType Ty, bool isLocalToUnit, llvm::Value *Val) { Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_variable), @@ -555,10 +555,10 @@ return DIGlobalVariable(Node); } -/// CreateStaticVariable - Create a new descriptor for the specified static +/// createStaticVariable - Create a new descriptor for the specified static /// variable. DIGlobalVariable DIBuilder:: -CreateStaticVariable(DIDescriptor Context, StringRef Name, +createStaticVariable(DIDescriptor Context, StringRef Name, StringRef LinkageName, DIFile F, unsigned LineNumber, DIType Ty, bool isLocalToUnit, llvm::Value *Val) { Value *Elts[] = { @@ -582,8 +582,8 @@ return DIGlobalVariable(Node); } -/// CreateVariable - Create a new descriptor for the specified variable. -DIVariable DIBuilder::CreateLocalVariable(unsigned Tag, DIDescriptor Scope, +/// createVariable - Create a new descriptor for the specified variable. +DIVariable DIBuilder::createLocalVariable(unsigned Tag, DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNo, DIType Ty, bool AlwaysPreserve, unsigned Flags) { @@ -614,9 +614,9 @@ return DIVariable(Node); } -/// CreateComplexVariable - Create a new descriptor for the specified variable +/// createComplexVariable - Create a new descriptor for the specified variable /// which has a complex address expression for its address. -DIVariable DIBuilder::CreateComplexVariable(unsigned Tag, DIDescriptor Scope, +DIVariable DIBuilder::createComplexVariable(unsigned Tag, DIDescriptor Scope, StringRef Name, DIFile F, unsigned LineNo, DIType Ty, Value *const *Addr, @@ -633,8 +633,8 @@ return DIVariable(MDNode::get(VMContext, Elts.data(), Elts.size())); } -/// CreateFunction - Create a new descriptor for the specified function. -DISubprogram DIBuilder::CreateFunction(DIDescriptor Context, +/// createFunction - Create a new descriptor for the specified function. +DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name, StringRef LinkageName, DIFile File, unsigned LineNo, @@ -670,8 +670,8 @@ return DISubprogram(Node); } -/// CreateMethod - Create a new descriptor for the specified C++ method. -DISubprogram DIBuilder::CreateMethod(DIDescriptor Context, +/// createMethod - Create a new descriptor for the specified C++ method. +DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name, StringRef LinkageName, DIFile F, @@ -710,9 +710,9 @@ return DISubprogram(Node); } -/// CreateNameSpace - This creates new descriptor for a namespace +/// createNameSpace - This creates new descriptor for a namespace /// with the specified parent scope. -DINameSpace DIBuilder::CreateNameSpace(DIDescriptor Scope, StringRef Name, +DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNo) { Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_namespace), @@ -724,7 +724,7 @@ return DINameSpace(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -DILexicalBlock DIBuilder::CreateLexicalBlock(DIDescriptor Scope, DIFile File, +DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File, unsigned Line, unsigned Col) { // Defeat MDNode uniqing for lexical blocks by using unique id. static unsigned int unique_id = 0; @@ -739,8 +739,8 @@ return DILexicalBlock(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } -/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call. -Instruction *DIBuilder::InsertDeclare(Value *Storage, DIVariable VarInfo, +/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call. +Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo, Instruction *InsertBefore) { assert(Storage && "no storage passed to dbg.declare"); assert(VarInfo.Verify() && "empty DIVariable passed to dbg.declare"); @@ -751,8 +751,8 @@ return CallInst::Create(DeclareFn, Args, Args+2, "", InsertBefore); } -/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call. -Instruction *DIBuilder::InsertDeclare(Value *Storage, DIVariable VarInfo, +/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call. +Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo, BasicBlock *InsertAtEnd) { assert(Storage && "no storage passed to dbg.declare"); assert(VarInfo.Verify() && "invalid DIVariable passed to dbg.declare"); @@ -769,8 +769,8 @@ return CallInst::Create(DeclareFn, Args, Args+2, "", InsertAtEnd); } -/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. -Instruction *DIBuilder::InsertDbgValueIntrinsic(Value *V, uint64_t Offset, +/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. +Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset, DIVariable VarInfo, Instruction *InsertBefore) { assert(V && "no value passed to dbg.value"); @@ -784,8 +784,8 @@ return CallInst::Create(ValueFn, Args, Args+3, "", InsertBefore); } -/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. -Instruction *DIBuilder::InsertDbgValueIntrinsic(Value *V, uint64_t Offset, +/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call. +Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset, DIVariable VarInfo, BasicBlock *InsertAtEnd) { assert(V && "no value passed to dbg.value"); From stuart at apple.com Tue Feb 22 13:52:23 2011 From: stuart at apple.com (Stuart Hastings) Date: Tue, 22 Feb 2011 19:52:23 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r126237 - /llvm-gcc-4.2/trunk/build_gcc Message-ID: <20110222195223.976B22A6C12C@llvm.org> Author: stuart Date: Tue Feb 22 13:52:23 2011 New Revision: 126237 URL: http://llvm.org/viewvc/llvm-project?rev=126237&view=rev Log: Insure minor version # appears in -v output. Radar 8546196. Modified: llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=126237&r1=126236&r2=126237&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Tue Feb 22 13:52:23 2011 @@ -248,7 +248,12 @@ MAKEFLAGS="$MAKEFLAGS BUILD_LLVM_APPLE_STYLE=1" # Build llvm-gcc in 'dylib mode'. MAKEFLAGS="$MAKEFLAGS BUILD_LLVM_INTO_A_DYLIB=1" - MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_SUBMIT_VERSION" + if [ x$LLVM_SUBMIT_SUBVERSION == x ]; then + MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_SUBMIT_VERSION" + else + MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_SUBMIT_VERSION.$LLVM_SUBMIT_SUBVERSION" + fi + fi # LLVM LOCAL end From evan.cheng at apple.com Tue Feb 22 13:53:14 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Feb 2011 19:53:14 -0000 Subject: [llvm-commits] [llvm] r126238 - in /llvm/trunk/lib/Target/ARM: ARMBaseInstrInfo.h ARMHazardRecognizer.cpp ARMInstrFormats.td ARMInstrVFP.td MLxExpansionPass.cpp NEONMoveFix.cpp Message-ID: <20110222195314.6C28D2A6C12C@llvm.org> Author: evancheng Date: Tue Feb 22 13:53:14 2011 New Revision: 126238 URL: http://llvm.org/viewvc/llvm-project?rev=126238&view=rev Log: VFP single precision arith instructions can go down to NEON pipeline, but on Cortex-A8 only. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h llvm/trunk/lib/Target/ARM/ARMHazardRecognizer.cpp llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrVFP.td llvm/trunk/lib/Target/ARM/MLxExpansionPass.cpp llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=126238&r1=126237&r2=126238&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Tue Feb 22 13:53:14 2011 @@ -155,10 +155,11 @@ //===------------------------------------------------------------------===// // Code domain. DomainShift = 18, - DomainMask = 3 << DomainShift, + DomainMask = 7 << DomainShift, DomainGeneral = 0 << DomainShift, DomainVFP = 1 << DomainShift, DomainNEON = 2 << DomainShift, + DomainNEONA8 = 4 << DomainShift, //===------------------------------------------------------------------===// // Field shifts - such shifts are used to set field while generating Modified: llvm/trunk/lib/Target/ARM/ARMHazardRecognizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMHazardRecognizer.cpp?rev=126238&r1=126237&r2=126238&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMHazardRecognizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMHazardRecognizer.cpp Tue Feb 22 13:53:14 2011 @@ -21,17 +21,14 @@ // FIXME: Detect integer instructions properly. const TargetInstrDesc &TID = MI->getDesc(); unsigned Domain = TID.TSFlags & ARMII::DomainMask; - if (Domain == ARMII::DomainVFP) { - unsigned Opcode = MI->getOpcode(); - if (Opcode == ARM::VSTRS || Opcode == ARM::VSTRD || - Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD) - return false; - } else if (Domain == ARMII::DomainNEON) { - if (MI->getDesc().mayStore() || MI->getDesc().mayLoad()) - return false; - } else + if (TID.mayStore()) return false; - return MI->readsRegister(DefMI->getOperand(0).getReg(), &TRI); + unsigned Opcode = TID.getOpcode(); + if (Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD) + return false; + if ((Domain & ARMII::DomainVFP) || (Domain & ARMII::DomainNEON)) + return MI->readsRegister(DefMI->getOperand(0).getReg(), &TRI); + return false; } ScheduleHazardRecognizer::HazardType Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=126238&r1=126237&r2=126238&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Tue Feb 22 13:53:14 2011 @@ -127,13 +127,14 @@ def IndexModeUpd : IndexMode<3>; // Instruction execution domain. -class Domain val> { - bits<2> Value = val; +class Domain val> { + bits<3> Value = val; } def GenericDomain : Domain<0>; def VFPDomain : Domain<1>; // Instructions in VFP domain only def NeonDomain : Domain<2>; // Instructions in Neon domain only def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains +def VFPNeonA8Domain : Domain<7>; // Instructions in VFP & Neon under A8 //===----------------------------------------------------------------------===// // ARM special operands. @@ -249,7 +250,7 @@ let TSFlags{15-10} = Form; let TSFlags{16} = isUnaryDataProc; let TSFlags{17} = canXformTo16Bit; - let TSFlags{19-18} = D.Value; + let TSFlags{20-18} = D.Value; let Constraints = cstr; let Itinerary = itin; Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=126238&r1=126237&r2=126238&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Tue Feb 22 13:53:14 2011 @@ -197,9 +197,9 @@ (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpALU32, "vadd", ".f32\t$Sd, $Sn, $Sm", [(set SPR:$Sd, (fadd SPR:$Sn, SPR:$Sm))]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VSUBD : ADbI<0b11100, 0b11, 1, 0, @@ -211,9 +211,9 @@ (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpALU32, "vsub", ".f32\t$Sd, $Sn, $Sm", [(set SPR:$Sd, (fsub SPR:$Sn, SPR:$Sm))]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VDIVD : ADbI<0b11101, 0b00, 0, 0, @@ -235,9 +235,9 @@ (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpMUL32, "vmul", ".f32\t$Sd, $Sn, $Sm", [(set SPR:$Sd, (fmul SPR:$Sn, SPR:$Sm))]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VNMULD : ADbI<0b11100, 0b10, 1, 0, @@ -249,9 +249,9 @@ (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpMUL32, "vnmul", ".f32\t$Sd, $Sn, $Sm", [(set SPR:$Sd, (fneg (fmul SPR:$Sn, SPR:$Sm)))]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } // Match reassociated forms only if not sign dependent rounding. @@ -271,9 +271,9 @@ (outs), (ins SPR:$Sd, SPR:$Sm), IIC_fpCMP32, "vcmpe", ".f32\t$Sd, $Sm", [(arm_cmpfp SPR:$Sd, SPR:$Sm)]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } // FIXME: Verify encoding after integrated assembler is working. @@ -286,9 +286,9 @@ (outs), (ins SPR:$Sd, SPR:$Sm), IIC_fpCMP32, "vcmp", ".f32\t$Sd, $Sm", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } } // Defs = [FPSCR] @@ -305,9 +305,9 @@ (outs SPR:$Sd), (ins SPR:$Sm), IIC_fpUNA32, "vabs", ".f32\t$Sd, $Sm", [(set SPR:$Sd, (fabs SPR:$Sm))]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } let Defs = [FPSCR] in { @@ -326,9 +326,9 @@ let Inst{3-0} = 0b0000; let Inst{5} = 0; - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } // FIXME: Verify encoding after integrated assembler is working. @@ -347,9 +347,9 @@ let Inst{3-0} = 0b0000; let Inst{5} = 0; - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } } // Defs = [FPSCR] @@ -423,9 +423,9 @@ (outs SPR:$Sd), (ins SPR:$Sm), IIC_fpUNA32, "vneg", ".f32\t$Sd, $Sm", [(set SPR:$Sd, (fneg SPR:$Sm))]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VSQRTD : ADuI<0b11101, 0b11, 0b0001, 0b11, 0, @@ -598,9 +598,9 @@ [(set SPR:$Sd, (arm_sitof SPR:$Sm))]> { let Inst{7} = 1; // s32 - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VUITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011, @@ -616,9 +616,9 @@ [(set SPR:$Sd, (arm_uitof SPR:$Sm))]> { let Inst{7} = 0; // u32 - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } // FP -> Int: @@ -671,9 +671,9 @@ [(set SPR:$Sd, (arm_ftosi SPR:$Sm))]> { let Inst{7} = 1; // Z bit - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VTOUIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011, @@ -689,9 +689,9 @@ [(set SPR:$Sd, (arm_ftoui SPR:$Sm))]> { let Inst{7} = 1; // Z bit - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } // And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR. @@ -743,36 +743,36 @@ (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VTOUHS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 0, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VTOSLS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VTOULS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VTOSHD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 0, @@ -801,36 +801,36 @@ (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VUHTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 0, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VSLTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VULTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits", [/* For disassembly only; pattern left blank */]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def VSHTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 0, @@ -874,9 +874,9 @@ SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))), @@ -901,9 +901,9 @@ SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))), @@ -928,9 +928,9 @@ SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin), @@ -954,9 +954,9 @@ [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin), @@ -995,9 +995,9 @@ IIC_fpUNA32, "vneg", ".f32\t$Sd, $Sm", [/*(set SPR:$Sd, (ARMcneg SPR:$Sn, SPR:$Sm, imm:$cc))*/]>, RegConstraint<"$Sn = $Sd"> { - // Some single precision VFP instructions may be executed on both NEON and VFP - // pipelines. - let D = VFPNeonDomain; + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines on A8. + let D = VFPNeonA8Domain; } } // neverHasSideEffects Modified: llvm/trunk/lib/Target/ARM/MLxExpansionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MLxExpansionPass.cpp?rev=126238&r1=126237&r2=126238&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/MLxExpansionPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/MLxExpansionPass.cpp Tue Feb 22 13:53:14 2011 @@ -132,22 +132,16 @@ } bool MLxExpansion::hasRAWHazard(unsigned Reg, MachineInstr *MI) const { - const TargetInstrDesc &TID = MI->getDesc(); // FIXME: Detect integer instructions properly. + const TargetInstrDesc &TID = MI->getDesc(); unsigned Domain = TID.TSFlags & ARMII::DomainMask; - if (Domain == ARMII::DomainVFP) { - unsigned Opcode = TID.getOpcode(); - if (Opcode == ARM::VSTRS || Opcode == ARM::VSTRD || - Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD) - return false; - } else if (Domain == ARMII::DomainNEON) { - if (TID.mayStore() || TID.mayLoad()) - return false; - } else { + if (TID.mayStore()) return false; - } - - return MI->readsRegister(Reg, TRI); + unsigned Opcode = TID.getOpcode(); + if (Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD) + return false; + if ((Domain & ARMII::DomainVFP) || (Domain & ARMII::DomainNEON)) + return MI->readsRegister(Reg, TRI); return false; } Modified: llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp?rev=126238&r1=126237&r2=126238&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp (original) +++ llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp Tue Feb 22 13:53:14 2011 @@ -35,6 +35,7 @@ private: const TargetRegisterInfo *TRI; const ARMBaseInstrInfo *TII; + bool isA8; typedef DenseMap RegMap; @@ -43,6 +44,16 @@ char NEONMoveFixPass::ID = 0; } +static bool inNEONDomain(unsigned Domain, bool isA8) { + if (Domain & ARMII::DomainNEON) { + // Some instructions only go down NEON pipeline when executed on CortexA8. + if (Domain & ARMII::DomainNEONA8) + return isA8; + return true; + } + return false; +} + bool NEONMoveFixPass::InsertMoves(MachineBasicBlock &MBB) { RegMap Defs; bool Modified = false; @@ -70,7 +81,7 @@ Domain = ARMII::DomainNEON; } - if (Domain & ARMII::DomainNEON) { + if (inNEONDomain(Domain, isA8)) { // Convert VMOVD to VMOVDneon unsigned DestReg = MI->getOperand(0).getReg(); @@ -123,6 +134,7 @@ TRI = TM.getRegisterInfo(); TII = static_cast(TM.getInstrInfo()); + isA8 = TM.getSubtarget().isCortexA8(); bool Modified = false; for (MachineFunction::iterator MFI = Fn.begin(), E = Fn.end(); MFI != E; From joerg at bec.de Tue Feb 22 14:40:09 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Tue, 22 Feb 2011 20:40:09 -0000 Subject: [llvm-commits] [llvm] r126244 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/X86/x86-64.s Message-ID: <20110222204009.6AD5A2A6C12C@llvm.org> Author: joerg Date: Tue Feb 22 14:40:09 2011 New Revision: 126244 URL: http://llvm.org/viewvc/llvm-project?rev=126244&view=rev Log: Use the same (%dx) hack for in[bwl] as for out[bwl]. Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/test/MC/X86/x86-64.s Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=126244&r1=126243&r2=126244&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Feb 22 14:40:09 2011 @@ -775,6 +775,19 @@ delete &Op; } } + // Same hack for "in[bwl]? (%dx), %al" -> "inb %dx, %al". + if ((Name == "inb" || Name == "inw" || Name == "inl" || Name == "in") && + Operands.size() == 3) { + X86Operand &Op = *(X86Operand*)Operands.begin()[1]; + if (Op.isMem() && Op.Mem.SegReg == 0 && + isa(Op.Mem.Disp) && + cast(Op.Mem.Disp)->getValue() == 0 && + Op.Mem.BaseReg == MatchRegisterName("dx") && Op.Mem.IndexReg == 0) { + SMLoc Loc = Op.getEndLoc(); + Operands.begin()[1] = X86Operand::CreateReg(Op.Mem.BaseReg, Loc, Loc); + delete &Op; + } + } // FIXME: Hack to handle recognize s{hr,ar,hl} $1, . Canonicalize to // "shift ". Modified: llvm/trunk/test/MC/X86/x86-64.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-64.s?rev=126244&r1=126243&r2=126244&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86-64.s (original) +++ llvm/trunk/test/MC/X86/x86-64.s Tue Feb 22 14:40:09 2011 @@ -241,13 +241,32 @@ // PR8114 // CHECK: outb %al, %dx +// CHECK: outb %al, %dx +// CHECK: outw %ax, %dx // CHECK: outw %ax, %dx // CHECK: outl %eax, %dx +// CHECK: outl %eax, %dx -out %al, (%dx) -out %ax, (%dx) -outl %eax, (%dx) - +out %al, (%dx) +outb %al, (%dx) +out %ax, (%dx) +outw %ax, (%dx) +out %eax, (%dx) +outl %eax, (%dx) + +// CHECK: inb %dx, %al +// CHECK: inb %dx, %al +// CHECK: inw %dx, %ax +// CHECK: inw %dx, %ax +// CHECK: inl %dx, %eax +// CHECK: inl %dx, %eax + +in (%dx), %al +inb (%dx), %al +in (%dx), %ax +inw (%dx), %ax +in (%dx), %eax +inl (%dx), %eax // rdar://8431422 From clattner at apple.com Tue Feb 22 14:57:36 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Feb 2011 12:57:36 -0800 Subject: [llvm-commits] [llvm] r126226 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h In-Reply-To: <20110222173005.5A9022A6C12C@llvm.org> References: <20110222173005.5A9022A6C12C@llvm.org> Message-ID: On Feb 22, 2011, at 9:30 AM, Roman Divacky wrote: > Author: rdivacky > Date: Tue Feb 22 11:30:05 2011 > New Revision: 126226 > > URL: http://llvm.org/viewvc/llvm-project?rev=126226&view=rev > Log: > Stack alignment is 16 bytes on FreeBSD/i386 too. Are there any targets where it isn't 16? -Chris > > > Modified: > llvm/trunk/lib/Target/X86/X86Subtarget.cpp > llvm/trunk/lib/Target/X86/X86Subtarget.h > > Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=126226&r1=126225&r2=126226&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Feb 22 11:30:05 2011 > @@ -342,9 +342,10 @@ > assert((!Is64Bit || HasX86_64) && > "64-bit code requested on a subtarget that doesn't support it!"); > > - // Stack alignment is 16 bytes on Darwin, Linux and Solaris (both 32 and 64 > - // bit) and for all 64-bit targets. > - if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || Is64Bit) > + // Stack alignment is 16 bytes on Darwin, FreeBSD, Linux and Solaris (both > + // 32 and 64 bit) and for all 64-bit targets. > + if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() || > + isTargetSolaris() || Is64Bit) > stackAlignment = 16; From clattner at apple.com Tue Feb 22 15:02:01 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Feb 2011 13:02:01 -0800 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr> Message-ID: On Feb 22, 2011, at 5:47 AM, Jin Gu Kang wrote: > replaceAllUsesWith() is an example. :) > > I don't know all of passes which use inforamtion of Use. > so I would like to know whether this issue is trivial or not. > > I think view of you and other llvm-commiters are right. Hi Jin, Instead of focusing on the patch, lets look at it another way: what problem are you experiencing and trying to solve? -Chris From joerg at britannica.bec.de Tue Feb 22 15:06:14 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Tue, 22 Feb 2011 22:06:14 +0100 Subject: [llvm-commits] [llvm] r126226 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h In-Reply-To: References: <20110222173005.5A9022A6C12C@llvm.org> Message-ID: <20110222210614.GA27936@britannica.bec.de> On Tue, Feb 22, 2011 at 12:57:36PM -0800, Chris Lattner wrote: > > On Feb 22, 2011, at 9:30 AM, Roman Divacky wrote: > > > Author: rdivacky > > Date: Tue Feb 22 11:30:05 2011 > > New Revision: 126226 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=126226&view=rev > > Log: > > Stack alignment is 16 bytes on FreeBSD/i386 too. > > Are there any targets where it isn't 16? Any target that cares about the SYSV ABI. Joerg From rdivacky at freebsd.org Tue Feb 22 15:07:25 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Tue, 22 Feb 2011 22:07:25 +0100 Subject: [llvm-commits] [llvm] r126226 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h In-Reply-To: References: <20110222173005.5A9022A6C12C@llvm.org> Message-ID: <20110222210725.GA55752@freebsd.org> On Tue, Feb 22, 2011 at 12:57:36PM -0800, Chris Lattner wrote: > > On Feb 22, 2011, at 9:30 AM, Roman Divacky wrote: > > > Author: rdivacky > > Date: Tue Feb 22 11:30:05 2011 > > New Revision: 126226 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=126226&view=rev > > Log: > > Stack alignment is 16 bytes on FreeBSD/i386 too. > > Are there any targets where it isn't 16? I think that every target that uses gcc (all except windows?) have this set to 16 as thats what gcc does. From clattner at apple.com Tue Feb 22 15:12:02 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Feb 2011 13:12:02 -0800 Subject: [llvm-commits] [llvm] r126226 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h In-Reply-To: <20110222210614.GA27936@britannica.bec.de> References: <20110222173005.5A9022A6C12C@llvm.org> <20110222210614.GA27936@britannica.bec.de> Message-ID: <2F488BA9-2141-469B-89B3-89C7FA8B979F@apple.com> On Feb 22, 2011, at 1:06 PM, Joerg Sonnenberger wrote: >>> URL: http://llvm.org/viewvc/llvm-project?rev=126226&view=rev >>> Log: >>> Stack alignment is 16 bytes on FreeBSD/i386 too. >> >> Are there any targets where it isn't 16? > > Any target that cares about the SYSV ABI. Yeah, which targets are those exactly? The long list of subtargets included all theoretically care about SYSV. -Chris From zwarich at apple.com Tue Feb 22 15:43:40 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Tue, 22 Feb 2011 13:43:40 -0800 Subject: [llvm-commits] Patch to delete loops with multiple exiting blocks In-Reply-To: References: Message-ID: <39ADBEDF-3088-452B-9F21-7877968FACFA@apple.com> On Feb 20, 2011, at 9:28 AM, Andrew Clinton wrote: > This is a simple patch to improve the loop-delete pass so that it will > delete loops with multiple exiting blocks (but still a single exit). The patch looks good to me. There probably shouldn't be braces here according to our (often inconsistent) coding style: + P->replaceUsesOfWith(exitingBlocks[0], preheader); + for (unsigned i = 1; i < exitingBlocks.size(); ++i) { + P->removeIncomingValue(exitingBlocks[i]); + } Do you want me to commit this for you? Cameron From joerg at britannica.bec.de Tue Feb 22 15:49:38 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Tue, 22 Feb 2011 22:49:38 +0100 Subject: [llvm-commits] [llvm] r126226 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h In-Reply-To: <2F488BA9-2141-469B-89B3-89C7FA8B979F@apple.com> References: <20110222173005.5A9022A6C12C@llvm.org> <20110222210614.GA27936@britannica.bec.de> <2F488BA9-2141-469B-89B3-89C7FA8B979F@apple.com> Message-ID: <20110222214938.GA6896@britannica.bec.de> On Tue, Feb 22, 2011 at 01:12:02PM -0800, Chris Lattner wrote: > > On Feb 22, 2011, at 1:06 PM, Joerg Sonnenberger wrote: > > >>> URL: http://llvm.org/viewvc/llvm-project?rev=126226&view=rev > >>> Log: > >>> Stack alignment is 16 bytes on FreeBSD/i386 too. > >> > >> Are there any targets where it isn't 16? > > > > Any target that cares about the SYSV ABI. > > Yeah, which targets are those exactly? The long list of subtargets > included all theoretically care about SYSV. Linux doesn't and FreeBSD has decided to not care either. While it is easy to get away with it in most cases, there is enough assembler and signal code to be very careful here. Joerg From zwarich at apple.com Tue Feb 22 16:25:39 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Tue, 22 Feb 2011 22:25:39 -0000 Subject: [llvm-commits] [llvm] r126253 - in /llvm/trunk: lib/Transforms/Scalar/LoopDeletion.cpp test/Transforms/LoopDeletion/multiple-exits.ll Message-ID: <20110222222539.9F9932A6C12E@llvm.org> Author: zwarich Date: Tue Feb 22 16:25:39 2011 New Revision: 126253 URL: http://llvm.org/viewvc/llvm-project?rev=126253&view=rev Log: Make LoopDeletion work on loops with multiple edges, as long as the incoming values from all of the loop's exiting blocks are equal. Patch by Andrew Clinton. Added: llvm/trunk/test/Transforms/LoopDeletion/multiple-exits.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=126253&r1=126252&r2=126253&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Tue Feb 22 16:25:39 2011 @@ -78,7 +78,6 @@ SmallVector& exitingBlocks, SmallVector& exitBlocks, bool &Changed, BasicBlock *Preheader) { - BasicBlock* exitingBlock = exitingBlocks[0]; BasicBlock* exitBlock = exitBlocks[0]; // Make sure that all PHI entries coming from the loop are loop invariant. @@ -88,11 +87,21 @@ // of the loop. BasicBlock::iterator BI = exitBlock->begin(); while (PHINode* P = dyn_cast(BI)) { - Value* incoming = P->getIncomingValueForBlock(exitingBlock); + Value* incoming = P->getIncomingValueForBlock(exitingBlocks[0]); + + // Make sure all exiting blocks produce the same incoming value for the exit + // block. If there are different incoming values for different exiting + // blocks, then it is impossible to statically determine which value should + // be used. + for (unsigned i = 1; i < exitingBlocks.size(); ++i) { + if (incoming != P->getIncomingValueForBlock(exitingBlocks[i])) + return false; + } + if (Instruction* I = dyn_cast(incoming)) if (!L->makeLoopInvariant(I, Changed, Preheader->getTerminator())) return false; - + ++BI; } @@ -147,10 +156,6 @@ if (exitBlocks.size() != 1) return false; - // Loops with multiple exits are too complicated to handle correctly. - if (exitingBlocks.size() != 1) - return false; - // Finally, we have to check that the loop really is dead. bool Changed = false; if (!IsLoopDead(L, exitingBlocks, exitBlocks, Changed, preheader)) @@ -166,7 +171,6 @@ // Now that we know the removal is safe, remove the loop by changing the // branch from the preheader to go to the single exit block. BasicBlock* exitBlock = exitBlocks[0]; - BasicBlock* exitingBlock = exitingBlocks[0]; // Because we're deleting a large chunk of code at once, the sequence in which // we remove things is very important to avoid invalidation issues. Don't @@ -183,9 +187,12 @@ // Rewrite phis in the exit block to get their inputs from // the preheader instead of the exiting block. + BasicBlock* exitingBlock = exitingBlocks[0]; BasicBlock::iterator BI = exitBlock->begin(); while (PHINode* P = dyn_cast(BI)) { P->replaceUsesOfWith(exitingBlock, preheader); + for (unsigned i = 1; i < exitingBlocks.size(); ++i) + P->removeIncomingValue(exitingBlocks[i]); ++BI; } Added: llvm/trunk/test/Transforms/LoopDeletion/multiple-exits.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopDeletion/multiple-exits.ll?rev=126253&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopDeletion/multiple-exits.ll (added) +++ llvm/trunk/test/Transforms/LoopDeletion/multiple-exits.ll Tue Feb 22 16:25:39 2011 @@ -0,0 +1,26 @@ +; RUN: opt < %s -loop-deletion -S | FileCheck %s + +; Checks whether dead loops with multiple exits can be eliminated + +; CHECK: entry: +; CHECK-NEXT: br label %return + +; CHECK: return: +; CHECK-NEXT: ret void + +define void @foo(i64 %n, i64 %m) nounwind { +entry: + br label %bb + +bb: + %x.0 = phi i64 [ 0, %entry ], [ %t0, %bb2 ] + %t0 = add i64 %x.0, 1 + %t1 = icmp slt i64 %x.0, %n + br i1 %t1, label %bb2, label %return +bb2: + %t2 = icmp slt i64 %x.0, %m + br i1 %t1, label %bb, label %return + +return: + ret void +} From nicholas at mxc.ca Tue Feb 22 16:48:47 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Feb 2011 22:48:47 -0000 Subject: [llvm-commits] [llvm] r126256 - in /llvm/trunk/include/llvm/ADT: ImmutableIntervalMap.h ImmutableMap.h Message-ID: <20110222224848.036392A6C12C@llvm.org> Author: nicholas Date: Tue Feb 22 16:48:47 2011 New Revision: 126256 URL: http://llvm.org/viewvc/llvm-project?rev=126256&view=rev Log: Fix C++0x incompatibility. The signature of std::make_pair<> changes from: template pair make_pair(const T1&, const T2&); to template pair make_pair(T1&&, T2&&); so explicitly specifying the template arguments to make_pair<> is going to break when C++0x rolls through. Replace them with equivalent std::pair<>. Patch by James Dennett! Modified: llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h llvm/trunk/include/llvm/ADT/ImmutableMap.h Modified: llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h?rev=126256&r1=126255&r2=126256&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h Tue Feb 22 16:48:47 2011 @@ -215,7 +215,7 @@ ImmutableIntervalMap add(ImmutableIntervalMap Old, key_type_ref K, data_type_ref D) { - TreeTy *T = F.add(Old.Root, std::make_pair(K, D)); + TreeTy *T = F.add(Old.Root, std::pair(K, D)); return ImmutableIntervalMap(F.getCanonicalTree(T)); } Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableMap.h?rev=126256&r1=126255&r2=126256&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Tue Feb 22 16:48:47 2011 @@ -108,7 +108,7 @@ ImmutableMap getEmptyMap() { return ImmutableMap(F.getEmptyTree()); } ImmutableMap add(ImmutableMap Old, key_type_ref K, data_type_ref D) { - TreeTy *T = F.add(Old.Root, std::make_pair(K,D)); + TreeTy *T = F.add(Old.Root, std::pair(K,D)); return ImmutableMap(Canonicalize ? F.getCanonicalTree(T): T); } From stoklund at 2pi.dk Tue Feb 22 17:01:49 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Feb 2011 23:01:49 -0000 Subject: [llvm-commits] [llvm] r126258 - /llvm/trunk/lib/CodeGen/InlineSpiller.cpp Message-ID: <20110222230149.89B052A6C12C@llvm.org> Author: stoklund Date: Tue Feb 22 17:01:49 2011 New Revision: 126258 URL: http://llvm.org/viewvc/llvm-project?rev=126258&view=rev Log: 80 Col. Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=126258&r1=126257&r2=126258&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original) +++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Tue Feb 22 17:01:49 2011 @@ -102,8 +102,7 @@ } } -/// reMaterializeFor - Attempt to rematerialize edit_->getReg() before MI instead of -/// reloading it. +/// reMaterializeFor - Attempt to rematerialize before MI instead of reloading. bool InlineSpiller::reMaterializeFor(MachineBasicBlock::iterator MI) { SlotIndex UseIdx = lis_.getInstructionIndex(MI).getUseIndex(); VNInfo *OrigVNI = edit_->getParent().getVNInfoAt(UseIdx); From stoklund at 2pi.dk Tue Feb 22 17:01:52 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Feb 2011 23:01:52 -0000 Subject: [llvm-commits] [llvm] r126259 - in /llvm/trunk/lib/CodeGen: RegAllocBase.h RegAllocBasic.cpp RegAllocGreedy.cpp Message-ID: <20110222230152.5F5622A6C12D@llvm.org> Author: stoklund Date: Tue Feb 22 17:01:52 2011 New Revision: 126259 URL: http://llvm.org/viewvc/llvm-project?rev=126259&view=rev Log: Change the RAGreedy register assignment order so large live ranges are allocated first. This is based on the observation that long live ranges are more difficult to allocate, so there is a better chance of solving the puzzle by handling the big pieces first. The allocator will evict and split long alive ranges when they get in the way. RABasic is still using spill weights for its priority queue, so the interface to the queue has been virtualized. Modified: llvm/trunk/lib/CodeGen/RegAllocBase.h llvm/trunk/lib/CodeGen/RegAllocBasic.cpp llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocBase.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBase.h?rev=126259&r1=126258&r2=126259&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocBase.h (original) +++ llvm/trunk/lib/CodeGen/RegAllocBase.h Tue Feb 22 17:01:52 2011 @@ -39,7 +39,6 @@ #include "llvm/ADT/OwningPtr.h" #include "LiveIntervalUnion.h" -#include namespace llvm { @@ -58,8 +57,8 @@ /// be extended to add interesting heuristics. /// /// Register allocators must override the selectOrSplit() method to implement -/// live range splitting. They may also override getPriority() which otherwise -/// defaults to the spill weight computed by CalculateSpillWeights. +/// live range splitting. They must also override enqueue/dequeue to provide an +/// assignment order. class RegAllocBase { LiveIntervalUnion::Allocator UnionAllocator; protected: @@ -120,9 +119,11 @@ // Get a temporary reference to a Spiller instance. virtual Spiller &spiller() = 0; - // getPriority - Calculate the allocation priority for VirtReg. - // Virtual registers with higher priorities are allocated first. - virtual float getPriority(LiveInterval *LI) = 0; + /// enqueue - Add VirtReg to the priority queue of unassigned registers. + virtual void enqueue(LiveInterval *LI) = 0; + + /// dequeue - Return the next unassigned register, or NULL. + virtual LiveInterval *dequeue() = 0; // A RegAlloc pass should override this to provide the allocation heuristics. // Each call must guarantee forward progess by returning an available PhysReg @@ -170,7 +171,7 @@ static bool VerifyEnabled; private: - void seedLiveVirtRegs(std::priority_queue >&); + void seedLiveRegs(); void spillReg(LiveInterval &VirtReg, unsigned PhysReg, SmallVectorImpl &SplitVRegs); Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=126259&r1=126258&r2=126259&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocBasic.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocBasic.cpp Tue Feb 22 17:01:52 2011 @@ -45,6 +45,7 @@ #include "llvm/Support/Timer.h" #include +#include using namespace llvm; @@ -65,6 +66,14 @@ bool RegAllocBase::VerifyEnabled = false; namespace { + struct CompSpillWeight { + bool operator()(LiveInterval *A, LiveInterval *B) const { + return A->weight < B->weight; + } + }; +} + +namespace { /// RABasic provides a minimal implementation of the basic register allocation /// algorithm. It prioritizes live virtual registers by spill weight and spills /// whenever a register is unavailable. This is not practical in production but @@ -82,7 +91,8 @@ // state std::auto_ptr SpillerInstance; - + std::priority_queue, + CompSpillWeight> Queue; public: RABasic(); @@ -100,6 +110,18 @@ virtual float getPriority(LiveInterval *LI) { return LI->weight; } + virtual void enqueue(LiveInterval *LI) { + Queue.push(LI); + } + + virtual LiveInterval *dequeue() { + if (Queue.empty()) + return 0; + LiveInterval *LI = Queue.top(); + Queue.pop(); + return LI; + } + virtual unsigned selectOrSplit(LiveInterval &VirtReg, SmallVectorImpl &SplitVRegs); @@ -227,18 +249,17 @@ PhysReg2LiveUnion.clear(); } -// Visit all the live virtual registers. If they are already assigned to a -// physical register, unify them with the corresponding LiveIntervalUnion, -// otherwise push them on the priority queue for later assignment. -void RegAllocBase:: -seedLiveVirtRegs(std::priority_queue > &VirtRegQ) { +// Visit all the live registers. If they are already assigned to a physical +// register, unify them with the corresponding LiveIntervalUnion, otherwise push +// them on the priority queue for later assignment. +void RegAllocBase::seedLiveRegs() { for (LiveIntervals::iterator I = LIS->begin(), E = LIS->end(); I != E; ++I) { unsigned RegNum = I->first; LiveInterval &VirtReg = *I->second; if (TargetRegisterInfo::isPhysicalRegister(RegNum)) PhysReg2LiveUnion[RegNum].unify(VirtReg); else - VirtRegQ.push(std::make_pair(getPriority(&VirtReg), RegNum)); + enqueue(&VirtReg); } } @@ -263,38 +284,31 @@ // Top-level driver to manage the queue of unassigned VirtRegs and call the // selectOrSplit implementation. void RegAllocBase::allocatePhysRegs() { - - // Push each vreg onto a queue or "precolor" by adding it to a physreg union. - std::priority_queue > VirtRegQ; - seedLiveVirtRegs(VirtRegQ); + seedLiveRegs(); // Continue assigning vregs one at a time to available physical registers. - while (!VirtRegQ.empty()) { - // Pop the highest priority vreg. - LiveInterval &VirtReg = LIS->getInterval(VirtRegQ.top().second); - VirtRegQ.pop(); - + while (LiveInterval *VirtReg = dequeue()) { // selectOrSplit requests the allocator to return an available physical // register if possible and populate a list of new live intervals that // result from splitting. - DEBUG(dbgs() << "\nselectOrSplit " << MRI->getRegClass(VirtReg.reg)->getName() - << ':' << VirtReg << '\n'); + DEBUG(dbgs() << "\nselectOrSplit " + << MRI->getRegClass(VirtReg->reg)->getName() + << ':' << *VirtReg << '\n'); typedef SmallVector VirtRegVec; VirtRegVec SplitVRegs; - unsigned AvailablePhysReg = selectOrSplit(VirtReg, SplitVRegs); + unsigned AvailablePhysReg = selectOrSplit(*VirtReg, SplitVRegs); if (AvailablePhysReg) - assign(VirtReg, AvailablePhysReg); + assign(*VirtReg, AvailablePhysReg); for (VirtRegVec::iterator I = SplitVRegs.begin(), E = SplitVRegs.end(); I != E; ++I) { - LiveInterval* SplitVirtReg = *I; + LiveInterval *SplitVirtReg = *I; if (SplitVirtReg->empty()) continue; DEBUG(dbgs() << "queuing new interval: " << *SplitVirtReg << "\n"); assert(TargetRegisterInfo::isVirtualRegister(SplitVirtReg->reg) && "expect split value in virtual register"); - VirtRegQ.push(std::make_pair(getPriority(SplitVirtReg), - SplitVirtReg->reg)); + enqueue(SplitVirtReg); ++NumNewQueued; } } Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=126259&r1=126258&r2=126259&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Feb 22 17:01:52 2011 @@ -43,6 +43,8 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Timer.h" +#include + using namespace llvm; STATISTIC(NumGlobalSplits, "Number of split global live ranges"); @@ -71,6 +73,7 @@ // state std::auto_ptr SpillerInstance; std::auto_ptr SA; + std::priority_queue > Queue; // splitting state. @@ -91,13 +94,10 @@ /// RAGreedy analysis usage. virtual void getAnalysisUsage(AnalysisUsage &AU) const; - virtual void releaseMemory(); - virtual Spiller &spiller() { return *SpillerInstance; } - - virtual float getPriority(LiveInterval *LI); - + virtual void enqueue(LiveInterval *LI); + virtual LiveInterval *dequeue(); virtual unsigned selectOrSplit(LiveInterval&, SmallVectorImpl&); @@ -186,22 +186,29 @@ RegAllocBase::releaseMemory(); } -float RAGreedy::getPriority(LiveInterval *LI) { - float Priority = LI->weight; +void RAGreedy::enqueue(LiveInterval *LI) { + // Prioritize live ranges by size, assigning larger ranges first. + // The queue holds (size, reg) pairs. + unsigned Size = LI->getSize(); + unsigned Reg = LI->reg; + assert(TargetRegisterInfo::isVirtualRegister(Reg) && + "Can only enqueue virtual registers"); + + // Boost ranges that have a physical register hint. + unsigned Hint = VRM->getRegAllocPref(Reg); + if (TargetRegisterInfo::isPhysicalRegister(Hint)) + Size |= (1u << 30); - // Prioritize hinted registers so they are allocated first. - std::pair Hint; - if (Hint.first || Hint.second) { - // The hint can be target specific, a virtual register, or a physreg. - Priority *= 2; - - // Prefer physreg hints above anything else. - if (Hint.first == 0 && TargetRegisterInfo::isPhysicalRegister(Hint.second)) - Priority *= 2; - } - return Priority; + Queue.push(std::make_pair(Size, Reg)); } +LiveInterval *RAGreedy::dequeue() { + if (Queue.empty()) + return 0; + LiveInterval *LI = &LIS->getInterval(Queue.top().second); + Queue.pop(); + return LI; +} //===----------------------------------------------------------------------===// // Register Reassignment From greened at obbligato.org Tue Feb 22 17:30:45 2011 From: greened at obbligato.org (David Greene) Date: Tue, 22 Feb 2011 23:30:45 -0000 Subject: [llvm-commits] [llvm] r126263 - /llvm/trunk/utils/llvmbuild Message-ID: <20110222233045.996412A6C12C@llvm.org> Author: greened Date: Tue Feb 22 17:30:45 2011 New Revision: 126263 URL: http://llvm.org/viewvc/llvm-project?rev=126263&view=rev Log: Fix Builder::execute() to more properly pass the desired environment to tools. Modified: llvm/trunk/utils/llvmbuild Modified: llvm/trunk/utils/llvmbuild URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvmbuild?rev=126263&r1=126262&r2=126263&view=diff ============================================================================== --- llvm/trunk/utils/llvmbuild (original) +++ llvm/trunk/utils/llvmbuild Tue Feb 22 17:30:45 2011 @@ -318,8 +318,10 @@ if not os.path.exists(execdir): os.makedirs(execdir) + execenv = os.environ.copy() + for key, value in env.items(): - os.environ[key] = value + execenv[key] = value self.logger.debug("[" + prefix + "] " + "env " + str(env) + " " + " ".join(command)); @@ -327,6 +329,7 @@ try: proc = subprocess.Popen(command, cwd=execdir, + env=execenv, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -339,9 +342,6 @@ except: traceback.print_exc() - for key, value in env.items(): - os.environ.pop(key) - # Get a list of C++ include directories to pass to clang. def get_includes(self): # Assume we're building with g++ for now. From greened at obbligato.org Tue Feb 22 17:31:46 2011 From: greened at obbligato.org (David Greene) Date: Tue, 22 Feb 2011 23:31:46 -0000 Subject: [llvm-commits] [llvm] r126264 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h Message-ID: <20110222233146.9E22D2A6C12C@llvm.org> Author: greened Date: Tue Feb 22 17:31:46 2011 New Revision: 126264 URL: http://llvm.org/viewvc/llvm-project?rev=126264&view=rev Log: [AVX] General VUNPCKL codegen support. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=126264&r1=126263&r2=126264&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Feb 22 17:31:46 2011 @@ -2693,6 +2693,10 @@ case X86ISD::MOVSD: case X86ISD::UNPCKLPS: case X86ISD::UNPCKLPD: + case X86ISD::VUNPCKLPS: + case X86ISD::VUNPCKLPD: + case X86ISD::VUNPCKLPSY: + case X86ISD::VUNPCKLPDY: case X86ISD::PUNPCKLWD: case X86ISD::PUNPCKLBW: case X86ISD::PUNPCKLDQ: @@ -2760,6 +2764,10 @@ case X86ISD::MOVSD: case X86ISD::UNPCKLPS: case X86ISD::UNPCKLPD: + case X86ISD::VUNPCKLPS: + case X86ISD::VUNPCKLPD: + case X86ISD::VUNPCKLPSY: + case X86ISD::VUNPCKLPDY: case X86ISD::PUNPCKLWD: case X86ISD::PUNPCKLBW: case X86ISD::PUNPCKLDQ: @@ -9327,6 +9335,10 @@ case X86ISD::MOVSS: return "X86ISD::MOVSS"; case X86ISD::UNPCKLPS: return "X86ISD::UNPCKLPS"; case X86ISD::UNPCKLPD: return "X86ISD::UNPCKLPD"; + case X86ISD::VUNPCKLPS: return "X86ISD::VUNPCKLPS"; + case X86ISD::VUNPCKLPD: return "X86ISD::VUNPCKLPD"; + case X86ISD::VUNPCKLPSY: return "X86ISD::VUNPCKLPSY"; + case X86ISD::VUNPCKLPDY: return "X86ISD::VUNPCKLPDY"; case X86ISD::UNPCKHPS: return "X86ISD::UNPCKHPS"; case X86ISD::UNPCKHPD: return "X86ISD::UNPCKHPD"; case X86ISD::PUNPCKLBW: return "X86ISD::PUNPCKLBW"; @@ -11984,6 +11996,10 @@ case X86ISD::PUNPCKLQDQ: case X86ISD::UNPCKLPS: case X86ISD::UNPCKLPD: + case X86ISD::VUNPCKLPS: + case X86ISD::VUNPCKLPD: + case X86ISD::VUNPCKLPSY: + case X86ISD::VUNPCKLPDY: case X86ISD::MOVHLPS: case X86ISD::MOVLHPS: case X86ISD::PSHUFD: Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=126264&r1=126263&r2=126264&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Feb 22 17:31:46 2011 @@ -248,6 +248,10 @@ MOVSS, UNPCKLPS, UNPCKLPD, + VUNPCKLPS, + VUNPCKLPD, + VUNPCKLPSY, + VUNPCKLPDY, UNPCKHPS, UNPCKHPD, PUNPCKLBW, From andrew at sidefx.com Tue Feb 22 16:06:42 2011 From: andrew at sidefx.com (Andrew Clinton) Date: Tue, 22 Feb 2011 17:06:42 -0500 Subject: [llvm-commits] Patch to delete loops with multiple exiting blocks In-Reply-To: <39ADBEDF-3088-452B-9F21-7877968FACFA@apple.com> References: <39ADBEDF-3088-452B-9F21-7877968FACFA@apple.com> Message-ID: <4D643372.1090609@sidefx.com> On 02/22/2011 04:43 PM, Cameron Zwarich wrote: > On Feb 20, 2011, at 9:28 AM, Andrew Clinton wrote: > >> This is a simple patch to improve the loop-delete pass so that it will >> delete loops with multiple exiting blocks (but still a single exit). > The patch looks good to me. There probably shouldn't be braces here according to our (often inconsistent) coding style: > > + P->replaceUsesOfWith(exitingBlocks[0], preheader); > + for (unsigned i = 1; i< exitingBlocks.size(); ++i) { > + P->removeIncomingValue(exitingBlocks[i]); > + } > > Do you want me to commit this for you? > Yes, that would be great if you could commit this for me - thanks for having a look! Andrew From stoklund at 2pi.dk Tue Feb 22 18:29:52 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Feb 2011 00:29:52 -0000 Subject: [llvm-commits] [llvm] r126276 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110223002952.B87302A6C12C@llvm.org> Author: stoklund Date: Tue Feb 22 18:29:52 2011 New Revision: 126276 URL: http://llvm.org/viewvc/llvm-project?rev=126276&view=rev Log: Be more aggressive about evicting interference. Use interval sizes instead of spill weights to determine if it is legal to evict interference. A smaller interval can evict interference if all interfering live ranges are larger. Allow multiple interferences to be evicted as along as they are all larger than the live range being allocated. Spill weights are still used to select the preferred eviction candidate. 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=126276&r1=126275&r2=126276&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Feb 22 18:29:52 2011 @@ -119,9 +119,12 @@ SlotIndex getPrevMappedIndex(const MachineInstr*); void calcPrevSlots(); unsigned nextSplitPoint(unsigned); + bool canEvictInterference(LiveInterval&, unsigned, unsigned, float&); - unsigned tryReassignOrEvict(LiveInterval&, AllocationOrder&, + unsigned tryReassign(LiveInterval&, AllocationOrder&, SmallVectorImpl&); + unsigned tryEvict(LiveInterval&, AllocationOrder&, + SmallVectorImpl&); unsigned tryRegionSplit(LiveInterval&, AllocationOrder&, SmallVectorImpl&); unsigned tryLocalSplit(LiveInterval&, AllocationOrder&, @@ -283,21 +286,14 @@ return false; } -/// tryReassignOrEvict - Try to reassign a single interferences to a different -/// physreg, or evict a single interference with a lower spill weight. +/// tryReassign - Try to reassign a single interference to a different physreg. /// @param VirtReg Currently unassigned virtual register. /// @param Order Physregs to try. /// @return Physreg to assign VirtReg, or 0. -unsigned RAGreedy::tryReassignOrEvict(LiveInterval &VirtReg, - AllocationOrder &Order, - SmallVectorImpl &NewVRegs){ +unsigned RAGreedy::tryReassign(LiveInterval &VirtReg, AllocationOrder &Order, + SmallVectorImpl &NewVRegs){ NamedRegionTimer T("Reassign", TimerGroupName, TimePassesIsEnabled); - // Keep track of the lightest single interference seen so far. - float BestWeight = VirtReg.weight; - LiveInterval *BestVirt = 0; - unsigned BestPhys = 0; - Order.rewind(); while (unsigned PhysReg = Order.next()) { LiveInterval *InterferingVReg = getSingleInterference(VirtReg, PhysReg); @@ -307,25 +303,89 @@ continue; if (reassignVReg(*InterferingVReg, PhysReg)) return PhysReg; + } + return 0; +} + + +//===----------------------------------------------------------------------===// +// Interference eviction +//===----------------------------------------------------------------------===// - // Cannot reassign, is this an eviction candidate? - if (InterferingVReg->weight < BestWeight) { - BestVirt = InterferingVReg; - BestPhys = PhysReg; - BestWeight = InterferingVReg->weight; +/// canEvict - Return true if all interferences between VirtReg and PhysReg can +/// be evicted. Set maxWeight to the maximal spill weight of an interference. +bool RAGreedy::canEvictInterference(LiveInterval &VirtReg, unsigned PhysReg, + unsigned Size, float &MaxWeight) { + float Weight = 0; + for (const unsigned *AliasI = TRI->getOverlaps(PhysReg); *AliasI; ++AliasI) { + LiveIntervalUnion::Query &Q = query(VirtReg, *AliasI); + // If there is 10 or more interferences, chances are one is smaller. + if (Q.collectInterferingVRegs(10) >= 10) + return false; + + // CHeck if any interfering live range is shorter than VirtReg. + for (unsigned i = 0, e = Q.interferingVRegs().size(); i != e; ++i) { + LiveInterval *Intf = Q.interferingVRegs()[i]; + if (TargetRegisterInfo::isPhysicalRegister(Intf->reg)) + return false; + if (Intf->getSize() <= Size) + return false; + Weight = std::max(Weight, Intf->weight); } } + MaxWeight = Weight; + return true; +} + +/// tryEvict - Try to evict all interferences for a physreg. +/// @param VirtReg Currently unassigned virtual register. +/// @param Order Physregs to try. +/// @return Physreg to assign VirtReg, or 0. +unsigned RAGreedy::tryEvict(LiveInterval &VirtReg, + AllocationOrder &Order, + SmallVectorImpl &NewVRegs){ + NamedRegionTimer T("Evict", TimerGroupName, TimePassesIsEnabled); + + // We can only evict interference if all interfering registers are virtual and + // longer than VirtReg. + const unsigned Size = VirtReg.getSize(); - // Nothing reassigned, can we evict a lighter single interference? - if (BestVirt) { - DEBUG(dbgs() << "evicting lighter " << *BestVirt << '\n'); - unassign(*BestVirt, VRM->getPhys(BestVirt->reg)); - ++NumEvicted; - NewVRegs.push_back(BestVirt); - return BestPhys; + // Keep track of the lightest single interference seen so far. + float BestWeight = 0; + unsigned BestPhys = 0; + + Order.rewind(); + while (unsigned PhysReg = Order.next()) { + float Weight = 0; + if (!canEvictInterference(VirtReg, PhysReg, Size, Weight)) + continue; + + // This is an eviction candidate. + DEBUG(dbgs() << "max " << PrintReg(PhysReg, TRI) << " interference = " + << Weight << '\n'); + if (BestPhys && Weight >= BestWeight) + continue; + + // Best so far. + BestPhys = PhysReg; + BestWeight = Weight; } - return 0; + if (!BestPhys) + return 0; + + DEBUG(dbgs() << "evicting " << PrintReg(BestPhys, TRI) << " interference\n"); + for (const unsigned *AliasI = TRI->getOverlaps(BestPhys); *AliasI; ++AliasI) { + LiveIntervalUnion::Query &Q = query(VirtReg, *AliasI); + assert(Q.seenAllInterferences() && "Didn't check all interfererences."); + for (unsigned i = 0, e = Q.interferingVRegs().size(); i != e; ++i) { + LiveInterval *Intf = Q.interferingVRegs()[i]; + unassign(*Intf, VRM->getPhys(Intf->reg)); + ++NumEvicted; + NewVRegs.push_back(Intf); + } + } + return BestPhys; } @@ -1237,8 +1297,10 @@ return PhysReg; } - // Try to reassign interferences. - if (unsigned PhysReg = tryReassignOrEvict(VirtReg, Order, NewVRegs)) + if (unsigned PhysReg = tryReassign(VirtReg, Order, NewVRegs)) + return PhysReg; + + if (unsigned PhysReg = tryEvict(VirtReg, Order, NewVRegs)) return PhysReg; assert(NewVRegs.empty() && "Cannot append to existing NewVRegs"); From stoklund at 2pi.dk Tue Feb 22 18:29:55 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Feb 2011 00:29:55 -0000 Subject: [llvm-commits] [llvm] r126277 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110223002955.57E722A6C12D@llvm.org> Author: stoklund Date: Tue Feb 22 18:29:55 2011 New Revision: 126277 URL: http://llvm.org/viewvc/llvm-project?rev=126277&view=rev Log: Fix a bug in determining if there is only a single interfering register. 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=126277&r1=126276&r2=126277&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Feb 22 18:29:55 2011 @@ -240,8 +240,7 @@ if (Q.checkInterference()) { if (Interference) return 0; - Q.collectInterferingVRegs(1); - if (!Q.seenAllInterferences()) + if (Q.collectInterferingVRegs(2) > 1) return 0; Interference = Q.interferingVRegs().front(); } From stoklund at 2pi.dk Tue Feb 22 18:56:56 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Feb 2011 00:56:56 -0000 Subject: [llvm-commits] [llvm] r126282 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110223005656.F2E2A2A6C12C@llvm.org> Author: stoklund Date: Tue Feb 22 18:56:56 2011 New Revision: 126282 URL: http://llvm.org/viewvc/llvm-project?rev=126282&view=rev Log: Keep track of how many times a live range has been dequeued, and prioritize new ranges. When a large live range is evicted, it will usually be split when it comes around again. By deferring evicted live ranges, the splitting happens at a time when the interference pattern is more realistic. This prevents repeated splitting and evictions. 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=126282&r1=126281&r2=126282&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Feb 22 18:56:56 2011 @@ -74,6 +74,7 @@ std::auto_ptr SpillerInstance; std::auto_ptr SA; std::priority_queue > Queue; + IndexedMap Generation; // splitting state. @@ -186,6 +187,7 @@ void RAGreedy::releaseMemory() { SpillerInstance.reset(0); + Generation.clear(); RegAllocBase::releaseMemory(); } @@ -202,6 +204,11 @@ if (TargetRegisterInfo::isPhysicalRegister(Hint)) Size |= (1u << 30); + // Boost ranges that we see for the first time. + Generation.grow(Reg); + if (++Generation[Reg] == 1) + Size |= (1u << 31); + Queue.push(std::make_pair(Size, Reg)); } From evan.cheng at apple.com Tue Feb 22 20:24:55 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Feb 2011 02:24:55 -0000 Subject: [llvm-commits] [llvm] r126295 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp test/CodeGen/ARM/fcopysign.ll Message-ID: <20110223022456.148022A6C12C@llvm.org> Author: evancheng Date: Tue Feb 22 20:24:55 2011 New Revision: 126295 URL: http://llvm.org/viewvc/llvm-project?rev=126295&view=rev Log: More fcopysign correctness and performance fix. The previous codegen for the slow path (when values are in VFP / NEON registers) was incorrect if the source is NaN. The new codegen uses NEON vbsl instruction to copy the sign bit. e.g. vmov.i32 d1, #0x80000000 vbsl d1, d2, d0 If NEON is not available, it uses integer instructions to copy the sign bit. rdar://9034702 Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/test/CodeGen/ARM/fcopysign.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=126295&r1=126294&r2=126295&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Feb 22 20:24:55 2011 @@ -2838,8 +2838,51 @@ DebugLoc dl = Op.getDebugLoc(); EVT VT = Op.getValueType(); EVT SrcVT = Tmp1.getValueType(); - bool F2IisFast = Subtarget->isCortexA9() || - Tmp0.getOpcode() == ISD::BITCAST || Tmp0.getOpcode() == ARMISD::VMOVDRR; + bool InGPR = Tmp0.getOpcode() == ISD::BITCAST || + Tmp0.getOpcode() == ARMISD::VMOVDRR; + bool UseNEON = !InGPR && Subtarget->hasNEON(); + + if (UseNEON) { + // Use VBSL to copy the sign bit. + unsigned EncodedVal = ARM_AM::createNEONModImm(0x6, 0x80); + SDValue Mask = DAG.getNode(ARMISD::VMOVIMM, dl, MVT::v2i32, + DAG.getTargetConstant(EncodedVal, MVT::i32)); + EVT OpVT = (VT == MVT::f32) ? MVT::v2i32 : MVT::v1i64; + if (VT == MVT::f64) + Mask = DAG.getNode(ARMISD::VSHL, dl, OpVT, + DAG.getNode(ISD::BITCAST, dl, OpVT, Mask), + DAG.getConstant(32, MVT::i32)); + else /*if (VT == MVT::f32)*/ + Tmp0 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v2f32, Tmp0); + if (SrcVT == MVT::f32) { + Tmp1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v2f32, Tmp1); + if (VT == MVT::f64) + Tmp1 = DAG.getNode(ARMISD::VSHL, dl, OpVT, + DAG.getNode(ISD::BITCAST, dl, OpVT, Tmp1), + DAG.getConstant(32, MVT::i32)); + } + Tmp0 = DAG.getNode(ISD::BITCAST, dl, OpVT, Tmp0); + Tmp1 = DAG.getNode(ISD::BITCAST, dl, OpVT, Tmp1); + + SDValue AllOnes = DAG.getTargetConstant(ARM_AM::createNEONModImm(0xe, 0xff), + MVT::i32); + AllOnes = DAG.getNode(ARMISD::VMOVIMM, dl, MVT::v8i8, AllOnes); + SDValue MaskNot = DAG.getNode(ISD::XOR, dl, OpVT, Mask, + DAG.getNode(ISD::BITCAST, dl, OpVT, AllOnes)); + + SDValue Res = DAG.getNode(ISD::OR, dl, OpVT, + DAG.getNode(ISD::AND, dl, OpVT, Tmp1, Mask), + DAG.getNode(ISD::AND, dl, OpVT, Tmp0, MaskNot)); + if (SrcVT == MVT::f32) { + Res = DAG.getNode(ISD::BITCAST, dl, MVT::v2f32, Res); + Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::f32, Res, + DAG.getConstant(0, MVT::i32)); + } else { + Res = DAG.getNode(ISD::BITCAST, dl, MVT::f64, Res); + } + + return Res; + } // Bitcast operand 1 to i32. if (SrcVT == MVT::f64) @@ -2847,37 +2890,24 @@ &Tmp1, 1).getValue(1); Tmp1 = DAG.getNode(ISD::BITCAST, dl, MVT::i32, Tmp1); - // If float to int conversion isn't going to be super expensive, then simply - // or in the signbit. - if (F2IisFast) { - SDValue Mask1 = DAG.getConstant(0x80000000, MVT::i32); - SDValue Mask2 = DAG.getConstant(0x7fffffff, MVT::i32); - Tmp1 = DAG.getNode(ISD::AND, dl, MVT::i32, Tmp1, Mask1); - if (VT == MVT::f32) { - Tmp0 = DAG.getNode(ISD::AND, dl, MVT::i32, - DAG.getNode(ISD::BITCAST, dl, MVT::i32, Tmp0), Mask2); - return DAG.getNode(ISD::BITCAST, dl, MVT::f32, - DAG.getNode(ISD::OR, dl, MVT::i32, Tmp0, Tmp1)); - } - - // f64: Or the high part with signbit and then combine two parts. - Tmp0 = DAG.getNode(ARMISD::VMOVRRD, dl, DAG.getVTList(MVT::i32, MVT::i32), - &Tmp0, 1); - SDValue Lo = Tmp0.getValue(0); - SDValue Hi = DAG.getNode(ISD::AND, dl, MVT::i32, Tmp0.getValue(1), Mask2); - Hi = DAG.getNode(ISD::OR, dl, MVT::i32, Hi, Tmp1); - return DAG.getNode(ARMISD::VMOVDRR, dl, MVT::f64, Lo, Hi); - } - - // Remove the signbit of operand 0. - Tmp0 = DAG.getNode(ISD::FABS, dl, VT, Tmp0); - - // If operand 1 signbit is one, then negate operand 0. - SDValue ARMcc; - SDValue Cmp = getARMCmp(Tmp1, DAG.getConstant(0, MVT::i32), - ISD::SETLT, ARMcc, DAG, dl); - SDValue CCR = DAG.getRegister(ARM::CPSR, MVT::i32); - return DAG.getNode(ARMISD::CNEG, dl, VT, Tmp0, Tmp0, ARMcc, CCR, Cmp); + // Or in the signbit with integer operations. + SDValue Mask1 = DAG.getConstant(0x80000000, MVT::i32); + SDValue Mask2 = DAG.getConstant(0x7fffffff, MVT::i32); + Tmp1 = DAG.getNode(ISD::AND, dl, MVT::i32, Tmp1, Mask1); + if (VT == MVT::f32) { + Tmp0 = DAG.getNode(ISD::AND, dl, MVT::i32, + DAG.getNode(ISD::BITCAST, dl, MVT::i32, Tmp0), Mask2); + return DAG.getNode(ISD::BITCAST, dl, MVT::f32, + DAG.getNode(ISD::OR, dl, MVT::i32, Tmp0, Tmp1)); + } + + // f64: Or the high part with signbit and then combine two parts. + Tmp0 = DAG.getNode(ARMISD::VMOVRRD, dl, DAG.getVTList(MVT::i32, MVT::i32), + &Tmp0, 1); + SDValue Lo = Tmp0.getValue(0); + SDValue Hi = DAG.getNode(ISD::AND, dl, MVT::i32, Tmp0.getValue(1), Mask2); + Hi = DAG.getNode(ISD::OR, dl, MVT::i32, Hi, Tmp1); + return DAG.getNode(ARMISD::VMOVDRR, dl, MVT::f64, Lo, Hi); } SDValue ARMTargetLowering::LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const{ Modified: llvm/trunk/test/CodeGen/ARM/fcopysign.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fcopysign.ll?rev=126295&r1=126294&r2=126295&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/fcopysign.ll (original) +++ llvm/trunk/test/CodeGen/ARM/fcopysign.ll Tue Feb 22 20:24:55 2011 @@ -9,9 +9,8 @@ ; SOFT: bfi r0, r1, #31, #1 ; HARD: test1: -; HARD: vabs.f32 d0, d0 -; HARD: cmp r0, #0 -; HARD: vneglt.f32 s0, s0 +; HARD: vmov.i32 [[REG1:(d[0-9]+)]], #0x80000000 +; HARD: vbsl [[REG1]], d2, d0 %0 = tail call float @copysignf(float %x, float %y) nounwind ret float %0 } @@ -23,9 +22,9 @@ ; SOFT: bfi r1, r2, #31, #1 ; HARD: test2: -; HARD: vabs.f64 d0, d0 -; HARD: cmp r1, #0 -; HARD: vneglt.f64 d0, d0 +; HARD: vmov.i32 [[REG2:(d[0-9]+)]], #0x80000000 +; HARD: vshl.i64 [[REG2]], [[REG2]], #32 +; HARD: vbsl [[REG2]], d1, d0 %0 = tail call double @copysign(double %x, double %y) nounwind ret double %0 } @@ -33,9 +32,9 @@ define double @test3(double %x, double %y, double %z) nounwind { entry: ; SOFT: test3: -; SOFT: vabs.f64 -; SOFT: cmp {{.*}}, #0 -; SOFT: vneglt.f64 +; SOFT: vmov.i32 [[REG3:(d[0-9]+)]], #0x80000000 +; SOFT: vshl.i64 [[REG3]], [[REG3]], #32 +; SOFT: vbsl [[REG3]], %0 = fmul double %x, %y %1 = tail call double @copysign(double %0, double %z) nounwind ret double %1 From stuart at apple.com Tue Feb 22 20:27:05 2011 From: stuart at apple.com (Stuart Hastings) Date: Wed, 23 Feb 2011 02:27:05 -0000 Subject: [llvm-commits] [llvm] r126297 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/MC/MCAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/MC/MCAsmInfo.cpp lib/MC/MCAsmInfoDarwin.cpp Message-ID: <20110223022705.CF4F42A6C12C@llvm.org> Author: stuart Date: Tue Feb 22 20:27:05 2011 New Revision: 126297 URL: http://llvm.org/viewvc/llvm-project?rev=126297&view=rev Log: Omit private_extern declarations of extern symbols; followup to r124468. Patch by Rafael Avila de Espindola! Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/include/llvm/MC/MCAsmInfo.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/MC/MCAsmInfo.cpp llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=126297&r1=126296&r2=126297&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Feb 22 20:27:05 2011 @@ -445,7 +445,8 @@ /// EmitVisibility - This emits visibility information about symbol, if /// this is suported by the target. - void EmitVisibility(MCSymbol *Sym, unsigned Visibility) const; + void EmitVisibility(MCSymbol *Sym, unsigned Visibility, + bool IsDefinition = true) const; void EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const; Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=126297&r1=126296&r2=126297&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Tue Feb 22 20:27:05 2011 @@ -246,6 +246,11 @@ /// declare a symbol as having hidden visibility. MCSymbolAttr HiddenVisibilityAttr; // Defaults to MCSA_Hidden. + /// HiddenDeclarationVisibilityAttr - This attribute, if not MCSA_Invalid, + /// is used to declare an undefined symbol as having hidden visibility. + MCSymbolAttr HiddenDeclarationVisibilityAttr; // Defaults to MCSA_Hidden. + + /// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used /// to declare a symbol as having protected visibility. MCSymbolAttr ProtectedVisibilityAttr; // Defaults to MCSA_Protected @@ -425,6 +430,9 @@ const char *getLinkOnceDirective() const { return LinkOnceDirective; } MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;} + MCSymbolAttr getHiddenDeclarationVisibilityAttr() const { + return HiddenDeclarationVisibilityAttr; + } MCSymbolAttr getProtectedVisibilityAttr() const { return ProtectedVisibilityAttr; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=126297&r1=126296&r2=126297&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 22 20:27:05 2011 @@ -764,7 +764,7 @@ continue; MCSymbol *Name = Mang->getSymbol(&F); - EmitVisibility(Name, V); + EmitVisibility(Name, V, false); } // Finalize debug and EH information. @@ -1820,13 +1820,17 @@ } } -void AsmPrinter::EmitVisibility(MCSymbol *Sym, unsigned Visibility) const { +void AsmPrinter::EmitVisibility(MCSymbol *Sym, unsigned Visibility, + bool IsDefinition) const { MCSymbolAttr Attr = MCSA_Invalid; switch (Visibility) { default: break; case GlobalValue::HiddenVisibility: - Attr = MAI->getHiddenVisibilityAttr(); + if (IsDefinition) + Attr = MAI->getHiddenVisibilityAttr(); + else + Attr = MAI->getHiddenDeclarationVisibilityAttr(); break; case GlobalValue::ProtectedVisibility: Attr = MAI->getProtectedVisibilityAttr(); Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=126297&r1=126296&r2=126297&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmInfo.cpp (original) +++ llvm/trunk/lib/MC/MCAsmInfo.cpp Tue Feb 22 20:27:05 2011 @@ -65,6 +65,7 @@ WeakDefDirective = 0; LinkOnceDirective = 0; HiddenVisibilityAttr = MCSA_Hidden; + HiddenDeclarationVisibilityAttr = MCSA_Hidden; ProtectedVisibilityAttr = MCSA_Protected; HasLEB128 = false; SupportsDebugInformation = false; Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=126297&r1=126296&r2=126297&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original) +++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Tue Feb 22 20:27:05 2011 @@ -45,6 +45,7 @@ HasAggressiveSymbolFolding = false; HiddenVisibilityAttr = MCSA_PrivateExtern; + HiddenDeclarationVisibilityAttr = MCSA_Invalid; // Doesn't support protected visibility. ProtectedVisibilityAttr = MCSA_Global; From echristo at apple.com Tue Feb 22 20:33:49 2011 From: echristo at apple.com (Eric Christopher) Date: Tue, 22 Feb 2011 18:33:49 -0800 Subject: [llvm-commits] [llvm] r126297 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/MC/MCAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/MC/MCAsmInfo.cpp lib/MC/MCAsmInfoDarwin.cpp In-Reply-To: <20110223022705.CF4F42A6C12C@llvm.org> References: <20110223022705.CF4F42A6C12C@llvm.org> Message-ID: On Feb 22, 2011, at 6:27 PM, Stuart Hastings wrote: > Omit private_extern declarations of extern symbols; followup to > r124468. Patch by Rafael Avila de Espindola! > > Modified: > llvm/trunk/include/llvm/CodeGen/AsmPrinter.h > llvm/trunk/include/llvm/MC/MCAsmInfo.h > llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp > llvm/trunk/lib/MC/MCAsmInfo.cpp > llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Awesome! Thanks Rafael! -eric From evan.cheng at apple.com Tue Feb 22 20:35:33 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Feb 2011 02:35:33 -0000 Subject: [llvm-commits] [llvm] r126298 - in /llvm/trunk/lib/Target/ARM: ARMInstrFormats.td NEONMoveFix.cpp Message-ID: <20110223023533.9B2E22A6C12C@llvm.org> Author: evancheng Date: Tue Feb 22 20:35:33 2011 New Revision: 126298 URL: http://llvm.org/viewvc/llvm-project?rev=126298&view=rev Log: Change VFPNeonA8 definition to make the code easier to read. Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=126298&r1=126297&r2=126298&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Tue Feb 22 20:35:33 2011 @@ -134,7 +134,7 @@ def VFPDomain : Domain<1>; // Instructions in VFP domain only def NeonDomain : Domain<2>; // Instructions in Neon domain only def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains -def VFPNeonA8Domain : Domain<7>; // Instructions in VFP & Neon under A8 +def VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8 //===----------------------------------------------------------------------===// // ARM special operands. Modified: llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp?rev=126298&r1=126297&r2=126298&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp (original) +++ llvm/trunk/lib/Target/ARM/NEONMoveFix.cpp Tue Feb 22 20:35:33 2011 @@ -45,13 +45,8 @@ } static bool inNEONDomain(unsigned Domain, bool isA8) { - if (Domain & ARMII::DomainNEON) { - // Some instructions only go down NEON pipeline when executed on CortexA8. - if (Domain & ARMII::DomainNEONA8) - return isA8; - return true; - } - return false; + return (Domain & ARMII::DomainNEON) || + (isA8 && (Domain & ARMII::DomainNEONA8)); } bool NEONMoveFixPass::InsertMoves(MachineBasicBlock &MBB) { From scallanan at apple.com Tue Feb 22 21:29:41 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 23 Feb 2011 03:29:41 -0000 Subject: [llvm-commits] [llvm] r126301 - /llvm/trunk/tools/llvm-mc/Disassembler.cpp Message-ID: <20110223032941.407C32A6C12C@llvm.org> Author: spyffe Date: Tue Feb 22 21:29:41 2011 New Revision: 126301 URL: http://llvm.org/viewvc/llvm-project?rev=126301&view=rev Log: Fixed a bug in the enhanced disassembly tester that caused it to only parse one line of input. Modified: llvm/trunk/tools/llvm-mc/Disassembler.cpp Modified: llvm/trunk/tools/llvm-mc/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/Disassembler.cpp?rev=126301&r1=126300&r2=126301&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/Disassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/Disassembler.cpp Tue Feb 22 21:29:41 2011 @@ -235,108 +235,112 @@ return -1; } - EDInst *inst = - disassembler->createInst(byteArrayReader, 0, &ByteArray); - - if (inst == 0) { - errs() << "error: Didn't get an instruction\n"; - return -1; - } - - unsigned numTokens = inst->numTokens(); - if ((int)numTokens < 0) { - errs() << "error: couldn't count the instruction's tokens\n"; - return -1; - } - - for (unsigned tokenIndex = 0; tokenIndex != numTokens; ++tokenIndex) { - EDToken *token; - - if (inst->getToken(token, tokenIndex)) { - errs() << "error: Couldn't get token\n"; + while (ByteArray.size()) { + EDInst *inst = + disassembler->createInst(byteArrayReader, 0, &ByteArray); + + ByteArray.erase (ByteArray.begin(), ByteArray.begin() + inst->byteSize()); + + if (inst == 0) { + errs() << "error: Didn't get an instruction\n"; return -1; } - const char *buf; - if (token->getString(buf)) { - errs() << "error: Couldn't get string for token\n"; + unsigned numTokens = inst->numTokens(); + if ((int)numTokens < 0) { + errs() << "error: couldn't count the instruction's tokens\n"; return -1; } - Out << '['; - int operandIndex = token->operandID(); - - if (operandIndex >= 0) - Out << operandIndex << "-"; - - switch (token->type()) { - default: Out << "?"; break; - case EDToken::kTokenWhitespace: Out << "w"; break; - case EDToken::kTokenPunctuation: Out << "p"; break; - case EDToken::kTokenOpcode: Out << "o"; break; - case EDToken::kTokenLiteral: Out << "l"; break; - case EDToken::kTokenRegister: Out << "r"; break; - } - - Out << ":" << buf; - - if (token->type() == EDToken::kTokenLiteral) { - Out << "="; - if (token->literalSign()) - Out << "-"; - uint64_t absoluteValue; - if (token->literalAbsoluteValue(absoluteValue)) { - errs() << "error: Couldn't get the value of a literal token\n"; + for (unsigned tokenIndex = 0; tokenIndex != numTokens; ++tokenIndex) { + EDToken *token; + + if (inst->getToken(token, tokenIndex)) { + errs() << "error: Couldn't get token\n"; return -1; } - Out << absoluteValue; - } else if (token->type() == EDToken::kTokenRegister) { - Out << "="; - unsigned regID; - if (token->registerID(regID)) { - errs() << "error: Couldn't get the ID of a register token\n"; + + const char *buf; + if (token->getString(buf)) { + errs() << "error: Couldn't get string for token\n"; return -1; } - Out << "r" << regID; + + Out << '['; + int operandIndex = token->operandID(); + + if (operandIndex >= 0) + Out << operandIndex << "-"; + + switch (token->type()) { + default: Out << "?"; break; + case EDToken::kTokenWhitespace: Out << "w"; break; + case EDToken::kTokenPunctuation: Out << "p"; break; + case EDToken::kTokenOpcode: Out << "o"; break; + case EDToken::kTokenLiteral: Out << "l"; break; + case EDToken::kTokenRegister: Out << "r"; break; + } + + Out << ":" << buf; + + if (token->type() == EDToken::kTokenLiteral) { + Out << "="; + if (token->literalSign()) + Out << "-"; + uint64_t absoluteValue; + if (token->literalAbsoluteValue(absoluteValue)) { + errs() << "error: Couldn't get the value of a literal token\n"; + return -1; + } + Out << absoluteValue; + } else if (token->type() == EDToken::kTokenRegister) { + Out << "="; + unsigned regID; + if (token->registerID(regID)) { + errs() << "error: Couldn't get the ID of a register token\n"; + return -1; + } + Out << "r" << regID; + } + + Out << "]"; } - Out << "]"; - } - - Out << " "; + Out << " "; + + if (inst->isBranch()) + Out << "
"; + if (inst->isMove()) + Out << " "; - if (inst->isBranch()) - Out << "
"; - if (inst->isMove()) - Out << " "; - - unsigned numOperands = inst->numOperands(); - - if ((int)numOperands < 0) { - errs() << "error: Couldn't count operands\n"; - return -1; - } - - for (unsigned operandIndex = 0; operandIndex != numOperands; ++operandIndex) { - Out << operandIndex << ":"; + unsigned numOperands = inst->numOperands(); - EDOperand *operand; - if (inst->getOperand(operand, operandIndex)) { - errs() << "error: couldn't get operand\n"; + if ((int)numOperands < 0) { + errs() << "error: Couldn't count operands\n"; return -1; } - uint64_t evaluatedResult; - void *Arg[] = { disassembler, &Out }; - if (operand->evaluate(evaluatedResult, verboseEvaluator, Arg)) { - errs() << "error: Couldn't evaluate an operand\n"; - return -1; + for (unsigned operandIndex = 0; operandIndex != numOperands; ++operandIndex) { + Out << operandIndex << ":"; + + EDOperand *operand; + if (inst->getOperand(operand, operandIndex)) { + errs() << "error: couldn't get operand\n"; + return -1; + } + + uint64_t evaluatedResult; + void *Arg[] = { disassembler, &Out }; + if (operand->evaluate(evaluatedResult, verboseEvaluator, Arg)) { + errs() << "error: Couldn't evaluate an operand\n"; + return -1; + } + Out << "=" << evaluatedResult << " "; } - Out << "=" << evaluatedResult << " "; + + Out << '\n'; } - Out << '\n'; - return 0; } From scallanan at apple.com Tue Feb 22 21:31:28 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 23 Feb 2011 03:31:28 -0000 Subject: [llvm-commits] [llvm] r126302 - in /llvm/trunk: lib/MC/MCDisassembler/EDOperand.cpp test/MC/Disassembler/X86/enhanced.txt Message-ID: <20110223033129.05AB32A6C12C@llvm.org> Author: spyffe Date: Tue Feb 22 21:31:28 2011 New Revision: 126302 URL: http://llvm.org/viewvc/llvm-project?rev=126302&view=rev Log: Fixed a bug in the enhanced disassembler that caused it to ignore valid uses of FS and GS as additional base registers in address computations. Added a test case for this. Modified: llvm/trunk/lib/MC/MCDisassembler/EDOperand.cpp llvm/trunk/test/MC/Disassembler/X86/enhanced.txt Modified: llvm/trunk/lib/MC/MCDisassembler/EDOperand.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/EDOperand.cpp?rev=126302&r1=126301&r2=126302&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCDisassembler/EDOperand.cpp (original) +++ llvm/trunk/lib/MC/MCDisassembler/EDOperand.cpp Tue Feb 22 21:31:28 2011 @@ -152,10 +152,23 @@ uint64_t scaleAmount = Inst.Inst->getOperand(MCOpIndex+1).getImm(); unsigned indexReg = Inst.Inst->getOperand(MCOpIndex+2).getReg(); int64_t displacement = Inst.Inst->getOperand(MCOpIndex+3).getImm(); - //unsigned segmentReg = Inst.Inst->getOperand(MCOpIndex+4).getReg(); - + uint64_t addr = 0; + unsigned segmentReg = Inst.Inst->getOperand(MCOpIndex+4).getReg(); + + if (segmentReg != 0 && Disassembler.Key.Arch == Triple::x86_64) { + unsigned fsID = Disassembler.registerIDWithName("FS"); + unsigned gsID = Disassembler.registerIDWithName("GS"); + + if (segmentReg == fsID || + segmentReg == gsID) { + uint64_t segmentBase; + if (!callback(&segmentBase, segmentReg, arg)) + addr += segmentBase; + } + } + if (baseReg) { uint64_t baseVal; if (callback(&baseVal, baseReg, arg)) @@ -175,7 +188,7 @@ result = addr; return 0; } - } + } // switch (operandType) break; case Triple::arm: case Triple::thumb: @@ -203,6 +216,7 @@ return 0; } } + break; } return -1; Modified: llvm/trunk/test/MC/Disassembler/X86/enhanced.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/X86/enhanced.txt?rev=126302&r1=126301&r2=126302&view=diff ============================================================================== --- llvm/trunk/test/MC/Disassembler/X86/enhanced.txt (original) +++ llvm/trunk/test/MC/Disassembler/X86/enhanced.txt Tue Feb 22 21:31:28 2011 @@ -2,3 +2,5 @@ # CHECK: [o:jne][w: ][0-p:-][0-l:10=10]
0:[RIP/111](pc)=18446744073709551606 0x0f 0x85 0xf6 0xff 0xff 0xff +# CHECK: [o:movq][w: ][1-r:%gs=r63][1-p::][1-l:8=8][p:,][w: ][0-r:%rcx=r108] 0:[RCX/108]=0 1:[GS/63]=8 +0x65 0x48 0x8b 0x0c 0x25 0x08 0x00 0x00 0x00 From ajclinto at gmail.com Tue Feb 22 23:25:53 2011 From: ajclinto at gmail.com (Andrew Clinton) Date: Wed, 23 Feb 2011 00:25:53 -0500 Subject: [llvm-commits] Patch to fix windows compile warning in AlignOf.h Message-ID: This patch fixes a Visual Studio compiler warning due to the private constructor. It just adds a private destructor. Andrew -------------- next part -------------- A non-text attachment was scrubbed... Name: alignof.diff Type: text/x-patch Size: 459 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110223/21c2eeee/attachment.bin From jaykang10 at imrc.kist.re.kr Tue Feb 22 23:34:32 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Wed, 23 Feb 2011 14:34:32 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr> Hi Chris I tested the following code using llvm-gcc-4.2. struct test{ char c:3; char d:4; char e:5; int a; double b; }; struct kist { char a; int b; struct test temp; short c; int d; }; struct kist kang = {1, 2, {1, 2, 3, 5, 6}, 3, 4}; int main(void) { kang.temp.e = 1; return 0; } The converted result is as in the following: %0 = type { i8, i32, %1, i16, i32 } %1 = type { i8, i8, i32, double } %struct.kist = type { i8, i32, %struct.test, i16, i32 } %struct.test = type { i32, i32, double } @kang = unnamed_addr global %0 { i8 1, i32 2, %1 { i8 17, i8 3, i32 5, double 6.000000e+00 }, i16 3, i32 4 } define i32 @main() nounwind { entry: %retval = alloca i32 %0 = alloca i32 %"alloca point" = bitcast i32 0 to i32 %1 = load i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*), align 8 %2 = and i32 %1, -7937 %3 = or i32 %2, 256 store i32 %3, i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*), align 8 store i32 0, i32* %0, align 4 %4 = load i32* %0, align 4 store i32 %4, i32* %retval, align 4 br label %return return: ; preds = %entry %retval1 = load i32* %retval ret i32 %retval1 } I thought some of issues about converted code. First, I thought index of getelementptr is confused. %1 = load i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*) On above statement, there is not bitcast which decribes kang's sub struct type(%1) is mapped to struct.test. The reason why bitcast disappears that SymbolicallyEvaluateGEP() function under CreateStructGEP() function changes bitcast ConstantExpr to bitcast ConstantExpr's operand(0) using stripPointerCasts() and makes new GEP using the operand(0). I would like to know what do you think about keeping bitcast ConstantExpr about above code? Second, I thought redundant information is generated while processing CreateStructGEP(). Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, unsigned NumIdx) const { return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); } As I said on previous e-mail, I thought if fold() function's argument is different with fold() function's return value, fold() function's argument which was newly created is redundant. This redundant ConstantExpr increases Use count of its operand and Increased Use Count may have effect on functions which use Use inforamation like replaceAllUsesWith(). so I would like to remove this redundant ConstantExprs. :) These were my thoughts. :) Thanks, Jin-Gu Kang ________________________________________ From: Chris Lattner [clattner at apple.com] Sent: Wednesday, February 23, 2011 6:02 AM To: Jin Gu Kang Cc: Duncan Sands; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr On Feb 22, 2011, at 5:47 AM, Jin Gu Kang wrote: > replaceAllUsesWith() is an example. :) > > I don't know all of passes which use inforamtion of Use. > so I would like to know whether this issue is trivial or not. > > I think view of you and other llvm-commiters are right. Hi Jin, Instead of focusing on the patch, lets look at it another way: what problem are you experiencing and trying to solve? -Chris From nicholas at mxc.ca Tue Feb 22 23:48:12 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Feb 2011 21:48:12 -0800 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF3@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF3@base.imrc.kist.re.kr> Message-ID: <4D649F9C.1000305@mxc.ca> Jin Gu Kang wrote: > OK. I see. > > I found wrong use count of value caused by useless ConstantExpr, > so reported this issue. :) You can call C->removeDeadConstantUsers() to get rid of those. It won't delete the constants, it just removes them from C's use list. Nick > > Thanks your comment. > Jin-Gu Kang > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 6:22 PM > To: Jin Gu Kang > Cc: llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> OK. I unstand :) >> >> I send modified patch > > I think this is pointless. Unused constants can be created in many places, so > concentrating on one makes no sense. If you want to get rid of them it would > be better to add a pass that looks at all constants and zaps those that are > unused. For all I know maybe some pass does this already. > > Ciao, Duncan. > >> >> Index: include/llvm/Support/TargetFolder.h >> =================================================================== >> --- include/llvm/Support/TargetFolder.h (revision 126080) >> +++ include/llvm/Support/TargetFolder.h (working copy) >> @@ -34,8 +34,12 @@ >> /// Fold - Fold the constant using target specific information. >> Constant *Fold(Constant *C) const { >> if (ConstantExpr *CE = dyn_cast(C)) >> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >> + if (CF != CE) >> + if (CE->use_empty()) >> + CE->destroyConstant(); >> return CF; >> + } >> return C; >> } >> >> >> ________________________________________ >> From: Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:57 PM >> To: Jin Gu Kang >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >>> Argument of Fold() is as follows: >>> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >>> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >>> unsigned NumIdx) const { >>> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >>> } >>> >>> Newly made ConstantExpr is argument of Fold() function. >> >> It may not really be new, that's the point. >> >> Ciao, Duncan. >> >>> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >>> so if Fold() function make new folded ConstantExpr, I think >>> previous created ConstantExpr is redundant. >>> >>> ________________________________________ >>> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >>> Sent: Tuesday, February 22, 2011 5:35 PM >>> To: llvm-commits at cs.uiuc.edu >>> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >>> >>> Hi Jin Gu Kang, >>> >>>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>>> +++ include/llvm/Support/TargetFolder.h (working copy) >>>> @@ -34,8 +34,11 @@ >>>> /// Fold - Fold the constant using target specific information. >>>> Constant *Fold(Constant *C) const { >>>> if (ConstantExpr *CE = dyn_cast(C)) >>>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>>> + if (CF != CE) >>>> + CE->destroyConstant(); >>> >>> this is wrong. Constants are global and uniqued: if someone creates a constant, >>> eg: 27, any later attempt to create an identical constant (27) returns the same >>> constant as was created earlier, not a new one. This means that you can check >>> if constants are identical by comparing their pointer values. It also means >>> that you can't free a constant like your patch does without first proving that >>> it is not being used anywhere. >>> >>> Ciao, Duncan. >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From jaykang10 at imrc.kist.re.kr Tue Feb 22 23:52:22 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Wed, 23 Feb 2011 14:52:22 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D649F9C.1000305@mxc.ca> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr>, <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr>, <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr>, <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF3@base.imrc.kist.re.kr>, <4D649F9C.1000305@mxc.ca> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFB@base.imrc.kist.re.kr> Thank you for your adivce. :) Jin-Gu Kang ________________________________________ From: Nick Lewycky [nicholas at mxc.ca] Sent: Wednesday, February 23, 2011 2:48 PM To: Jin Gu Kang Cc: Duncan Sands; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Jin Gu Kang wrote: > OK. I see. > > I found wrong use count of value caused by useless ConstantExpr, > so reported this issue. :) You can call C->removeDeadConstantUsers() to get rid of those. It won't delete the constants, it just removes them from C's use list. Nick > > Thanks your comment. > Jin-Gu Kang > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Tuesday, February 22, 2011 6:22 PM > To: Jin Gu Kang > Cc: llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> OK. I unstand :) >> >> I send modified patch > > I think this is pointless. Unused constants can be created in many places, so > concentrating on one makes no sense. If you want to get rid of them it would > be better to add a pass that looks at all constants and zaps those that are > unused. For all I know maybe some pass does this already. > > Ciao, Duncan. > >> >> Index: include/llvm/Support/TargetFolder.h >> =================================================================== >> --- include/llvm/Support/TargetFolder.h (revision 126080) >> +++ include/llvm/Support/TargetFolder.h (working copy) >> @@ -34,8 +34,12 @@ >> /// Fold - Fold the constant using target specific information. >> Constant *Fold(Constant *C) const { >> if (ConstantExpr *CE = dyn_cast(C)) >> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >> + if (CF != CE) >> + if (CE->use_empty()) >> + CE->destroyConstant(); >> return CF; >> + } >> return C; >> } >> >> >> ________________________________________ >> From: Duncan Sands [baldrick at free.fr] >> Sent: Tuesday, February 22, 2011 5:57 PM >> To: Jin Gu Kang >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >>> Argument of Fold() is as follows: >>> file: include/llvm/Support/TargetFolder.h on llvm-2.8 >>> Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, >>> unsigned NumIdx) const { >>> return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); >>> } >>> >>> Newly made ConstantExpr is argument of Fold() function. >> >> It may not really be new, that's the point. >> >> Ciao, Duncan. >> >>> --> ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx) >>> so if Fold() function make new folded ConstantExpr, I think >>> previous created ConstantExpr is redundant. >>> >>> ________________________________________ >>> From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands [baldrick at free.fr] >>> Sent: Tuesday, February 22, 2011 5:35 PM >>> To: llvm-commits at cs.uiuc.edu >>> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >>> >>> Hi Jin Gu Kang, >>> >>>> --- include/llvm/Support/TargetFolder.h (revision 126080) >>>> +++ include/llvm/Support/TargetFolder.h (working copy) >>>> @@ -34,8 +34,11 @@ >>>> /// Fold - Fold the constant using target specific information. >>>> Constant *Fold(Constant *C) const { >>>> if (ConstantExpr *CE = dyn_cast(C)) >>>> - if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) >>>> + if (Constant *CF = ConstantFoldConstantExpression(CE, TD)) { >>>> + if (CF != CE) >>>> + CE->destroyConstant(); >>> >>> this is wrong. Constants are global and uniqued: if someone creates a constant, >>> eg: 27, any later attempt to create an identical constant (27) returns the same >>> constant as was created earlier, not a new one. This means that you can check >>> if constants are identical by comparing their pointer values. It also means >>> that you can't free a constant like your patch does without first proving that >>> it is not being used anywhere. >>> >>> Ciao, Duncan. >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From baldrick at free.fr Wed Feb 23 01:59:16 2011 From: baldrick at free.fr (Duncan Sands) Date: Wed, 23 Feb 2011 08:59:16 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr> Message-ID: <4D64BE54.8090603@free.fr> Hi Jin Gu Kang, > %struct.kist = type { i8, i32, %struct.test, i16, i32 } > %struct.test = type { i32, i32, double } ... > %1 = load i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*), align 8 the getelementptr access the first field (i32) of %struct.test. You can read it as follows: ignore the first index (i32 0); the second index (i32 2) indexes the third field in %struct.kist, i.e. the %struct.test field; the third index (i32 0) indexes the first field in %struct.test, which is an i32 (it contains the three C fields c, d and e). > First, I thought index of getelementptr is confused. See above explanation. > %1 = load i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*) > On above statement, there is not bitcast which decribes kang's sub struct type(%1) is mapped to struct.test. That's because it is not getting a pointer to temp, it is getting a pointer to the first field of temp, see above. It may be that the front-end originally got a pointer to temp and bitcast it to a pointer to the first field of the struct, and the constant folder turned this into a GEP that goes one deeper. > The reason why bitcast disappears that SymbolicallyEvaluateGEP() function under CreateStructGEP() > function changes bitcast ConstantExpr to bitcast ConstantExpr's operand(0) using stripPointerCasts() > and makes new GEP using the operand(0). > > I would like to know what do you think about keeping bitcast ConstantExpr about above code? What for? Also, if you want less constant folding, use ConstantFolder rather than TargetFolder. > Second, I thought redundant information is generated while processing CreateStructGEP(). > Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, > unsigned NumIdx) const { > return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); > } > As I said on previous e-mail, I thought if fold() function's argument is different with fold() function's return value, > fold() function's argument which was newly created is redundant. This redundant ConstantExpr > increases Use count of its operand and Increased Use Count may have effect on functions which use Use inforamation > like replaceAllUsesWith(). so I would like to remove this redundant ConstantExprs. :) I'm sure more time has been spent discussing this point with you than would ever be saved during the history of the universe by doing this optimization. I don't intend to reply any more on this point. Ciao, Duncan. From jaykang10 at imrc.kist.re.kr Wed Feb 23 02:42:38 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Wed, 23 Feb 2011 17:42:38 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D64BE54.8090603@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr> Hi Duncan > First, I thought index of getelementptr is confused. > %1 = load i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*) > On above statement, there is not bitcast which decribes kang's sub struct type(%1) is mapped to struct.test. On above statement, I meant it may be hard to understand that bitcast from i8* to i32* is conversion from first field of %1(kang's sub struct type) to first field struct test. > int main(void) { > kang.temp.e = 1; > return 0; >} while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. Thanks, Jin-Gu Kang ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Wednesday, February 23, 2011 4:59 PM To: Jin Gu Kang Cc: Chris Lattner; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Hi Jin Gu Kang, > %struct.kist = type { i8, i32, %struct.test, i16, i32 } > %struct.test = type { i32, i32, double } ... > %1 = load i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*), align 8 the getelementptr access the first field (i32) of %struct.test. You can read it as follows: ignore the first index (i32 0); the second index (i32 2) indexes the third field in %struct.kist, i.e. the %struct.test field; the third index (i32 0) indexes the first field in %struct.test, which is an i32 (it contains the three C fields c, d and e). > First, I thought index of getelementptr is confused. See above explanation. > %1 = load i32* bitcast (i8* getelementptr inbounds (%0* @kang, i32 0, i32 2, i32 0) to i32*) > On above statement, there is not bitcast which decribes kang's sub struct type(%1) is mapped to struct.test. That's because it is not getting a pointer to temp, it is getting a pointer to the first field of temp, see above. It may be that the front-end originally got a pointer to temp and bitcast it to a pointer to the first field of the struct, and the constant folder turned this into a GEP that goes one deeper. > The reason why bitcast disappears that SymbolicallyEvaluateGEP() function under CreateStructGEP() > function changes bitcast ConstantExpr to bitcast ConstantExpr's operand(0) using stripPointerCasts() > and makes new GEP using the operand(0). > > I would like to know what do you think about keeping bitcast ConstantExpr about above code? What for? Also, if you want less constant folding, use ConstantFolder rather than TargetFolder. > Second, I thought redundant information is generated while processing CreateStructGEP(). > Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, > unsigned NumIdx) const { > return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); > } > As I said on previous e-mail, I thought if fold() function's argument is different with fold() function's return value, > fold() function's argument which was newly created is redundant. This redundant ConstantExpr > increases Use count of its operand and Increased Use Count may have effect on functions which use Use inforamation > like replaceAllUsesWith(). so I would like to remove this redundant ConstantExprs. :) I'm sure more time has been spent discussing this point with you than would ever be saved during the history of the universe by doing this optimization. I don't intend to reply any more on this point. Ciao, Duncan. From baldrick at free.fr Wed Feb 23 02:57:41 2011 From: baldrick at free.fr (Duncan Sands) Date: Wed, 23 Feb 2011 09:57:41 +0100 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr> Message-ID: <4D64CC05.2050802@free.fr> Hi Jin Gu Kang, > while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, > StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different > from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). > Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. > > so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. it is true that disabling all constant folding may be helpful for beginners who want to read the bitcode and understand how it relates to the original C. This is not so easy to achieve however because a minimal amount of constant folding always occurs. For example you can change llvm-gcc from using TargetFolder to ConstantFolder. This will result in less constant folding because it will no longer use information about the target when constant folding. However the fold you mentioned (bitcast turned into deeper GEP) will occur anyway because doing it does not require knowing the target. There is also a NoFolder class which does no folding whatsoever, by creating instructions rather than constants, but I hear that it doesn't work anymore (it used to, but perhaps bitrotted because no one uses it). If you want to disable all constant folding in llvm-gcc then I suggest you change all instances of TargetFolder to NoFolder in llvm-internal.h and llvm-backend.cpp. This line TheFolder = new TargetFolder(TheTarget->getTargetData()); probably needs to become something like this: TheFolder = new NoFolder(getGlobalContext()); However as I mentioned it probably will require some work on IRBuilder and NoFolder to get it working properly. If you succeed please send in a patch. Ciao, Duncan. From ofv at wanadoo.es Wed Feb 23 05:28:40 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Wed, 23 Feb 2011 11:28:40 -0000 Subject: [llvm-commits] [llvm] r126309 - /llvm/trunk/cmake/modules/LLVM.cmake Message-ID: <20110223112840.306912A6C12C@llvm.org> Author: ofv Date: Wed Feb 23 05:28:40 2011 New Revision: 126309 URL: http://llvm.org/viewvc/llvm-project?rev=126309&view=rev Log: Export TARGET_TRIPLE on LLVM.cmake. It is necessary for running tests on Clang when it builds using LLVM as an external library. Fixes PR9293. Modified: llvm/trunk/cmake/modules/LLVM.cmake Modified: llvm/trunk/cmake/modules/LLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVM.cmake?rev=126309&r1=126308&r2=126309&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVM.cmake (original) +++ llvm/trunk/cmake/modules/LLVM.cmake Wed Feb 23 05:28:40 2011 @@ -10,6 +10,8 @@ set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@) +set(TARGET_TRIPLE "@TARGET_TRIPLE@") + set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@) set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@) From fvbommel at gmail.com Wed Feb 23 07:43:06 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Wed, 23 Feb 2011 13:43:06 -0000 Subject: [llvm-commits] [llvm] r126311 - /llvm/trunk/include/llvm/ADT/ArrayRef.h Message-ID: <20110223134306.7E0F62A6C12C@llvm.org> Author: fvbommel Date: Wed Feb 23 07:43:06 2011 New Revision: 126311 URL: http://llvm.org/viewvc/llvm-project?rev=126311&view=rev Log: Implement TODO for implicit C-array-to-ArrayRef conversion. Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=126311&r1=126310&r2=126311&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ArrayRef.h (original) +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Wed Feb 23 07:43:06 2011 @@ -64,7 +64,10 @@ /*implicit*/ ArrayRef(const std::vector &Vec) : Data(Vec.empty() ? (T*)0 : &Vec[0]), Length(Vec.size()) {} - // TODO: C arrays. + /// Construct an ArrayRef from a C array. + template + /*implicit*/ ArrayRef(const T (&Arr)[N]) + : Data(Arr), Length(N) {} /// @} /// @name Simple Operations From richard at xmos.com Wed Feb 23 08:45:03 2011 From: richard at xmos.com (Richard Osborne) Date: Wed, 23 Feb 2011 14:45:03 -0000 Subject: [llvm-commits] [llvm] r126313 - in /llvm/trunk: include/llvm/IntrinsicsXCore.td lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/resources.ll Message-ID: <20110223144503.797FF2A6C12D@llvm.org> Author: friedgold Date: Wed Feb 23 08:45:03 2011 New Revision: 126313 URL: http://llvm.org/viewvc/llvm-project?rev=126313&view=rev Log: Add XCore intrinsic for settw instruction. Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td llvm/trunk/test/CodeGen/XCore/resources.ll Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsXCore.td?rev=126313&r1=126312&r2=126313&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsXCore.td (original) +++ llvm/trunk/include/llvm/IntrinsicsXCore.td Wed Feb 23 08:45:03 2011 @@ -43,4 +43,6 @@ [NoCapture<0>]>; def int_xcore_syncr : Intrinsic<[],[llvm_anyptr_ty], [NoCapture<0>]>; + def int_xcore_settw : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; } Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=126313&r1=126312&r2=126313&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 23 08:45:03 2011 @@ -817,7 +817,7 @@ [(int_xcore_setd GRRegs:$r, GRRegs:$val)]>; // Two operand long -// TODO settw, setclk, setrdy, setpsc, endin, peek, +// TODO setclk, setrdy, setpsc, endin, peek, // getd, testlcl, tinitlr, getps, setps def BITREV_l2r : _FL2R<(outs GRRegs:$dst), (ins GRRegs:$src), "bitrev $dst, $src", @@ -835,6 +835,10 @@ "setc res[$r], $val", [(int_xcore_setc GRRegs:$r, GRRegs:$val)]>; +def SETTW_l2r : _FL2R<(outs), (ins GRRegs:$r, GRRegs:$val), + "settw res[$r], $val", + [(int_xcore_settw GRRegs:$r, GRRegs:$val)]>; + // One operand short // TODO edu, eeu, waitet, waitef, tstart, msync, mjoin, clrtp // setdp, setcp, setv, setev, kcall Modified: llvm/trunk/test/CodeGen/XCore/resources.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/resources.ll?rev=126313&r1=126312&r2=126313&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/resources.ll (original) +++ llvm/trunk/test/CodeGen/XCore/resources.ll Wed Feb 23 08:45:03 2011 @@ -16,6 +16,7 @@ declare void @llvm.xcore.setpt.p1i8(i8 addrspace(1)* %r, i32 %value) declare i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r) declare void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r) +declare void @llvm.xcore.settw.p1i8(i8 addrspace(1)* %r, i32 %value) define i8 addrspace(1)* @getr() { ; CHECK: getr: @@ -149,3 +150,10 @@ call void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r) ret void } + +define void @settw(i8 addrspace(1)* %r, i32 %value) { +; CHECK: settw: +; CHECK: settw res[r0], r1 + call void @llvm.xcore.settw.p1i8(i8 addrspace(1)* %r, i32 %value) + ret void +} From richard at xmos.com Wed Feb 23 09:20:16 2011 From: richard at xmos.com (Richard Osborne) Date: Wed, 23 Feb 2011 15:20:16 -0000 Subject: [llvm-commits] [llvm] r126314 - /llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Message-ID: <20110223152016.8C7772A6C12C@llvm.org> Author: friedgold Date: Wed Feb 23 09:20:16 2011 New Revision: 126314 URL: http://llvm.org/viewvc/llvm-project?rev=126314&view=rev Log: Fix format for setc instruction. Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=126314&r1=126313&r2=126314&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 23 09:20:16 2011 @@ -831,7 +831,7 @@ "clz $dst, $src", [(set GRRegs:$dst, (ctlz GRRegs:$src))]>; -def SETC_l2r : _FRU6<(outs), (ins GRRegs:$r, GRRegs:$val), +def SETC_l2r : _FL2R<(outs), (ins GRRegs:$r, GRRegs:$val), "setc res[$r], $val", [(int_xcore_setc GRRegs:$r, GRRegs:$val)]>; From richard at xmos.com Wed Feb 23 10:46:37 2011 From: richard at xmos.com (Richard Osborne) Date: Wed, 23 Feb 2011 16:46:37 -0000 Subject: [llvm-commits] [llvm] r126315 - in /llvm/trunk: include/llvm/IntrinsicsXCore.td lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/resources.ll Message-ID: <20110223164637.A29282A6C12C@llvm.org> Author: friedgold Date: Wed Feb 23 10:46:37 2011 New Revision: 126315 URL: http://llvm.org/viewvc/llvm-project?rev=126315&view=rev Log: Add XCore intrinsic for the setv instruction. Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td llvm/trunk/test/CodeGen/XCore/resources.ll Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsXCore.td?rev=126315&r1=126314&r2=126315&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsXCore.td (original) +++ llvm/trunk/include/llvm/IntrinsicsXCore.td Wed Feb 23 10:46:37 2011 @@ -45,4 +45,6 @@ [NoCapture<0>]>; def int_xcore_settw : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], [NoCapture<0>]>; + def int_xcore_setv : Intrinsic<[],[llvm_anyptr_ty, llvm_ptr_ty], + [NoCapture<0>]>; } Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=126315&r1=126314&r2=126315&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 23 10:46:37 2011 @@ -841,7 +841,7 @@ // One operand short // TODO edu, eeu, waitet, waitef, tstart, msync, mjoin, clrtp -// setdp, setcp, setv, setev, kcall +// setdp, setcp, setev, kcall // dgetreg let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1 in def BAU_1r : _F1R<(outs), (ins GRRegs:$addr), @@ -889,6 +889,11 @@ "freer res[$r]", [(int_xcore_freer GRRegs:$r)]>; +let Uses=[R11] in +def SETV_1r : _F1R<(outs), (ins GRRegs:$r), + "setv res[$r], r11", + [(int_xcore_setv GRRegs:$r, R11)]>; + // Zero operand short // TODO waiteu, clre, ssync, freet, ldspc, stspc, ldssr, stssr, ldsed, stsed, // stet, geted, getet, getkep, getksp, setkep, getid, kret, dcall, dret, Modified: llvm/trunk/test/CodeGen/XCore/resources.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/resources.ll?rev=126315&r1=126314&r2=126315&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/resources.ll (original) +++ llvm/trunk/test/CodeGen/XCore/resources.ll Wed Feb 23 10:46:37 2011 @@ -17,6 +17,7 @@ declare i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r) declare void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r) declare void @llvm.xcore.settw.p1i8(i8 addrspace(1)* %r, i32 %value) +declare void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p) define i8 addrspace(1)* @getr() { ; CHECK: getr: @@ -157,3 +158,11 @@ call void @llvm.xcore.settw.p1i8(i8 addrspace(1)* %r, i32 %value) ret void } + +define void @setv(i8 addrspace(1)* %r, i8* %p) { +; CHECK: setv: +; CHECK: mov r11, r1 +; CHECK-NEXT: setv res[r0], r11 + call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p) + ret void +} From Brice.Lin at gmail.com Wed Feb 23 11:51:37 2011 From: Brice.Lin at gmail.com (Brice Lin) Date: Wed, 23 Feb 2011 17:51:37 -0000 Subject: [llvm-commits] [poolalloc] r126318 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <20110223175137.94FD72A6C12C@llvm.org> Author: bglin2 Date: Wed Feb 23 11:51:37 2011 New Revision: 126318 URL: http://llvm.org/viewvc/llvm-project?rev=126318&view=rev Log: Added debug support for pool_strlen(). Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=126318&r1=126317&r2=126318&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Wed Feb 23 11:51:37 2011 @@ -870,6 +870,8 @@ (CF->getName() == "sc.pool_unregister") || (CF->getName() == "sc.get_actual_val")) { visitRuntimeCheck (CS); + } else if (CF->getName() == "pool_strlen") { + visitCStdLibCheck(CS, 1); } else if (CF->getName() == "pool_strcpy") { visitCStdLibCheck(CS, 2); } else if (CF->getName() == "pthread_create") { From grosbach at apple.com Wed Feb 23 12:10:54 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 10:10:54 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <7D36755B-29D2-470C-BA6B-7769705259A0@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> <4D5C5CD0.1080703@gmail.com> <20110217000829.GC23813@britannica.bec.de> <7D36755B-29D2-470C-BA6B-7769705259A0@apple.com> Message-ID: Ping. Any progress on fixing this? It needs to be either fixed or reverted. On Feb 21, 2011, at 4:43 PM, Jim Grosbach wrote: > > On Feb 16, 2011, at 4:08 PM, Joerg Sonnenberger wrote: >> >>> Joerg, how common are assembly files with [] in them? If common, can you >>> code a patch making [] conditional on x86(-64) ELF? >> >> Why not just make the function virtual and let platforms that can't >> accept the default behavior overwrite it? I actually think that quite a >> few platforms GNU as support don't distinguish between [] and () as the >> patch implements. > > That's mandating opt-out from all targets that don't want the behavior, which is the opposite of how this sort of thing should be. The default behaviour should be those bits that all targets want. If there's additional stuff necessary for a target, that logic should be specific for the targets that want it. > > -Jim > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From stoklund at 2pi.dk Wed Feb 23 12:26:31 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Feb 2011 18:26:31 -0000 Subject: [llvm-commits] [llvm] r126319 - /llvm/trunk/lib/CodeGen/SplitKit.cpp Message-ID: <20110223182631.A23462A6C12C@llvm.org> Author: stoklund Date: Wed Feb 23 12:26:31 2011 New Revision: 126319 URL: http://llvm.org/viewvc/llvm-project?rev=126319&view=rev Log: It is safe to ignore LastSplitPoint when the variable is not live out. No code will be inserted after the split point anyway. Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=126319&r1=126318&r2=126319&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Wed Feb 23 12:26:31 2011 @@ -961,10 +961,10 @@ openIntv(); SlotIndex SegStart = enterIntvBefore(BI.FirstUse); - if (BI.LastUse < BI.LastSplitPoint) { + if (!BI.LiveOut || BI.LastUse < BI.LastSplitPoint) { useIntv(SegStart, leaveIntvAfter(BI.LastUse)); } else { - // THe last use os after tha last valid split point. + // The last use is after the last valid split point. SlotIndex SegStop = leaveIntvBefore(BI.LastSplitPoint); useIntv(SegStart, SegStop); overlapIntv(SegStop, BI.LastUse); From richard at xmos.com Wed Feb 23 12:35:59 2011 From: richard at xmos.com (Richard Osborne) Date: Wed, 23 Feb 2011 18:35:59 -0000 Subject: [llvm-commits] [llvm] r126320 - in /llvm/trunk: include/llvm/IntrinsicsXCore.td lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/events.ll Message-ID: <20110223183559.36AF22A6C12C@llvm.org> Author: friedgold Date: Wed Feb 23 12:35:59 2011 New Revision: 126320 URL: http://llvm.org/viewvc/llvm-project?rev=126320&view=rev Log: Add llvm.xcore.waitevent intrinsic. The effect of this intrinsic is to enable events on the thread and wait until a resource is ready to event. The vector of the resource that is ready is returned. Added: llvm/trunk/test/CodeGen/XCore/events.ll Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsXCore.td?rev=126320&r1=126319&r2=126320&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsXCore.td (original) +++ llvm/trunk/include/llvm/IntrinsicsXCore.td Wed Feb 23 12:35:59 2011 @@ -47,4 +47,7 @@ [NoCapture<0>]>; def int_xcore_setv : Intrinsic<[],[llvm_anyptr_ty, llvm_ptr_ty], [NoCapture<0>]>; + + // Intrinsics for events. + def int_xcore_waitevent : Intrinsic<[llvm_ptr_ty],[], [IntrReadMem]>; } Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=126320&r1=126319&r2=126320&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 23 12:35:59 2011 @@ -895,7 +895,7 @@ [(int_xcore_setv GRRegs:$r, R11)]>; // Zero operand short -// TODO waiteu, clre, ssync, freet, ldspc, stspc, ldssr, stssr, ldsed, stsed, +// TODO clre, ssync, freet, ldspc, stspc, ldssr, stssr, ldsed, stsed, // stet, geted, getet, getkep, getksp, setkep, getid, kret, dcall, dret, // dentsp, drestsp @@ -904,6 +904,12 @@ "get r11, id", [(set R11, (int_xcore_getid))]>; +let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1, + hasSideEffects = 1 in +def WAITEU_0R : _F0R<(outs), (ins), + "waiteu", + [(brind (int_xcore_waitevent))]>; + //===----------------------------------------------------------------------===// // Non-Instruction Patterns //===----------------------------------------------------------------------===// Added: llvm/trunk/test/CodeGen/XCore/events.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/events.ll?rev=126320&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/XCore/events.ll (added) +++ llvm/trunk/test/CodeGen/XCore/events.ll Wed Feb 23 12:35:59 2011 @@ -0,0 +1,21 @@ +; RUN: llc < %s -march=xcore | FileCheck %s + +declare void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p) +declare i8* @llvm.xcore.waitevent() + +define i32 @f(i8 addrspace(1)* %r) nounwind { +; CHECK: f: +entry: + call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* blockaddress(@f, %L1)) + call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* blockaddress(@f, %L2)) + %goto_addr = call i8* @llvm.xcore.waitevent() +; CHECK: waiteu + indirectbr i8* %goto_addr, [label %L1, label %L2] +L1: + br label %ret +L2: + br label %ret +ret: + %retval = phi i32 [1, %L1], [2, %L2] + ret i32 %retval +} From joerg at britannica.bec.de Wed Feb 23 12:54:34 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed, 23 Feb 2011 19:54:34 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: References: <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> <4D5C5CD0.1080703@gmail.com> <20110217000829.GC23813@britannica.bec.de> <7D36755B-29D2-470C-BA6B-7769705259A0@apple.com> Message-ID: <20110223185434.GB18368@britannica.bec.de> On Wed, Feb 23, 2011 at 10:10:54AM -0800, Jim Grosbach wrote: > Ping. Any progress on fixing this? It needs to be either fixed or reverted. This doesn't break valid code. Reverting it does. You haven't really made a proper suggestion for how to handle [] on other platforms either. I don't exactly get the argument about ARM, but llvm-mc doesn't seem to deal with any of the NetBSD ARM assembler files. So I guess there are bigger fishes to fry... Joerg From richard at xmos.com Wed Feb 23 12:52:05 2011 From: richard at xmos.com (Richard Osborne) Date: Wed, 23 Feb 2011 18:52:05 -0000 Subject: [llvm-commits] [llvm] r126322 - in /llvm/trunk: include/llvm/IntrinsicsXCore.td lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/events.ll Message-ID: <20110223185205.B99602A6C12D@llvm.org> Author: friedgold Date: Wed Feb 23 12:52:05 2011 New Revision: 126322 URL: http://llvm.org/viewvc/llvm-project?rev=126322&view=rev Log: Add XCore intrinsic for clre instruction. Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td llvm/trunk/test/CodeGen/XCore/events.ll Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsXCore.td?rev=126322&r1=126321&r2=126322&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsXCore.td (original) +++ llvm/trunk/include/llvm/IntrinsicsXCore.td Wed Feb 23 12:52:05 2011 @@ -50,4 +50,5 @@ // Intrinsics for events. def int_xcore_waitevent : Intrinsic<[llvm_ptr_ty],[], [IntrReadMem]>; + def int_xcore_clre : Intrinsic<[],[],[]>; } Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=126322&r1=126321&r2=126322&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 23 12:52:05 2011 @@ -895,10 +895,12 @@ [(int_xcore_setv GRRegs:$r, R11)]>; // Zero operand short -// TODO clre, ssync, freet, ldspc, stspc, ldssr, stssr, ldsed, stsed, +// TODO ssync, freet, ldspc, stspc, ldssr, stssr, ldsed, stsed, // stet, geted, getet, getkep, getksp, setkep, getid, kret, dcall, dret, // dentsp, drestsp +def CLRE_0R : _F0R<(outs), (ins), "clre", [(int_xcore_clre)]>; + let Defs = [R11] in def GETID_0R : _F0R<(outs), (ins), "get r11, id", Modified: llvm/trunk/test/CodeGen/XCore/events.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/events.ll?rev=126322&r1=126321&r2=126322&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/events.ll (original) +++ llvm/trunk/test/CodeGen/XCore/events.ll Wed Feb 23 12:52:05 2011 @@ -2,10 +2,13 @@ declare void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p) declare i8* @llvm.xcore.waitevent() +declare void @llvm.xcore.clre() define i32 @f(i8 addrspace(1)* %r) nounwind { ; CHECK: f: entry: +; CHECK: clre + call void @llvm.xcore.clre() call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* blockaddress(@f, %L1)) call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* blockaddress(@f, %L2)) %goto_addr = call i8* @llvm.xcore.waitevent() From grosbach at apple.com Wed Feb 23 13:33:53 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 11:33:53 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110223185434.GB18368@britannica.bec.de> References: <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> <4D5C5CD0.1080703@gmail.com> <20110217000829.GC23813@britannica.bec.de> <7D36755B-29D2-470C-BA6B-7769705259A0@apple.com> <20110223185434.GB18368@britannica.bec.de> Message-ID: <557F170B-38DF-4D03-95E3-BBA546FF9054@apple.com> On Feb 23, 2011, at 10:54 AM, Joerg Sonnenberger wrote: > On Wed, Feb 23, 2011 at 10:10:54AM -0800, Jim Grosbach wrote: >> Ping. Any progress on fixing this? It needs to be either fixed or reverted. > > This doesn't break valid code. Reverting it does. You haven't really > made a proper suggestion for how to handle [] on other platforms either. > I don't exactly get the argument about ARM, but llvm-mc doesn't seem to > deal with any of the NetBSD ARM assembler files. So I guess there are > bigger fishes to fry... > You don't seem to understand. Disregarding concerns like this is not acceptable. Conditionalizing the behavior properly is a problem for you to solve since you're the one who wants the changes. I reiterate. Either fix it or revert it. -Jim From joerg at britannica.bec.de Wed Feb 23 13:54:42 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed, 23 Feb 2011 20:54:42 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> Message-ID: <20110223195442.GA29117@britannica.bec.de> On Wed, Feb 16, 2011 at 09:47:22AM -0800, Jim Grosbach wrote: > What about other targets? ARM, MIPS, etc.. shouldn't accept > bracket-as-parens expressions unless that's part of their documented > syntax. Can you name a specific platform for which GAS doesn't accept it? > For example, the following is not legal ARM assembly and should give a > syntax error on the '[' token. > add r0, r1, #[_foo - _bar] > > With these changes, that's not happening anymore. _foo: _bar: add r0, r1, #[_foo - _bar] is accepted by GAS and gives the same result as the expression with (). Joerg From dpatel at apple.com Wed Feb 23 13:59:17 2011 From: dpatel at apple.com (Devang Patel) Date: Wed, 23 Feb 2011 19:59:17 -0000 Subject: [llvm-commits] [test-suite] r126329 - in /test-suite/trunk: Makefile.programs TEST.dbgopt.Makefile Message-ID: <20110223195917.3D4002A6C12C@llvm.org> Author: dpatel Date: Wed Feb 23 13:59:17 2011 New Revision: 126329 URL: http://llvm.org/viewvc/llvm-project?rev=126329&view=rev Log: Adopt clang as the compiler. Stay within 80 cols. Modified: test-suite/trunk/Makefile.programs test-suite/trunk/TEST.dbgopt.Makefile Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=126329&r1=126328&r2=126329&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Wed Feb 23 13:59:17 2011 @@ -988,8 +988,8 @@ @echo " information." @echo " " @echo " Run following commands to investigate failures." - @echo " prompt> llvm-gcc -g -fdebug-disable-debug-info-print -Os -S foo.c -o foo.first.s" - @echo " prompt> llvm-gcc -Os -S foo.c -o foo.second.s" + @echo " prompt> clang -g -fdebug-disable-debug-info-print -Os -S foo.c -o foo.first.s" + @echo " prompt> clang -Os -S foo.c -o foo.second.s" @echo " prompt> diff foo.first.s foo.second.s" @echo "***************************************************************" Modified: test-suite/trunk/TEST.dbgopt.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.dbgopt.Makefile?rev=126329&r1=126328&r2=126329&view=diff ============================================================================== --- test-suite/trunk/TEST.dbgopt.Makefile (original) +++ test-suite/trunk/TEST.dbgopt.Makefile Wed Feb 23 13:59:17 2011 @@ -3,8 +3,9 @@ # This test checks whether presense of debugging information influences # the optimizer or not. # -# $ llvm-gcc -g -fdebug-disable-debug-info-print -Os -S foo.c -o foo.first.s -# $ llvm-gcc -Os -S foo.c -o foo.second.s +# $ clang -fno-verbose-asm -g -mllvm --disable-debug-info-print -Os \ +# -S foo.c -o foo.first.s +# $ clang -fno-verbose-asm -Os -S foo.c -o foo.second.s # $ diff foo.first.s foo.second.s # ##===----------------------------------------------------------------------===## @@ -16,8 +17,11 @@ test.$(TEST).%: Output/%.diff Output/%.s: %.c Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.first.s - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.second.s + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -fno-verbose-asm -mllvm --disable-debug-info-print \ + -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.first.s + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os \ + -fno-verbose-asm -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ else \ @@ -25,8 +29,11 @@ fi Output/%.s: %.cpp Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.first.s - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.second.s + -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -fno-verbose-asm -mllvm --disable-debug-info-print \ + -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.first.s + -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -fno-verbose-asm ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ else \ @@ -34,8 +41,11 @@ fi Output/%.s: %.cc Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.first.s - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.second.s + -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -fno-verbose-asm -mllvm -disable-debug-info-print \ + -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.first.s + -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -fno-verbose-asm ${PROJ_SRC_DIR}/$*.cc -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ else \ @@ -43,8 +53,11 @@ fi Output/%.s: %.m Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.first.s - -$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.second.s + -$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -fno-verbose-asm -mllvm --disable-debug-info-print \ + -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.first.s + -$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -fno-verbose-asm ${PROJ_SRC_DIR}/$*.m -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ else \ @@ -52,8 +65,11 @@ fi Output/%.s: %.mm Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.first.s - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.second.s + -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -fno-verbose-asm -mllvm --disable-debug-info-print \ + -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.first.s + -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -fno-verbose-asm ${PROJ_SRC_DIR}/$*.mm -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ else \ From grosbach at apple.com Wed Feb 23 14:06:52 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 12:06:52 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110223195442.GA29117@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> Message-ID: <16132883-7514-4704-98CE-8926EBEC1078@apple.com> On Feb 23, 2011, at 11:54 AM, Joerg Sonnenberger wrote: > On Wed, Feb 16, 2011 at 09:47:22AM -0800, Jim Grosbach wrote: >> What about other targets? ARM, MIPS, etc.. shouldn't accept >> bracket-as-parens expressions unless that's part of their documented >> syntax. > > Can you name a specific platform for which GAS doesn't accept it? > >> For example, the following is not legal ARM assembly and should give a >> syntax error on the '[' token. >> add r0, r1, #[_foo - _bar] >> >> With these changes, that's not happening anymore. > > _foo: > _bar: > add r0, r1, #[_foo - _bar] > > is accepted by GAS and gives the same result as the expression with (). You are operating under the mistaken impression that what gas accepts is the definition of what is legal assembly. This is a bug in gas for it to accept that expression for ARM. It may or may not be a bug for it to accept it for X86. I don't know X86 assembly syntax well enough to know the answer to that. -Jim From rafael.espindola at gmail.com Wed Feb 23 14:22:07 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 23 Feb 2011 20:22:07 -0000 Subject: [llvm-commits] [llvm] r126330 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp test/MC/ELF/pr9292.s Message-ID: <20110223202207.49DA02A6C12C@llvm.org> Author: rafael Date: Wed Feb 23 14:22:07 2011 New Revision: 126330 URL: http://llvm.org/viewvc/llvm-project?rev=126330&view=rev Log: Put in the symbol table symbols only used in a .globl statement. Fixes PR9292. Added: llvm/trunk/test/MC/ELF/pr9292.s Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=126330&r1=126329&r2=126330&view=diff ============================================================================== --- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Feb 23 14:22:07 2011 @@ -833,7 +833,11 @@ return true; const MCSymbol &A = Symbol.AliasedSymbol(); - if (!A.isVariable() && A.isUndefined() && !Data.isCommon()) + if (Symbol.isVariable() && !A.isVariable() && A.isUndefined()) + return false; + + bool IsGlobal = GetBinding(Data) == ELF::STB_GLOBAL; + if (!Symbol.isVariable() && Symbol.isUndefined() && !IsGlobal) return false; if (!Asm.isSymbolLinkerVisible(Symbol) && !Symbol.isUndefined()) Added: llvm/trunk/test/MC/ELF/pr9292.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/pr9292.s?rev=126330&view=auto ============================================================================== --- llvm/trunk/test/MC/ELF/pr9292.s (added) +++ llvm/trunk/test/MC/ELF/pr9292.s Wed Feb 23 14:22:07 2011 @@ -0,0 +1,26 @@ +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s + +// Test that both foo and bar are undefined. + +.globl foo +.globl bar +mov %eax,bar + + +// CHECK: (('st_name', 0x00000005) # 'bar' +// CHECK-NEXT: ('st_bind', 0x00000001) +// CHECK-NEXT: ('st_type', 0x00000000) +// CHECK-NEXT: ('st_other', 0x00000000) +// CHECK-NEXT: ('st_shndx', 0x00000000) +// CHECK-NEXT: ('st_value', 0x0000000000000000) +// CHECK-NEXT: ('st_size', 0x0000000000000000) +// CHECK-NEXT: ), +// CHECK-NEXT: # Symbol 0x00000005 +// CHECK-NEXT: (('st_name', 0x00000001) # 'foo' +// CHECK-NEXT: ('st_bind', 0x00000001) +// CHECK-NEXT: ('st_type', 0x00000000) +// CHECK-NEXT: ('st_other', 0x00000000) +// CHECK-NEXT: ('st_shndx', 0x00000000) +// CHECK-NEXT: ('st_value', 0x0000000000000000) +// CHECK-NEXT: ('st_size', 0x0000000000000000) +// CHECK-NEXT: ), From joerg at britannica.bec.de Wed Feb 23 14:32:54 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed, 23 Feb 2011 21:32:54 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <16132883-7514-4704-98CE-8926EBEC1078@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> Message-ID: <20110223203249.GA12162@britannica.bec.de> On Wed, Feb 23, 2011 at 12:06:52PM -0800, Jim Grosbach wrote: > On Feb 23, 2011, at 11:54 AM, Joerg Sonnenberger wrote: > > > On Wed, Feb 16, 2011 at 09:47:22AM -0800, Jim Grosbach wrote: > >> What about other targets? ARM, MIPS, etc.. shouldn't accept > >> bracket-as-parens expressions unless that's part of their documented > >> syntax. > > > > Can you name a specific platform for which GAS doesn't accept it? > > > >> For example, the following is not legal ARM assembly and should give a > >> syntax error on the '[' token. > >> add r0, r1, #[_foo - _bar] > >> > >> With these changes, that's not happening anymore. > > > > _foo: > > _bar: > > add r0, r1, #[_foo - _bar] > > > > is accepted by GAS and gives the same result as the expression with (). > > > You are operating under the mistaken impression that what gas accepts > is the definition of what is legal assembly. This is a bug in gas for > it to accept that expression for ARM. It may or may not be a bug for > it to accept it for X86. I don't know X86 assembly syntax well enough > to know the answer to that. Since you seem to operate under the impression that you are right and I am wrong, feel free to change it however you like as long as it doesn't break the x86 backend. Joerg From wendling at apple.com Wed Feb 23 15:13:20 2011 From: wendling at apple.com (Bill Wendling) Date: Wed, 23 Feb 2011 13:13:20 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110223203249.GA12162@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> Message-ID: On Feb 23, 2011, at 12:32 PM, Joerg Sonnenberger wrote: > On Wed, Feb 23, 2011 at 12:06:52PM -0800, Jim Grosbach wrote: >> On Feb 23, 2011, at 11:54 AM, Joerg Sonnenberger wrote: >> >>> On Wed, Feb 16, 2011 at 09:47:22AM -0800, Jim Grosbach wrote: >>>> What about other targets? ARM, MIPS, etc.. shouldn't accept >>>> bracket-as-parens expressions unless that's part of their documented >>>> syntax. >>> >>> Can you name a specific platform for which GAS doesn't accept it? >>> >>>> For example, the following is not legal ARM assembly and should give a >>>> syntax error on the '[' token. >>>> add r0, r1, #[_foo - _bar] >>>> >>>> With these changes, that's not happening anymore. >>> >>> _foo: >>> _bar: >>> add r0, r1, #[_foo - _bar] >>> >>> is accepted by GAS and gives the same result as the expression with (). >> >> >> You are operating under the mistaken impression that what gas accepts >> is the definition of what is legal assembly. This is a bug in gas for >> it to accept that expression for ARM. It may or may not be a bug for >> it to accept it for X86. I don't know X86 assembly syntax well enough >> to know the answer to that. > > Since you seem to operate under the impression that you are right and I > am wrong, feel free to change it however you like as long as it doesn't > break the x86 backend. > Jim demonstrated how this breaks ARM. Therefore, it's not just his "impression" that you are wrong, but you *are* wrong. -bw -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110223/fc58bc08/attachment.html From grosbach at apple.com Wed Feb 23 15:26:51 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 21:26:51 -0000 Subject: [llvm-commits] [llvm] r126336 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s Message-ID: <20110223212651.EF88C2A6C12C@llvm.org> Author: grosbach Date: Wed Feb 23 15:26:51 2011 New Revision: 126336 URL: http://llvm.org/viewvc/llvm-project?rev=126336&view=rev Log: Revert r125595, which is an X86-only undocumented assembly syntax extension enabled for all targets. Non-X86 targets should not have this behavior enabled by default. Joerg, if you would like to resubmit with the behavior conditionalized to be X86-ELF only, that's fine. Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp llvm/trunk/test/MC/AsmParser/exprs.s llvm/trunk/test/MC/AsmParser/paren.s Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=126336&r1=126335&r2=126336&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Wed Feb 23 15:26:51 2011 @@ -173,7 +173,6 @@ bool ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc); bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res, SMLoc &EndLoc); bool ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc); - bool ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc); /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) /// and set \arg Res to the identifier contents. @@ -493,20 +492,6 @@ return false; } -/// ParseBracketExpr - Parse a bracket expression and return it. -/// NOTE: This assumes the leading '[' has already been consumed. -/// -/// bracketexpr ::= expr] -/// -bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) { - if (ParseExpression(Res)) return true; - if (Lexer.isNot(AsmToken::RBrac)) - return TokError("expected ']' in brackets expression"); - EndLoc = Lexer.getLoc(); - Lex(); - return false; -} - /// ParsePrimaryExpr - Parse a primary expression and return it. /// primaryexpr ::= (parenexpr /// primaryexpr ::= symbol @@ -602,9 +587,6 @@ case AsmToken::LParen: Lex(); // Eat the '('. return ParseParenExpr(Res, EndLoc); - case AsmToken::LBrac: - Lex(); // Eat the '['. - return ParseBracketExpr(Res, EndLoc); case AsmToken::Minus: Lex(); // Eat the operator. if (ParsePrimaryExpr(Res, EndLoc)) Modified: llvm/trunk/test/MC/AsmParser/exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=126336&r1=126335&r2=126336&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/exprs.s (original) +++ llvm/trunk/test/MC/AsmParser/exprs.s Wed Feb 23 15:26:51 2011 @@ -35,8 +35,6 @@ check_expr 1 << 1, 2 check_expr 2 >> 1, 1 check_expr (~0 >> 1), -1 - check_expr [~0 >> 1], -1 - check_expr 4 * [4 + (3 + [2 * 2] + 1)], 48 check_expr 3 - 2, 1 check_expr 1 ^ 3, 2 check_expr 1 && 2, 1 Modified: llvm/trunk/test/MC/AsmParser/paren.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/paren.s?rev=126336&r1=126335&r2=126336&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/paren.s (original) +++ llvm/trunk/test/MC/AsmParser/paren.s Wed Feb 23 15:26:51 2011 @@ -1,8 +0,0 @@ -// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t1 > %t2 -// RUN: FileCheck < %t1 %s - -// CHECK: error: expected ']' in brackets expression -.size x, [.-x) - -// CHECK: error: expected ')' in parentheses expression -.size y, (.-y] From grosbach at apple.com Wed Feb 23 15:30:44 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 13:30:44 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110223203249.GA12162@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> Message-ID: <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> Hi Joerg, I'm sorry that we've been unable to resolve this via discussion. Perhaps we simply have differing enough philosophical approaches that we simply weren't ever going to reach consensus. Be that as it may, I do feel strongly that it is inappropriate for this change to go in as it stands. It introduces ambiguities into the ARM syntax, as I previously documented, for an X86 extenstion. I have reverted the patch in r126336. If you would like to resubmit with the feature being conditional on X86/ELF, please do. If you feel this is inappropriate or would otherwise like to escalate the issue, please contact the LLVM backend maintainer, Evan Cheng. I've CCed him on this message. Regards, Jim From grosbach at apple.com Wed Feb 23 15:43:31 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 21:43:31 -0000 Subject: [llvm-commits] [llvm] r126337 - /llvm/trunk/test/MC/AsmParser/paren.s Message-ID: <20110223214331.B51A62A6C12C@llvm.org> Author: grosbach Date: Wed Feb 23 15:43:31 2011 New Revision: 126337 URL: http://llvm.org/viewvc/llvm-project?rev=126337&view=rev Log: Remove file. Previous commit deleted content, but left the file around. Removed: llvm/trunk/test/MC/AsmParser/paren.s Removed: llvm/trunk/test/MC/AsmParser/paren.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/paren.s?rev=126336&view=auto ============================================================================== (empty) From rafael.espindola at gmail.com Wed Feb 23 15:48:34 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Wed, 23 Feb 2011 16:48:34 -0500 Subject: [llvm-commits] [llvm] r126336 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110223212651.EF88C2A6C12C@llvm.org> References: <20110223212651.EF88C2A6C12C@llvm.org> Message-ID: <4D6580B2.60404@gmail.com> On 11-02-23 04:26 PM, Jim Grosbach wrote: > Author: grosbach > Date: Wed Feb 23 15:26:51 2011 > New Revision: 126336 > > URL: http://llvm.org/viewvc/llvm-project?rev=126336&view=rev > Log: > Revert r125595, which is an X86-only undocumented assembly syntax extension > enabled for all targets. Non-X86 targets should not have this behavior > enabled by default. This is an undocumented extension, but it is *not* x86 only. The following *is* accepted by gas for ARM: _foo: _bar: add r0, r1, #[_foo - _bar] > Joerg, if you would like to resubmit with the behavior conditionalized to be > X86-ELF only, that's fine. Cheers, Rafael From grosbach at apple.com Wed Feb 23 15:51:38 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 13:51:38 -0800 Subject: [llvm-commits] [llvm] r126336 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4D6580B2.60404@gmail.com> References: <20110223212651.EF88C2A6C12C@llvm.org> <4D6580B2.60404@gmail.com> Message-ID: <432B037C-57A0-4F64-BF39-C5773F8542E5@apple.com> On Feb 23, 2011, at 1:48 PM, Rafael Avila de Espindola wrote: > On 11-02-23 04:26 PM, Jim Grosbach wrote: >> Author: grosbach >> Date: Wed Feb 23 15:26:51 2011 >> New Revision: 126336 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=126336&view=rev >> Log: >> Revert r125595, which is an X86-only undocumented assembly syntax extension >> enabled for all targets. Non-X86 targets should not have this behavior >> enabled by default. > > This is an undocumented extension, but it is *not* x86 only. The > following *is* accepted by gas for ARM: > > _foo: > _bar: > add r0, r1, #[_foo - _bar] > Somewhat arguing semantics at this point, honestly. By X86-only I simply mean that the extension was added to LLVM because of a need in X86 which has not manifested in other targets. Sorry for any confusion. -j From joerg at britannica.bec.de Wed Feb 23 15:55:30 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed, 23 Feb 2011 22:55:30 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> Message-ID: <20110223215523.GA15835@britannica.bec.de> On Wed, Feb 23, 2011 at 01:30:44PM -0800, Jim Grosbach wrote: > I'm sorry that we've been unable to resolve this via discussion. > Perhaps we simply have differing enough philosophical approaches that > we simply weren't ever going to reach consensus. Right, I am wrong and you are right. Please reopen the bug that this triggers and provide a proper solution, since you don't care about consistency or breaking things for other people. > Be that as it may, I do feel strongly that it is inappropriate for > this change to go in as it stands. It introduces ambiguities into the > ARM syntax, as I previously documented, for an X86 extenstion. There is no ambiguity as has been demonstrated. It is not an X86 extension, it is a standard functionality of GNU as on most platforms for the expression language. The philosphical difference seems to be that I consider a consistent approach that follows the behavior of the primary assembler on Unix more useful than the whatever input the assembler of a hardware vendor currently decides to reject. > I have reverted the patch in r126336. If you would like to resubmit > with the feature being conditional on X86/ELF, please do. > > If you feel this is inappropriate or would otherwise like to escalate > the issue, please contact the LLVM backend maintainer, Evan Cheng. > I've CCed him on this message. Yes, I consider this behavior inappropiate. I have offered making the function virtual and overriding it. I don't really care if it is opt-in or opt-out. You just broke valid input for the only reason to reject invalid input on a platform that is accepted by other tools on that platform. Joerg From grosbach at apple.com Wed Feb 23 16:06:22 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 23 Feb 2011 14:06:22 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110223215523.GA15835@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> Message-ID: Hi Joerg, I'm sorry you feel that way. Please take up the issue with Evan if you would like. Regards, -Jim On Feb 23, 2011, at 1:55 PM, Joerg Sonnenberger wrote: > On Wed, Feb 23, 2011 at 01:30:44PM -0800, Jim Grosbach wrote: >> I'm sorry that we've been unable to resolve this via discussion. >> Perhaps we simply have differing enough philosophical approaches that >> we simply weren't ever going to reach consensus. > > Right, I am wrong and you are right. Please reopen the bug that this > triggers and provide a proper solution, since you don't care about > consistency or breaking things for other people. > >> Be that as it may, I do feel strongly that it is inappropriate for >> this change to go in as it stands. It introduces ambiguities into the >> ARM syntax, as I previously documented, for an X86 extenstion. > > There is no ambiguity as has been demonstrated. It is not an X86 > extension, it is a standard functionality of GNU as on most platforms > for the expression language. The philosphical difference seems to be > that I consider a consistent approach that follows the behavior of the > primary assembler on Unix more useful than the whatever input the > assembler of a hardware vendor currently decides to reject. > >> I have reverted the patch in r126336. If you would like to resubmit >> with the feature being conditional on X86/ELF, please do. >> >> If you feel this is inappropriate or would otherwise like to escalate >> the issue, please contact the LLVM backend maintainer, Evan Cheng. >> I've CCed him on this message. > > Yes, I consider this behavior inappropiate. I have offered making the > function virtual and overriding it. I don't really care if it is opt-in > or opt-out. You just broke valid input for the only reason to reject > invalid input on a platform that is accepted by other tools on that > platform. > > Joerg > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gkistanova at gmail.com Wed Feb 23 16:11:02 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Wed, 23 Feb 2011 14:11:02 -0800 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash Message-ID: Starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash. Please see the builder llvm-gcc-mingw32-cross-arm-linux-gnueabi-hard-float for more details on what configuration gets built. The builder is 32-bit Windows XP SP3 machine. ld.exe crashes with the following error: ld.exe has encounterd a problem and needs to close. It seems a null pointer gets dereferenced. I have tried the ld.exe from the binutils ToT with the same result. Thanks Galina -------------- next part -------------- A non-text attachment was scrubbed... Name: Error_message.bmp Type: image/bmp Size: 363478 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110223/ec1d25c1/attachment-0001.bmp From dpatel at apple.com Wed Feb 23 16:35:57 2011 From: dpatel at apple.com (Devang Patel) Date: Wed, 23 Feb 2011 22:35:57 -0000 Subject: [llvm-commits] [llvm] r126338 - in /llvm/trunk/test/CodeGen: ARM/2011-01-19-MergedGlobalDbg.ll X86/dbg-value-location.ll Message-ID: <20110223223557.A4D6C2A6C12C@llvm.org> Author: dpatel Date: Wed Feb 23 16:35:57 2011 New Revision: 126338 URL: http://llvm.org/viewvc/llvm-project?rev=126338&view=rev Log: Check only relevant strings in output to increase stability of the tests. Modified: llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll llvm/trunk/test/CodeGen/X86/dbg-value-location.ll Modified: llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll?rev=126338&r1=126337&r2=126338&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll Wed Feb 23 16:35:57 2011 @@ -17,13 +17,12 @@ ; DW_OP_constu ; offset -;CHECK: .byte 7 @ Abbrev [7] 0x1a5:0x13 DW_TAG_variable -;CHECK-NEXT: .ascii "x2" @ DW_AT_name +;CHECK: .ascii "x2" @ DW_AT_name ;CHECK-NEXT: .byte 0 -;CHECK-NEXT: .long 93 @ DW_AT_type -;CHECK-NEXT: .byte 1 @ DW_AT_decl_file -;CHECK-NEXT: .byte 6 @ DW_AT_decl_line -;CHECK-NEXT: .byte 8 @ DW_AT_location +;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 Modified: llvm/trunk/test/CodeGen/X86/dbg-value-location.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-location.ll?rev=126338&r1=126337&r2=126338&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-location.ll (original) +++ llvm/trunk/test/CodeGen/X86/dbg-value-location.ll Wed Feb 23 16:35:57 2011 @@ -5,10 +5,10 @@ ;CHECK: .ascii "var" ## DW_AT_name ;CHECK-NEXT: .byte 0 -;CHECK-NEXT: .byte 2 ## DW_AT_decl_file -;CHECK-NEXT: .short 19509 ## DW_AT_decl_line -;CHECK-NEXT: .long 68 ## DW_AT_type -;CHECK-NEXT: .byte 1 ## DW_AT_location +;CHECK-NEXT: ## DW_AT_decl_file +;CHECK-NEXT: ## DW_AT_decl_line +;CHECK-NEXT: ## DW_AT_type +;CHECK-NEXT: ## DW_AT_location @dfm = external global i32, align 4 From dpatel at apple.com Wed Feb 23 16:37:04 2011 From: dpatel at apple.com (Devang Patel) Date: Wed, 23 Feb 2011 22:37:04 -0000 Subject: [llvm-commits] [llvm] r126339 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/CodeGen/X86/2010-06-28-DbgEntryPC.ll Message-ID: <20110223223704.CDCEC2A6C12C@llvm.org> Author: dpatel Date: Wed Feb 23 16:37:04 2011 New Revision: 126339 URL: http://llvm.org/viewvc/llvm-project?rev=126339&view=rev Log: Use DW_FORM_data2 for DW_AT_language and let users use DW_LANG_lo_user=0x8000 to DW_LANG_hi_user=0xffff range. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/test/CodeGen/X86/2010-06-28-DbgEntryPC.ll Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=126339&r1=126338&r2=126339&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 23 16:37:04 2011 @@ -1894,7 +1894,7 @@ DIE *Die = new DIE(dwarf::DW_TAG_compile_unit); addString(Die, dwarf::DW_AT_producer, dwarf::DW_FORM_string, DIUnit.getProducer()); - addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data1, + addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2, DIUnit.getLanguage()); addString(Die, dwarf::DW_AT_name, dwarf::DW_FORM_string, FN); // Use DW_AT_entry_pc instead of DW_AT_low_pc/DW_AT_high_pc pair. This Modified: llvm/trunk/test/CodeGen/X86/2010-06-28-DbgEntryPC.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-06-28-DbgEntryPC.ll?rev=126339&r1=126338&r2=126339&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2010-06-28-DbgEntryPC.ll (original) +++ llvm/trunk/test/CodeGen/X86/2010-06-28-DbgEntryPC.ll Wed Feb 23 16:37:04 2011 @@ -7,7 +7,7 @@ ; CHECK-NEXT: .byte 37 ## DW_AT_producer ; CHECK-NEXT: .byte 8 ## DW_FORM_string ; CHECK-NEXT: .byte 19 ## DW_AT_language -; CHECK-NEXT: .byte 11 ## DW_FORM_data1 +; CHECK-NEXT: .byte 5 ## DW_FORM_data2 ; CHECK-NEXT: .byte 3 ## DW_AT_name ; CHECK-NEXT: .byte 8 ## DW_FORM_string ; CHECK-NEXT: .byte 82 ## DW_AT_entry_pc From dpatel at apple.com Wed Feb 23 16:51:31 2011 From: dpatel at apple.com (Devang Patel) Date: Wed, 23 Feb 2011 22:51:31 -0000 Subject: [llvm-commits] [test-suite] r126340 - /test-suite/trunk/TEST.dbgopt.Makefile Message-ID: <20110223225131.DC85C2A6C12C@llvm.org> Author: dpatel Date: Wed Feb 23 16:51:31 2011 New Revision: 126340 URL: http://llvm.org/viewvc/llvm-project?rev=126340&view=rev Log: Really use clang instead of llvmgcc as the compiler. Modified: test-suite/trunk/TEST.dbgopt.Makefile Modified: test-suite/trunk/TEST.dbgopt.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.dbgopt.Makefile?rev=126340&r1=126339&r2=126340&view=diff ============================================================================== --- test-suite/trunk/TEST.dbgopt.Makefile (original) +++ test-suite/trunk/TEST.dbgopt.Makefile Wed Feb 23 16:51:31 2011 @@ -29,10 +29,10 @@ fi Output/%.s: %.cpp Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ -fno-verbose-asm -mllvm --disable-debug-info-print \ -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.first.s - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ -fno-verbose-asm ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ @@ -41,10 +41,10 @@ fi Output/%.s: %.cc Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ -fno-verbose-asm -mllvm -disable-debug-info-print \ -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.first.s - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ -fno-verbose-asm ${PROJ_SRC_DIR}/$*.cc -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ @@ -53,10 +53,10 @@ fi Output/%.s: %.m Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -$(LLVMCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ -fno-verbose-asm -mllvm --disable-debug-info-print \ -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.first.s - -$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -$(LLVMCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ -fno-verbose-asm ${PROJ_SRC_DIR}/$*.m -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ @@ -65,10 +65,10 @@ fi Output/%.s: %.mm Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \ -fno-verbose-asm -mllvm --disable-debug-info-print \ -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.first.s - -$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ + -$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \ -fno-verbose-asm ${PROJ_SRC_DIR}/$*.mm -o Output/$*.second.s @-if diff Output/$*.first.s Output/$*.second.s > $@; then \ echo "--------- TEST-PASS: $*" > Output/$*.dbgopt.report.txt; \ From bigcheesegs at gmail.com Wed Feb 23 19:02:32 2011 From: bigcheesegs at gmail.com (Michael J. Spencer) Date: Thu, 24 Feb 2011 01:02:32 -0000 Subject: [llvm-commits] [llvm] r126348 - /llvm/trunk/include/llvm/Support/PathV1.h Message-ID: <20110224010232.4D6F42A6C12C@llvm.org> Author: mspencer Date: Wed Feb 23 19:02:32 2011 New Revision: 126348 URL: http://llvm.org/viewvc/llvm-project?rev=126348&view=rev Log: Depricate PathV1::isAbsolute. Modified: llvm/trunk/include/llvm/Support/PathV1.h Modified: llvm/trunk/include/llvm/Support/PathV1.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV1.h?rev=126348&r1=126347&r2=126348&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PathV1.h (original) +++ llvm/trunk/include/llvm/Support/PathV1.h Wed Feb 23 19:02:32 2011 @@ -312,9 +312,9 @@ /// This function determines if the path name is absolute, as opposed to /// relative. /// @brief Determine if the path is absolute. -//FIXME: LLVM_ATTRIBUTE_DEPRECATED( - bool isAbsolute() const; -//FIXME: LLVMV_PATH_DEPRECATED_MSG(path::is_absolute)); + LLVM_ATTRIBUTE_DEPRECATED( + bool isAbsolute() const, + LLVM_PATH_DEPRECATED_MSG(path::is_absolute)); /// This function determines if the path name is absolute, as opposed to /// relative. From stoklund at 2pi.dk Wed Feb 23 19:07:55 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 24 Feb 2011 01:07:55 -0000 Subject: [llvm-commits] [llvm] r126353 - /llvm/trunk/lib/CodeGen/InlineSpiller.cpp Message-ID: <20110224010755.966922A6C12C@llvm.org> Author: stoklund Date: Wed Feb 23 19:07:55 2011 New Revision: 126353 URL: http://llvm.org/viewvc/llvm-project?rev=126353&view=rev Log: Use the same spill slot for all live ranges that descend form the same original register. This avoids some silly stack slot shuffling when both sides of a copy get spilled. Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=126353&r1=126352&r2=126353&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original) +++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Wed Feb 23 19:07:55 2011 @@ -345,7 +345,8 @@ && "Trying to spill a stack slot."); DEBUG(dbgs() << "Inline spilling " << mri_.getRegClass(edit.getReg())->getName() - << ':' << edit.getParent() << "\n"); + << ':' << edit.getParent() << "\nFrom original " + << PrintReg(vrm_.getOriginal(edit.getReg())) << '\n'); assert(edit.getParent().isSpillable() && "Attempting to spill already spilled value."); @@ -356,12 +357,20 @@ return; rc_ = mri_.getRegClass(edit.getReg()); - stackSlot_ = vrm_.assignVirt2StackSlot(edit_->getReg()); + + // Share a stack slot among all descendants of Orig. + unsigned Orig = vrm_.getOriginal(edit.getReg()); + stackSlot_ = vrm_.getStackSlot(Orig); + if (stackSlot_ == VirtRegMap::NO_STACK_SLOT) + stackSlot_ = vrm_.assignVirt2StackSlot(Orig); + + if (Orig != edit.getReg()) + vrm_.assignVirt2StackSlot(edit.getReg(), stackSlot_); // Update LiveStacks now that we are committed to spilling. LiveInterval &stacklvr = lss_.getOrCreateInterval(stackSlot_, rc_); - assert(stacklvr.empty() && "Just created stack slot not empty"); - stacklvr.getNextValue(SlotIndex(), 0, lss_.getVNInfoAllocator()); + if (!stacklvr.hasAtLeastOneValue()) + stacklvr.getNextValue(SlotIndex(), 0, lss_.getVNInfoAllocator()); stacklvr.MergeRangesInAsValue(edit_->getParent(), stacklvr.getValNumInfo(0)); // Iterate over instructions using register. From clattner at apple.com Wed Feb 23 20:14:23 2011 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Feb 2011 18:14:23 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110223215523.GA15835@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> Message-ID: <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> On Feb 23, 2011, at 1:55 PM, Joerg Sonnenberger wrote: > On Wed, Feb 23, 2011 at 01:30:44PM -0800, Jim Grosbach wrote: >> I'm sorry that we've been unable to resolve this via discussion. >> Perhaps we simply have differing enough philosophical approaches that >> we simply weren't ever going to reach consensus. > > Right, I am wrong and you are right. Please reopen the bug that this > triggers and provide a proper solution, since you don't care about > consistency or breaking things for other people. Joerg and others, It looks like there are a couple of misunderstandings going on here. I really appreciate the work you've been doing and I agree that the patch to add [] is a good feature for the X86 backend. Unfortunately, Jim is right that it does break perfectly legal ARM code (and Jim should add a testcase for this code that is getting broken!). I don't think that this is a matter of "what is right or wrong" or "who" is right. The general policy we follow in LLVM (documented here: http://llvm.org/docs/DeveloperPolicy.html#quality) is that we don't want to regress currently working stuff. Jim's coming at this from the perspective that your patch broke something on ARM and therefore introduced a regression. I think it's lousy that there isn't a regression test for this, but these things do happen. In any case, instead of focusing on who is right or wrong, it is more productive to focus on how to make progress here. I agree with Jim that reverting the patch for the time being is the right thing to do. It would be great if you could resubmit the patch, adding a target hook at the the ARM assembler can override to disable [] parsing. I don't think that this would be a major extension to the patch and would be happy to help with it. Just remember, we're all friends here. :-) -Chris From evan.cheng at apple.com Wed Feb 23 20:36:52 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Feb 2011 02:36:52 -0000 Subject: [llvm-commits] [llvm] r126359 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.cpp test/CodeGen/X86/2011-02-23-UnfoldBug.ll Message-ID: <20110224023652.EA75C2A6C12C@llvm.org> Author: evancheng Date: Wed Feb 23 20:36:52 2011 New Revision: 126359 URL: http://llvm.org/viewvc/llvm-project?rev=126359&view=rev Log: Fix bug in X86 folding / unfolding table. Int_CMPSDrm and Int_CMPSSrm memory operands starts at index 2, not 1. rdar://9045024 PR9305 Added: llvm/trunk/test/CodeGen/X86/2011-02-23-UnfoldBug.ll Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=126359&r1=126358&r2=126359&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Wed Feb 23 20:36:52 2011 @@ -369,8 +369,6 @@ { X86::IMUL32rri8, X86::IMUL32rmi8, 0 }, { X86::IMUL64rri32, X86::IMUL64rmi32, 0 }, { X86::IMUL64rri8, X86::IMUL64rmi8, 0 }, - { X86::Int_CMPSDrr, X86::Int_CMPSDrm, 0 }, - { X86::Int_CMPSSrr, X86::Int_CMPSSrm, 0 }, { X86::Int_COMISDrr, X86::Int_COMISDrm, 0 }, { X86::Int_COMISSrr, X86::Int_COMISSrm, 0 }, { X86::Int_CVTDQ2PDrr, X86::Int_CVTDQ2PDrm, 16 }, @@ -568,6 +566,8 @@ { X86::IMUL16rr, X86::IMUL16rm, 0 }, { X86::IMUL32rr, X86::IMUL32rm, 0 }, { X86::IMUL64rr, X86::IMUL64rm, 0 }, + { X86::Int_CMPSDrr, X86::Int_CMPSDrm, 0 }, + { X86::Int_CMPSSrr, X86::Int_CMPSSrm, 0 }, { X86::MAXPDrr, X86::MAXPDrm, 16 }, { X86::MAXPDrr_Int, X86::MAXPDrm_Int, 16 }, { X86::MAXPSrr, X86::MAXPSrm, 16 }, Added: llvm/trunk/test/CodeGen/X86/2011-02-23-UnfoldBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-23-UnfoldBug.ll?rev=126359&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2011-02-23-UnfoldBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2011-02-23-UnfoldBug.ll Wed Feb 23 20:36:52 2011 @@ -0,0 +1,42 @@ +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 +; rdar://9045024 +; PR9305 + +define void @calc_gb_rad_still_sse2_double() nounwind ssp { +entry: + br label %for.cond.outer + +for.cond.outer: ; preds = %if.end71, %entry + %theta.0.ph = phi <2 x double> [ undef, %entry ], [ %theta.1, %if.end71 ] + %mul.i97 = fmul <2 x double> %theta.0.ph, undef + %mul.i96 = fmul <2 x double> %mul.i97, fmul (<2 x double> , <2 x double> undef) + br i1 undef, label %for.body, label %for.end82 + +for.body: ; preds = %for.cond.outer + br i1 undef, label %for.body33.lr.ph, label %for.end + +for.body33.lr.ph: ; preds = %for.body + %dccf.2 = select i1 undef, <2 x double> %mul.i96, <2 x double> undef + unreachable + +for.end: ; preds = %for.body + %vecins.i94 = insertelement <2 x double> undef, double 0.000000e+00, i32 0 + %cmpsd.i = tail call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %vecins.i94, <2 x double> , i8 2) nounwind + tail call void (...)* @_mm_movemask_pd(<2 x double> %cmpsd.i) nounwind + br i1 undef, label %if.then67, label %if.end71 + +if.then67: ; preds = %for.end + %vecins.i91 = insertelement <2 x double> %vecins.i94, double undef, i32 0 + br label %if.end71 + +if.end71: ; preds = %if.then67, %for.end + %theta.1 = phi <2 x double> [ %vecins.i91, %if.then67 ], [ %theta.0.ph, %for.end ] + br label %for.cond.outer + +for.end82: ; preds = %for.cond.outer + ret void +} + +declare void @_mm_movemask_pd(...) + +declare <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double>, <2 x double>, i8) nounwind readnone From rafael.espindola at gmail.com Wed Feb 23 20:40:35 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Wed, 23 Feb 2011 21:40:35 -0500 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> Message-ID: <4D65C523.9090209@gmail.com> > Joerg and others, > > It looks like there are a couple of misunderstandings going on here. > I really appreciate the work you've been doing and I agree that the > patch to add [] is a good feature for the X86 backend. > Unfortunately, Jim is right that it does break perfectly legal ARM > code (and Jim should add a testcase for this code that is getting > broken!). > > I don't think that this is a matter of "what is right or wrong" or > "who" is right. The general policy we follow in LLVM (documented > here: http://llvm.org/docs/DeveloperPolicy.html#quality) is that we > don't want to regress currently working stuff. Jim's coming at this > from the perspective that your patch broke something on ARM and > therefore introduced a regression. I think it's lousy that there > isn't a regression test for this, but these things do happen. > > In any case, instead of focusing on who is right or wrong, it is more > productive to focus on how to make progress here. I agree with Jim > that reverting the patch for the time being is the right thing to do. > It would be great if you could resubmit the patch, adding a target > hook at the the ARM assembler can override to disable [] parsing. I > don't think that this would be a major extension to the patch and > would be happy to help with it. > > Just remember, we're all friends here. :-) Just a nit, it looks like it is a Mach-O X ELF, not X86 x ARM. Just to be sure, would this be a desirable feature for X86 Darwin? Now that I know that existing assemblers for ARM Mach-O don't support this, I agree it is not a good idea to be the first one to do so. Since this is in the expression parser, we probably need a HasFunnySquareBracketExpr flag or something, but yes, it should not be a big change on top of the previous patch. > -Chris Cheers, Rafael From rafael.espindola at gmail.com Wed Feb 23 22:22:19 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Wed, 23 Feb 2011 23:22:19 -0500 Subject: [llvm-commits] [patch] Switch LTO to use MC Message-ID: <4D65DCFB.90205@gmail.com> I was updating my patch for disabling .globl matching on ELF targets and decided I should at least try to see how hard it would be to implement the proper solution with MC. The first step is probably to switch LTO to use MC. It wouldn't make a lot of sense to have LTO require MC for finding definitions and then passing assembly to 'as'. The attached patch converts LTO to using MC for object emission. It simplifies the code a lot, since now all the assembler logic is in LLVM itself. It also has a nice impact on performance. With the patch libxul.so now links in 6m30, which is about 30s less than before :-) Cheers, Rafael -------------- next part -------------- A non-text attachment was scrubbed... Name: lto-mc.patch Type: text/x-patch Size: 9586 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110223/9a6b9350/attachment.bin From sabre at nondot.org Wed Feb 23 23:10:56 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Feb 2011 05:10:56 -0000 Subject: [llvm-commits] [llvm] r126363 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll test/Transforms/InstCombine/call.ll Message-ID: <20110224051056.4D4B42A6C12C@llvm.org> Author: lattner Date: Wed Feb 23 23:10:56 2011 New Revision: 126363 URL: http://llvm.org/viewvc/llvm-project?rev=126363&view=rev Log: change instcombine to not turn a call to non-varargs bitcast of function prototype into a call to a varargs prototype. We do allow the xform if we have a definition, but otherwise we don't want to risk that we're changing the abi in a subtle way. On X86-64, for example, varargs require passing stuff in %al. Removed: llvm/trunk/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp llvm/trunk/test/Transforms/InstCombine/call.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=126363&r1=126362&r2=126363&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Wed Feb 23 23:10:56 2011 @@ -953,10 +953,19 @@ if (Callee->isDeclaration() && !isConvertible) return false; } - if (FT->getNumParams() < NumActualArgs && !FT->isVarArg() && - Callee->isDeclaration()) - return false; // Do not delete arguments unless we have a function body. - + if (Callee->isDeclaration()) { + // Do not delete arguments unless we have a function body. + if (FT->getNumParams() < NumActualArgs && !FT->isVarArg()) + return false; + + // If the callee is just a declaration, don't change the varargsness of the + // call. We don't want to introduce a varargs call where one doesn't + // already exist. + const PointerType *APTy = cast(CS.getCalledValue()->getType()); + if (FT->isVarArg()!=cast(APTy->getElementType())->isVarArg()) + return false; + } + if (FT->getNumParams() < NumActualArgs && FT->isVarArg() && !CallerPAL.isEmpty()) // In this case we have more arguments than the new function type, but we @@ -970,8 +979,9 @@ return false; } + // Okay, we decided that this is a safe thing to do: go ahead and start - // inserting cast instructions as necessary... + // inserting cast instructions as necessary. std::vector Args; Args.reserve(NumActualArgs); SmallVector attrVec; Removed: llvm/trunk/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll?rev=126362&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll (removed) @@ -1,12 +0,0 @@ -; RUN: opt < %s -instcombine -S | FileCheck %s -target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" - -declare void @free(i8*) - -define void @test(i32* %X) { - call void (...)* bitcast (void (i8*)* @free to void (...)*)( i32* %X ) ; :1 [#uses=0] -; CHECK: %tmp = bitcast i32* %X to i8* -; CHECK: call void @free(i8* %tmp) - ret void -; CHECK: ret void -} Modified: llvm/trunk/test/Transforms/InstCombine/call.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/call.ll?rev=126363&r1=126362&r2=126363&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/call.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/call.ll Wed Feb 23 23:10:56 2011 @@ -32,7 +32,7 @@ ; Resolving this should insert a cast from sbyte to int, following the C ; promotion rules. -declare void @test3a(i8, ...) +define void @test3a(i8, ...) {unreachable } define void @test3(i8 %A, i8 %B) { call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B @@ -116,3 +116,17 @@ ; CHECK: @test8() { ; CHECK-NEXT: invoke void @test8a() + + +; Don't turn this into a direct call, because test9x is just a prototype and +; doing so will make it varargs. +; rdar://9038601 +declare i8* @test9x(i8*, i8*, ...) noredzone +define i8* @test9(i8* %arg, i8* %tmp3) nounwind ssp noredzone { +entry: + %call = call i8* bitcast (i8* (i8*, i8*, ...)* @test9x to i8* (i8*, i8*)*)(i8* %arg, i8* %tmp3) noredzone + ret i8* %call +; CHECK: @test9( +; CHECK: call i8* bitcast +} + From clattner at apple.com Wed Feb 23 23:32:57 2011 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Feb 2011 21:32:57 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4D65C523.9090209@gmail.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> <4D65C523.9090209@gmail.com> Message-ID: <26511CEA-92A4-413D-8E28-32E51DBB0EDE@apple.com> On Feb 23, 2011, at 6:40 PM, Rafael ?vila de Esp?ndola wrote: >> n any case, instead of focusing on who is right or wrong, it is more >> productive to focus on how to make progress here. I agree with Jim >> that reverting the patch for the time being is the right thing to do. >> It would be great if you could resubmit the patch, adding a target >> hook at the the ARM assembler can override to disable [] parsing. I >> don't think that this would be a major extension to the patch and >> would be happy to help with it. >> >> Just remember, we're all friends here. :-) > > Just a nit, it looks like it is a Mach-O X ELF, not X86 x ARM. > > Just to be sure, would this be a desirable feature for X86 Darwin? Sure, I'd like the mc assembler to be as consistent as reasonable across different OS's. > Now that I know that existing assemblers for ARM Mach-O don't support > this, I agree it is not a good idea to be the first one to do so. *shrug*, the assembler is already a scary place full of compatibility hacks. I don't think that making it any more complex by disabling upwards compatible extensions is a good way to go. > Since this is in the expression parser, we probably need a > HasFunnySquareBracketExpr flag or something, but yes, it should not be a > big change on top of the previous patch. Right, -Chris From sabre at nondot.org Thu Feb 24 01:12:12 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Feb 2011 07:12:12 -0000 Subject: [llvm-commits] [llvm] r126366 - /llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Message-ID: <20110224071212.6C4702A6C12C@llvm.org> Author: lattner Date: Thu Feb 24 01:12:12 2011 New Revision: 126366 URL: http://llvm.org/viewvc/llvm-project?rev=126366&view=rev Log: move a massive amount of code out into its own helper function to reduce nesting. This needs to be turned into a table. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=126366&r1=126365&r2=126366&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Thu Feb 24 01:12:12 2011 @@ -1402,6 +1402,7 @@ void setDoesNotAlias(Function &F, unsigned n); bool doInitialization(Module &M); + void inferPrototypeAttributes(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { } }; @@ -1597,688 +1598,654 @@ } } + +void SimplifyLibCalls::inferPrototypeAttributes(Function &F) { + const FunctionType *FTy = F.getFunctionType(); + + StringRef Name = F.getName(); + switch (Name[0]) { + case 's': + if (Name == "strlen") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setOnlyReadsMemory(F); + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "strchr" || + Name == "strrchr") { + if (FTy->getNumParams() != 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isIntegerTy()) + return; + setOnlyReadsMemory(F); + setDoesNotThrow(F); + } else if (Name == "strcpy" || + Name == "stpcpy" || + Name == "strcat" || + Name == "strtol" || + Name == "strtod" || + Name == "strtof" || + Name == "strtoul" || + Name == "strtoll" || + Name == "strtold" || + Name == "strncat" || + Name == "strncpy" || + Name == "strtoull") { + if (FTy->getNumParams() < 2 || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "strxfrm") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "strcmp" || + Name == "strspn" || + Name == "strncmp" || + Name == "strcspn" || + Name == "strcoll" || + Name == "strcasecmp" || + Name == "strncasecmp") { + if (FTy->getNumParams() < 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setOnlyReadsMemory(F); + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "strstr" || + Name == "strpbrk") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setOnlyReadsMemory(F); + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "strtok" || + Name == "strtok_r") { + if (FTy->getNumParams() < 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "scanf" || + Name == "setbuf" || + Name == "setvbuf") { + if (FTy->getNumParams() < 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "strdup" || + Name == "strndup") { + if (FTy->getNumParams() < 1 || !FTy->getReturnType()->isPointerTy() || + !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 1); + } else if (Name == "stat" || + Name == "sscanf" || + Name == "sprintf" || + Name == "statvfs") { + if (FTy->getNumParams() < 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "snprintf") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(2)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 3); + } else if (Name == "setitimer") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(1)->isPointerTy() || + !FTy->getParamType(2)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + setDoesNotCapture(F, 3); + } else if (Name == "system") { + if (FTy->getNumParams() != 1 || + !FTy->getParamType(0)->isPointerTy()) + return; + // May throw; "system" is a valid pthread cancellation point. + setDoesNotCapture(F, 1); + } + break; + case 'm': + if (Name == "malloc") { + if (FTy->getNumParams() != 1 || + !FTy->getReturnType()->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + } else if (Name == "memcmp") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setOnlyReadsMemory(F); + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "memchr" || + Name == "memrchr") { + if (FTy->getNumParams() != 3) + return; + setOnlyReadsMemory(F); + setDoesNotThrow(F); + } else if (Name == "modf" || + Name == "modff" || + Name == "modfl" || + Name == "memcpy" || + Name == "memccpy" || + Name == "memmove") { + if (FTy->getNumParams() < 2 || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "memalign") { + if (!FTy->getReturnType()->isPointerTy()) + return; + setDoesNotAlias(F, 0); + } else if (Name == "mkdir" || + Name == "mktime") { + if (FTy->getNumParams() == 0 || + !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'r': + if (Name == "realloc") { + if (FTy->getNumParams() != 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getReturnType()->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 1); + } else if (Name == "read") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(1)->isPointerTy()) + return; + // May throw; "read" is a valid pthread cancellation point. + setDoesNotCapture(F, 2); + } else if (Name == "rmdir" || + Name == "rewind" || + Name == "remove" || + Name == "realpath") { + if (FTy->getNumParams() < 1 || + !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "rename" || + Name == "readlink") { + if (FTy->getNumParams() < 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } + break; + case 'w': + if (Name == "write") { + if (FTy->getNumParams() != 3 || !FTy->getParamType(1)->isPointerTy()) + return; + // May throw; "write" is a valid pthread cancellation point. + setDoesNotCapture(F, 2); + } + break; + case 'b': + if (Name == "bcopy") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "bcmp") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setOnlyReadsMemory(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "bzero") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'c': + if (Name == "calloc") { + if (FTy->getNumParams() != 2 || + !FTy->getReturnType()->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + } else if (Name == "chmod" || + Name == "chown" || + Name == "ctermid" || + Name == "clearerr" || + Name == "closedir") { + if (FTy->getNumParams() == 0 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'a': + if (Name == "atoi" || + Name == "atol" || + Name == "atof" || + Name == "atoll") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setOnlyReadsMemory(F); + setDoesNotCapture(F, 1); + } else if (Name == "access") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'f': + if (Name == "fopen") { + if (FTy->getNumParams() != 2 || + !FTy->getReturnType()->isPointerTy() || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "fdopen") { + if (FTy->getNumParams() != 2 || + !FTy->getReturnType()->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 2); + } else if (Name == "feof" || + Name == "free" || + Name == "fseek" || + Name == "ftell" || + Name == "fgetc" || + Name == "fseeko" || + Name == "ftello" || + Name == "fileno" || + Name == "fflush" || + Name == "fclose" || + Name == "fsetpos" || + Name == "flockfile" || + Name == "funlockfile" || + Name == "ftrylockfile") { + if (FTy->getNumParams() == 0 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "ferror") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setOnlyReadsMemory(F); + } else if (Name == "fputc" || + Name == "fstat" || + Name == "frexp" || + Name == "frexpf" || + Name == "frexpl" || + Name == "fstatvfs") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "fgets") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(2)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 3); + } else if (Name == "fread" || + Name == "fwrite") { + if (FTy->getNumParams() != 4 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(3)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 4); + } else if (Name == "fputs" || + Name == "fscanf" || + Name == "fprintf" || + Name == "fgetpos") { + if (FTy->getNumParams() < 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } + break; + case 'g': + if (Name == "getc" || + Name == "getlogin_r" || + Name == "getc_unlocked") { + if (FTy->getNumParams() == 0 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "getenv") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setOnlyReadsMemory(F); + setDoesNotCapture(F, 1); + } else if (Name == "gets" || + Name == "getchar") { + setDoesNotThrow(F); + } else if (Name == "getitimer") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "getpwnam") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'u': + if (Name == "ungetc") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "uname" || + Name == "unlink" || + Name == "unsetenv") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "utime" || + Name == "utimes") { + if (FTy->getNumParams() != 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } + break; + case 'p': + if (Name == "putc") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "puts" || + Name == "printf" || + Name == "perror") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "pread" || + Name == "pwrite") { + if (FTy->getNumParams() != 4 || !FTy->getParamType(1)->isPointerTy()) + return; + // May throw; these are valid pthread cancellation points. + setDoesNotCapture(F, 2); + } else if (Name == "putchar") { + setDoesNotThrow(F); + } else if (Name == "popen") { + if (FTy->getNumParams() != 2 || + !FTy->getReturnType()->isPointerTy() || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "pclose") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'v': + if (Name == "vscanf") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "vsscanf" || + Name == "vfscanf") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(1)->isPointerTy() || + !FTy->getParamType(2)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "valloc") { + if (!FTy->getReturnType()->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + } else if (Name == "vprintf") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "vfprintf" || + Name == "vsprintf") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "vsnprintf") { + if (FTy->getNumParams() != 4 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(2)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 3); + } + break; + case 'o': + if (Name == "open") { + if (FTy->getNumParams() < 2 || !FTy->getParamType(0)->isPointerTy()) + return; + // May throw; "open" is a valid pthread cancellation point. + setDoesNotCapture(F, 1); + } else if (Name == "opendir") { + if (FTy->getNumParams() != 1 || + !FTy->getReturnType()->isPointerTy() || + !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 1); + } + break; + case 't': + if (Name == "tmpfile") { + if (!FTy->getReturnType()->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + } else if (Name == "times") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'h': + if (Name == "htonl" || + Name == "htons") { + setDoesNotThrow(F); + setDoesNotAccessMemory(F); + } + break; + case 'n': + if (Name == "ntohl" || + Name == "ntohs") { + setDoesNotThrow(F); + setDoesNotAccessMemory(F); + } + break; + case 'l': + if (Name == "lstat") { + if (FTy->getNumParams() != 2 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "lchown") { + if (FTy->getNumParams() != 3 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } + break; + case 'q': + if (Name == "qsort") { + if (FTy->getNumParams() != 4 || !FTy->getParamType(3)->isPointerTy()) + return; + // May throw; places call through function pointer. + setDoesNotCapture(F, 4); + } + break; + case '_': + if (Name == "__strdup" || + Name == "__strndup") { + if (FTy->getNumParams() < 1 || + !FTy->getReturnType()->isPointerTy() || + !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 1); + } else if (Name == "__strtok_r") { + if (FTy->getNumParams() != 3 || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "_IO_getc") { + if (FTy->getNumParams() != 1 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "_IO_putc") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } + break; + case 1: + if (Name == "\1__isoc99_scanf") { + if (FTy->getNumParams() < 1 || + !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "\1stat64" || + Name == "\1lstat64" || + Name == "\1statvfs64" || + Name == "\1__isoc99_sscanf") { + if (FTy->getNumParams() < 1 || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "\1fopen64") { + if (FTy->getNumParams() != 2 || + !FTy->getReturnType()->isPointerTy() || + !FTy->getParamType(0)->isPointerTy() || + !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + } else if (Name == "\1fseeko64" || + Name == "\1ftello64") { + if (FTy->getNumParams() == 0 || !FTy->getParamType(0)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 1); + } else if (Name == "\1tmpfile64") { + if (!FTy->getReturnType()->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotAlias(F, 0); + } else if (Name == "\1fstat64" || + Name == "\1fstatvfs64") { + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + return; + setDoesNotThrow(F); + setDoesNotCapture(F, 2); + } else if (Name == "\1open64") { + if (FTy->getNumParams() < 2 || !FTy->getParamType(0)->isPointerTy()) + return; + // May throw; "open" is a valid pthread cancellation point. + setDoesNotCapture(F, 1); + } + break; + } +} + /// doInitialization - Add attributes to well-known functions. /// bool SimplifyLibCalls::doInitialization(Module &M) { Modified = false; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { Function &F = *I; - if (!F.isDeclaration()) - continue; - - if (!F.hasName()) - continue; - - const FunctionType *FTy = F.getFunctionType(); - - StringRef Name = F.getName(); - switch (Name[0]) { - case 's': - if (Name == "strlen") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setOnlyReadsMemory(F); - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "strchr" || - Name == "strrchr") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isIntegerTy()) - continue; - setOnlyReadsMemory(F); - setDoesNotThrow(F); - } else if (Name == "strcpy" || - Name == "stpcpy" || - Name == "strcat" || - Name == "strtol" || - Name == "strtod" || - Name == "strtof" || - Name == "strtoul" || - Name == "strtoll" || - Name == "strtold" || - Name == "strncat" || - Name == "strncpy" || - Name == "strtoull") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "strxfrm") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "strcmp" || - Name == "strspn" || - Name == "strncmp" || - Name == "strcspn" || - Name == "strcoll" || - Name == "strcasecmp" || - Name == "strncasecmp") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setOnlyReadsMemory(F); - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "strstr" || - Name == "strpbrk") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setOnlyReadsMemory(F); - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "strtok" || - Name == "strtok_r") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "scanf" || - Name == "setbuf" || - Name == "setvbuf") { - if (FTy->getNumParams() < 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "strdup" || - Name == "strndup") { - if (FTy->getNumParams() < 1 || - !FTy->getReturnType()->isPointerTy() || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 1); - } else if (Name == "stat" || - Name == "sscanf" || - Name == "sprintf" || - Name == "statvfs") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "snprintf") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(2)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 3); - } else if (Name == "setitimer") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(1)->isPointerTy() || - !FTy->getParamType(2)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - setDoesNotCapture(F, 3); - } else if (Name == "system") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - // May throw; "system" is a valid pthread cancellation point. - setDoesNotCapture(F, 1); - } - break; - case 'm': - if (Name == "malloc") { - if (FTy->getNumParams() != 1 || - !FTy->getReturnType()->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - } else if (Name == "memcmp") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setOnlyReadsMemory(F); - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "memchr" || - Name == "memrchr") { - if (FTy->getNumParams() != 3) - continue; - setOnlyReadsMemory(F); - setDoesNotThrow(F); - } else if (Name == "modf" || - Name == "modff" || - Name == "modfl" || - Name == "memcpy" || - Name == "memccpy" || - Name == "memmove") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "memalign") { - if (!FTy->getReturnType()->isPointerTy()) - continue; - setDoesNotAlias(F, 0); - } else if (Name == "mkdir" || - Name == "mktime") { - if (FTy->getNumParams() == 0 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'r': - if (Name == "realloc") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getReturnType()->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 1); - } else if (Name == "read") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(1)->isPointerTy()) - continue; - // May throw; "read" is a valid pthread cancellation point. - setDoesNotCapture(F, 2); - } else if (Name == "rmdir" || - Name == "rewind" || - Name == "remove" || - Name == "realpath") { - if (FTy->getNumParams() < 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "rename" || - Name == "readlink") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } - break; - case 'w': - if (Name == "write") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(1)->isPointerTy()) - continue; - // May throw; "write" is a valid pthread cancellation point. - setDoesNotCapture(F, 2); - } - break; - case 'b': - if (Name == "bcopy") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "bcmp") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setOnlyReadsMemory(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "bzero") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'c': - if (Name == "calloc") { - if (FTy->getNumParams() != 2 || - !FTy->getReturnType()->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - } else if (Name == "chmod" || - Name == "chown" || - Name == "ctermid" || - Name == "clearerr" || - Name == "closedir") { - if (FTy->getNumParams() == 0 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'a': - if (Name == "atoi" || - Name == "atol" || - Name == "atof" || - Name == "atoll") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setOnlyReadsMemory(F); - setDoesNotCapture(F, 1); - } else if (Name == "access") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'f': - if (Name == "fopen") { - if (FTy->getNumParams() != 2 || - !FTy->getReturnType()->isPointerTy() || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "fdopen") { - if (FTy->getNumParams() != 2 || - !FTy->getReturnType()->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 2); - } else if (Name == "feof" || - Name == "free" || - Name == "fseek" || - Name == "ftell" || - Name == "fgetc" || - Name == "fseeko" || - Name == "ftello" || - Name == "fileno" || - Name == "fflush" || - Name == "fclose" || - Name == "fsetpos" || - Name == "flockfile" || - Name == "funlockfile" || - Name == "ftrylockfile") { - if (FTy->getNumParams() == 0 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "ferror") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setOnlyReadsMemory(F); - } else if (Name == "fputc" || - Name == "fstat" || - Name == "frexp" || - Name == "frexpf" || - Name == "frexpl" || - Name == "fstatvfs") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "fgets") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(2)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 3); - } else if (Name == "fread" || - Name == "fwrite") { - if (FTy->getNumParams() != 4 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(3)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 4); - } else if (Name == "fputs" || - Name == "fscanf" || - Name == "fprintf" || - Name == "fgetpos") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } - break; - case 'g': - if (Name == "getc" || - Name == "getlogin_r" || - Name == "getc_unlocked") { - if (FTy->getNumParams() == 0 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "getenv") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setOnlyReadsMemory(F); - setDoesNotCapture(F, 1); - } else if (Name == "gets" || - Name == "getchar") { - setDoesNotThrow(F); - } else if (Name == "getitimer") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "getpwnam") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'u': - if (Name == "ungetc") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "uname" || - Name == "unlink" || - Name == "unsetenv") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "utime" || - Name == "utimes") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } - break; - case 'p': - if (Name == "putc") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "puts" || - Name == "printf" || - Name == "perror") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "pread" || - Name == "pwrite") { - if (FTy->getNumParams() != 4 || - !FTy->getParamType(1)->isPointerTy()) - continue; - // May throw; these are valid pthread cancellation points. - setDoesNotCapture(F, 2); - } else if (Name == "putchar") { - setDoesNotThrow(F); - } else if (Name == "popen") { - if (FTy->getNumParams() != 2 || - !FTy->getReturnType()->isPointerTy() || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "pclose") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'v': - if (Name == "vscanf") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "vsscanf" || - Name == "vfscanf") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(1)->isPointerTy() || - !FTy->getParamType(2)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "valloc") { - if (!FTy->getReturnType()->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - } else if (Name == "vprintf") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "vfprintf" || - Name == "vsprintf") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "vsnprintf") { - if (FTy->getNumParams() != 4 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(2)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 3); - } - break; - case 'o': - if (Name == "open") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(0)->isPointerTy()) - continue; - // May throw; "open" is a valid pthread cancellation point. - setDoesNotCapture(F, 1); - } else if (Name == "opendir") { - if (FTy->getNumParams() != 1 || - !FTy->getReturnType()->isPointerTy() || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 1); - } - break; - case 't': - if (Name == "tmpfile") { - if (!FTy->getReturnType()->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - } else if (Name == "times") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'h': - if (Name == "htonl" || - Name == "htons") { - setDoesNotThrow(F); - setDoesNotAccessMemory(F); - } - break; - case 'n': - if (Name == "ntohl" || - Name == "ntohs") { - setDoesNotThrow(F); - setDoesNotAccessMemory(F); - } - break; - case 'l': - if (Name == "lstat") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "lchown") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } - break; - case 'q': - if (Name == "qsort") { - if (FTy->getNumParams() != 4 || - !FTy->getParamType(3)->isPointerTy()) - continue; - // May throw; places call through function pointer. - setDoesNotCapture(F, 4); - } - break; - case '_': - if (Name == "__strdup" || - Name == "__strndup") { - if (FTy->getNumParams() < 1 || - !FTy->getReturnType()->isPointerTy() || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 1); - } else if (Name == "__strtok_r") { - if (FTy->getNumParams() != 3 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "_IO_getc") { - if (FTy->getNumParams() != 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "_IO_putc") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } - break; - case 1: - if (Name == "\1__isoc99_scanf") { - if (FTy->getNumParams() < 1 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "\1stat64" || - Name == "\1lstat64" || - Name == "\1statvfs64" || - Name == "\1__isoc99_sscanf") { - if (FTy->getNumParams() < 1 || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "\1fopen64") { - if (FTy->getNumParams() != 2 || - !FTy->getReturnType()->isPointerTy() || - !FTy->getParamType(0)->isPointerTy() || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - setDoesNotCapture(F, 1); - setDoesNotCapture(F, 2); - } else if (Name == "\1fseeko64" || - Name == "\1ftello64") { - if (FTy->getNumParams() == 0 || - !FTy->getParamType(0)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 1); - } else if (Name == "\1tmpfile64") { - if (!FTy->getReturnType()->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotAlias(F, 0); - } else if (Name == "\1fstat64" || - Name == "\1fstatvfs64") { - if (FTy->getNumParams() != 2 || - !FTy->getParamType(1)->isPointerTy()) - continue; - setDoesNotThrow(F); - setDoesNotCapture(F, 2); - } else if (Name == "\1open64") { - if (FTy->getNumParams() < 2 || - !FTy->getParamType(0)->isPointerTy()) - continue; - // May throw; "open" is a valid pthread cancellation point. - setDoesNotCapture(F, 1); - } - break; - } + if (F.isDeclaration() && F.hasName()) + inferPrototypeAttributes(F); } return Modified; } From sabre at nondot.org Thu Feb 24 01:16:14 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Feb 2011 07:16:14 -0000 Subject: [llvm-commits] [llvm] r126367 - /llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Message-ID: <20110224071614.87AA42A6C12C@llvm.org> Author: lattner Date: Thu Feb 24 01:16:14 2011 New Revision: 126367 URL: http://llvm.org/viewvc/llvm-project?rev=126367&view=rev Log: wire TargetLibraryInfo into simplify libcalls and use it in a couple of trivial places. This pass needs a lot of work. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=126367&r1=126366&r2=126367&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Thu Feb 24 01:16:14 2011 @@ -25,13 +25,14 @@ #include "llvm/Support/IRBuilder.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLibraryInfo.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Config/config.h" +#include "llvm/Config/config.h" // FIXME: Shouldn't depend on host! using namespace llvm; STATISTIC(NumSimplified, "Number of library calls simplified"); @@ -1369,6 +1370,8 @@ /// This pass optimizes well known library functions from libc and libm. /// class SimplifyLibCalls : public FunctionPass { + TargetLibraryInfo *TLI; + StringMap Optimizations; // String and Memory LibCall Optimizations StrCatOpt StrCat; StrNCatOpt StrNCat; StrChrOpt StrChr; StrRChrOpt StrRChr; @@ -1385,7 +1388,7 @@ SPrintFOpt SPrintF; PrintFOpt PrintF; FWriteOpt FWrite; FPutsOpt FPuts; FPrintFOpt FPrintF; PutsOpt Puts; - + bool Modified; // This is only used by doInitialization. public: static char ID; // Pass identification @@ -1404,13 +1407,18 @@ void inferPrototypeAttributes(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); } }; - char SimplifyLibCalls::ID = 0; } // end anonymous namespace. -INITIALIZE_PASS(SimplifyLibCalls, "simplify-libcalls", - "Simplify well-known library calls", false, false) +char SimplifyLibCalls::ID = 0; + +INITIALIZE_PASS_BEGIN(SimplifyLibCalls, "simplify-libcalls", + "Simplify well-known library calls", false, false) +INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo) +INITIALIZE_PASS_END(SimplifyLibCalls, "simplify-libcalls", + "Simplify well-known library calls", false, false) // Public interface to the Simplify LibCalls pass. FunctionPass *llvm::createSimplifyLibCallsPass() { @@ -1442,9 +1450,9 @@ Optimizations["strcspn"] = &StrCSpn; Optimizations["strstr"] = &StrStr; Optimizations["memcmp"] = &MemCmp; - Optimizations["memcpy"] = &MemCpy; + if (TLI->has(LibFunc::memcpy)) Optimizations["memcpy"] = &MemCpy; Optimizations["memmove"] = &MemMove; - Optimizations["memset"] = &MemSet; + if (TLI->has(LibFunc::memset)) Optimizations["memset"] = &MemSet; // _chk variants of String and Memory LibCall Optimizations. Optimizations["__strcpy_chk"] = &StrCpyChk; @@ -1507,6 +1515,8 @@ /// runOnFunction - Top level algorithm. /// bool SimplifyLibCalls::runOnFunction(Function &F) { + TLI = &getAnalysis(); + if (Optimizations.empty()) InitOptimizations(); From baldrick at free.fr Thu Feb 24 02:27:09 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 09:27:09 +0100 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash In-Reply-To: References: Message-ID: <4D66165D.909@free.fr> Hi Galina, > Starting from the revion 124059 llvm-gcc cross to ARM build failing > with the ld.exe crash. so commit 124059 is the cause of the crash? ------------------------------------------------------------------------ r124059 | rafael | 2011-01-23 06:43:40 +0100 (Sun, 23 Jan 2011) | 2 lines Delay the creation of eh_frame so that the user can change the defaults. Add support for SHT_X86_64_UNWIND. ------------------------------------------------------------------------ Ciao, Duncan. From anton at korobeynikov.info Thu Feb 24 02:46:03 2011 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 24 Feb 2011 11:46:03 +0300 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash In-Reply-To: <4D66165D.909@free.fr> References: <4D66165D.909@free.fr> Message-ID: > so commit 124059 is the cause of the crash? > > ------------------------------------------------------------------------ > r124059 | rafael | 2011-01-23 06:43:40 +0100 (Sun, 23 Jan 2011) | 2 lines > > Delay the creation of eh_frame so that the user can change the defaults. > Add support for SHT_X86_64_UNWIND. > ------------------------------------------------------------------------ This commit looks like it can be reverted independently. Galina, does reverting it fix the problem? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From baldrick at free.fr Thu Feb 24 03:14:44 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 09:14:44 -0000 Subject: [llvm-commits] [dragonegg] r126373 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110224091444.957BF2A6C12D@llvm.org> Author: baldrick Date: Thu Feb 24 03:14:44 2011 New Revision: 126373 URL: http://llvm.org/viewvc/llvm-project?rev=126373&view=rev Log: Bail out if an "asm goto" statement is encountered rather than quietly miscompiling the code. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126373&r1=126372&r2=126373&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Thu Feb 24 03:14:44 2011 @@ -6699,6 +6699,12 @@ //===----------------------------------------------------------------------===// void TreeToLLVM::RenderGIMPLE_ASM(gimple stmt) { + // TODO: Add support for labels. + if (gimple_asm_nlabels(stmt) > 0) { + sorry("'asm goto' not supported"); + return; + } + // Some of the GCC utilities we use still want lists and not gimple, so create // input, output and clobber lists for their benefit. unsigned NumOutputs = gimple_asm_noutputs (stmt); From baldrick at free.fr Thu Feb 24 03:22:05 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 09:22:05 -0000 Subject: [llvm-commits] [dragonegg] r126374 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110224092205.D2DEE2A6C12D@llvm.org> Author: baldrick Date: Thu Feb 24 03:22:05 2011 New Revision: 126374 URL: http://llvm.org/viewvc/llvm-project?rev=126374&view=rev Log: Simplify part of asm handling, and add some explanatory comments. In particular there is no need to resolve symbolic names because nowadays it is done before getting here. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126374&r1=126373&r2=126374&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Thu Feb 24 03:22:05 2011 @@ -3112,8 +3112,7 @@ /// punctuation. /// Other %xN expressions are turned into LLVM ${N:x} operands. /// -static std::string ConvertInlineAsmStr(gimple stmt, tree outputs, tree inputs, - tree labels, unsigned NumOperands) { +static std::string ConvertInlineAsmStr(gimple stmt, unsigned NumOperands) { const char *AsmStr = gimple_asm_string(stmt); // gimple_asm_input_p - This flag is set if this is a non-extended ASM, @@ -3131,17 +3130,11 @@ } } - // Expand [name] symbolic operand names. - tree str = resolve_asm_operand_names(build_string (strlen (AsmStr), AsmStr), - outputs, inputs, labels); - - const char *InStr = TREE_STRING_POINTER(str); - std::string Result; while (1) { - switch (*InStr++) { + switch (*AsmStr++) { case 0: return Result; // End of string. - default: Result += InStr[-1]; break; // Normal character. + default: Result += AsmStr[-1]; break; // Normal character. case '$': Result += "$$"; break; // Escape '$' characters. #ifdef ASSEMBLER_DIALECT // Note that we can't escape to ${, because that is the syntax for vars. @@ -3150,23 +3143,23 @@ case '|': Result += "$|"; break; // Escape '|' character. #endif case '%': // GCC escape character. - char EscapedChar = *InStr++; + char EscapedChar = *AsmStr++; if (EscapedChar == '%') { // Escaped '%' character Result += '%'; } else if (EscapedChar == '=') { // Unique ID for the asm instance. Result += "${:uid}"; } #ifdef LLVM_ASM_EXTENSIONS - LLVM_ASM_EXTENSIONS(EscapedChar, InStr, Result) + LLVM_ASM_EXTENSIONS(EscapedChar, AsmStr, Result) #endif else if (ISALPHA(EscapedChar)) { // % followed by a letter and some digits. This outputs an operand in a // special way depending on the letter. We turn this into LLVM ${N:o} // syntax. char *EndPtr; - unsigned long OpNum = strtoul(InStr, &EndPtr, 10); + unsigned long OpNum = strtoul(AsmStr, &EndPtr, 10); - if (InStr == EndPtr) { + if (AsmStr == EndPtr) { error_at(gimple_location(stmt), "operand number missing after %%-letter"); return Result; @@ -3175,11 +3168,11 @@ return Result; } Result += "${" + utostr(OpNum) + ":" + EscapedChar + "}"; - InStr = EndPtr; + AsmStr = EndPtr; } else if (ISDIGIT(EscapedChar)) { char *EndPtr; - unsigned long OpNum = strtoul(InStr-1, &EndPtr, 10); - InStr = EndPtr; + unsigned long OpNum = strtoul(AsmStr-1, &EndPtr, 10); + AsmStr = EndPtr; Result += "$" + utostr(OpNum); #ifdef PRINT_OPERAND_PUNCT_VALID_P } else if (PRINT_OPERAND_PUNCT_VALID_P((unsigned char)EscapedChar)) { @@ -3460,8 +3453,9 @@ static void FreeConstTupleStrings(const char **ReplacementStrings, unsigned int Size) { - for (unsigned int i=0; i(ReplacementStrings[i])); + if (ReplacementStrings) + for (unsigned int i=0; i(ReplacementStrings[i])); } @@ -6699,6 +6693,51 @@ //===----------------------------------------------------------------------===// void TreeToLLVM::RenderGIMPLE_ASM(gimple stmt) { + // A gimple asm statement consists of an asm string, a list of outputs, a list + // of inputs, a list of clobbers, a list of labels and a "volatile" flag. + // These correspond directly to the elements of an asm statement. For example + // asm ("combine %2,%0" : "=r" (x) : "0" (x), "g" (y)); + // Here the asm string is "combine %2,%0" and can be obtained as a const char* + // by calling gimple_asm_string. The only output is "=r" (x). The number of + // outputs is given by gimple_asm_noutputs, 1 in this case, and the outputs + // themselves can be obtained by calling gimple_asm_output_op. This returns a + // TREE_LIST node with an SSA name for "x" as the TREE_VALUE; the TREE_PURPOSE + // is also a TREE_LIST with TREE_VALUE a string constant holding "=r". There + // are two inputs, "0" (x) and "g" (y), so gimple_asm_ninputs returns 2. The + // routine gimple_asm_input_op returns them in the same format as for outputs. + // The number of clobbers is returned by gimple_asm_nclobbers, 0 in this case. + // To get the clobbers use gimple_asm_clobber_op. This returns a TREE_LIST + // node with TREE_VALUE a string constant holding the clobber. To find out if + // the asm is volatile call gimple_asm_volatile_p, which returns true if so. + // See below for labels (this example does not have any). + + // Note that symbolic names have been substituted before getting here. For + // example this + // asm ("cmoveq %1,%2,%[result]" : [result] "=r"(result) + // : "r"(test), "r"(new), "[result]"(old)); + // turns up as + // asm ("cmoveq %1,%2,%0" : "=r"(result) : "r"(test), "r"(new), "0"(old)); + + // Note that clobbers may not turn up in the same order as in the original, eg + // asm volatile ("movc3 %0,%1,%2" : /* no outputs */ + // : "g" (from), "g" (to), "g" (count) + // : "r0", "r1", "r2", "r3", "r4", "r5"); + // The clobbers turn up as "r5", "r4", "r3", "r2", "r1", "r0". + + // Here is an example of the "asm goto" construct (not yet supported by LLVM): + // int frob(int x) { + // int y; + // asm goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5" + // : : "r"(x), "r"(&y) : "r5", "memory" : error); + // return y; + // error: + // return -1; + // } + // The number of labels, one in this case, is returned by gimple_asm_nlabels. + // The labels themselves are returned by gimple_asm_label_op as a TREE_LIST + // node with TREE_PURPOSE a string constant holding the label name ("error") + // and TREE_VALUE holding the appropriate LABEL_DECL. + // TODO: Add support for labels. if (gimple_asm_nlabels(stmt) > 0) { sorry("'asm goto' not supported"); @@ -6820,8 +6859,6 @@ std::vector CallOps; std::vector CallArgTypes; - std::string NewAsmStr = ConvertInlineAsmStr(stmt, outputs, inputs, labels, - NumOutputs+NumInputs); std::string ConstraintStr; bool HasSideEffects = gimple_asm_volatile_p(stmt) || !outputs; @@ -6843,8 +6880,7 @@ bool IsInOut, AllowsReg, AllowsMem; if (!parse_output_constraint(&Constraint, ValNum, NumInputs, NumOutputs, &AllowsMem, &AllowsReg, &IsInOut)) { - if (NumChoices>1) - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } assert(Constraint[0] == '=' && "Not an output constraint?"); @@ -6930,8 +6966,7 @@ if (!parse_input_constraint(Constraints+ValNum, ValNum-NumOutputs, NumInputs, NumOutputs, NumInOut, Constraints, &AllowsMem, &AllowsReg)) { - if (NumChoices>1) - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } bool isIndirect = false; @@ -7008,8 +7043,7 @@ error_at(gimple_location(stmt), "unsupported inline asm: input constraint with a matching " "output constraint of incompatible type!"); - if (NumChoices>1) - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } unsigned OTyBits = TD.getTypeSizeInBits(OTy); @@ -7089,8 +7123,7 @@ case -2: // Invalid. error_at(gimple_location(stmt), "unknown register name %qs in %", RegName); - if (NumChoices>1) - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; case -3: // cc ConstraintStr += ",~{cc}"; @@ -7128,11 +7161,11 @@ // Make sure we're created a valid inline asm expression. if (!InlineAsm::Verify(FTy, ConstraintStr)) { error_at(gimple_location(stmt), "Invalid or unsupported inline assembly!"); - if (NumChoices>1) - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } + std::string NewAsmStr = ConvertInlineAsmStr(stmt, NumOutputs+NumInputs); Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr, HasSideEffects); CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(), CallResultTypes.empty() ? "" : "asmtmp"); @@ -7162,8 +7195,7 @@ if (const TargetLowering *TLI = TheTarget->getTargetLowering()) TLI->ExpandInlineAsm(CV); - if (NumChoices>1) - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); } void TreeToLLVM::RenderGIMPLE_ASSIGN(gimple stmt) { From zwarich at apple.com Thu Feb 24 04:00:04 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 24 Feb 2011 10:00:04 -0000 Subject: [llvm-commits] [llvm] r126375 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <20110224100004.D54142A6C12C@llvm.org> Author: zwarich Date: Thu Feb 24 04:00:04 2011 New Revision: 126375 URL: http://llvm.org/viewvc/llvm-project?rev=126375&view=rev Log: Have isel visit blocks in reverse postorder rather than an undefined order. This allows for the information propagated across basic blocks to be merged at phis. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126375&r1=126374&r2=126375&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 24 04:00:04 2011 @@ -49,6 +49,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/Statistic.h" #include using namespace llvm; @@ -832,8 +833,10 @@ FastIS = TLI.createFastISel(*FuncInfo); // Iterate over all basic blocks in the function. - for (Function::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) { - const BasicBlock *LLVMBB = &*I; + ReversePostOrderTraversal RPOT(&Fn); + for (ReversePostOrderTraversal::rpo_iterator + I = RPOT.begin(), E = RPOT.end(); I != E; ++I) { + const BasicBlock *LLVMBB = *I; #ifndef NDEBUG CheckLineNumbers(LLVMBB); #endif From zwarich at apple.com Thu Feb 24 04:00:08 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 24 Feb 2011 10:00:08 -0000 Subject: [llvm-commits] [llvm] r126376 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <20110224100009.165512A6C12D@llvm.org> Author: zwarich Date: Thu Feb 24 04:00:08 2011 New Revision: 126376 URL: http://llvm.org/viewvc/llvm-project?rev=126376&view=rev Log: Refactor the LiveOutInfo interface into a few methods on FunctionLoweringInfo and make the actual map private. Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126376&r1=126375&r2=126376&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Thu Feb 24 04:00:08 2011 @@ -105,9 +105,6 @@ APInt KnownOne, KnownZero; LiveOutInfo() : NumSignBits(0), KnownOne(1, 0), KnownZero(1, 0) {} }; - - /// LiveOutRegInfo - Information about live out vregs. - IndexedMap LiveOutRegInfo; /// PHINodesToUpdate - A list of phi instructions whose operand list will /// be updated after processing the current basic block. @@ -143,12 +140,38 @@ return R = CreateRegs(V->getType()); } + /// GetLiveOutRegInfo - Gets LiveOutInfo for a register, returning NULL if the + /// register is a PHI destination and the PHI's LiveOutInfo is not valid. + const LiveOutInfo *GetLiveOutRegInfo(unsigned Reg) { + if (!LiveOutRegInfo.inBounds(Reg)) + return NULL; + return &LiveOutRegInfo[Reg]; + } + + /// AddLiveOutRegInfo - Adds LiveOutInfo for a register. + void AddLiveOutRegInfo(unsigned Reg, unsigned NumSignBits, + const APInt &KnownZero, const APInt &KnownOne) { + // Only install this information if it tells us something. + if (NumSignBits == 1 && KnownZero == 0 && KnownOne == 0) + return; + + LiveOutRegInfo.grow(Reg); + LiveOutInfo &LOI = LiveOutRegInfo[Reg]; + LOI.NumSignBits = NumSignBits; + LOI.KnownOne = KnownOne; + LOI.KnownZero = KnownZero; + } + /// setByValArgumentFrameIndex - Record frame index for the byval /// argument. void setByValArgumentFrameIndex(const Argument *A, int FI); /// getByValArgumentFrameIndex - Get frame index for the byval argument. int getByValArgumentFrameIndex(const Argument *A); + +private: + /// LiveOutRegInfo - Information about live out vregs. + IndexedMap LiveOutRegInfo; }; /// AddCatchInfo - Extract the personality and type infos from an eh.selector Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=126376&r1=126375&r2=126376&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 24 04:00:08 2011 @@ -641,16 +641,17 @@ // If the source register was virtual and if we know something about it, // add an assert node. if (!TargetRegisterInfo::isVirtualRegister(Regs[Part+i]) || - !RegisterVT.isInteger() || RegisterVT.isVector() || - !FuncInfo.LiveOutRegInfo.inBounds(Regs[Part+i])) + !RegisterVT.isInteger() || RegisterVT.isVector()) + continue; + + const FunctionLoweringInfo::LiveOutInfo *LOI = + FuncInfo.GetLiveOutRegInfo(Regs[Part+i]); + if (!LOI) continue; - - const FunctionLoweringInfo::LiveOutInfo &LOI = - FuncInfo.LiveOutRegInfo[Regs[Part+i]]; unsigned RegSize = RegisterVT.getSizeInBits(); - unsigned NumSignBits = LOI.NumSignBits; - unsigned NumZeroBits = LOI.KnownZero.countLeadingOnes(); + unsigned NumSignBits = LOI->NumSignBits; + unsigned NumZeroBits = LOI->KnownZero.countLeadingOnes(); // FIXME: We capture more information than the dag can represent. For // now, just use the tightest assertzext/assertsext possible. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126376&r1=126375&r2=126376&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 24 04:00:08 2011 @@ -480,16 +480,7 @@ unsigned NumSignBits = CurDAG->ComputeNumSignBits(Src); Mask = APInt::getAllOnesValue(SrcVT.getSizeInBits()); CurDAG->ComputeMaskedBits(Src, Mask, KnownZero, KnownOne); - - // Only install this information if it tells us something. - if (NumSignBits != 1 || KnownZero != 0 || KnownOne != 0) { - FuncInfo->LiveOutRegInfo.grow(DestReg); - FunctionLoweringInfo::LiveOutInfo &LOI = - FuncInfo->LiveOutRegInfo[DestReg]; - LOI.NumSignBits = NumSignBits; - LOI.KnownOne = KnownOne; - LOI.KnownZero = KnownZero; - } + FuncInfo->AddLiveOutRegInfo(DestReg, NumSignBits, KnownZero, KnownOne); } while (!Worklist.empty()); } From zwarich at apple.com Thu Feb 24 04:00:13 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 24 Feb 2011 10:00:13 -0000 Subject: [llvm-commits] [llvm] r126377 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <20110224100013.55A0B2A6C12C@llvm.org> Author: zwarich Date: Thu Feb 24 04:00:13 2011 New Revision: 126377 URL: http://llvm.org/viewvc/llvm-project?rev=126377&view=rev Log: Track blocks visited in reverse postorder. Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126377&r1=126376&r2=126377&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Thu Feb 24 04:00:13 2011 @@ -106,6 +106,10 @@ LiveOutInfo() : NumSignBits(0), KnownOne(1, 0), KnownZero(1, 0) {} }; + /// VisitedBBs - The set of basic blocks visited thus far by instruction + /// selection. + DenseSet VisitedBBs; + /// PHINodesToUpdate - A list of phi instructions whose operand list will /// be updated after processing the current basic block. /// TODO: This isn't per-function state, it's per-basic-block state. But Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=126377&r1=126376&r2=126377&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Thu Feb 24 04:00:13 2011 @@ -219,6 +219,7 @@ CatchInfoFound.clear(); #endif LiveOutRegInfo.clear(); + VisitedBBs.clear(); ArgDbgValues.clear(); ByValArgFrameIndexMap.clear(); RegFixups.clear(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126377&r1=126376&r2=126377&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 24 04:00:13 2011 @@ -831,6 +831,10 @@ #ifndef NDEBUG CheckLineNumbers(LLVMBB); #endif + + if (OptLevel != CodeGenOpt::None) + FuncInfo->VisitedBBs.insert(LLVMBB); + FuncInfo->MBB = FuncInfo->MBBMap[LLVMBB]; FuncInfo->InsertPt = FuncInfo->MBB->getFirstNonPHI(); From zwarich at apple.com Thu Feb 24 04:00:17 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 24 Feb 2011 10:00:17 -0000 Subject: [llvm-commits] [llvm] r126378 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <20110224100017.10D2B2A6C12D@llvm.org> Author: zwarich Date: Thu Feb 24 04:00:16 2011 New Revision: 126378 URL: http://llvm.org/viewvc/llvm-project?rev=126378&view=rev Log: Add a mechanism for invalidating the LiveOutInfo of a PHI, and use it whenever a block is visited before all of its predecessors. Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126378&r1=126377&r2=126378&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Thu Feb 24 04:00:16 2011 @@ -101,9 +101,11 @@ #endif struct LiveOutInfo { - unsigned NumSignBits; + unsigned NumSignBits : 31; + bool IsValid : 1; APInt KnownOne, KnownZero; - LiveOutInfo() : NumSignBits(0), KnownOne(1, 0), KnownZero(1, 0) {} + LiveOutInfo() : NumSignBits(0), IsValid(true), KnownOne(1, 0), + KnownZero(1, 0) {} }; /// VisitedBBs - The set of basic blocks visited thus far by instruction @@ -149,7 +151,12 @@ const LiveOutInfo *GetLiveOutRegInfo(unsigned Reg) { if (!LiveOutRegInfo.inBounds(Reg)) return NULL; - return &LiveOutRegInfo[Reg]; + + const LiveOutInfo *LOI = &LiveOutRegInfo[Reg]; + if (!LOI->IsValid) + return NULL; + + return LOI; } /// AddLiveOutRegInfo - Adds LiveOutInfo for a register. @@ -166,6 +173,14 @@ LOI.KnownZero = KnownZero; } + /// InvalidatePHILiveOutRegInfo - Invalidates a PHI's LiveOutInfo, to be + /// called when a block is visited before all of its predecessors. + void InvalidatePHILiveOutRegInfo(const PHINode *PN) { + unsigned Reg = ValueMap[PN]; + LiveOutRegInfo.grow(Reg); + LiveOutRegInfo[Reg].IsValid = false; + } + /// setByValArgumentFrameIndex - Record frame index for the byval /// argument. void setByValArgumentFrameIndex(const Argument *A, int FI); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126378&r1=126377&r2=126378&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 24 04:00:16 2011 @@ -832,8 +832,25 @@ CheckLineNumbers(LLVMBB); #endif - if (OptLevel != CodeGenOpt::None) + if (OptLevel != CodeGenOpt::None) { + bool AllPredsVisited = true; + for (const_pred_iterator PI = pred_begin(LLVMBB), PE = pred_end(LLVMBB); + PI != PE; ++PI) { + if (!FuncInfo->VisitedBBs.count(*PI)) { + AllPredsVisited = false; + break; + } + } + + if (!AllPredsVisited) { + for (BasicBlock::const_iterator I = LLVMBB->begin(), E = LLVMBB->end(); + I != E && isa(I); ++I) { + FuncInfo->InvalidatePHILiveOutRegInfo(cast(I)); + } + } + FuncInfo->VisitedBBs.insert(LLVMBB); + } FuncInfo->MBB = FuncInfo->MBBMap[LLVMBB]; FuncInfo->InsertPt = FuncInfo->MBB->getFirstNonPHI(); From zwarich at apple.com Thu Feb 24 04:00:20 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 24 Feb 2011 10:00:20 -0000 Subject: [llvm-commits] [llvm] r126379 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <20110224100020.BEA182A6C12C@llvm.org> Author: zwarich Date: Thu Feb 24 04:00:20 2011 New Revision: 126379 URL: http://llvm.org/viewvc/llvm-project?rev=126379&view=rev Log: Add a getNumSignBits() method to APInt. Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=126379&r1=126378&r2=126379&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Thu Feb 24 04:00:20 2011 @@ -1193,6 +1193,12 @@ /// @brief Count the number of leading one bits. unsigned countLeadingOnes() const; + /// Computes the number of leading bits of this APInt that are equal to its + /// sign bit. + unsigned getNumSignBits() const { + return isNegative() ? countLeadingOnes() : countLeadingZeros(); + } + /// countTrailingZeros - This function is an APInt version of the /// countTrailingZeros_{32,64} functions in MathExtras.h. It counts /// the number of zeros from the least significant bit to the first set bit. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=126379&r1=126378&r2=126379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 24 04:00:20 2011 @@ -2088,12 +2088,7 @@ case ISD::Constant: { const APInt &Val = cast(Op)->getAPIntValue(); - // If negative, return # leading ones. - if (Val.isNegative()) - return Val.countLeadingOnes(); - - // Return # leading zeros. - return Val.countLeadingZeros(); + return Val.getNumSignBits(); } case ISD::SIGN_EXTEND: From zwarich at apple.com Thu Feb 24 04:00:25 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 24 Feb 2011 10:00:25 -0000 Subject: [llvm-commits] [llvm] r126380 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/phi-constants.ll Message-ID: <20110224100025.A82C82A6C12D@llvm.org> Author: zwarich Date: Thu Feb 24 04:00:25 2011 New Revision: 126380 URL: http://llvm.org/viewvc/llvm-project?rev=126380&view=rev Log: Merge information about the number of zero, one, and sign bits of live-out registers at phis. This enables us to eliminate a lot of pointless zexts during the DAGCombine phase. This fixes . Added: llvm/trunk/test/CodeGen/X86/phi-constants.ll Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126380&r1=126379&r2=126380&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Thu Feb 24 04:00:25 2011 @@ -159,6 +159,13 @@ return LOI; } + /// GetLiveOutRegInfo - Gets LiveOutInfo for a register, returning NULL if the + /// register is a PHI destination and the PHI's LiveOutInfo is not valid. If + /// the register's LiveOutInfo is for a smaller bit width, it is extended to + /// the larger bit width by zero extension. The bit width must be no smaller + /// than the LiveOutInfo's existing bit width. + const LiveOutInfo *GetLiveOutRegInfo(unsigned Reg, unsigned BitWidth); + /// AddLiveOutRegInfo - Adds LiveOutInfo for a register. void AddLiveOutRegInfo(unsigned Reg, unsigned NumSignBits, const APInt &KnownZero, const APInt &KnownOne) { @@ -173,6 +180,10 @@ LOI.KnownZero = KnownZero; } + /// ComputePHILiveOutRegInfo - Compute LiveOutInfo for a PHI's destination + /// register based on the LiveOutInfo of its operands. + void ComputePHILiveOutRegInfo(const PHINode*); + /// InvalidatePHILiveOutRegInfo - Invalidates a PHI's LiveOutInfo, to be /// called when a block is visited before all of its predecessors. void InvalidatePHILiveOutRegInfo(const PHINode *PN) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=126380&r1=126379&r2=126380&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Thu Feb 24 04:00:25 2011 @@ -255,6 +255,122 @@ return FirstReg; } +/// GetLiveOutRegInfo - Gets LiveOutInfo for a register, returning NULL if the +/// register is a PHI destination and the PHI's LiveOutInfo is not valid. If +/// the register's LiveOutInfo is for a smaller bit width, it is extended to +/// the larger bit width by zero extension. The bit width must be no smaller +/// than the LiveOutInfo's existing bit width. +const FunctionLoweringInfo::LiveOutInfo * +FunctionLoweringInfo::GetLiveOutRegInfo(unsigned Reg, unsigned BitWidth) { + if (!LiveOutRegInfo.inBounds(Reg)) + return NULL; + + LiveOutInfo *LOI = &LiveOutRegInfo[Reg]; + if (!LOI->IsValid) + return NULL; + + if (BitWidth >= LOI->KnownZero.getBitWidth()) { + LOI->KnownZero = LOI->KnownZero.zextOrTrunc(BitWidth); + LOI->KnownOne = LOI->KnownOne.zextOrTrunc(BitWidth); + } + + return LOI; +} + +/// ComputePHILiveOutRegInfo - Compute LiveOutInfo for a PHI's destination +/// register based on the LiveOutInfo of its operands. +void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) { + const Type *Ty = PN->getType(); + if (!Ty->isIntegerTy() || Ty->isVectorTy()) + return; + + SmallVector ValueVTs; + ComputeValueVTs(TLI, Ty, ValueVTs); + assert(ValueVTs.size() == 1 && + "PHIs with non-vector integer types should have a single VT."); + EVT IntVT = ValueVTs[0]; + + if (TLI.getNumRegisters(PN->getContext(), IntVT) != 1) + return; + IntVT = TLI.getTypeToTransformTo(PN->getContext(), IntVT); + unsigned BitWidth = IntVT.getSizeInBits(); + + unsigned DestReg = ValueMap[PN]; + if (!TargetRegisterInfo::isVirtualRegister(DestReg)) + return; + LiveOutRegInfo.grow(DestReg); + LiveOutInfo &DestLOI = LiveOutRegInfo[DestReg]; + + Value *V = PN->getIncomingValue(0); + if (isa(V) || isa(V)) { + DestLOI.NumSignBits = 1; + APInt Zero(BitWidth, 0); + DestLOI.KnownZero = Zero; + DestLOI.KnownOne = Zero; + return; + } + + if (ConstantInt *CI = dyn_cast(V)) { + APInt Val = CI->getValue().zextOrTrunc(BitWidth); + DestLOI.NumSignBits = Val.getNumSignBits(); + DestLOI.KnownZero = ~Val; + DestLOI.KnownOne = Val; + } else { + assert(ValueMap.count(V) && "V should have been placed in ValueMap when its" + "CopyToReg node was created."); + unsigned SrcReg = ValueMap[V]; + if (!TargetRegisterInfo::isVirtualRegister(SrcReg)) { + DestLOI.IsValid = false; + return; + } + const LiveOutInfo *SrcLOI = GetLiveOutRegInfo(SrcReg, BitWidth); + if (!SrcLOI) { + DestLOI.IsValid = false; + return; + } + DestLOI = *SrcLOI; + } + + assert(DestLOI.KnownZero.getBitWidth() == BitWidth && + DestLOI.KnownOne.getBitWidth() == BitWidth && + "Masks should have the same bit width as the type."); + + for (unsigned i = 1, e = PN->getNumIncomingValues(); i != e; ++i) { + Value *V = PN->getIncomingValue(i); + if (isa(V) || isa(V)) { + DestLOI.NumSignBits = 1; + APInt Zero(BitWidth, 0); + DestLOI.KnownZero = Zero; + DestLOI.KnownOne = Zero; + return; + } + + if (ConstantInt *CI = dyn_cast(V)) { + APInt Val = CI->getValue().zextOrTrunc(BitWidth); + DestLOI.NumSignBits = std::min(DestLOI.NumSignBits, Val.getNumSignBits()); + DestLOI.KnownZero &= ~Val; + DestLOI.KnownOne &= Val; + continue; + } + + assert(ValueMap.count(V) && "V should have been placed in ValueMap when " + "its CopyToReg node was created."); + unsigned SrcReg = ValueMap[V]; + if (!TargetRegisterInfo::isVirtualRegister(SrcReg)) { + DestLOI.IsValid = false; + return; + } + const LiveOutInfo *SrcLOI = GetLiveOutRegInfo(SrcReg, BitWidth); + if (!SrcLOI) { + DestLOI.IsValid = false; + return; + } + DestLOI.NumSignBits = std::min(DestLOI.NumSignBits, SrcLOI->NumSignBits); + DestLOI.KnownZero &= SrcLOI->KnownZero; + DestLOI.KnownOne &= SrcLOI->KnownOne; + } +} + /// setByValArgumentFrameIndex - Record frame index for the byval /// argument. This overrides previous frame index entry for this argument, /// if any. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=126380&r1=126379&r2=126380&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 24 04:00:25 2011 @@ -842,7 +842,12 @@ } } - if (!AllPredsVisited) { + if (AllPredsVisited) { + for (BasicBlock::const_iterator I = LLVMBB->begin(), E = LLVMBB->end(); + I != E && isa(I); ++I) { + FuncInfo->ComputePHILiveOutRegInfo(cast(I)); + } + } else { for (BasicBlock::const_iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E && isa(I); ++I) { FuncInfo->InvalidatePHILiveOutRegInfo(cast(I)); Added: llvm/trunk/test/CodeGen/X86/phi-constants.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/phi-constants.ll?rev=126380&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/phi-constants.ll (added) +++ llvm/trunk/test/CodeGen/X86/phi-constants.ll Thu Feb 24 04:00:25 2011 @@ -0,0 +1,35 @@ +; RUN: llc < %s -march=x86-64 | FileCheck %s + +%"class.std::bitset" = type { [8 x i8] } + +define zeroext i1 @_Z3fooPjmS_mRSt6bitsetILm32EE(i32* nocapture %a, i64 %asize, i32* nocapture %b, i64 %bsize, %"class.std::bitset"* %bits) nounwind readonly ssp noredzone { +entry: + %tmp.i.i.i.i = bitcast %"class.std::bitset"* %bits to i64* + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] + %conv = zext i32 %0 to i64 + %cmp = icmp eq i64 %conv, %bsize + br i1 %cmp, label %return, label %for.body + +for.body: ; preds = %for.cond + %arrayidx = getelementptr inbounds i32* %b, i64 %conv + %tmp5 = load i32* %arrayidx, align 4 + %conv6 = zext i32 %tmp5 to i64 + %rem.i.i.i.i = and i64 %conv6, 63 + %tmp3.i = load i64* %tmp.i.i.i.i, align 8 + %shl.i.i = shl i64 1, %rem.i.i.i.i + %and.i = and i64 %shl.i.i, %tmp3.i + %cmp.i = icmp eq i64 %and.i, 0 + br i1 %cmp.i, label %for.inc, label %return + +for.inc: ; preds = %for.body + %inc = add i32 %0, 1 + br label %for.cond + +return: ; preds = %for.body, %for.cond +; CHECK-NOT: and + %retval.0 = phi i1 [ true, %for.body ], [ false, %for.cond ] + ret i1 %retval.0 +} From benny.kra at googlemail.com Thu Feb 24 05:03:19 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Thu, 24 Feb 2011 11:03:19 -0000 Subject: [llvm-commits] [llvm] r126381 - in /llvm/trunk: lib/MC/MCDisassembler/EDToken.cpp tools/llvm-mc/Disassembler.cpp Message-ID: <20110224110319.609E42A6C12C@llvm.org> Author: d0k Date: Thu Feb 24 05:03:19 2011 New Revision: 126381 URL: http://llvm.org/viewvc/llvm-project?rev=126381&view=rev Log: Plug some leaks in edis. - Don't leak parsed operands during tokenization. - Don't leak printed insts in llvm-mc. Modified: llvm/trunk/lib/MC/MCDisassembler/EDToken.cpp llvm/trunk/tools/llvm-mc/Disassembler.cpp Modified: llvm/trunk/lib/MC/MCDisassembler/EDToken.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/EDToken.cpp?rev=126381&r1=126380&r2=126381&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCDisassembler/EDToken.cpp (original) +++ llvm/trunk/lib/MC/MCDisassembler/EDToken.cpp Thu Feb 24 05:03:19 2011 @@ -194,6 +194,10 @@ tokens.push_back(token); } + // Free any parsed operands. + for (unsigned i = 0, e = parsedOperands.size(); i != e; ++i) + delete parsedOperands[i]; + return 0; } Modified: llvm/trunk/tools/llvm-mc/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/Disassembler.cpp?rev=126381&r1=126380&r2=126381&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/Disassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/Disassembler.cpp Thu Feb 24 05:03:19 2011 @@ -227,8 +227,8 @@ } EDDisassembler::initialize(); - EDDisassembler *disassembler = - EDDisassembler::getDisassembler(TS.c_str(), AS); + OwningPtr + disassembler(EDDisassembler::getDisassembler(TS.c_str(), AS)); if (disassembler == 0) { errs() << "error: couldn't get disassembler for " << TS << '\n'; @@ -236,8 +236,8 @@ } while (ByteArray.size()) { - EDInst *inst = - disassembler->createInst(byteArrayReader, 0, &ByteArray); + OwningPtr + inst(disassembler->createInst(byteArrayReader, 0, &ByteArray)); ByteArray.erase (ByteArray.begin(), ByteArray.begin() + inst->byteSize()); @@ -330,7 +330,7 @@ } uint64_t evaluatedResult; - void *Arg[] = { disassembler, &Out }; + void *Arg[] = { disassembler.get(), &Out }; if (operand->evaluate(evaluatedResult, verboseEvaluator, Arg)) { errs() << "error: Couldn't evaluate an operand\n"; return -1; From baldrick at free.fr Thu Feb 24 05:54:18 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 11:54:18 -0000 Subject: [llvm-commits] [llvm] r126382 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <20110224115418.DFF4C2A6C12C@llvm.org> Author: baldrick Date: Thu Feb 24 05:54:18 2011 New Revision: 126382 URL: http://llvm.org/viewvc/llvm-project?rev=126382&view=rev Log: Rewrite the vector part of getExtendedTypeAction to make it more understandable (at least I find it easier to understand like this). No intended functionality change. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=126382&r1=126381&r2=126382&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Thu Feb 24 05:54:18 2011 @@ -221,27 +221,41 @@ return Promote; return Expand; } - - // If this is a type smaller than a legal vector type, promote to that - // type, e.g. <2 x float> -> <4 x float>. - if (VT.getVectorElementType().isSimple() && - VT.getVectorNumElements() != 1) { - MVT EltType = VT.getVectorElementType().getSimpleVT(); - unsigned NumElts = VT.getVectorNumElements(); - while (1) { - // Round up to the nearest power of 2. - NumElts = (unsigned)NextPowerOf2(NumElts); - - MVT LargerVector = MVT::getVectorVT(EltType, NumElts); - if (LargerVector == MVT()) break; - - // If this the larger type is legal, promote to it. - if (getTypeAction(LargerVector) == Legal) return Promote; - } + + // Vectors with only one element are always scalarized. + if (VT.getVectorNumElements() == 1) + return Expand; + + // Vectors with a number of elements that is not a power of two are always + // widened, for example <3 x float> -> <4 x float>. + if (!VT.isPow2VectorType()) + return Promote; + + // Vectors with a crazy element type are always expanded, for example + // <4 x i2> is expanded into two vectors of type <2 x i2>. + if (!VT.getVectorElementType().isSimple()) + return Expand; + + // If this type is smaller than a legal vector type then widen it, + // otherwise expand it. E.g. <2 x float> -> <4 x float>. + MVT EltType = VT.getVectorElementType().getSimpleVT(); + unsigned NumElts = VT.getVectorNumElements(); + while (1) { + // Round up to the next power of 2. + NumElts = (unsigned)NextPowerOf2(NumElts); + + // If there is no simple vector type with this many elements then there + // cannot be a larger legal vector type. Note that this assumes that + // there are no skipped intermediate vector types in the simple types. + MVT LargerVector = MVT::getVectorVT(EltType, NumElts); + if (LargerVector == MVT()) + return Expand; + + // If this type is legal then widen the vector. + if (getTypeAction(LargerVector) == Legal) + return Promote; } - - return VT.isPow2VectorType() ? Expand : Promote; - } + } public: ValueTypeActionImpl() { std::fill(ValueTypeActions, array_endof(ValueTypeActions), 0); From geek4civic at gmail.com Thu Feb 24 06:34:34 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 24 Feb 2011 12:34:34 -0000 Subject: [llvm-commits] [llvm] r126383 - /llvm/trunk/test/lit.cfg Message-ID: <20110224123434.5CA1D2A6C12C@llvm.org> Author: chapuni Date: Thu Feb 24 06:34:34 2011 New Revision: 126383 URL: http://llvm.org/viewvc/llvm-project?rev=126383&view=rev Log: test/lit.cfg: Add PATHEXT to 'substitution', to recognize tools on Windows hosts. Thanks to Danil Malyshev! Some tests on Windows use the "not" utility and fail with an error "program not executable". The reason for this error is that the name of the executable file sended to the "not" without the extension. Modified: llvm/trunk/test/lit.cfg Modified: llvm/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=126383&r1=126382&r2=126383&view=diff ============================================================================== --- llvm/trunk/test/lit.cfg (original) +++ llvm/trunk/test/lit.cfg Thu Feb 24 06:34:34 2011 @@ -175,6 +175,10 @@ # (llvm_tools_dir in lit parlance). # Don't match 'bugpoint-' or 'clang-'. # Don't match '/clang'. +if os.pathsep == ';': + pathext = os.environ.get('PATHEXT', '').split(';') +else: + pathext = [''] for pattern in [r"\bbugpoint\b(?!-)", r"(? References: <6AE1604EE3EC5F4296C096518C6B77EE17DD290816@mail.accesssoftek.com> Message-ID: Danil, applied in r126383, thank you! ...Takumi From richard at xmos.com Thu Feb 24 07:39:18 2011 From: richard at xmos.com (Richard Osborne) Date: Thu, 24 Feb 2011 13:39:18 -0000 Subject: [llvm-commits] [llvm] r126384 - in /llvm/trunk: include/llvm/IntrinsicsXCore.td lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/resources.ll Message-ID: <20110224133918.459632A6C12C@llvm.org> Author: friedgold Date: Thu Feb 24 07:39:18 2011 New Revision: 126384 URL: http://llvm.org/viewvc/llvm-project?rev=126384&view=rev Log: Add XCore intrinsic for eeu instruction. Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td llvm/trunk/test/CodeGen/XCore/resources.ll Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsXCore.td?rev=126384&r1=126383&r2=126384&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsXCore.td (original) +++ llvm/trunk/include/llvm/IntrinsicsXCore.td Thu Feb 24 07:39:18 2011 @@ -47,6 +47,7 @@ [NoCapture<0>]>; def int_xcore_setv : Intrinsic<[],[llvm_anyptr_ty, llvm_ptr_ty], [NoCapture<0>]>; + def int_xcore_eeu : Intrinsic<[],[llvm_anyptr_ty], [NoCapture<0>]>; // Intrinsics for events. def int_xcore_waitevent : Intrinsic<[llvm_ptr_ty],[], [IntrReadMem]>; Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=126384&r1=126383&r2=126384&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Thu Feb 24 07:39:18 2011 @@ -894,6 +894,10 @@ "setv res[$r], r11", [(int_xcore_setv GRRegs:$r, R11)]>; +def EEU_1r : _F1R<(outs), (ins GRRegs:$r), + "eeu res[$r]", + [(int_xcore_eeu GRRegs:$r)]>; + // Zero operand short // TODO ssync, freet, ldspc, stspc, ldssr, stssr, ldsed, stsed, // stet, geted, getet, getkep, getksp, setkep, getid, kret, dcall, dret, Modified: llvm/trunk/test/CodeGen/XCore/resources.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/resources.ll?rev=126384&r1=126383&r2=126384&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/resources.ll (original) +++ llvm/trunk/test/CodeGen/XCore/resources.ll Thu Feb 24 07:39:18 2011 @@ -18,6 +18,7 @@ declare void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r) declare void @llvm.xcore.settw.p1i8(i8 addrspace(1)* %r, i32 %value) declare void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p) +declare void @llvm.xcore.eeu.p1i8(i8 addrspace(1)* %r) define i8 addrspace(1)* @getr() { ; CHECK: getr: @@ -166,3 +167,10 @@ call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p) ret void } + +define void @eeu(i8 addrspace(1)* %r) { +; CHECK: eeu: +; CHECK: eeu res[r0] + call void @llvm.xcore.eeu.p1i8(i8 addrspace(1)* %r) + ret void +} From baldrick at free.fr Thu Feb 24 09:30:59 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 15:30:59 -0000 Subject: [llvm-commits] [dragonegg] r126385 - /dragonegg/trunk/Makefile Message-ID: <20110224153059.5D0E22A6C12C@llvm.org> Author: baldrick Date: Thu Feb 24 09:30:59 2011 New Revision: 126385 URL: http://llvm.org/viewvc/llvm-project?rev=126385&view=rev Log: Since LD_OPTIONS can contain fundamental system libraries like -ldl, make sure it comes after any libraries that might use these. Modified: dragonegg/trunk/Makefile Modified: dragonegg/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Makefile?rev=126385&r1=126384&r2=126385&view=diff ============================================================================== --- dragonegg/trunk/Makefile (original) +++ dragonegg/trunk/Makefile Thu Feb 24 09:30:59 2011 @@ -54,7 +54,7 @@ -DGCC_MAJOR=$(GCC_MAJOR) -DGCC_MINOR=$(GCC_MINOR) \ -I$(SRC_DIR) -I$(GCC_PLUGIN_DIR)/include -LD_OPTIONS+=$(LDFLAGS) $(shell $(LLVM_CONFIG) --ldflags) +LD_OPTIONS+=$(shell $(LLVM_CONFIG) --ldflags) $(LDFLAGS) # NOTE: The following flags can only be used after TARGET_UTIL has been built. TARGET_HEADERS+=-DTARGET_NAME=\"$(shell $(TARGET_UTIL) -t)\" \ @@ -71,8 +71,8 @@ $(TARGET_UTIL): $(TARGET_UTIL_OBJECTS) @echo Linking $@ - $(QUIET)$(CXX) -o $@ $^ $(LD_OPTIONS) \ - $(shell $(LLVM_CONFIG) --libs support) + $(QUIET)$(CXX) -o $@ $^ $(shell $(LLVM_CONFIG) --libs support) \ + $(LD_OPTIONS) %.o : $(SRC_DIR)/%.c $(TARGET_UTIL) @echo Compiling $*.c @@ -90,9 +90,9 @@ $(PLUGIN): $(PLUGIN_OBJECTS) $(TARGET_OBJECT) $(TARGET_UTIL) @echo Linking $@ $(QUIET)$(CXX) -o $@ $(LOADABLE_MODULE_OPTIONS) $(CXXFLAGS) \ - $(LD_OPTIONS) $(PLUGIN_OBJECTS) $(TARGET_OBJECT) \ - $(shell $(LLVM_CONFIG) --libs analysis core ipo scalaropts target \ - $(shell $(TARGET_UTIL) -p)) + $(PLUGIN_OBJECTS) $(TARGET_OBJECT) $(shell $(LLVM_CONFIG) --libs \ + analysis core ipo scalaropts target $(shell $(TARGET_UTIL) -p)) \ + $(LD_OPTIONS) clean:: $(QUIET)rm -f *.o *.d $(PLUGIN) $(TARGET_UTIL) From rafael.espindola at gmail.com Thu Feb 24 10:13:09 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Thu, 24 Feb 2011 11:13:09 -0500 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <26511CEA-92A4-413D-8E28-32E51DBB0EDE@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> <4D65C523.9090209@gmail.com> <26511CEA-92A4-413D-8E28-32E51DBB0EDE@apple.com> Message-ID: <4D668395.5020707@gmail.com> >> Just a nit, it looks like it is a Mach-O X ELF, not X86 x ARM. >> >> Just to be sure, would this be a desirable feature for X86 Darwin? > > Sure, I'd like the mc assembler to be as consistent as reasonable across different OS's. OK, so the summary so far is *) Disabled for Mach-O ARM *) Enabled for Mach-O X86 *) Enabled for ELF ARM and X86 It was also requested that the default be off. > > -Chris Cheers, Rafael From rafael.espindola at gmail.com Thu Feb 24 10:17:18 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Thu, 24 Feb 2011 11:17:18 -0500 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash In-Reply-To: <4D66165D.909@free.fr> References: <4D66165D.909@free.fr> Message-ID: <4D66848E.7080908@gmail.com> On 11-02-24 03:27 AM, Duncan Sands wrote: > Hi Galina, > >> Starting from the revion 124059 llvm-gcc cross to ARM build failing >> with the ld.exe crash. Since this is a cross compile, can you reproduce it running in on Linux? > so commit 124059 is the cause of the crash? > > ------------------------------------------------------------------------ > r124059 | rafael | 2011-01-23 06:43:40 +0100 (Sun, 23 Jan 2011) | 2 lines > > Delay the creation of eh_frame so that the user can change the defaults. > Add support for SHT_X86_64_UNWIND. > ------------------------------------------------------------------------ > > Ciao, Duncan. Cheers, Rafael From baldrick at free.fr Thu Feb 24 10:32:08 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 17:32:08 +0100 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash In-Reply-To: <4D66848E.7080908@gmail.com> References: <4D66165D.909@free.fr> <4D66848E.7080908@gmail.com> Message-ID: <4D668808.7040707@free.fr> >>> Starting from the revion 124059 llvm-gcc cross to ARM build failing >>> with the ld.exe crash. > > Since this is a cross compile, can you reproduce it running in on Linux? > >> so commit 124059 is the cause of the crash? >> >> ------------------------------------------------------------------------ >> r124059 | rafael | 2011-01-23 06:43:40 +0100 (Sun, 23 Jan 2011) | 2 lines >> >> Delay the creation of eh_frame so that the user can change the defaults. >> Add support for SHT_X86_64_UNWIND. >> ------------------------------------------------------------------------ Trying to bootstrap llvm-gcc on x86-64 linux dies for me like this: *** glibc detected *** /usr/bin/ld: munmap_chunk(): invalid pointer: 0x0000000002ad33f8 *** ======= Backtrace: ========= /lib/libc.so.6(+0x76db6)[0x2ac52bc23db6] /usr/lib/libbfd-2.21.0-system.20110216.so(_bfd_elf_discard_section_eh_frame+0x3f6)[0x2ac52b51b8c6] /usr/lib/libbfd-2.21.0-system.20110216.so(bfd_elf_discard_info+0x2ed)[0x2ac52b50ef1d] /usr/bin/ld[0x421dbc] /usr/bin/ld[0x413f7e] /usr/bin/ld[0x418986] /lib/libc.so.6(__libc_start_main+0xfe)[0x2ac52bbcbefe] /usr/bin/ld[0x404419] From dpatel at apple.com Thu Feb 24 10:42:50 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Feb 2011 08:42:50 -0800 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: <4D65DCFB.90205@gmail.com> References: <4D65DCFB.90205@gmail.com> Message-ID: <0B83988D-9538-4FC3-BC2D-4A328B594603@apple.com> On Feb 23, 2011, at 8:22 PM, Rafael ?vila de Esp?ndola wrote: > I was updating my patch for disabling .globl matching on ELF targets and > decided I should at least try to see how hard it would be to implement > the proper solution with MC. > > The first step is probably to switch LTO to use MC. It wouldn't make a > lot of sense to have LTO require MC for finding definitions and then > passing assembly to 'as'. Well, that is due to natural development cycle of MC, certainly not the state we want to keep forever. > > The attached patch converts LTO to using MC for object emission. It > simplifies the code a lot, since now all the assembler logic is in LLVM > itself. It also has a nice impact on performance. With the patch > libxul.so now links in 6m30, which is about 30s less than before :-) > Looks good, please apply. Thanks, - Devang > Cheers, > Rafael > From baldrick at free.fr Thu Feb 24 11:00:08 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 17:00:08 -0000 Subject: [llvm-commits] [dragonegg] r126388 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110224170008.6375C2A6C12C@llvm.org> Author: baldrick Date: Thu Feb 24 11:00:08 2011 New Revision: 126388 URL: http://llvm.org/viewvc/llvm-project?rev=126388&view=rev Log: Use gimple asm accessors wherever possible (there is only one place where input, output and clobber lists are needed). Do some extra cleanups while there, in particular the gimplifier splits in/out outputs into an input and an output, so IsInOut can never be set. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126388&r1=126387&r2=126388&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Thu Feb 24 11:00:08 2011 @@ -3350,10 +3350,12 @@ /// is performed after things like SROA, not before. At the moment we are /// just trying to pick one that will work. This may get refined. static void -ChooseConstraintTuple(const char **Constraints, tree outputs, tree inputs, - unsigned NumOutputs, unsigned NumInputs, +ChooseConstraintTuple(gimple stmt, const char **Constraints, unsigned NumChoices, const char **ReplacementStrings) { + unsigned NumInputs = gimple_asm_ninputs(stmt); + unsigned NumOutputs = gimple_asm_noutputs(stmt); + int MaxWeight = -1; unsigned int CommasToSkip = 0; int *Weights = (int *)alloca(NumChoices * sizeof(int)); @@ -3365,11 +3367,10 @@ memcpy(RunningConstraints, Constraints, (NumInputs+NumOutputs) * sizeof(const char*)); // The entire point of this loop is to compute CommasToSkip. - for (unsigned int i=0; iMaxWeight) { CommasToSkip = i; @@ -6744,106 +6744,63 @@ return; } - // Some of the GCC utilities we use still want lists and not gimple, so create - // input, output and clobber lists for their benefit. - unsigned NumOutputs = gimple_asm_noutputs (stmt); - tree outputs = NULL_TREE; - if (NumOutputs) { - tree t = outputs = gimple_asm_output_op (stmt, 0); - for (unsigned i = 1; i < NumOutputs; i++) { - TREE_CHAIN (t) = gimple_asm_output_op (stmt, i); - t = gimple_asm_output_op (stmt, i); - } - } - - unsigned NumInputs = gimple_asm_ninputs(stmt); - tree inputs = NULL_TREE; - if (NumInputs) { - tree t = inputs = gimple_asm_input_op (stmt, 0); - for (unsigned i = 1; i < NumInputs; i++) { - TREE_CHAIN (t) = gimple_asm_input_op (stmt, i); - t = gimple_asm_input_op (stmt, i); - } - } - - unsigned NumClobbers = gimple_asm_nclobbers (stmt); - tree clobbers = NULL_TREE; - if (NumClobbers) { - tree t = clobbers = gimple_asm_clobber_op (stmt, 0); - for (unsigned i = 1; i < NumClobbers; i++) { - TREE_CHAIN (t) = gimple_asm_clobber_op (stmt, i); - t = gimple_asm_clobber_op (stmt, i); - } - } - - // TODO: Understand what these labels are about, and handle them properly. - unsigned NumLabels = gimple_asm_nlabels (stmt); - tree labels = NULL_TREE; - if (NumLabels) { - tree t = labels = gimple_asm_label_op (stmt, 0); - for (unsigned i = 1; i < NumLabels; i++) { - TREE_CHAIN (t) = gimple_asm_label_op (stmt, i); - t = gimple_asm_label_op (stmt, i); - } - } - - unsigned NumInOut = 0; + const unsigned NumOutputs = gimple_asm_noutputs (stmt); + const unsigned NumInputs = gimple_asm_ninputs(stmt); + const unsigned NumClobbers = gimple_asm_nclobbers (stmt); // Look for multiple alternative constraints: multiple alternatives separated // by commas. unsigned NumChoices = 0; // sentinal; real value is always at least 1. - const char* p; - for (tree t = inputs; t; t = TREE_CHAIN(t)) { + for (unsigned i = 0; i != NumInputs; ++i) { + tree Input = gimple_asm_input_op(stmt, i); unsigned NumInputChoices = 1; - for (p = TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(t))); *p; p++) { + for (const char *p = TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Input))); + *p; ++p) if (*p == ',') - NumInputChoices++; - } - if (NumChoices==0) + ++NumInputChoices; + assert((!NumChoices || NumChoices == NumInputChoices) && + "invalid constraints!"); + if (NumChoices == 0) NumChoices = NumInputChoices; - else if (NumChoices != NumInputChoices) - llvm_unreachable("invalid constraints"); } - for (tree t = outputs; t; t = TREE_CHAIN(t)) { + for (unsigned i = 0; i != NumOutputs; ++i) { + tree Output = gimple_asm_output_op(stmt, i); unsigned NumOutputChoices = 1; - for (p = TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(t))); *p; p++) { + for (const char *p = TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Output))); + *p; ++p) if (*p == ',') - NumOutputChoices++; - } - if (NumChoices==0) + ++NumOutputChoices; + assert((!NumChoices || NumChoices == NumOutputChoices) && + "invalid constraints!"); + if (NumChoices == 0) NumChoices = NumOutputChoices; - else if (NumChoices != NumOutputChoices) - llvm_unreachable("invalid constraints"); } /// Constraints - The output/input constraints, concatenated together in array - /// form instead of list form. + /// form instead of list form. This way of doing things is forced on us by + /// GCC routines like parse_output_constraint which rummage around inside the + /// array. const char **Constraints = (const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *)); - // Process outputs. - int ValNum = 0; - for (tree Output = outputs; Output; Output = TREE_CHAIN(Output), ++ValNum) { - tree Operand = TREE_VALUE(Output); - tree type = TREE_TYPE(Operand); - // If there's an erroneous arg, emit no insn. - if (type == error_mark_node) return; - - // Parse the output constraint. + // Initialize the Constraints array. + for (unsigned i = 0; i != NumOutputs; ++i) { + tree Output = gimple_asm_output_op(stmt, i); + // If there's an erroneous arg then bail out. + if (TREE_TYPE(TREE_VALUE(Output)) == error_mark_node) return; + // Record the output constraint. const char *Constraint = TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Output))); - Constraints[ValNum] = Constraint; + Constraints[i] = Constraint; } - // Process inputs. - for (tree Input = inputs; Input; Input = TREE_CHAIN(Input),++ValNum) { - tree Val = TREE_VALUE(Input); - tree type = TREE_TYPE(Val); - // If there's an erroneous arg, emit no insn. - if (type == error_mark_node) return; - + for (unsigned i = 0; i != NumInputs; ++i) { + tree Input = gimple_asm_input_op(stmt, i); + // If there's an erroneous arg then bail out. + if (TREE_TYPE(TREE_VALUE(Input)) == error_mark_node) return; + // Record the input constraint. const char *Constraint = TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Input))); - Constraints[ValNum] = Constraint; + Constraints[NumOutputs+i] = Constraint; } // If there are multiple constraint tuples, pick one. Constraints is @@ -6853,14 +6810,13 @@ if (NumChoices>1) { ReplacementStrings = (const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *)); - ChooseConstraintTuple(Constraints, outputs, inputs, NumOutputs, NumInputs, - NumChoices, ReplacementStrings); + ChooseConstraintTuple(stmt, Constraints, NumChoices, ReplacementStrings); } std::vector CallOps; std::vector CallArgTypes; std::string ConstraintStr; - bool HasSideEffects = gimple_asm_volatile_p(stmt) || !outputs; + bool HasSideEffects = gimple_asm_volatile_p(stmt) || (NumOutputs == 0); // StoreCallResultAddr - The pointer to store the result of the call through. SmallVector StoreCallResultAddrs; @@ -6871,28 +6827,20 @@ SmallVector CallResultSSATemps; // Process outputs. - ValNum = 0; - for (tree Output = outputs; Output; Output = TREE_CHAIN(Output), ++ValNum) { + for (unsigned i = 0; i != NumOutputs; ++i) { + tree Output = gimple_asm_output_op(stmt, i); tree Operand = TREE_VALUE(Output); // Parse the output constraint. - const char *Constraint = Constraints[ValNum]; + const char *Constraint = Constraints[i]; bool IsInOut, AllowsReg, AllowsMem; - if (!parse_output_constraint(&Constraint, ValNum, NumInputs, NumOutputs, + if (!parse_output_constraint(&Constraint, i, NumInputs, NumOutputs, &AllowsMem, &AllowsReg, &IsInOut)) { FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } assert(Constraint[0] == '=' && "Not an output constraint?"); - - // Output constraints must be addressable if they aren't simple register - // constraints (this emits "address of register var" errors, etc). - if (!AllowsReg && (AllowsMem || IsInOut)) - mark_addressable(Operand); - - // Count the number of "+" constraints. - if (IsInOut) - ++NumInOut, ++NumInputs; + assert(!IsInOut && "asm expression not gimplified?"); std::string SimplifiedConstraint; // If this output register is pinned to a machine register, use that machine @@ -6956,15 +6904,16 @@ } // Process inputs. - for (tree Input = inputs; Input; Input = TREE_CHAIN(Input),++ValNum) { + for (unsigned i = 0; i != NumInputs; ++i) { + tree Input = gimple_asm_input_op(stmt, i); tree Val = TREE_VALUE(Input); tree type = TREE_TYPE(Val); - const char *Constraint = Constraints[ValNum]; + const char *Constraint = Constraints[NumOutputs+i]; bool AllowsReg, AllowsMem; - if (!parse_input_constraint(Constraints+ValNum, ValNum-NumOutputs, - NumInputs, NumOutputs, NumInOut, + if (!parse_input_constraint(Constraints+NumOutputs+i, i, + NumInputs, NumOutputs, 0, Constraints, &AllowsMem, &AllowsReg)) { FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; @@ -7063,6 +7012,7 @@ error_at(gimple_location(stmt), "unsupported inline asm: input constraint with a matching " "output constraint of incompatible type!"); + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } else if (OTyBits > OpTyBits) { Op = CastToAnyType(Op, !TYPE_UNSIGNED(type), @@ -7113,7 +7063,39 @@ // Process clobbers. // Some targets automatically clobber registers across an asm. - tree Clobbers = targetm.md_asm_clobbers(outputs, inputs, clobbers); + tree Clobbers; + { + // Create input, output & clobber lists for the benefit of md_asm_clobbers. + tree outputs = NULL_TREE; + if (NumOutputs) { + tree t = outputs = gimple_asm_output_op (stmt, 0); + for (unsigned i = 1; i < NumOutputs; i++) { + TREE_CHAIN (t) = gimple_asm_output_op (stmt, i); + t = gimple_asm_output_op (stmt, i); + } + } + + tree inputs = NULL_TREE; + if (NumInputs) { + tree t = inputs = gimple_asm_input_op (stmt, 0); + for (unsigned i = 1; i < NumInputs; i++) { + TREE_CHAIN (t) = gimple_asm_input_op (stmt, i); + t = gimple_asm_input_op (stmt, i); + } + } + + tree clobbers = NULL_TREE; + if (NumClobbers) { + tree t = clobbers = gimple_asm_clobber_op (stmt, 0); + for (unsigned i = 1; i < NumClobbers; i++) { + TREE_CHAIN (t) = gimple_asm_clobber_op (stmt, i); + t = gimple_asm_clobber_op (stmt, i); + } + } + + Clobbers = targetm.md_asm_clobbers(outputs, inputs, clobbers); + } + for (; Clobbers; Clobbers = TREE_CHAIN(Clobbers)) { const char *RegName = TREE_STRING_POINTER(TREE_VALUE(Clobbers)); int RegCode = decode_reg_name(RegName); From dpatel at apple.com Thu Feb 24 11:26:06 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Feb 2011 17:26:06 -0000 Subject: [llvm-commits] [test-suite] r126390 - /test-suite/trunk/SingleSource/Regression/C++/Makefile Message-ID: <20110224172606.194342A6C12C@llvm.org> Author: dpatel Date: Thu Feb 24 11:26:05 2011 New Revision: 126390 URL: http://llvm.org/viewvc/llvm-project?rev=126390&view=rev Log: Do not specify -std=c99 for c++ testcases. o llvm-gcc issues a ignores it after issuing a warning. o On the otherside, clang follows it by rejecting c++ constructs in the testcase. Modified: test-suite/trunk/SingleSource/Regression/C++/Makefile Modified: test-suite/trunk/SingleSource/Regression/C++/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/Makefile?rev=126390&r1=126389&r2=126390&view=diff ============================================================================== --- test-suite/trunk/SingleSource/Regression/C++/Makefile (original) +++ test-suite/trunk/SingleSource/Regression/C++/Makefile Thu Feb 24 11:26:05 2011 @@ -6,6 +6,5 @@ # LEVEL = ../../.. DIRS=EH -CFLAGS += -std=c99 LDFLAGS += -lstdc++ include $(LEVEL)/SingleSource/Makefile.singlesrc From grosbach at apple.com Thu Feb 24 11:53:18 2011 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 24 Feb 2011 09:53:18 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4D668395.5020707@gmail.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> <4D65C523.9090209@gmail.com> <26511CEA-92A4-413D-8E28-32E51DBB0EDE@apple.com> <4D668395.5020707@gmail.com> Message-ID: <9D7603DE-CAF9-453C-837A-B867A5D53B10@apple.com> On Feb 24, 2011, at 8:13 AM, Rafael Avila de Espindola wrote: >>> Just a nit, it looks like it is a Mach-O X ELF, not X86 x ARM. >>> >>> Just to be sure, would this be a desirable feature for X86 Darwin? >> >> Sure, I'd like the mc assembler to be as consistent as reasonable across different OS's. > > OK, so the summary so far is > > *) Disabled for Mach-O ARM > *) Enabled for Mach-O X86 > *) Enabled for ELF ARM and X86 > > It was also requested that the default be off. This sounds fine to me. I'd marginally prefer that it be disabled for X86/MachO, but I don't feel strongly about that. I do feel that the default should be Disabled, as many archs use square brackets for memory references and will thus encounter the same sorts of parsing ambiguities that ARM does. For implementation specifics, I agree a member var in the MCAsmParser class with getter/setter methods should do the trick. Targets that want to enable the flag just call the setter in their TargetAsmParser constructor. Should be very simple and interface trivially with the prior patch. -Jim From clattner at apple.com Thu Feb 24 12:30:19 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 24 Feb 2011 10:30:19 -0800 Subject: [llvm-commits] [llvm] r126382 - /llvm/trunk/include/llvm/Target/TargetLowering.h In-Reply-To: <20110224115418.DFF4C2A6C12C@llvm.org> References: <20110224115418.DFF4C2A6C12C@llvm.org> Message-ID: <31DE9452-CDB6-414E-AC94-C3B4C24F137D@apple.com> On Feb 24, 2011, at 3:54 AM, Duncan Sands wrote: > Author: baldrick > Date: Thu Feb 24 05:54:18 2011 > New Revision: 126382 > > URL: http://llvm.org/viewvc/llvm-project?rev=126382&view=rev > Log: > Rewrite the vector part of getExtendedTypeAction to make it more > understandable (at least I find it easier to understand like this). > No intended functionality change. While you're here, can you move this out of line? It's huge :) -Chris From dpatel at apple.com Thu Feb 24 12:49:31 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Feb 2011 18:49:31 -0000 Subject: [llvm-commits] [llvm] r126397 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <20110224184931.16E342A6C12C@llvm.org> Author: dpatel Date: Thu Feb 24 12:49:30 2011 New Revision: 126397 URL: http://llvm.org/viewvc/llvm-project?rev=126397&view=rev Log: Do not use DIFactory. 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=126397&r1=126396&r2=126397&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Feb 24 12:49:30 2011 @@ -31,6 +31,7 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Analysis/DebugInfo.h" +#include "llvm/Analysis/DIBuilder.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" @@ -644,12 +645,12 @@ for (unsigned i = 0, N = DV->getNumAddrElements(); i < N; ++i) { uint64_t Element = DV->getAddrElement(i); - if (Element == DIFactory::OpPlus) { + if (Element == DIBuilder::OpPlus) { addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); addUInt(Block, 0, dwarf::DW_FORM_udata, DV->getAddrElement(++i)); - } else if (Element == DIFactory::OpDeref) { + } else if (Element == DIBuilder::OpDeref) { addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); - } else llvm_unreachable("unknown DIFactory Opcode"); + } else llvm_unreachable("unknown DIBuilder Opcode"); } // Now attach the location information to the DIE. From dpatel at apple.com Thu Feb 24 12:49:55 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Feb 2011 18:49:55 -0000 Subject: [llvm-commits] [llvm] r126398 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Message-ID: <20110224184955.41F372A6C12C@llvm.org> Author: dpatel Date: Thu Feb 24 12:49:55 2011 New Revision: 126398 URL: http://llvm.org/viewvc/llvm-project?rev=126398&view=rev Log: Do not use DIFactory. Use DIBuilder. Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=126398&r1=126397&r2=126398&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Thu Feb 24 12:49:55 2011 @@ -35,6 +35,7 @@ #include "llvm/Metadata.h" #include "llvm/Analysis/AliasSetTracker.h" #include "llvm/Analysis/DebugInfo.h" +#include "llvm/Analysis/DIBuilder.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/ADT/DenseMap.h" @@ -190,7 +191,7 @@ /// std::vector Allocas; DominatorTree &DT; - DIFactory *DIF; + DIBuilder *DIB; /// AST - An AliasSetTracker object to update. If null, don't update it. /// @@ -235,9 +236,9 @@ public: PromoteMem2Reg(const std::vector &A, DominatorTree &dt, AliasSetTracker *ast) - : Allocas(A), DT(dt), DIF(0), AST(ast) {} + : Allocas(A), DT(dt), DIB(0), AST(ast) {} ~PromoteMem2Reg() { - delete DIF; + delete DIB; } void run(); @@ -951,9 +952,9 @@ if (!DIVar.Verify()) return; - if (!DIF) - DIF = new DIFactory(*SI->getParent()->getParent()->getParent()); - Instruction *DbgVal = DIF->InsertDbgValueIntrinsic(SI->getOperand(0), 0, + if (!DIB) + DIB = new DIBuilder(*SI->getParent()->getParent()->getParent()); + Instruction *DbgVal = DIB->insertDbgValueIntrinsic(SI->getOperand(0), 0, DIVar, SI); // Propagate any debug metadata from the store onto the dbg.value. From sabre at nondot.org Thu Feb 24 12:59:38 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Feb 2011 18:59:38 -0000 Subject: [llvm-commits] [llvm] r126399 - /llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Message-ID: <20110224185938.425EA2A6C12C@llvm.org> Author: lattner Date: Thu Feb 24 12:59:38 2011 New Revision: 126399 URL: http://llvm.org/viewvc/llvm-project?rev=126399&view=rev Log: fit in 80 cols. Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=126399&r1=126398&r2=126399&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Thu Feb 24 12:59:38 2011 @@ -89,7 +89,8 @@ outs() << getPassesString(PassesToRun) << "\n"; } -cl::opt SilencePasses("silence-passes", cl::desc("Suppress output of running passes (both stdout and stderr)")); +cl::opt SilencePasses("silence-passes", + cl::desc("Suppress output of running passes (both stdout and stderr)")); static cl::list OptArgs("opt-args", cl::Positional, cl::desc("..."), From dpatel at apple.com Thu Feb 24 13:06:27 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Feb 2011 19:06:27 -0000 Subject: [llvm-commits] [llvm] r126401 - in /llvm/trunk/test: CodeGen/ARM/2009-10-16-Scope.ll CodeGen/ARM/2010-08-04-StackVariable.ll CodeGen/X86/2009-10-16-Scope.ll CodeGen/X86/2010-08-04-StackVariable.ll DebugInfo/2009-10-16-Scope.ll DebugInfo/2010-08-04-StackVariable.ll MC/ARM/darwin-ARM-reloc.s MC/ARM/darwin-Thumb-reloc.s MC/ARM/full_line_comment.s MC/AsmParser/full_line_comment.s MC/MachO/darwin-ARM-reloc.s MC/MachO/darwin-Thumb-reloc.s Message-ID: <20110224190627.4A0F32A6C12C@llvm.org> Author: dpatel Date: Thu Feb 24 13:06:27 2011 New Revision: 126401 URL: http://llvm.org/viewvc/llvm-project?rev=126401&view=rev Log: Move arch specific tests in arch specific directories. Added: llvm/trunk/test/CodeGen/ARM/2009-10-16-Scope.ll - copied, changed from r126390, llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll llvm/trunk/test/CodeGen/ARM/2010-08-04-StackVariable.ll - copied, changed from r126390, llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll llvm/trunk/test/CodeGen/X86/2009-10-16-Scope.ll - copied, changed from r126390, llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll - copied, changed from r126390, llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll llvm/trunk/test/MC/ARM/darwin-ARM-reloc.s - copied unchanged from r126390, llvm/trunk/test/MC/MachO/darwin-ARM-reloc.s llvm/trunk/test/MC/ARM/darwin-Thumb-reloc.s - copied unchanged from r126390, llvm/trunk/test/MC/MachO/darwin-Thumb-reloc.s llvm/trunk/test/MC/ARM/full_line_comment.s - copied unchanged from r126390, llvm/trunk/test/MC/AsmParser/full_line_comment.s Removed: llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll llvm/trunk/test/MC/AsmParser/full_line_comment.s llvm/trunk/test/MC/MachO/darwin-ARM-reloc.s llvm/trunk/test/MC/MachO/darwin-Thumb-reloc.s Copied: llvm/trunk/test/CodeGen/ARM/2009-10-16-Scope.ll (from r126390, llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-10-16-Scope.ll?p2=llvm/trunk/test/CodeGen/ARM/2009-10-16-Scope.ll&p1=llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll&r1=126390&r2=126401&rev=126401&view=diff ============================================================================== --- llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2009-10-16-Scope.ll Thu Feb 24 13:06:27 2011 @@ -1,4 +1,3 @@ -; RUN: llc %s -O0 -o /dev/null -mtriple=x86_64-apple-darwin ; RUN: llc %s -O0 -o /dev/null -mtriple=arm-apple-darwin ; PR 5197 ; There is not any llvm instruction assocated with !5. The code generator Copied: llvm/trunk/test/CodeGen/ARM/2010-08-04-StackVariable.ll (from r126390, llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2010-08-04-StackVariable.ll?p2=llvm/trunk/test/CodeGen/ARM/2010-08-04-StackVariable.ll&p1=llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll&r1=126390&r2=126401&rev=126401&view=diff ============================================================================== --- llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2010-08-04-StackVariable.ll Thu Feb 24 13:06:27 2011 @@ -1,5 +1,4 @@ ; RUN: llc -O0 -mtriple=arm-apple-darwin < %s | grep DW_OP_fbreg -; RUN: llc -O0 -mtriple=x86_64-apple-darwin < %s | grep DW_OP_fbreg ; Use DW_OP_fbreg in variable's location expression if the variable is in a stack slot. %struct.SVal = type { i8*, i32 } Copied: llvm/trunk/test/CodeGen/X86/2009-10-16-Scope.ll (from r126390, llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-10-16-Scope.ll?p2=llvm/trunk/test/CodeGen/X86/2009-10-16-Scope.ll&p1=llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll&r1=126390&r2=126401&rev=126401&view=diff ============================================================================== --- llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-10-16-Scope.ll Thu Feb 24 13:06:27 2011 @@ -1,5 +1,4 @@ ; RUN: llc %s -O0 -o /dev/null -mtriple=x86_64-apple-darwin -; RUN: llc %s -O0 -o /dev/null -mtriple=arm-apple-darwin ; PR 5197 ; There is not any llvm instruction assocated with !5. The code generator ; should be able to handle this. Copied: llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll (from r126390, llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll?p2=llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll&p1=llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll&r1=126390&r2=126401&rev=126401&view=diff ============================================================================== --- llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll (original) +++ llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll Thu Feb 24 13:06:27 2011 @@ -1,4 +1,3 @@ -; RUN: llc -O0 -mtriple=arm-apple-darwin < %s | grep DW_OP_fbreg ; RUN: llc -O0 -mtriple=x86_64-apple-darwin < %s | grep DW_OP_fbreg ; Use DW_OP_fbreg in variable's location expression if the variable is in a stack slot. Removed: llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll?rev=126400&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll (original) +++ llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll (removed) @@ -1,33 +0,0 @@ -; RUN: llc %s -O0 -o /dev/null -mtriple=x86_64-apple-darwin -; RUN: llc %s -O0 -o /dev/null -mtriple=arm-apple-darwin -; PR 5197 -; There is not any llvm instruction assocated with !5. The code generator -; should be able to handle this. - -define void @bar() nounwind ssp { -entry: - %count_ = alloca i32, align 4 ; [#uses=2] - br label %do.body, !dbg !0 - -do.body: ; preds = %entry - call void @llvm.dbg.declare(metadata !{i32* %count_}, metadata !4) - %conv = ptrtoint i32* %count_ to i32, !dbg !0 ; [#uses=1] - %call = call i32 @foo(i32 %conv) ssp, !dbg !0 ; [#uses=0] - br label %do.end, !dbg !0 - -do.end: ; preds = %do.body - ret void, !dbg !7 -} - -declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone - -declare i32 @foo(i32) ssp - -!0 = metadata !{i32 5, i32 2, metadata !1, null} -!1 = metadata !{i32 458763, metadata !2}; [DW_TAG_lexical_block ] -!2 = metadata !{i32 458798, i32 0, metadata !3, metadata !"bar", metadata !"bar", metadata !"bar", metadata !3, i32 4, null, i1 false, i1 true}; [DW_TAG_subprogram ] -!3 = metadata !{i32 458769, i32 0, i32 12, metadata !"genmodes.i", metadata !"/Users/yash/Downloads", metadata !"clang 1.1", i1 true, i1 false, metadata !"", i32 0}; [DW_TAG_compile_unit ] -!4 = metadata !{i32 459008, metadata !5, metadata !"count_", metadata !3, i32 5, metadata !6}; [ DW_TAG_auto_variable ] -!5 = metadata !{i32 458763, metadata !1}; [DW_TAG_lexical_block ] -!6 = metadata !{i32 458788, metadata !3, metadata !"int", metadata !3, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ] -!7 = metadata !{i32 6, i32 1, metadata !2, null} Removed: llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll?rev=126400&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll (original) +++ llvm/trunk/test/DebugInfo/2010-08-04-StackVariable.ll (removed) @@ -1,125 +0,0 @@ -; RUN: llc -O0 -mtriple=arm-apple-darwin < %s | grep DW_OP_fbreg -; RUN: llc -O0 -mtriple=x86_64-apple-darwin < %s | grep DW_OP_fbreg -; Use DW_OP_fbreg in variable's location expression if the variable is in a stack slot. - -%struct.SVal = type { i8*, i32 } - -define i32 @_Z3fooi4SVal(i32 %i, %struct.SVal* noalias %location) nounwind ssp { -entry: - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !23), !dbg !24 - call void @llvm.dbg.value(metadata !{%struct.SVal* %location}, i64 0, metadata !25), !dbg !24 - %0 = icmp ne i32 %i, 0, !dbg !27 ; [#uses=1] - br i1 %0, label %bb, label %bb1, !dbg !27 - -bb: ; preds = %entry - %1 = getelementptr inbounds %struct.SVal* %location, i32 0, i32 1, !dbg !29 ; [#uses=1] - %2 = load i32* %1, align 8, !dbg !29 ; [#uses=1] - %3 = add i32 %2, %i, !dbg !29 ; [#uses=1] - br label %bb2, !dbg !29 - -bb1: ; preds = %entry - %4 = getelementptr inbounds %struct.SVal* %location, i32 0, i32 1, !dbg !30 ; [#uses=1] - %5 = load i32* %4, align 8, !dbg !30 ; [#uses=1] - %6 = sub i32 %5, 1, !dbg !30 ; [#uses=1] - br label %bb2, !dbg !30 - -bb2: ; preds = %bb1, %bb - %.0 = phi i32 [ %3, %bb ], [ %6, %bb1 ] ; [#uses=1] - br label %return, !dbg !29 - -return: ; preds = %bb2 - ret i32 %.0, !dbg !29 -} - -define linkonce_odr void @_ZN4SValC1Ev(%struct.SVal* %this) nounwind ssp align 2 { -entry: - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.value(metadata !{%struct.SVal* %this}, i64 0, metadata !31), !dbg !34 - %0 = getelementptr inbounds %struct.SVal* %this, i32 0, i32 0, !dbg !34 ; [#uses=1] - store i8* null, i8** %0, align 8, !dbg !34 - %1 = getelementptr inbounds %struct.SVal* %this, i32 0, i32 1, !dbg !34 ; [#uses=1] - store i32 0, i32* %1, align 8, !dbg !34 - br label %return, !dbg !34 - -return: ; preds = %entry - ret void, !dbg !35 -} - -declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone - -define i32 @main() nounwind ssp { -entry: - %0 = alloca %struct.SVal ; <%struct.SVal*> [#uses=3] - %v = alloca %struct.SVal ; <%struct.SVal*> [#uses=4] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.declare(metadata !{%struct.SVal* %v}, metadata !38), !dbg !41 - call void @_ZN4SValC1Ev(%struct.SVal* %v) nounwind, !dbg !41 - %1 = getelementptr inbounds %struct.SVal* %v, i32 0, i32 1, !dbg !42 ; [#uses=1] - store i32 1, i32* %1, align 8, !dbg !42 - %2 = getelementptr inbounds %struct.SVal* %0, i32 0, i32 0, !dbg !43 ; [#uses=1] - %3 = getelementptr inbounds %struct.SVal* %v, i32 0, i32 0, !dbg !43 ; [#uses=1] - %4 = load i8** %3, align 8, !dbg !43 ; [#uses=1] - store i8* %4, i8** %2, align 8, !dbg !43 - %5 = getelementptr inbounds %struct.SVal* %0, i32 0, i32 1, !dbg !43 ; [#uses=1] - %6 = getelementptr inbounds %struct.SVal* %v, i32 0, i32 1, !dbg !43 ; [#uses=1] - %7 = load i32* %6, align 8, !dbg !43 ; [#uses=1] - store i32 %7, i32* %5, align 8, !dbg !43 - %8 = call i32 @_Z3fooi4SVal(i32 2, %struct.SVal* noalias %0) nounwind, !dbg !43 ; [#uses=0] - call void @llvm.dbg.value(metadata !{i32 %8}, i64 0, metadata !44), !dbg !43 - br label %return, !dbg !45 - -return: ; preds = %entry - ret i32 0, !dbg !45 -} - -declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone - -!llvm.dbg.sp = !{!0, !9, !16, !17, !20} - -!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"SVal", metadata !"SVal", metadata !"", metadata !2, i32 11, metadata !14, i1 false, i1 false, i32 0, i32 0, null, i1 false, i1 false, null} ; [ DW_TAG_subprogram ] -!1 = metadata !{i32 524307, metadata !2, metadata !"SVal", metadata !2, i32 1, i64 128, i64 64, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_structure_type ] -!2 = metadata !{i32 524329, metadata !"small.cc", metadata !"/Users/manav/R8248330", metadata !3} ; [ DW_TAG_file_type ] -!3 = metadata !{i32 524305, i32 0, i32 4, metadata !"small.cc", metadata !"/Users/manav/R8248330", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] -!4 = metadata !{metadata !5, metadata !7, metadata !0, metadata !9} -!5 = metadata !{i32 524301, metadata !1, metadata !"Data", metadata !2, i32 7, i64 64, i64 64, i64 0, i32 0, metadata !6} ; [ DW_TAG_member ] -!6 = metadata !{i32 524303, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, null} ; [ DW_TAG_pointer_type ] -!7 = metadata !{i32 524301, metadata !1, metadata !"Kind", metadata !2, i32 8, i64 32, i64 32, i64 64, i32 0, metadata !8} ; [ DW_TAG_member ] -!8 = metadata !{i32 524324, metadata !2, metadata !"unsigned int", metadata !2, i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] -!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"~SVal", metadata !"~SVal", metadata !"", metadata !2, i32 12, metadata !10, i1 false, i1 false, i32 0, i32 0, null, i1 false, i1 false, null} ; [ DW_TAG_subprogram ] -!10 = metadata !{i32 524309, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null} ; [ DW_TAG_subroutine_type ] -!11 = metadata !{null, metadata !12, metadata !13} -!12 = metadata !{i32 524303, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !1} ; [ DW_TAG_pointer_type ] -!13 = metadata !{i32 524324, metadata !2, metadata !"int", metadata !2, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] -!14 = metadata !{i32 524309, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null} ; [ DW_TAG_subroutine_type ] -!15 = metadata !{null, metadata !12} -!16 = metadata !{i32 524334, i32 0, metadata !1, metadata !"SVal", metadata !"SVal", metadata !"_ZN4SValC1Ev", metadata !2, i32 11, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, void (%struct.SVal*)* @_ZN4SValC1Ev} ; [ DW_TAG_subprogram ] -!17 = metadata !{i32 524334, i32 0, metadata !2, metadata !"foo", metadata !"foo", metadata !"_Z3fooi4SVal", metadata !2, i32 16, metadata !18, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32, %struct.SVal*)* @_Z3fooi4SVal} ; [ DW_TAG_subprogram ] -!18 = metadata !{i32 524309, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !19, i32 0, null} ; [ DW_TAG_subroutine_type ] -!19 = metadata !{metadata !13, metadata !13, metadata !1} -!20 = metadata !{i32 524334, i32 0, metadata !2, metadata !"main", metadata !"main", metadata !"main", metadata !2, i32 23, metadata !21, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ] -!21 = metadata !{i32 524309, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !22, i32 0, null} ; [ DW_TAG_subroutine_type ] -!22 = metadata !{metadata !13} -!23 = metadata !{i32 524545, metadata !17, metadata !"i", metadata !2, i32 16, metadata !13} ; [ DW_TAG_arg_variable ] -!24 = metadata !{i32 16, i32 0, metadata !17, null} -!25 = metadata !{i32 524545, metadata !17, metadata !"location", metadata !2, i32 16, metadata !26} ; [ DW_TAG_arg_variable ] -!26 = metadata !{i32 524304, metadata !2, metadata !"SVal", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !1} ; [ DW_TAG_reference_type ] -!27 = metadata !{i32 17, i32 0, metadata !28, null} -!28 = metadata !{i32 524299, metadata !17, i32 16, i32 0, metadata !2, i32 2} ; [ DW_TAG_lexical_block ] -!29 = metadata !{i32 18, i32 0, metadata !28, null} -!30 = metadata !{i32 20, i32 0, metadata !28, null} -!31 = metadata !{i32 524545, metadata !16, metadata !"this", metadata !2, i32 11, metadata !32} ; [ DW_TAG_arg_variable ] -!32 = metadata !{i32 524326, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !33} ; [ DW_TAG_const_type ] -!33 = metadata !{i32 524303, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !1} ; [ DW_TAG_pointer_type ] -!34 = metadata !{i32 11, i32 0, metadata !16, null} -!35 = metadata !{i32 11, i32 0, metadata !36, null} -!36 = metadata !{i32 524299, metadata !37, i32 11, i32 0, metadata !2, i32 1} ; [ DW_TAG_lexical_block ] -!37 = metadata !{i32 524299, metadata !16, i32 11, i32 0, metadata !2, i32 0} ; [ DW_TAG_lexical_block ] -!38 = metadata !{i32 524544, metadata !39, metadata !"v", metadata !2, i32 24, metadata !1} ; [ DW_TAG_auto_variable ] -!39 = metadata !{i32 524299, metadata !40, i32 23, i32 0, metadata !2, i32 4} ; [ DW_TAG_lexical_block ] -!40 = metadata !{i32 524299, metadata !20, i32 23, i32 0, metadata !2, i32 3} ; [ DW_TAG_lexical_block ] -!41 = metadata !{i32 24, i32 0, metadata !39, null} -!42 = metadata !{i32 25, i32 0, metadata !39, null} -!43 = metadata !{i32 26, i32 0, metadata !39, null} -!44 = metadata !{i32 524544, metadata !39, metadata !"k", metadata !2, i32 26, metadata !13} ; [ DW_TAG_auto_variable ] -!45 = metadata !{i32 27, i32 0, metadata !39, null} Removed: llvm/trunk/test/MC/AsmParser/full_line_comment.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/full_line_comment.s?rev=126400&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/full_line_comment.s (original) +++ llvm/trunk/test/MC/AsmParser/full_line_comment.s (removed) @@ -1,8 +0,0 @@ -// RUN: llvm-mc -triple arm-apple-darwin10 %s | FileCheck %s -# this is a full line comment starting at column 1 - # this starting at column 2 - - .data -// CHECK: .long 0 -.long 0 -# .long 1 this line is commented out Removed: llvm/trunk/test/MC/MachO/darwin-ARM-reloc.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/darwin-ARM-reloc.s?rev=126400&view=auto ============================================================================== --- llvm/trunk/test/MC/MachO/darwin-ARM-reloc.s (original) +++ llvm/trunk/test/MC/MachO/darwin-ARM-reloc.s (removed) @@ -1,171 +0,0 @@ -@ RUN: llvm-mc -n -triple armv7-apple-darwin10 %s -filetype=obj -o %t.obj -@ RUN: macho-dump --dump-section-data < %t.obj > %t.dump -@ RUN: FileCheck < %t.dump %s - - .syntax unified - .text -_f0: - bl _printf - -_f1: - bl _f0 - - .data -_d0: -Ld0_0: - .long Lsc0_0 - Ld0_0 - - .section __TEXT,__cstring,cstring_literals -Lsc0_0: - .long 0 - -@ CHECK: ('cputype', 12) -@ CHECK: ('cpusubtype', 9) -@ CHECK: ('filetype', 1) -@ CHECK: ('num_load_commands', 3) -@ CHECK: ('load_commands_size', 364) -@ CHECK: ('flag', 0) -@ CHECK: ('load_commands', [ -@ CHECK: # Load Command 0 -@ CHECK: (('command', 1) -@ CHECK: ('size', 260) -@ CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('vm_addr', 0) -@ CHECK: ('vm_size', 16) -@ CHECK: ('file_offset', 392) -@ CHECK: ('file_size', 16) -@ CHECK: ('maxprot', 7) -@ CHECK: ('initprot', 7) -@ CHECK: ('num_sections', 3) -@ CHECK: ('flags', 0) -@ CHECK: ('sections', [ -@ CHECK: # Section 0 -@ CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('address', 0) -@ CHECK: ('size', 8) -@ CHECK: ('offset', 392) -@ CHECK: ('alignment', 0) -@ CHECK: ('reloc_offset', 408) -@ CHECK: ('num_reloc', 2) -@ CHECK: ('flags', 0x80000400) -@ CHECK: ('reserved1', 0) -@ CHECK: ('reserved2', 0) -@ CHECK: ), -@ CHECK: ('_relocations', [ -@ CHECK: # Relocation 0 -@ CHECK: (('word-0', 0x4), -@ CHECK: ('word-1', 0x55000001)), -@ CHECK: # Relocation 1 -@ CHECK: (('word-0', 0x0), -@ CHECK: ('word-1', 0x5d000003)), -@ CHECK: ]) -@ CHECK: ('_section_data', 'feffffeb fdffffeb') -@ CHECK: # Section 1 -@ CHECK: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('address', 8) -@ CHECK: ('size', 4) -@ CHECK: ('offset', 400) -@ CHECK: ('alignment', 0) -@ CHECK: ('reloc_offset', 424) -@ CHECK: ('num_reloc', 2) -@ CHECK: ('flags', 0x0) -@ CHECK: ('reserved1', 0) -@ CHECK: ('reserved2', 0) -@ CHECK: ), -@ CHECK: ('_relocations', [ -@ CHECK: # Relocation 0 -@ CHECK: (('word-0', 0xa2000000), -@ CHECK: ('word-1', 0xc)), -@ CHECK: # Relocation 1 -@ CHECK: (('word-0', 0xa1000000), -@ CHECK: ('word-1', 0x8)), -@ CHECK: ]) -@ CHECK: ('_section_data', '04000000') -@ CHECK: # Section 2 -@ CHECK: (('section_name', '__cstring\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('address', 12) -@ CHECK: ('size', 4) -@ CHECK: ('offset', 404) -@ CHECK: ('alignment', 0) -@ CHECK: ('reloc_offset', 0) -@ CHECK: ('num_reloc', 0) -@ CHECK: ('flags', 0x2) -@ CHECK: ('reserved1', 0) -@ CHECK: ('reserved2', 0) -@ CHECK: ), -@ CHECK: ('_relocations', [ -@ CHECK: ]) -@ CHECK: ('_section_data', '00000000') -@ CHECK: ]) -@ CHECK: ), -@ CHECK: # Load Command 1 -@ CHECK: (('command', 2) -@ CHECK: ('size', 24) -@ CHECK: ('symoff', 440) -@ CHECK: ('nsyms', 4) -@ CHECK: ('stroff', 488) -@ CHECK: ('strsize', 24) -@ CHECK: ('_string_data', '\x00_printf\x00_f0\x00_f1\x00_d0\x00\x00\x00\x00') -@ CHECK: ('_symbols', [ -@ CHECK: # Symbol 0 -@ CHECK: (('n_strx', 9) -@ CHECK: ('n_type', 0xe) -@ CHECK: ('n_sect', 1) -@ CHECK: ('n_desc', 0) -@ CHECK: ('n_value', 0) -@ CHECK: ('_string', '_f0') -@ CHECK: ), -@ CHECK: # Symbol 1 -@ CHECK: (('n_strx', 13) -@ CHECK: ('n_type', 0xe) -@ CHECK: ('n_sect', 1) -@ CHECK: ('n_desc', 0) -@ CHECK: ('n_value', 4) -@ CHECK: ('_string', '_f1') -@ CHECK: ), -@ CHECK: # Symbol 2 -@ CHECK: (('n_strx', 17) -@ CHECK: ('n_type', 0xe) -@ CHECK: ('n_sect', 2) -@ CHECK: ('n_desc', 0) -@ CHECK: ('n_value', 8) -@ CHECK: ('_string', '_d0') -@ CHECK: ), -@ CHECK: # Symbol 3 -@ CHECK: (('n_strx', 1) -@ CHECK: ('n_type', 0x1) -@ CHECK: ('n_sect', 0) -@ CHECK: ('n_desc', 0) -@ CHECK: ('n_value', 0) -@ CHECK: ('_string', '_printf') -@ CHECK: ), -@ CHECK: ]) -@ CHECK: ), -@ CHECK: # Load Command 2 -@ CHECK: (('command', 11) -@ CHECK: ('size', 80) -@ CHECK: ('ilocalsym', 0) -@ CHECK: ('nlocalsym', 3) -@ CHECK: ('iextdefsym', 3) -@ CHECK: ('nextdefsym', 0) -@ CHECK: ('iundefsym', 3) -@ CHECK: ('nundefsym', 1) -@ CHECK: ('tocoff', 0) -@ CHECK: ('ntoc', 0) -@ CHECK: ('modtaboff', 0) -@ CHECK: ('nmodtab', 0) -@ CHECK: ('extrefsymoff', 0) -@ CHECK: ('nextrefsyms', 0) -@ CHECK: ('indirectsymoff', 0) -@ CHECK: ('nindirectsyms', 0) -@ CHECK: ('extreloff', 0) -@ CHECK: ('nextrel', 0) -@ CHECK: ('locreloff', 0) -@ CHECK: ('nlocrel', 0) -@ CHECK: ('_indirect_symbols', [ -@ CHECK: ]) -@ CHECK: ), -@ CHECK: ]) Removed: llvm/trunk/test/MC/MachO/darwin-Thumb-reloc.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/darwin-Thumb-reloc.s?rev=126400&view=auto ============================================================================== --- llvm/trunk/test/MC/MachO/darwin-Thumb-reloc.s (original) +++ llvm/trunk/test/MC/MachO/darwin-Thumb-reloc.s (removed) @@ -1,139 +0,0 @@ -@ RUN: llvm-mc -n -triple thumbv7-apple-darwin10 %s -filetype=obj -o %t.obj -@ RUN: macho-dump --dump-section-data < %t.obj > %t.dump -@ RUN: FileCheck < %t.dump %s - - .syntax unified - .section __TEXT,__text,regular,pure_instructions - .globl _main - .align 2 - .code 16 - .thumb_func _main -_main: -LPC0_0: - blx _printf - .align 2 -LCPI0_0: - .long L_.str-(LPC0_0+4) - - .section __TEXT,__cstring,cstring_literals - .align 2 -L_.str: - .asciz "s0" - -.subsections_via_symbols - -@ CHECK: ('cputype', 12) -@ CHECK: ('cpusubtype', 9) -@ CHECK: ('filetype', 1) -@ CHECK: ('num_load_commands', 3) -@ CHECK: ('load_commands_size', 296) -@ CHECK: ('flag', 8192) -@ CHECK: ('load_commands', [ -@ CHECK: # Load Command 0 -@ CHECK: (('command', 1) -@ CHECK: ('size', 192) -@ CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('vm_addr', 0) -@ CHECK: ('vm_size', 11) -@ CHECK: ('file_offset', 324) -@ CHECK: ('file_size', 11) -@ CHECK: ('maxprot', 7) -@ CHECK: ('initprot', 7) -@ CHECK: ('num_sections', 2) -@ CHECK: ('flags', 0) -@ CHECK: ('sections', [ -@ CHECK: # Section 0 -@ CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('address', 0) -@ CHECK: ('size', 8) -@ CHECK: ('offset', 324) -@ CHECK: ('alignment', 2) -@ CHECK: ('reloc_offset', 336) -@ CHECK: ('num_reloc', 3) -@ CHECK: ('flags', 0x80000400) -@ CHECK: ('reserved1', 0) -@ CHECK: ('reserved2', 0) -@ CHECK: ), -@ CHECK: ('_relocations', [ -@ CHECK: # Relocation 0 -@ CHECK: (('word-0', 0xa2000004), -@ CHECK: ('word-1', 0x8)), -@ CHECK: # Relocation 1 -@ CHECK: (('word-0', 0xa1000000), -@ CHECK: ('word-1', 0x0)), -@ CHECK: # Relocation 2 -@ CHECK: (('word-0', 0x0), -@ CHECK: ('word-1', 0x6d000001)), -@ CHECK: ]) -@ CHECK-FIXME: ('_section_data', 'fff7feef 04000000') -@ CHECK: # Section 1 -@ CHECK: (('section_name', '__cstring\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -@ CHECK: ('address', 8) -@ CHECK: ('size', 3) -@ CHECK: ('offset', 332) -@ CHECK: ('alignment', 2) -@ CHECK: ('reloc_offset', 0) -@ CHECK: ('num_reloc', 0) -@ CHECK: ('flags', 0x2) -@ CHECK: ('reserved1', 0) -@ CHECK: ('reserved2', 0) -@ CHECK: ), -@ CHECK: ('_relocations', [ -@ CHECK: ]) -@ CHECK: ('_section_data', '733000') -@ CHECK: ]) -@ CHECK: ), -@ CHECK: # Load Command 1 -@ CHECK: (('command', 2) -@ CHECK: ('size', 24) -@ CHECK: ('symoff', 360) -@ CHECK: ('nsyms', 2) -@ CHECK: ('stroff', 384) -@ CHECK: ('strsize', 16) -@ CHECK: ('_string_data', '\x00_main\x00_printf\x00\x00') -@ CHECK: ('_symbols', [ -@ CHECK: # Symbol 0 -@ CHECK: (('n_strx', 1) -@ CHECK: ('n_type', 0xf) -@ CHECK: ('n_sect', 1) -@ CHECK: ('n_desc', 8) -@ CHECK: ('n_value', 0) -@ CHECK: ('_string', '_main') -@ CHECK: ), -@ CHECK: # Symbol 1 -@ CHECK: (('n_strx', 7) -@ CHECK: ('n_type', 0x1) -@ CHECK: ('n_sect', 0) -@ CHECK: ('n_desc', 0) -@ CHECK: ('n_value', 0) -@ CHECK: ('_string', '_printf') -@ CHECK: ), -@ CHECK: ]) -@ CHECK: ), -@ CHECK: # Load Command 2 -@ CHECK: (('command', 11) -@ CHECK: ('size', 80) -@ CHECK: ('ilocalsym', 0) -@ CHECK: ('nlocalsym', 0) -@ CHECK: ('iextdefsym', 0) -@ CHECK: ('nextdefsym', 1) -@ CHECK: ('iundefsym', 1) -@ CHECK: ('nundefsym', 1) -@ CHECK: ('tocoff', 0) -@ CHECK: ('ntoc', 0) -@ CHECK: ('modtaboff', 0) -@ CHECK: ('nmodtab', 0) -@ CHECK: ('extrefsymoff', 0) -@ CHECK: ('nextrefsyms', 0) -@ CHECK: ('indirectsymoff', 0) -@ CHECK: ('nindirectsyms', 0) -@ CHECK: ('extreloff', 0) -@ CHECK: ('nextrel', 0) -@ CHECK: ('locreloff', 0) -@ CHECK: ('nlocrel', 0) -@ CHECK: ('_indirect_symbols', [ -@ CHECK: ]) -@ CHECK: ), -@ CHECK: ]) From dpatel at apple.com Thu Feb 24 13:09:52 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Feb 2011 19:09:52 -0000 Subject: [llvm-commits] [llvm] r126402 - in /llvm/trunk/test/DebugInfo: 2009-03-03-deadstore.ll 2009-03-03-store-to-load-forward.ll Message-ID: <20110224190953.03F8A2A6C12C@llvm.org> Author: dpatel Date: Thu Feb 24 13:09:52 2011 New Revision: 126402 URL: http://llvm.org/viewvc/llvm-project?rev=126402&view=rev Log: Remove obsolete tests. Removed: llvm/trunk/test/DebugInfo/2009-03-03-deadstore.ll llvm/trunk/test/DebugInfo/2009-03-03-store-to-load-forward.ll Removed: llvm/trunk/test/DebugInfo/2009-03-03-deadstore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-03-03-deadstore.ll?rev=126401&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/2009-03-03-deadstore.ll (original) +++ llvm/trunk/test/DebugInfo/2009-03-03-deadstore.ll (removed) @@ -1,108 +0,0 @@ -; RUN: opt < %s -instcombine -S | not grep alloca -; ModuleID = '' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9.6" - - type { } ; type %0 - type <{ i8 }> ; type %1 - type { i32 (...)**, %3 } ; type %2 - type { %4, %2*, i8, i8, %10*, %11*, %12*, %12* } ; type %3 - type { i32 (...)**, i32, i32, i32, i32, i32, %5*, %6, [8 x %6], i32, %6*, %7 } ; type %4 - type { %5*, void (i32, %4*, i32)*, i32, i32 } ; type %5 - type { i8*, i32 } ; type %6 - type { %8* } ; type %7 - type { i32, %9**, i32, %9**, i8** } ; type %8 - type { i32 (...)**, i32 } ; type %9 - type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %7 } ; type %10 - type { %9, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 } ; type %11 - type { %9 } ; type %12 - type { i32, void ()* } ; type %13 - type { %15 } ; type %14 - type { %16 } ; type %15 - type { %17 } ; type %16 - type { i32*, i32*, i32* } ; type %17 - type { %19 } ; type %18 - type { %20 } ; type %19 - type { %21 } ; type %20 - type { %14*, %14*, %14* } ; type %21 - type { i32 } ; type %22 - type { i8 } ; type %23 - type { i32* } ; type %24 - type { %14* } ; type %25 - type { %27 } ; type %26 - type { i8* } ; type %27 - type { %29, %30, %3 } ; type %28 - type { i32 (...)** } ; type %29 - type { %10, i32, %26 } ; type %30 - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, %0*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } - %llvm.dbg.composite.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0*, %0*, i32 } - %llvm.dbg.derivedtype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0* } - %llvm.dbg.enumerator.type = type { i32, i8*, i64 } - %llvm.dbg.global_variable.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1, %0* } - %llvm.dbg.subprogram.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1 } - %llvm.dbg.subrange.type = type { i32, i64, i64 } - %llvm.dbg.variable.type = type { i32, %0*, i8*, %0*, i32, %0* } - - at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] - at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -internal constant [11 x i8] c"bigfib.cpp\00", section "llvm.metadata" ; <[11 x i8]*>:0 [#uses=1] -internal constant [84 x i8] c"/Volumes/Nanpura/mainline/llvm/projects/llvm-test/SingleSource/Benchmarks/Misc-C++/\00", section "llvm.metadata" ; <[84 x i8]*>:1 [#uses=1] -internal constant [57 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 2099)\00", section "llvm.metadata" ; <[57 x i8]*>:2 [#uses=1] - at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @0, i32 0, i32 0), i8* getelementptr ([84 x i8]* @1, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [23 x i8] c"/usr/include/c++/4.0.0\00", section "llvm.metadata" ; <[23 x i8]*>:3 [#uses=1] - - -internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*>:4 [#uses=1] - at llvm.dbg.basictype103 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @4, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -internal constant [8 x i8] c"iomanip\00", section "llvm.metadata" ; <[8 x i8]*>:5 [#uses=1] - at llvm.dbg.compile_unit1548 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([8 x i8]* @5, i32 0, i32 0), i8* getelementptr ([23 x i8]* @3, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [6 x i8] c"_Setw\00", section "llvm.metadata" ; <[6 x i8]*>:6 [#uses=1] -internal constant [5 x i8] c"_M_n\00", section "llvm.metadata" ; <[5 x i8]*>:7 [#uses=1] - at llvm.dbg.derivedtype1552 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @7, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1548 to %0*), i32 232, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype103 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.array1553 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1552 to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1] - at llvm.dbg.composite1554 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @6, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1548 to %0*), i32 232, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array1553 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] - at llvm.dbg.array1555 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1554 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype103 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1] - at llvm.dbg.composite1556 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1555 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [5 x i8] c"setw\00", section "llvm.metadata" ; <[5 x i8]*>:8 [#uses=2] -internal constant [11 x i8] c"_ZSt4setwi\00", section "llvm.metadata" ; <[11 x i8]*>:9 [#uses=1] - at llvm.dbg.subprogram1559 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @8, i32 0, i32 0), i8* getelementptr ([5 x i8]* @8, i32 0, i32 0), i8* getelementptr ([11 x i8]* @9, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1548 to %0*), i32 242, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1556 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -internal constant [4 x i8] c"__x\00", section "llvm.metadata" ; <[4 x i8]*>:10 [#uses=1] - at llvm.dbg.variable1563 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1559 to %0*), i8* getelementptr ([4 x i8]* @10, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1548 to %0*), i32 244, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1554 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] - -define linkonce i32 @_ZSt4setwi(i32) nounwind { - %2 = alloca %22 ; <%22*> [#uses=2] - %3 = alloca %22 ; <%22*> [#uses=3] - %4 = alloca %22 ; <%22*> [#uses=2] - %5 = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1559 to %0*)) - %6 = bitcast %22* %3 to %0* ; <%0*> [#uses=1] - call void @llvm.dbg.declare(%0* %6, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1563 to %0*)) - call void @llvm.dbg.stoppoint(i32 245, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1548 to %0*)) - %7 = getelementptr %22* %3, i32 0, i32 0 ; [#uses=1] - store i32 %0, i32* %7, align 4 - call void @llvm.dbg.stoppoint(i32 246, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1548 to %0*)) - %8 = getelementptr %22* %4, i32 0, i32 0 ; [#uses=1] - %9 = getelementptr %22* %3, i32 0, i32 0 ; [#uses=1] - %10 = load i32* %9, align 4 ; [#uses=1] - store i32 %10, i32* %8, align 4 - %11 = getelementptr %22* %2, i32 0, i32 0 ; [#uses=1] - %12 = getelementptr %22* %4, i32 0, i32 0 ; [#uses=1] - %13 = load i32* %12, align 4 ; [#uses=1] - store i32 %13, i32* %11, align 4 - %14 = bitcast %22* %2 to i32* ; [#uses=1] - %15 = load i32* %14 ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 246, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1548 to %0*)) - call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1559 to %0*)) - ret i32 %15 -} - -declare void @llvm.dbg.func.start(%0*) nounwind - -declare void @llvm.dbg.declare(%0*, %0*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, %0*) nounwind - -declare void @llvm.dbg.region.end(%0*) nounwind - Removed: llvm/trunk/test/DebugInfo/2009-03-03-store-to-load-forward.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-03-03-store-to-load-forward.ll?rev=126401&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/2009-03-03-store-to-load-forward.ll (original) +++ llvm/trunk/test/DebugInfo/2009-03-03-store-to-load-forward.ll (removed) @@ -1,260 +0,0 @@ -; RUN: opt < %s -instcombine -S | not grep alloca -; ModuleID = '' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9.6" - type { } ; type %0 - type <{ i8 }> ; type %1 - type { i32* } ; type %2 - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, %0*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } - %llvm.dbg.composite.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0*, %0*, i32 } - %llvm.dbg.derivedtype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0* } - %llvm.dbg.subprogram.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1 } - %llvm.dbg.variable.type = type { i32, %0*, i8*, %0*, i32, %0* } - at llvm.dbg.compile_units = internal constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -internal constant [11 x i8] c"bigfib.cpp\00", section "llvm.metadata" ; <[11 x i8]*>:0 [#uses=1] -internal constant [84 x i8] c"/Volumes/Nanpura/mainline/llvm/projects/llvm-test/SingleSource/Benchmarks/Misc-C++/\00", section "llvm.metadata" ; <[84 x i8]*>:1 [#uses=1] -internal constant [57 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 2099)\00", section "llvm.metadata" ; <[57 x i8]*>:2 [#uses=1] - at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @0, i32 0, i32 0), i8* getelementptr ([84 x i8]* @1, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [18 x i8] c"long unsigned int\00", section "llvm.metadata" ; <[18 x i8]*>:3 [#uses=1] - at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @3, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 7 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -internal constant [69 x i8] c"/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin9/4.2.1/include\00", section "llvm.metadata" ; <[69 x i8]*>:4 [#uses=1] - at llvm.dbg.subprograms = internal constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -internal constant [12 x i8] c"unnamed_arg\00", section "llvm.metadata" ; <[12 x i8]*>:5 [#uses=1] -internal constant [28 x i8] c"/usr/include/c++/4.0.0/bits\00", section "llvm.metadata" ; <[28 x i8]*>:6 [#uses=1] -internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*>:7 [#uses=1] - at llvm.dbg.basictype103 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @7, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] - at llvm.dbg.derivedtype110 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype103 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [11 x i8] c"\00", section "llvm.metadata" ; <[11 x i8]*>:8 [#uses=1] - at llvm.dbg.compile_unit112 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @8, i32 0, i32 0), i8* getelementptr ([84 x i8]* @1, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [10 x i8] c"ptrdiff_t\00", section "llvm.metadata" ; <[10 x i8]*>:9 [#uses=1] - at llvm.dbg.derivedtype114 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @9, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit112 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype110 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [9 x i8] c"_types.h\00", section "llvm.metadata" ; <[9 x i8]*>:10 [#uses=1] -internal constant [18 x i8] c"/usr/include/i386\00", section "llvm.metadata" ; <[18 x i8]*>:11 [#uses=1] - at llvm.dbg.compile_unit117 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @10, i32 0, i32 0), i8* getelementptr ([18 x i8]* @11, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [10 x i8] c"__int32_t\00", section "llvm.metadata" ; <[10 x i8]*>:12 [#uses=1] - at llvm.dbg.derivedtype119 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @12, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit117 to %0*), i32 43, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype114 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [19 x i8] c"__darwin_ct_rune_t\00", section "llvm.metadata" ; <[19 x i8]*>:13 [#uses=1] - at llvm.dbg.derivedtype121 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @13, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit117 to %0*), i32 50, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype119 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [19 x i8] c"__darwin_ptrdiff_t\00", section "llvm.metadata" ; <[19 x i8]*>:14 [#uses=1] - at llvm.dbg.derivedtype123 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @14, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit117 to %0*), i32 81, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype121 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [17 x i8] c"__darwin_wchar_t\00", section "llvm.metadata" ; <[17 x i8]*>:15 [#uses=1] - at llvm.dbg.derivedtype125 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @15, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit117 to %0*), i32 96, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype123 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [16 x i8] c"__darwin_rune_t\00", section "llvm.metadata" ; <[16 x i8]*>:16 [#uses=1] - at llvm.dbg.derivedtype127 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @16, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit117 to %0*), i32 102, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype125 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [16 x i8] c"__darwin_wint_t\00", section "llvm.metadata" ; <[16 x i8]*>:17 [#uses=1] - at llvm.dbg.derivedtype129 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @17, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit117 to %0*), i32 107, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype127 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [17 x i8] c"/usr/include/sys\00", section "llvm.metadata" ; <[17 x i8]*>:18 [#uses=1] - at llvm.dbg.compile_unit131 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @10, i32 0, i32 0), i8* getelementptr ([17 x i8]* @18, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [19 x i8] c"__darwin_blksize_t\00", section "llvm.metadata" ; <[19 x i8]*>:19 [#uses=1] - at llvm.dbg.derivedtype133 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @19, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit131 to %0*), i32 94, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype129 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [15 x i8] c"__darwin_dev_t\00", section "llvm.metadata" ; <[15 x i8]*>:20 [#uses=1] - at llvm.dbg.derivedtype135 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @20, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit131 to %0*), i32 95, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype133 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [15 x i8] c"__darwin_pid_t\00", section "llvm.metadata" ; <[15 x i8]*>:21 [#uses=1] - at llvm.dbg.derivedtype137 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @21, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit131 to %0*), i32 110, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype135 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [21 x i8] c"__darwin_suseconds_t\00", section "llvm.metadata" ; <[21 x i8]*>:22 [#uses=1] - at llvm.dbg.derivedtype139 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([21 x i8]* @22, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit131 to %0*), i32 131, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype137 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [17 x i8] c"__darwin_nl_item\00", section "llvm.metadata" ; <[17 x i8]*>:23 [#uses=1] - at llvm.dbg.derivedtype141 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @23, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit131 to %0*), i32 135, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype139 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [13 x i8] c"/usr/include\00", section "llvm.metadata" ; <[13 x i8]*>:24 [#uses=1] - at llvm.dbg.compile_unit143 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @10, i32 0, i32 0), i8* getelementptr ([13 x i8]* @24, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [19 x i8] c"__darwin_wctrans_t\00", section "llvm.metadata" ; <[19 x i8]*>:25 [#uses=1] - at llvm.dbg.derivedtype145 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @25, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit143 to %0*), i32 29, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype141 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [7 x i8] c"wait.h\00", section "llvm.metadata" ; <[7 x i8]*>:26 [#uses=1] - at llvm.dbg.compile_unit147 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([7 x i8]* @26, i32 0, i32 0), i8* getelementptr ([17 x i8]* @18, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [6 x i8] c"pid_t\00", section "llvm.metadata" ; <[6 x i8]*>:27 [#uses=1] - at llvm.dbg.derivedtype149 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @27, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit147 to %0*), i32 83, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype145 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [13 x i8] c"sig_atomic_t\00", section "llvm.metadata" ; <[13 x i8]*>:28 [#uses=1] - at llvm.dbg.derivedtype151 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @28, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit147 to %0*), i32 95, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype149 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [10 x i8] c"ct_rune_t\00", section "llvm.metadata" ; <[10 x i8]*>:29 [#uses=1] - at llvm.dbg.derivedtype153 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @29, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit147 to %0*), i32 262, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype151 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [9 x i8] c"stdlib.h\00", section "llvm.metadata" ; <[9 x i8]*>:30 [#uses=1] - at llvm.dbg.compile_unit155 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @30, i32 0, i32 0), i8* getelementptr ([13 x i8]* @24, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [7 x i8] c"rune_t\00", section "llvm.metadata" ; <[7 x i8]*>:31 [#uses=1] - at llvm.dbg.derivedtype157 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @31, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit155 to %0*), i32 81, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype153 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [8 x i8] c"types.h\00", section "llvm.metadata" ; <[8 x i8]*>:32 [#uses=1] - at llvm.dbg.compile_unit159 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([8 x i8]* @32, i32 0, i32 0), i8* getelementptr ([18 x i8]* @11, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [8 x i8] c"int32_t\00", section "llvm.metadata" ; <[8 x i8]*>:33 [#uses=1] - at llvm.dbg.derivedtype161 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @33, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit159 to %0*), i32 85, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype157 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [11 x i8] c"register_t\00", section "llvm.metadata" ; <[11 x i8]*>:34 [#uses=1] - at llvm.dbg.derivedtype163 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @34, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit159 to %0*), i32 95, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype161 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [6 x i8] c"dev_t\00", section "llvm.metadata" ; <[6 x i8]*>:35 [#uses=1] - at llvm.dbg.derivedtype165 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @35, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit159 to %0*), i32 125, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype163 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [11 x i8] c"_structs.h\00", section "llvm.metadata" ; <[11 x i8]*>:36 [#uses=1] - at llvm.dbg.compile_unit167 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @36, i32 0, i32 0), i8* getelementptr ([17 x i8]* @18, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [12 x i8] c"suseconds_t\00", section "llvm.metadata" ; <[12 x i8]*>:37 [#uses=1] - at llvm.dbg.derivedtype169 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @37, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit167 to %0*), i32 191, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype165 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [15 x i8] c"gthr-default.h\00", section "llvm.metadata" ; <[15 x i8]*>:38 [#uses=1] -internal constant [47 x i8] c"/usr/include/c++/4.0.0/i686-apple-darwin9/bits\00", section "llvm.metadata" ; <[47 x i8]*>:39 [#uses=1] - at llvm.dbg.compile_unit172 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([15 x i8]* @38, i32 0, i32 0), i8* getelementptr ([47 x i8]* @39, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [7 x i8] c"wint_t\00", section "llvm.metadata" ; <[7 x i8]*>:40 [#uses=1] - at llvm.dbg.derivedtype174 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @40, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit172 to %0*), i32 567, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype169 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [9 x i8] c"stdint.h\00", section "llvm.metadata" ; <[9 x i8]*>:41 [#uses=1] - at llvm.dbg.compile_unit176 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @41, i32 0, i32 0), i8* getelementptr ([69 x i8]* @4, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [14 x i8] c"int_least32_t\00", section "llvm.metadata" ; <[14 x i8]*>:42 [#uses=1] - at llvm.dbg.derivedtype178 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @42, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit176 to %0*), i32 60, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype174 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [13 x i8] c"int_fast32_t\00", section "llvm.metadata" ; <[13 x i8]*>:43 [#uses=1] - at llvm.dbg.derivedtype180 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @43, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit176 to %0*), i32 71, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype178 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [11 x i8] c"postypes.h\00", section "llvm.metadata" ; <[11 x i8]*>:44 [#uses=1] - at llvm.dbg.compile_unit182 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @44, i32 0, i32 0), i8* getelementptr ([28 x i8]* @6, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [11 x i8] c"streamsize\00", section "llvm.metadata" ; <[11 x i8]*>:45 [#uses=1] - at llvm.dbg.derivedtype184 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @45, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit182 to %0*), i32 72, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype180 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.derivedtype230 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @9, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit112 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype184 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [15 x i8] c"stl_iterator.h\00", section "llvm.metadata" ; <[15 x i8]*>:46 [#uses=1] - at llvm.dbg.compile_unit709 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([15 x i8]* @46, i32 0, i32 0), i8* getelementptr ([28 x i8]* @6, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [11 x i8] c"_M_current\00", section "llvm.metadata" ; <[11 x i8]*>:47 [#uses=1] -internal constant [18 x i8] c"__normal_iterator\00", section "llvm.metadata" ; <[18 x i8]*>:48 [#uses=1] -internal constant [10 x i8] c"operator*\00", section "llvm.metadata" ; <[10 x i8]*>:49 [#uses=1] -internal constant [11 x i8] c"operator->\00", section "llvm.metadata" ; <[11 x i8]*>:50 [#uses=1] -internal constant [11 x i8] c"operator++\00", section "llvm.metadata" ; <[11 x i8]*>:51 [#uses=1] -internal constant [11 x i8] c"operator--\00", section "llvm.metadata" ; <[11 x i8]*>:52 [#uses=1] - at llvm.dbg.derivedtype759 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype230 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [11 x i8] c"operator[]\00", section "llvm.metadata" ; <[11 x i8]*>:53 [#uses=1] -internal constant [11 x i8] c"operator+=\00", section "llvm.metadata" ; <[11 x i8]*>:54 [#uses=1] -internal constant [10 x i8] c"operator+\00", section "llvm.metadata" ; <[10 x i8]*>:55 [#uses=1] -internal constant [11 x i8] c"operator-=\00", section "llvm.metadata" ; <[11 x i8]*>:56 [#uses=1] -internal constant [10 x i8] c"operator-\00", section "llvm.metadata" ; <[10 x i8]*>:57 [#uses=1] -internal constant [5 x i8] c"base\00", section "llvm.metadata" ; <[5 x i8]*>:58 [#uses=1] -internal constant [18 x i8] c"cpp_type_traits.h\00", section "llvm.metadata" ; <[18 x i8]*>:59 [#uses=1] - at llvm.dbg.compile_unit1192 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([18 x i8]* @59, i32 0, i32 0), i8* getelementptr ([28 x i8]* @6, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -internal constant [12 x i8] c"__true_type\00", section "llvm.metadata" ; <[12 x i8]*>:60 [#uses=1] - at llvm.dbg.array1195 = internal constant [0 x %0*] zeroinitializer, section "llvm.metadata" ; <[0 x %0*]*> [#uses=1] - at llvm.dbg.composite1196 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @60, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1192 to %0*), i32 93, i64 8, i64 8, i64 0, i32 0, %0* null, %0* bitcast ([0 x %0*]* @llvm.dbg.array1195 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] - at llvm.dbg.derivedtype1631 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.derivedtype1633 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -internal constant [106 x i8] c"__normal_iterator > >\00", section "llvm.metadata" ; <[106 x i8]*>:61 [#uses=1] - at llvm.dbg.derivedtype1768 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @47, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 589, i64 32, i64 32, i64 0, i32 2, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1631 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.derivedtype1769 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.array1770 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1769 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1] - at llvm.dbg.composite1771 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1770 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] - at llvm.dbg.subprogram1772 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @48, i32 0, i32 0), i8* getelementptr ([18 x i8]* @48, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 600, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1771 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.derivedtype1773 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1631 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.derivedtype1774 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1773 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.array1775 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1769 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1774 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1] - at llvm.dbg.composite1776 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1775 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] - at llvm.dbg.subprogram1777 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @48, i32 0, i32 0), i8* getelementptr ([18 x i8]* @48, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 603, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1776 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.composite1778 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 587, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] - at llvm.dbg.derivedtype1779 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1778 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.derivedtype1780 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1779 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.array1781 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1769 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1780 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1] - at llvm.dbg.composite1782 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1781 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] - at llvm.dbg.subprogram1783 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @48, i32 0, i32 0), i8* getelementptr ([18 x i8]* @48, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 608, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1782 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.derivedtype1784 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.derivedtype1785 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1784 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.array1786 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1633 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1785 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1] - at llvm.dbg.composite1787 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1786 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [59 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEdeEv\00", section "llvm.metadata" ; <[59 x i8]*>:62 [#uses=1] - at llvm.dbg.subprogram1789 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @49, i32 0, i32 0), i8* getelementptr ([10 x i8]* @49, i32 0, i32 0), i8* getelementptr ([59 x i8]* @62, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 613, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1787 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.array1790 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1631 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1785 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1] - at llvm.dbg.composite1791 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1790 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [59 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEptEv\00", section "llvm.metadata" ; <[59 x i8]*>:63 [#uses=1] - at llvm.dbg.subprogram1793 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @50, i32 0, i32 0), i8* getelementptr ([11 x i8]* @50, i32 0, i32 0), i8* getelementptr ([59 x i8]* @63, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 617, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1791 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.derivedtype1794 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] - at llvm.dbg.array1795 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1794 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1769 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1] - at llvm.dbg.composite1796 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1795 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [58 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEppEv\00", section "llvm.metadata" ; <[58 x i8]*>:64 [#uses=1] - at llvm.dbg.subprogram1798 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @51, i32 0, i32 0), i8* getelementptr ([11 x i8]* @51, i32 0, i32 0), i8* getelementptr ([58 x i8]* @64, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 621, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1796 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.array1799 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1769 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype103 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1] - at llvm.dbg.composite1800 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1799 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [58 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEppEi\00", section "llvm.metadata" ; <[58 x i8]*>:65 [#uses=1] - at llvm.dbg.subprogram1802 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @51, i32 0, i32 0), i8* getelementptr ([11 x i8]* @51, i32 0, i32 0), i8* getelementptr ([58 x i8]* @65, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 628, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1800 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -internal constant [58 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEmmEv\00", section "llvm.metadata" ; <[58 x i8]*>:66 [#uses=1] - at llvm.dbg.subprogram1804 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @52, i32 0, i32 0), i8* getelementptr ([11 x i8]* @52, i32 0, i32 0), i8* getelementptr ([58 x i8]* @66, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 633, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1796 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -internal constant [58 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEmmEi\00", section "llvm.metadata" ; <[58 x i8]*>:67 [#uses=1] - at llvm.dbg.subprogram1806 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @52, i32 0, i32 0), i8* getelementptr ([11 x i8]* @52, i32 0, i32 0), i8* getelementptr ([58 x i8]* @67, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 640, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1800 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.array1807 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1633 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1785 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype759 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1] - at llvm.dbg.composite1808 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1807 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [61 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEixERKi\00", section "llvm.metadata" ; <[61 x i8]*>:68 [#uses=1] - at llvm.dbg.subprogram1810 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @53, i32 0, i32 0), i8* getelementptr ([11 x i8]* @53, i32 0, i32 0), i8* getelementptr ([61 x i8]* @68, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 645, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1808 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.array1811 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1794 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1769 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype759 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1] - at llvm.dbg.composite1812 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1811 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [60 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEpLERKi\00", section "llvm.metadata" ; <[60 x i8]*>:69 [#uses=1] - at llvm.dbg.subprogram1814 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @54, i32 0, i32 0), i8* getelementptr ([11 x i8]* @54, i32 0, i32 0), i8* getelementptr ([60 x i8]* @69, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 649, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1812 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.array1815 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1785 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype759 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1] - at llvm.dbg.composite1816 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1815 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [61 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEplERKi\00", section "llvm.metadata" ; <[61 x i8]*>:70 [#uses=1] - at llvm.dbg.subprogram1818 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @55, i32 0, i32 0), i8* getelementptr ([10 x i8]* @55, i32 0, i32 0), i8* getelementptr ([61 x i8]* @70, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 653, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1816 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -internal constant [60 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEmIERKi\00", section "llvm.metadata" ; <[60 x i8]*>:71 [#uses=1] - at llvm.dbg.subprogram1820 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @56, i32 0, i32 0), i8* getelementptr ([11 x i8]* @56, i32 0, i32 0), i8* getelementptr ([60 x i8]* @71, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 657, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1812 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -internal constant [61 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEmiERKi\00", section "llvm.metadata" ; <[61 x i8]*>:72 [#uses=1] - at llvm.dbg.subprogram1822 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @57, i32 0, i32 0), i8* getelementptr ([10 x i8]* @57, i32 0, i32 0), i8* getelementptr ([61 x i8]* @72, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 661, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1816 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.array1823 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1774 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1785 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1] - at llvm.dbg.composite1824 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1823 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [62 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEE4baseEv\00", section "llvm.metadata" ; <[62 x i8]*>:73 [#uses=1] - at llvm.dbg.subprogram1826 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @58, i32 0, i32 0), i8* getelementptr ([5 x i8]* @58, i32 0, i32 0), i8* getelementptr ([62 x i8]* @73, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 665, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1824 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.array1827 = internal constant [16 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1768 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1772 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1777 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1783 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1789 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1793 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1798 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1802 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1804 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1806 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1810 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1814 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.d bg.subprogram1818 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1820 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1822 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1826 to %0*)], section "llvm.metadata" ; <[16 x %0*]*> [#uses=1] - at llvm.dbg.composite1828 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([106 x i8]* @61, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit709 to %0*), i32 587, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([16 x %0*]* @llvm.dbg.array1827 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [8 x i8] c"__first\00", section "llvm.metadata" ; <[8 x i8]*>:74 [#uses=1] -internal constant [7 x i8] c"__last\00", section "llvm.metadata" ; <[7 x i8]*>:75 [#uses=1] -internal constant [9 x i8] c"__result\00", section "llvm.metadata" ; <[9 x i8]*>:76 [#uses=1] -internal constant [20 x i8] c"stl_uninitialized.h\00", section "llvm.metadata" ; <[20 x i8]*>:77 [#uses=1] - at llvm.dbg.compile_unit2900 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([20 x i8]* @77, i32 0, i32 0), i8* getelementptr ([28 x i8]* @6, i32 0, i32 0), i8* getelementptr ([57 x i8]* @2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] - at llvm.dbg.array4285 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1196 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1] - at llvm.dbg.composite4286 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array4285 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -internal constant [264 x i8] c"__uninitialized_copy_aux<__gnu_cxx::__normal_iterator > >, __gnu_cxx::__normal_iterator > > >\00", section "llvm.metadata" ; <[264 x i8]*>:78 [#uses=1] -internal constant [112 x i8] c"_ZSt24__uninitialized_copy_auxIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEES6_ET0_T_S8_S7_11__true_type\00", section "llvm.metadata" ; <[112 x i8]*>:79 [#uses=1] - at llvm.dbg.subprogram4289 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([264 x i8]* @78, i32 0, i32 0), i8* getelementptr ([264 x i8]* @78, i32 0, i32 0), i8* getelementptr ([112 x i8]* @79, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit2900 to %0*), i32 73, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite4286 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - at llvm.dbg.variable4290 = internal constant %llvm.dbg.variable.type { i32 459009, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram4289 to %0*), i8* getelementptr ([8 x i8]* @74, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit2900 to %0*), i32 73, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] - at llvm.dbg.variable4291 = internal constant %llvm.dbg.variable.type { i32 459009, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram4289 to %0*), i8* getelementptr ([7 x i8]* @75, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit2900 to %0*), i32 73, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] - at llvm.dbg.variable4292 = internal constant %llvm.dbg.variable.type { i32 459009, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram4289 to %0*), i8* getelementptr ([9 x i8]* @76, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit2900 to %0*), i32 73, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1828 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] - at llvm.dbg.variable4293 = internal constant %llvm.dbg.variable.type { i32 459009, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram4289 to %0*), i8* getelementptr ([12 x i8]* @5, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit2900 to %0*), i32 73, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1196 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] - at llvm.used = appending global [1 x i8*] [i8* bitcast (i32* (i32*, i32*, i32*, %1*)* @_ZSt24__uninitialized_copy_auxIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEES6_ET0_T_S8_S7_11__true_type to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] - -define i32* @_ZSt24__uninitialized_copy_auxIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEES6_ET0_T_S8_S7_11__true_type(i32*, i32*, i32*, %1* byval align 4) { - %5 = alloca %2 ; <%2*> [#uses=3] - %6 = alloca %2 ; <%2*> [#uses=3] - %7 = alloca %2 ; <%2*> [#uses=3] - %8 = alloca %2 ; <%2*> [#uses=2] - %9 = alloca %2 ; <%2*> [#uses=2] - %10 = alloca %2 ; <%2*> [#uses=2] - %11 = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram4289 to %0*)) - %12 = bitcast %2* %5 to %0* ; <%0*> [#uses=1] - call void @llvm.dbg.declare(%0* %12, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable4290 to %0*)) - %13 = getelementptr %2* %5, i32 0, i32 0 ; [#uses=1] - store i32* %0, i32** %13 - %14 = bitcast %2* %6 to %0* ; <%0*> [#uses=1] - call void @llvm.dbg.declare(%0* %14, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable4291 to %0*)) - %15 = getelementptr %2* %6, i32 0, i32 0 ; [#uses=1] - store i32* %1, i32** %15 - %16 = bitcast %2* %7 to %0* ; <%0*> [#uses=1] - call void @llvm.dbg.declare(%0* %16, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable4292 to %0*)) - %17 = getelementptr %2* %7, i32 0, i32 0 ; [#uses=1] - store i32* %2, i32** %17 - %18 = bitcast %1* %3 to %0* ; <%0*> [#uses=1] - call void @llvm.dbg.declare(%0* %18, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable4293 to %0*)) - call void @llvm.dbg.stoppoint(i32 74, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit2900 to %0*)) - %19 = getelementptr %2* %5, i32 0, i32 0 ; [#uses=1] - %20 = load i32** %19 ; [#uses=1] - %21 = getelementptr %2* %6, i32 0, i32 0 ; [#uses=1] - %22 = load i32** %21 ; [#uses=1] - %23 = getelementptr %2* %7, i32 0, i32 0 ; [#uses=1] - %24 = load i32** %23 ; [#uses=1] - %25 = call i32* @_ZSt4copyIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEES6_ET0_T_S8_S7_(i32* %20, i32* %22, i32* %24) ; [#uses=1] - %26 = bitcast %2* %9 to i32** ; [#uses=1] - store i32* %25, i32** %26, align 4 - %27 = getelementptr %2* %10, i32 0, i32 0 ; [#uses=1] - %28 = getelementptr %2* %9, i32 0, i32 0 ; [#uses=1] - %29 = load i32** %28, align 4 ; [#uses=1] - store i32* %29, i32** %27, align 4 - %30 = getelementptr %2* %8, i32 0, i32 0 ; [#uses=1] - %31 = getelementptr %2* %10, i32 0, i32 0 ; [#uses=1] - %32 = load i32** %31, align 4 ; [#uses=1] - store i32* %32, i32** %30, align 4 - %33 = bitcast %2* %8 to i32** ; [#uses=1] - %34 = load i32** %33 ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 74, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit2900 to %0*)) - call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram4289 to %0*)) - ret i32* %34 -} - -declare void @llvm.dbg.func.start(%0*) nounwind - -declare void @llvm.dbg.declare(%0*, %0*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, %0*) nounwind - -declare void @llvm.dbg.region.end(%0*) nounwind - -declare i32* @_ZSt4copyIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEES6_ET0_T_S8_S7_(i32*, i32*, i32*) From baldrick at free.fr Thu Feb 24 13:15:32 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 20:15:32 +0100 Subject: [llvm-commits] [llvm] r126382 - /llvm/trunk/include/llvm/Target/TargetLowering.h In-Reply-To: <31DE9452-CDB6-414E-AC94-C3B4C24F137D@apple.com> References: <20110224115418.DFF4C2A6C12C@llvm.org> <31DE9452-CDB6-414E-AC94-C3B4C24F137D@apple.com> Message-ID: <4D66AE54.3020304@free.fr> Hi Chris, >> Rewrite the vector part of getExtendedTypeAction to make it more >> understandable (at least I find it easier to understand like this). >> No intended functionality change. > > While you're here, can you move this out of line? It's huge :) I actually tried this once but failed because it created circular library dependencies. Ciao, Duncan. From aggarwa4 at illinois.edu Thu Feb 24 13:28:32 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 24 Feb 2011 19:28:32 -0000 Subject: [llvm-commits] [poolalloc] r126407 - /poolalloc/trunk/lib/AssistDS/IndCloner.cpp Message-ID: <20110224192832.C2DB42A6C12C@llvm.org> Author: aggarwa4 Date: Thu Feb 24 13:28:32 2011 New Revision: 126407 URL: http://llvm.org/viewvc/llvm-project?rev=126407&view=rev Log: Adjust the iterator. Modified: poolalloc/trunk/lib/AssistDS/IndCloner.cpp Modified: poolalloc/trunk/lib/AssistDS/IndCloner.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/IndCloner.cpp?rev=126407&r1=126406&r2=126407&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/IndCloner.cpp (original) +++ poolalloc/trunk/lib/AssistDS/IndCloner.cpp Thu Feb 24 13:28:32 2011 @@ -74,6 +74,7 @@ for (Value::use_iterator ui = I->use_begin(), ue = I->use_end(); ui != ue; ++ui) { if (!isa(ui) && !isa(ui)) { + if(!ui->use_empty()) // // If this function is used for anything other than a direct function // call, then we want to clone it. @@ -146,8 +147,10 @@ // for (Value::use_iterator ui = Original->use_begin(), ue = Original->use_end(); - ui != ue; ++ui) { - if (CallInst* CI = dyn_cast(ui)) { + ui != ue; ) { + CallInst *CI = dyn_cast(ui); + ui++; + if (CI) { if (CI->getOperand(0) == Original) { ++numReplaced; CI->setOperand(0, DirectF); From aggarwa4 at illinois.edu Thu Feb 24 13:29:30 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 24 Feb 2011 19:29:30 -0000 Subject: [llvm-commits] [poolalloc] r126408 - /poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Message-ID: <20110224192930.C3A6A2A6C12C@llvm.org> Author: aggarwa4 Date: Thu Feb 24 13:29:30 2011 New Revision: 126408 URL: http://llvm.org/viewvc/llvm-project?rev=126408&view=rev Log: Added some comments. Fixed some formatting. Also, clone the CallInst, instead of replacing called value. Modified: poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Modified: poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp?rev=126408&r1=126407&r2=126408&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp (original) +++ poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Thu Feb 24 13:29:30 2011 @@ -36,40 +36,42 @@ if (!I->isDeclaration() && !I->mayBeOverridden()) { //Call Sites for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); - ui != ue; ++ui) { - if (Constant *C = dyn_cast(ui)) { - if (ConstantExpr *CE = dyn_cast(C)) { - if (CE->getOpcode() == Instruction::BitCast) { - if(CE->getOperand(0) == I) { - if(const FunctionType *FTy = dyn_cast((cast(CE->getType()))->getElementType())) { - if(FTy->isVarArg()) { + ui != ue; ++ui) + //Bitcast + if (Constant *C = dyn_cast(ui)) + if (ConstantExpr *CE = dyn_cast(C)) + if (CE->getOpcode() == Instruction::BitCast) + if(CE->getOperand(0) == I) + if(const FunctionType *FTy = dyn_cast((cast(CE->getType()))->getElementType())) + //casting to a varargs funtion + if(FTy->isVarArg()) for(Value::use_iterator uii = CE->use_begin(), uee = CE->use_end(); - uii != uee; ++uii) { - if (CallInst* CI = dyn_cast(uii)) { - if(CI->getCalledValue() == CE) { - worklist.push_back(CI); - } - } - } - } - } - } - } - } - } - } + uii != uee; ++uii) + if (CallInst* CI = dyn_cast(uii)) + if(CI->getCalledValue() == CE) + worklist.push_back(CI); } } + // process the worklist + while(!worklist.empty()) { CallInst *CI = worklist.back(); worklist.pop_back(); Function *F = cast(CI->getCalledValue()->stripPointerCasts()); + // Only continue, if we are passing the exact number of arguments if(F->arg_size() != (CI->getNumOperands()-1)) continue; - if(F->getReturnType() != CI->getType()) + // Only continue if we are getting the same return type value + // Or we can discard the returned value. + if(F->getReturnType() != CI->getType()) { + if(!CI->use_empty()) continue; - unsigned arg_count = 1; + } + + // Check if the parameters passed match the expected types of the + // formal arguments bool change = true; + unsigned arg_count = 1; for (Function::arg_iterator ii = F->arg_begin(), ee = F->arg_end();ii != ee; ++ii,arg_count++) { if(ii->getType() != CI->getOperand(arg_count)->getType()) { change = false; @@ -78,7 +80,19 @@ } if(change) { - CI->setCalledFunction(F); + // if we want to ignore the returned value, create a new CallInst + SmallVector Args; + for(unsigned j =1;jgetNumOperands();j++) { + Args.push_back(CI->getOperand(j)); + } + CallInst *CINew = CallInst::Create(F, Args.begin(), Args.end(), "", CI); + if(F->getReturnType() != CI->getType()){ // means no uses + CINew->setDoesNotReturn(); + } else { + CI->replaceAllUsesWith(CINew); + } + CI->eraseFromParent(); + // else just set the function to call the original function. changed = true; numSimplified++; } From aggarwa4 at illinois.edu Thu Feb 24 13:30:13 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 24 Feb 2011 19:30:13 -0000 Subject: [llvm-commits] [poolalloc] r126409 - /poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp Message-ID: <20110224193013.8CAE22A6C12D@llvm.org> Author: aggarwa4 Date: Thu Feb 24 13:30:13 2011 New Revision: 126409 URL: http://llvm.org/viewvc/llvm-project?rev=126409&view=rev Log: Added Comments. Minor fixes. Modified: poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp Modified: poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp?rev=126409&r1=126408&r2=126409&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp (original) +++ poolalloc/trunk/lib/AssistDS/ArgSimplify.cpp Thu Feb 24 13:30:13 2011 @@ -24,8 +24,11 @@ using namespace llvm; STATISTIC(numTransformable, "Number of Args changeable"); + namespace { + static void simplify(Function *I, unsigned arg_count, const Type* type) { + for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); ui != ue; ++ui) { if (Constant *C = dyn_cast(ui)) { @@ -34,28 +37,41 @@ if(CE->getOperand(0) == I) { for(Value::use_iterator uii = CE->use_begin(), uee = CE->use_end(); uii != uee; ) { - if (CallInst* CI = dyn_cast(uii)) { - ++uii; + if (CallInst* CI = dyn_cast(uii++)) { if(CI->getCalledValue() == CE) { + // if I is ever called as a bitcasted function if(I->getReturnType() == CI->getType()){ + // if the return types match. if(I->arg_size() == (CI->getNumOperands()-1)){ + // and the numeber of args match too unsigned arg_count1 = 1; bool change = true; - for (Function::arg_iterator ii1 = I->arg_begin(), ee1 = I->arg_end();ii1 != ee1; ++ii1,arg_count1++) { - if(ii1->getType() != CI->getOperand(arg_count1)->getType()) { - if(arg_count1 == (arg_count + 1)) { - continue; + for (Function::arg_iterator ii1 = I->arg_begin(), ee1 = I->arg_end(); + ii1 != ee1; ++ii1,arg_count1++) { + if(arg_count1 == (arg_count + 1)) { + if(ii1->getType() == CI->getOperand(arg_count1)->getType()){ + change = false; + break; } + else + continue; + } + if(ii1->getType() != CI->getOperand(arg_count1)->getType()) { change = false; break; } } + // if all types match except the argument we are interested in + if(change){ + // create a new function, to do the cast from ptr to int, + // and call the original function, with the casted value std::vectorTP; for(unsigned c = 1; cgetNumOperands();c++) { TP.push_back(CI->getOperand(c)->getType()); } - const FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false); + const FunctionType *NewFTy = FunctionType:: + get(CI->getType(), TP, false); Module *M = I->getParent(); Function *NewF = Function::Create(NewFTy, @@ -63,32 +79,37 @@ "argbounce", M); std::vector fargs; - for(Function::arg_iterator ai = NewF->arg_begin(), ae= NewF->arg_end(); ai != ae; ++ai) { + for(Function::arg_iterator ai = NewF->arg_begin(), + ae= NewF->arg_end(); ai != ae; ++ai) { fargs.push_back(ai); ai->setName("arg"); } Value *CastedVal; - BasicBlock* entryBB = BasicBlock::Create (M->getContext(), "entry", NewF); + BasicBlock* entryBB = BasicBlock:: + Create (M->getContext(), "entry", NewF); + if(type->isIntegerTy()){ - CastedVal = new PtrToIntInst(fargs.at(arg_count), type, "castd", entryBB); + CastedVal = new PtrToIntInst(fargs.at(arg_count), + type, "castd", entryBB); } else { - CastedVal = new BitCastInst(fargs.at(arg_count), type, "castd", entryBB); + CastedVal = new BitCastInst(fargs.at(arg_count), + type, "castd", entryBB); } SmallVector Args; - for(Function::arg_iterator ai = NewF->arg_begin(), ae= NewF->arg_end(); ai != ae; ++ai) { + for(Function::arg_iterator ai = NewF->arg_begin(), + ae= NewF->arg_end(); ai != ae; ++ai) { if(ai->getArgNo() == arg_count) Args.push_back(CastedVal); else Args.push_back(ai); } - CallInst * CallI = CallInst::Create(I,Args.begin(), Args.end(),"", entryBB); + CallInst * CallI = CallInst::Create(I,Args.begin(), + Args.end(),"", entryBB); if(CallI->getType()->isVoidTy()) ReturnInst::Create(M->getContext(), entryBB); else ReturnInst::Create(M->getContext(), CallI, entryBB); - //new BitCastInst(fargs.at(ii->getArgNo()), ii->getType(), "test", entryBB); - //new UnreachableInst (M.getContext(), entryBB); CI->setCalledFunction(NewF); numTransformable++; @@ -96,8 +117,6 @@ } } } - } else { - ++uii; } } } @@ -111,8 +130,10 @@ public: static char ID; ArgSimplify() : ModulePass(&ID) {} + bool runOnModule(Module& M) { - for (Module::iterator I = M.begin(); I != M.end(); ++I) { + + for (Module::iterator I = M.begin(); I != M.end(); ++I) if (!I->isDeclaration() && !I->mayBeOverridden()) { if(I->getNameStr() == "main") continue; @@ -127,12 +148,14 @@ break; } } - if(change){ + // if this argument is only used in CMP instructions, we can + // replace it. + if(change) { simplify(I, ii->getArgNo(), ii->getType()); } } } - } + return true; } From aggarwa4 at illinois.edu Thu Feb 24 13:31:09 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 24 Feb 2011 19:31:09 -0000 Subject: [llvm-commits] [poolalloc] r126410 - /poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Message-ID: <20110224193109.B33F52A6C12C@llvm.org> Author: aggarwa4 Date: Thu Feb 24 13:31:09 2011 New Revision: 126410 URL: http://llvm.org/viewvc/llvm-project?rev=126410&view=rev Log: Minor fixes. I believe a GEP Constant Expr, does not return a pointer like a GEPInst does, hence copy over all the indexes, into the new GEP. Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=126410&r1=126409&r2=126410&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (original) +++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Thu Feb 24 13:31:09 2011 @@ -42,8 +42,8 @@ if(!(isa(I))) continue; GetElementPtrInst *GEP = cast(I); - // if(!isa(GEP->getType()->getElementType())) - // continue; + if(!isa(GEP->getType()->getElementType())) + continue; std::vector worklist; for (Value::use_iterator UI = GEP->use_begin(), UE = GEP->use_end(); UI != UE; ++UI){ @@ -61,7 +61,7 @@ GetElementPtrInst *GEPNew = GetElementPtrInst::Create(GEP->getOperand(0), Indices.begin(), Indices.end(), - GEPUse->getName()+ "mod", + GEPUse->getName()+ "moda", GEPUse); GEPUse->replaceAllUsesWith(GEPNew); GEPUse->eraseFromParent(); @@ -75,31 +75,33 @@ for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) { if(!(isa(I))) continue; - GetElementPtrInst *GEP = cast(I); - if (Constant *C = dyn_cast(GEP->getOperand(0))) { + GetElementPtrInst *GEP1 = cast(I); + if(!isa(GEP1->getType()->getElementType())) + continue; + if (Constant *C = dyn_cast(GEP1->getOperand(0))) { if (ConstantExpr *CE = dyn_cast(C)) { if (CE->getOpcode() == Instruction::GetElementPtr) { - worklist.push_back(GEP); + worklist.push_back(GEP1); } } } } } while(!worklist.empty()) { - GetElementPtrInst *GEP = worklist.back(); + GetElementPtrInst *GEP1 = worklist.back(); worklist.pop_back(); - Constant *C = cast(GEP->getOperand(0)); + Constant *C = cast(GEP1->getOperand(0)); ConstantExpr *CE = cast(C); SmallVector Indices; Indices.append(CE->op_begin()+1, CE->op_end()); - Indices.append(GEP->idx_begin()+1, GEP->idx_end()); + Indices.append(GEP1->idx_begin(), GEP1->idx_end()); GetElementPtrInst *GEPNew = GetElementPtrInst::Create(CE->getOperand(0), Indices.begin(), Indices.end(), - GEP->getName()+ "mod", - GEP); - GEP->replaceAllUsesWith(GEPNew); - GEP->eraseFromParent(); + GEP1->getName()+ "modb", + GEP1); + GEP1->replaceAllUsesWith(GEPNew); + GEP1->eraseFromParent(); changed = true; found = true; } From aggarwa4 at illinois.edu Thu Feb 24 13:32:17 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 24 Feb 2011 19:32:17 -0000 Subject: [llvm-commits] [poolalloc] r126411 - in /poolalloc/trunk/test: TEST.types.Makefile TEST.types.report Message-ID: <20110224193217.D958E2A6C12C@llvm.org> Author: aggarwa4 Date: Thu Feb 24 13:32:17 2011 New Revision: 126411 URL: http://llvm.org/viewvc/llvm-project?rev=126411&view=rev Log: Make sure we run all the optimized files too. Added a few more stats. Modified: poolalloc/trunk/test/TEST.types.Makefile poolalloc/trunk/test/TEST.types.report Modified: poolalloc/trunk/test/TEST.types.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.Makefile?rev=126411&r1=126410&r2=126411&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.Makefile (original) +++ poolalloc/trunk/test/TEST.types.Makefile Thu Feb 24 13:32:17 2011 @@ -47,14 +47,66 @@ $(PROGRAMS_TO_TEST:%=Output/%.opt.bc): \ Output/%.opt.bc: Output/%.llvm1.bc $(LOPT) $(ASSIST_SO) - -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -simplifygep -die -mergegep -die -globaldce -simplifycfg -deadargelim -arg-simplify -varargsfunc -deadargelim -globaldce -die -simplifycfg -stats -time-passes $< -f -o $@ + -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -simplifygep -die -mergegep -die -globaldce -simplifycfg -deadargelim -arg-simplify -varargsfunc -indclone -funcspec -deadargelim -globaldce -die -simplifycfg -gep-args -deadargelim -die -mergegep -die -globaldce -stats -time-passes $< -f -o $@ $(PROGRAMS_TO_TEST:%=Output/%.temp2.bc): \ Output/%.temp2.bc: Output/%.temp1.bc $(LOPT) $(ASSIST_SO) -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -mergegep -die -globaldce -stats -time-passes $< -f -o $@ +$(PROGRAMS_TO_TEST:%=Output/%.opt.s): \ +Output/%.opt.s: Output/%.opt.bc $(LLC) + -$(LLC) -f $< -o $@ +$(PROGRAMS_TO_TEST:%=Output/%.llvm1.s): \ +Output/%.llvm1.s: Output/%.llvm1.bc $(LLC) + -$(LLC) -f $< -o $@ + +$(PROGRAMS_TO_TEST:%=Output/%.opt): \ +Output/%.opt: Output/%.opt.s + -$(CC) $(CFLAGS) $< $(LLCLIBS) $(LDFLAGS) -o $@ +$(PROGRAMS_TO_TEST:%=Output/%.llvm1): \ +Output/%.llvm1: Output/%.llvm1.s + -$(CC) $(CFLAGS) $< $(LLCLIBS) $(LDFLAGS) -o $@ + +ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES + +$(PROGRAMS_TO_TEST:%=Output/%.opt.out): \ +Output/%.opt.out: Output/%.opt + -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) +$(PROGRAMS_TO_TEST:%=Output/%.llvm1.out): \ +Output/%.llvm1.out: Output/%.llvm1 + -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) + +else +$(PROGRAMS_TO_TEST:%=Output/%.opt.out): \ +Output/%.opt.out: Output/%.opt + -$(SPEC_SANDBOX) opt-$(RUN_TYPE) $@ $(REF_IN_DIR) \ + $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ + ../../$< $(RUN_OPTIONS) + -(cd Output/opt-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ + -cp Output/opt-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time +$(PROGRAMS_TO_TEST:%=Output/%.llvm1.out): \ +Output/%.llvm1.out: Output/%.llvm1 + -$(SPEC_SANDBOX) llvm1-$(RUN_TYPE) $@ $(REF_IN_DIR) \ + $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ + ../../$< $(RUN_OPTIONS) + -(cd Output/opt-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ + -cp Output/opt-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time + +endif + +$(PROGRAMS_TO_TEST:%=Output/%.opt.diff-nat): \ +Output/%.opt.diff-nat: Output/%.out-nat Output/%.opt.out + @cp Output/$*.out-nat Output/$*.opt.out-nat + -$(DIFFPROG) nat $*.opt $(HIDEDIFF) + +$(PROGRAMS_TO_TEST:%=Output/%.llvm1.diff-nat): \ +Output/%.llvm1.diff-nat: Output/%.out-nat Output/%.llvm1.out + @cp Output/$*.out-nat Output/$*.llvm1.out-nat + -$(DIFFPROG) nat $*.opt $(HIDEDIFF) + + $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: Output/%.opt.bc Output/%.LOC.txt $(LOPT) +Output/%.$(TEST).report.txt: Output/%.opt.bc Output/%.LOC.txt $(LOPT) Output/%.out-nat Output/%.opt.diff-nat Output/%.llvm1.diff-nat @# Gather data -($(RUNOPT) -dsa-$(PASS) -enable-type-inference-opts -dsa-stdlib-no-fold $(ANALYZE_OPTS) $<)> $@.time.1 2>&1 -($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.2 2>&1 Modified: poolalloc/trunk/test/TEST.types.report URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.report?rev=126411&r1=126410&r2=126411&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.report (original) +++ poolalloc/trunk/test/TEST.types.report Thu Feb 24 13:32:17 2011 @@ -156,7 +156,6 @@ ["I", "ACCESSES I: *([0-9]+)"], ["E", "ACCESSES E: *([0-9]+)"], ["U", "ACCESSES U: *([0-9]+)"], - [], # Nodes Folded [], ["VAFUNC", "VARARGS_CALLS: *([0-9]+)"], From aggarwa4 at illinois.edu Thu Feb 24 13:33:08 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 24 Feb 2011 19:33:08 -0000 Subject: [llvm-commits] [poolalloc] r126412 - /poolalloc/trunk/lib/AssistDS/TestGEP.cpp Message-ID: <20110224193308.AE4A22A6C12C@llvm.org> Author: aggarwa4 Date: Thu Feb 24 13:33:08 2011 New Revision: 126412 URL: http://llvm.org/viewvc/llvm-project?rev=126412&view=rev Log: If a function takes a pointer to a field inside a struct, clone the function, and pass the struct pointer instead. Added: poolalloc/trunk/lib/AssistDS/TestGEP.cpp Added: poolalloc/trunk/lib/AssistDS/TestGEP.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TestGEP.cpp?rev=126412&view=auto ============================================================================== --- poolalloc/trunk/lib/AssistDS/TestGEP.cpp (added) +++ poolalloc/trunk/lib/AssistDS/TestGEP.cpp Thu Feb 24 13:33:08 2011 @@ -0,0 +1,151 @@ +//===-- MergeGEP.cpp - Merge GEPs for indexing in arrays ------------ ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "gepargs" + +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Instructions.h" +#include "llvm/Constants.h" +#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Debug.h" +#include "llvm/Use.h" +#include +#include + +using namespace llvm; +STATISTIC(numSimplified, "Number of Calls Simplified"); + + +namespace { + class GEPArgs : public ModulePass { + private: + std::map, Function*> fnCache; + public: + static char ID; + GEPArgs() : ModulePass(&ID) {} + bool runOnModule(Module& M) { + for (Module::iterator F = M.begin(); F != M.end(); ++F){ + for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { + for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) { + if(!(isa(I))) + continue; + // we are only interested in GEPs + GetElementPtrInst *GEP = cast(I); + // Only GEPs that have constant indices, so we dont have + // to add more args + if(!GEP->hasAllConstantIndices()) + continue; + // If the GEP is not doing structure indexing, dont care. + const PointerType *PTy = cast(GEP->getPointerOperand()->getType()); + if(!PTy->getElementType()->isStructTy()) + continue; + + for (Value::use_iterator UI = GEP->use_begin(),UE = GEP->use_end(); UI != UE; ) { + // check if GEP is used in a Call Inst + CallInst *CI = dyn_cast(UI++); + if(!CI) + continue; + + // if the GEP calls a function, that is externally defined, + // or might be changed, ignore this call site. + Function *F = CI->getCalledFunction(); + + if (!F || (F->isDeclaration() || F->mayBeOverridden())) + continue; + + + // find the argument we must replace + unsigned argNum = 1; + for(; argNum < CI->getNumOperands();argNum++) + if(GEP == CI->getOperand(argNum)) + break; + + // Construct the new Type + // Appends the struct Type at the beginning + std::vectorTP; + TP.push_back(GEP->getPointerOperand()->getType()); + for(unsigned c = 1; c < CI->getNumOperands();c++) { + TP.push_back(CI->getOperand(c)->getType()); + } + + //return type is same as that of original instruction + const FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false); + Function *NewF; + if(fnCache.find(std::make_pair(F, NewFTy)) != fnCache.end()){ + NewF = fnCache[std::make_pair(F, NewFTy)]; + } + else { + numSimplified++; + if(numSimplified >2000) + return true; + + NewF = Function::Create(NewFTy, + GlobalValue::InternalLinkage, + F->getNameStr() + ".TEST", + &M); + + Function::arg_iterator NI = NewF->arg_begin(); + NI->setName("Sarg"); + ++NI; + + DenseMap ValueMap; + + for (Function::arg_iterator II = F->arg_begin(); NI != NewF->arg_end(); ++II, ++NI) { + ValueMap[II] = NI; + NI->setName(II->getName()); + } + // Perform the cloning. + SmallVector Returns; + CloneFunctionInto(NewF, F, ValueMap, Returns); + std::vector fargs; + for(Function::arg_iterator ai = NewF->arg_begin(), + ae= NewF->arg_end(); ai != ae; ++ai) { + fargs.push_back(ai); + } + + //Get the point to insert the GEP instr. + NI = NewF->arg_begin(); + SmallVector Ops(CI->op_begin()+1, CI->op_end()); + Instruction *InsertPoint; + for (BasicBlock::iterator insrt = NewF->front().begin(); isa(InsertPoint = insrt); ++insrt); + + SmallVector Indices; + Indices.append(GEP->op_begin()+1, GEP->op_end()); + GetElementPtrInst *GEP_new = GetElementPtrInst::Create(cast(NI), Indices.begin(), Indices.end(), "", InsertPoint); + fargs.at(argNum)->replaceAllUsesWith(GEP_new); + fnCache[std::make_pair(F, NewFTy)]= NewF; + } + + SmallVector Args; + Args.push_back(GEP->getPointerOperand()); + for(unsigned j =1;jgetNumOperands();j++) { + Args.push_back(CI->getOperand(j)); + } + CallInst *CallI = CallInst::Create(NewF,Args.begin(), Args.end(),"", CI); + CI->replaceAllUsesWith(CallI); + CI->eraseFromParent(); + } + } + } + } + return true; + } + }; +} + +char GEPArgs::ID = 0; +static RegisterPass +X("gep-args", "Find GEP into structs passed as args"); From rafael.espindola at gmail.com Thu Feb 24 14:18:02 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 24 Feb 2011 20:18:02 -0000 Subject: [llvm-commits] [llvm] r126421 - /llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Message-ID: <20110224201802.1CA402A6C12C@llvm.org> Author: rafael Date: Thu Feb 24 14:18:01 2011 New Revision: 126421 URL: http://llvm.org/viewvc/llvm-project?rev=126421&view=rev Log: Fix llvm-gcc bootstrap with gnu ld. The problem was codegen guessing the wrong values and printing .section .eh_frame,"aMS", at progbits,4 It is not clear at all if Codegen should try to guess, MC is the one that should know the default flags. Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=126421&r1=126420&r2=126421&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Thu Feb 24 14:18:01 2011 @@ -178,6 +178,10 @@ static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K) { + // FIXME: Why is this here? Codegen is should not be in the business + // of figuring section flags. If the user wrote section(".eh_frame"), + // we should just pass that to MC which will defer to the assembly + // or use its default if producing an object file. if (Name.empty() || Name[0] != '.') return K; // Some lame default implementation based on some magic section names. @@ -203,6 +207,9 @@ Name.startswith(".llvm.linkonce.tb.")) return SectionKind::getThreadBSS(); + if (Name == ".eh_frame") + return SectionKind::getDataRel(); + return K; } From joerg at britannica.bec.de Thu Feb 24 15:00:23 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Thu, 24 Feb 2011 22:00:23 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4D668395.5020707@gmail.com> References: <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> <4D65C523.9090209@gmail.com> <26511CEA-92A4-413D-8E28-32E51DBB0EDE@apple.com> <4D668395.5020707@gmail.com> Message-ID: <20110224210023.GA6468@britannica.bec.de> On Thu, Feb 24, 2011 at 11:13:09AM -0500, Rafael Avila de Espindola wrote: > *) Disabled for Mach-O ARM > *) Enabled for Mach-O X86 > *) Enabled for ELF ARM and X86 > > It was also requested that the default be off. Attached patch does all that but Mach-O X86. I leave that part for the Darwin folks. Joerg -------------- next part -------------- A non-text attachment was scrubbed... Name: bracket-v2.diff Type: text/x-diff Size: 4596 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110224/4452ef7e/attachment.bin From nadav.rotem at intel.com Thu Feb 24 15:01:34 2011 From: nadav.rotem at intel.com (Nadav Rotem) Date: Thu, 24 Feb 2011 21:01:34 -0000 Subject: [llvm-commits] [llvm] r126424 - in /llvm/trunk: docs/LangRef.html lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/vec_anyext.ll test/CodeGen/X86/vec_sext.ll Message-ID: <20110224210135.32FE72A6C12C@llvm.org> Author: nadav Date: Thu Feb 24 15:01:34 2011 New Revision: 126424 URL: http://llvm.org/viewvc/llvm-project?rev=126424&view=rev Log: Enable support for vector sext and trunc: Limit the folding of any_ext and sext into the load operation to scalars. Limit the active-bits trunc optimization to scalars. Document vector trunc and vector sext in LangRef. Similar to commit 126080 (for enabling zext). Added: llvm/trunk/test/CodeGen/X86/vec_anyext.ll llvm/trunk/test/CodeGen/X86/vec_sext.ll Modified: llvm/trunk/docs/LangRef.html llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=126424&r1=126423&r2=126424&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Thu Feb 24 15:01:34 2011 @@ -4575,12 +4575,12 @@ type ty2.

Arguments:
-

The 'trunc' instruction takes a value to trunc, which must - be an integer type, and a type that specifies the - size and type of the result, which must be - an integer type. The bit size of value must - be larger than the bit size of ty2. Equal sized types are not - allowed.

+

The 'trunc' instruction takes a value to trunc, and a type to trunc it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be larger than + the bit size of the destination type, ty2. + Equal sized types are not allowed.

Semantics:

The 'trunc' instruction truncates the high order bits @@ -4590,9 +4590,10 @@

Example:
-  %X = trunc i32 257 to i8              ; yields i8:1
-  %Y = trunc i32 123 to i1              ; yields i1:true
-  %Z = trunc i32 122 to i1              ; yields i1:false
+  %X = trunc i32 257 to i8                        ; yields i8:1
+  %Y = trunc i32 123 to i1                        ; yields i1:true
+  %Z = trunc i32 122 to i1                        ; yields i1:false
+  %W = trunc <2 x i16> <i16 8, i16 7> to <2 x i8> ; yields <i8 8, i8 7>
 
@@ -4651,10 +4652,11 @@

The 'sext' sign extends value to the type ty2.

Arguments:
-

The 'sext' instruction takes a value to cast, which must be of - integer type, and a type to cast it to, which must - also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, +

The 'sext' instruction takes a value to cast, and a type to cast it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be smaller than + the bit size of the destination type, ty2.

Semantics:
@@ -4668,6 +4670,7 @@
   %X = sext i8  -1 to i16              ; yields i16   :65535
   %Y = sext i1 true to i32             ; yields i32:-1
+  %Z = sext <2 x i16> <i16 8, i16 7> to <2 x i32> ; yields <i32 8, i32 7>
 
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=126424&r1=126423&r2=126424&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Feb 24 15:01:34 2011 @@ -3685,7 +3685,9 @@ } // fold (sext (load x)) -> (sext (truncate (sextload x))) - if (ISD::isNON_EXTLoad(N0.getNode()) && + // None of the supported targets knows how to perform load and sign extend + // in one instruction. We only perform this transformation on scalars. + if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() && ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::SEXTLOAD, N0.getValueType()))) { bool DoXform = true; @@ -4096,7 +4098,9 @@ } // fold (aext (load x)) -> (aext (truncate (extload x))) - if (ISD::isNON_EXTLoad(N0.getNode()) && + // None of the supported targets knows how to perform load and any_ext + // in one instruction. We only perform this transformation on scalars. + if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() && ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::EXTLOAD, N0.getValueType()))) { bool DoXform = true; @@ -4506,14 +4510,17 @@ } // See if we can simplify the input to this truncate through knowledge that - // only the low bits are being used. For example "trunc (or (shl x, 8), y)" - // -> trunc y - SDValue Shorter = - GetDemandedBits(N0, APInt::getLowBitsSet(N0.getValueSizeInBits(), - VT.getSizeInBits())); - if (Shorter.getNode()) - return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, Shorter); - + // only the low bits are being used. + // For example "trunc (or (shl x, 8), y)" // -> trunc y + // Currenly we only perform this optimization on scalars because vectors + // may have different active low bits. + if (!VT.isVector()) { + SDValue Shorter = + GetDemandedBits(N0, APInt::getLowBitsSet(N0.getValueSizeInBits(), + VT.getSizeInBits())); + if (Shorter.getNode()) + return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, Shorter); + } // fold (truncate (load x)) -> (smaller load x) // fold (truncate (srl (load x), c)) -> (smaller load (x+c/evtbits)) if (!LegalTypes || TLI.isTypeDesirableForOp(N0.getOpcode(), VT)) { Added: llvm/trunk/test/CodeGen/X86/vec_anyext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_anyext.ll?rev=126424&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_anyext.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_anyext.ll Thu Feb 24 15:01:34 2011 @@ -0,0 +1,77 @@ +; RUN: llc < %s -march=x86-64 +; PR 9267 + +define<4 x i16> @func_16_32() { + %F = load <4 x i32>* undef + %G = trunc <4 x i32> %F to <4 x i16> + %H = load <4 x i32>* undef + %Y = trunc <4 x i32> %H to <4 x i16> + %T = add <4 x i16> %Y, %G + store <4 x i16>%T , <4 x i16>* undef + ret <4 x i16> %T +} + +define<4 x i16> @func_16_64() { + %F = load <4 x i64>* undef + %G = trunc <4 x i64> %F to <4 x i16> + %H = load <4 x i64>* undef + %Y = trunc <4 x i64> %H to <4 x i16> + %T = xor <4 x i16> %Y, %G + store <4 x i16>%T , <4 x i16>* undef + ret <4 x i16> %T +} + +define<4 x i32> @func_32_64() { + %F = load <4 x i64>* undef + %G = trunc <4 x i64> %F to <4 x i32> + %H = load <4 x i64>* undef + %Y = trunc <4 x i64> %H to <4 x i32> + %T = or <4 x i32> %Y, %G + ret <4 x i32> %T +} + +define<4 x i8> @func_8_16() { + %F = load <4 x i16>* undef + %G = trunc <4 x i16> %F to <4 x i8> + %H = load <4 x i16>* undef + %Y = trunc <4 x i16> %H to <4 x i8> + %T = add <4 x i8> %Y, %G + ret <4 x i8> %T +} + +define<4 x i8> @func_8_32() { + %F = load <4 x i32>* undef + %G = trunc <4 x i32> %F to <4 x i8> + %H = load <4 x i32>* undef + %Y = trunc <4 x i32> %H to <4 x i8> + %T = sub <4 x i8> %Y, %G + ret <4 x i8> %T +} + +define<4 x i8> @func_8_64() { + %F = load <4 x i64>* undef + %G = trunc <4 x i64> %F to <4 x i8> + %H = load <4 x i64>* undef + %Y = trunc <4 x i64> %H to <4 x i8> + %T = add <4 x i8> %Y, %G + ret <4 x i8> %T +} + +define<4 x i16> @const_16_32() { + %G = trunc <4 x i32> to <4 x i16> + ret <4 x i16> %G +} + +define<4 x i16> @const_16_64() { + %G = trunc <4 x i64> to <4 x i16> + ret <4 x i16> %G +} + +define void @bugOnTruncBitwidthReduce() nounwind { +meh: + %0 = xor <4 x i64> zeroinitializer, zeroinitializer + %1 = trunc <4 x i64> %0 to <4 x i32> + %2 = lshr <4 x i32> %1, + %3 = xor <4 x i32> %2, %1 + ret void +} Added: llvm/trunk/test/CodeGen/X86/vec_sext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_sext.ll?rev=126424&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_sext.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_sext.ll Thu Feb 24 15:01:34 2011 @@ -0,0 +1,69 @@ +; RUN: llc < %s -march=x86-64 +; PR 9267 + +define<4 x i32> @func_16_32() { + %F = load <4 x i16>* undef + %G = sext <4 x i16> %F to <4 x i32> + %H = load <4 x i16>* undef + %Y = sext <4 x i16> %H to <4 x i32> + %T = add <4 x i32> %Y, %G + store <4 x i32>%T , <4 x i32>* undef + ret <4 x i32> %T +} + +define<4 x i64> @func_16_64() { + %F = load <4 x i16>* undef + %G = sext <4 x i16> %F to <4 x i64> + %H = load <4 x i16>* undef + %Y = sext <4 x i16> %H to <4 x i64> + %T = xor <4 x i64> %Y, %G + store <4 x i64>%T , <4 x i64>* undef + ret <4 x i64> %T +} + +define<4 x i64> @func_32_64() { + %F = load <4 x i32>* undef + %G = sext <4 x i32> %F to <4 x i64> + %H = load <4 x i32>* undef + %Y = sext <4 x i32> %H to <4 x i64> + %T = or <4 x i64> %Y, %G + ret <4 x i64> %T +} + +define<4 x i16> @func_8_16() { + %F = load <4 x i8>* undef + %G = sext <4 x i8> %F to <4 x i16> + %H = load <4 x i8>* undef + %Y = sext <4 x i8> %H to <4 x i16> + %T = add <4 x i16> %Y, %G + ret <4 x i16> %T +} + +define<4 x i32> @func_8_32() { + %F = load <4 x i8>* undef + %G = sext <4 x i8> %F to <4 x i32> + %H = load <4 x i8>* undef + %Y = sext <4 x i8> %H to <4 x i32> + %T = sub <4 x i32> %Y, %G + ret <4 x i32> %T +} + +define<4 x i64> @func_8_64() { + %F = load <4 x i8>* undef + %G = sext <4 x i8> %F to <4 x i64> + %H = load <4 x i8>* undef + %Y = sext <4 x i8> %H to <4 x i64> + %T = add <4 x i64> %Y, %G + ret <4 x i64> %T +} + +define<4 x i32> @const_16_32() { + %G = sext <4 x i16> to <4 x i32> + ret <4 x i32> %G +} + +define<4 x i64> @const_16_64() { + %G = sext <4 x i16> to <4 x i64> + ret <4 x i64> %G +} + From dpatel at apple.com Thu Feb 24 15:04:00 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Feb 2011 21:04:00 -0000 Subject: [llvm-commits] [llvm] r126425 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/PTX/ lib/Target/X86/ Message-ID: <20110224210400.8E73B2A6C12C@llvm.org> Author: dpatel Date: Thu Feb 24 15:04:00 2011 New Revision: 126425 URL: http://llvm.org/viewvc/llvm-project?rev=126425&view=rev Log: Enable DebugInfo support for COFF object files. Patch by Nathan Jeffords! Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCELFStreamer.cpp llvm/trunk/lib/MC/MCLoggingStreamer.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp llvm/trunk/lib/MC/MCNullStreamer.cpp llvm/trunk/lib/MC/MCPureStreamer.cpp llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp llvm/trunk/lib/MC/WinCOFFStreamer.cpp llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp llvm/trunk/lib/Target/X86/X86AsmBackend.cpp llvm/trunk/lib/Target/X86/X86FixupKinds.h llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Thu Feb 24 15:04:00 2011 @@ -239,6 +239,11 @@ /// EndCOFFSymbolDef - Marks the end of the symbol definition. virtual void EndCOFFSymbolDef() = 0; + /// EmitCOFFSecRel32 - Emits a COFF section relative relocation. + /// + /// @param Symbol - Symbol the section relative realocation should point to. + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) = 0; + /// EmitELFSize - Emit an ELF .size directive. /// /// This corresponds to an assembler statement such as: Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Thu Feb 24 15:04:00 2011 @@ -178,8 +178,7 @@ const MCSymbol *SectionLabel) const { // On COFF targets, we have to emit the special .secrel32 directive. if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) { - // FIXME: MCize. - OutStreamer.EmitRawText(SecOffDir + Twine(Label->getName())); + OutStreamer.EmitCOFFSecRel32(Label); return; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Thu Feb 24 15:04:00 2011 @@ -277,6 +277,29 @@ #endif //===----------------------------------------------------------------------===// +// DIESectionOffset Implementation +//===----------------------------------------------------------------------===// + +/// EmitValue - Emit label value. +/// +void DIESectionOffset::EmitValue(AsmPrinter *AP, unsigned Form) const { + AP->EmitSectionOffset (Label, Label); +} + +/// SizeOf - Determine size of label value in bytes. +/// +unsigned DIESectionOffset::SizeOf(AsmPrinter *AP, unsigned Form) const { + if (Form == dwarf::DW_FORM_data4) return 4; + return AP->getTargetData().getPointerSize(); +} + +#ifndef NDEBUG +void DIESectionOffset::print(raw_ostream &O) { + O << "SecRelLbl: " << Label->getName(); +} +#endif + +//===----------------------------------------------------------------------===// // DIEDelta Implementation //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Thu Feb 24 15:04:00 2011 @@ -333,6 +333,36 @@ }; //===--------------------------------------------------------------------===// + /// DIESectionOffset - A section relative label expression DIE. + // + class DIESectionOffset : public DIEValue { + const MCSymbol *Label; + public: + explicit DIESectionOffset(const MCSymbol *L) : DIEValue(isSectionOffset), + Label(L) {} + + /// EmitValue - Emit label value. + /// + virtual void EmitValue(AsmPrinter *AP, unsigned Form) const; + + /// getValue - Get MCSymbol. + /// + const MCSymbol *getValue() const { return Label; } + + /// SizeOf - Determine size of label value in bytes. + /// + virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const; + + // Implement isa/cast/dyncast. + static bool classof(const DIELabel *) { return true; } + static bool classof(const DIEValue *L) { return L->getType() == isSectionOffset; } + +#ifndef NDEBUG + virtual void print(raw_ostream &O); +#endif + }; + + //===--------------------------------------------------------------------===// /// DIEDelta - A simple label difference DIE. /// class DIEDelta : public DIEValue { Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Feb 24 15:04:00 2011 @@ -481,6 +481,15 @@ Die->addValue(Attribute, Form, Value); } +/// addSectionOffset - Add a Dwarf section relative label attribute data and +/// value. +/// +void DwarfDebug::addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, + const MCSymbol *Label) { + DIEValue *Value = new (DIEValueAllocator) DIESectionOffset(Label); + Die->addValue(Attribute, Form, Value); +} + /// addDelta - Add a label delta attribute data and value. /// void DwarfDebug::addDelta(DIE *Die, unsigned Attribute, unsigned Form, @@ -1904,8 +1913,8 @@ // DW_AT_stmt_list is a offset of line number information for this // compile unit in debug_line section. if (Asm->MAI->doesDwarfUsesAbsoluteLabelForStmtList()) - addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, - Asm->GetTempSymbol("section_line")); + addSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, + Asm->GetTempSymbol("section_line")); else addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Feb 24 15:04:00 2011 @@ -280,6 +280,12 @@ void addLabel(DIE *Die, unsigned Attribute, unsigned Form, const MCSymbol *Label); + /// addSectionOffset - Add a Dwarf section relative label attribute data and + /// value. + /// + void addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, + const MCSymbol *Label); + /// addDelta - Add a label delta attribute data and value. /// void addDelta(DIE *Die, unsigned Attribute, unsigned Form, Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original) +++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Thu Feb 24 15:04:00 2011 @@ -33,5 +33,6 @@ HasLEB128 = true; // Target asm supports leb128 directives (little-endian) SupportsDebugInformation = true; DwarfSectionOffsetDirective = "\t.secrel32\t"; + DwarfUsesAbsoluteLabelForStmtList = false; HasMicrosoftFastStdCallMangling = true; } Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -135,6 +135,7 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass); virtual void EmitCOFFSymbolType(int Type); virtual void EndCOFFSymbolDef(); + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment); @@ -384,6 +385,11 @@ EmitEOL(); } +void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) { + OS << "\t.secrel32\t" << *Symbol << '\n'; + EmitEOL(); +} + void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { assert(MAI.hasDotTypeDotSizeDirective()); OS << "\t.size\t" << *Symbol << ", " << *Value << '\n'; Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCELFStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCELFStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -108,6 +108,10 @@ assert(0 && "ELF doesn't support this directive"); } + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { + assert(0 && "ELF doesn't support this directive"); + } + virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); SD.setSize(Value); Modified: llvm/trunk/lib/MC/MCLoggingStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCLoggingStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCLoggingStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCLoggingStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -120,6 +120,11 @@ return Child->EndCOFFSymbolDef(); } + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { + LogCall("EndCOFFSymbolDef"); + return Child->EmitCOFFSecRel32(Symbol); + } + virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { LogCall("EmitELFSize"); return Child->EmitELFSize(Symbol, Value); Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -63,6 +63,9 @@ virtual void EndCOFFSymbolDef() { assert(0 && "macho doesn't support this directive"); } + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { + assert(0 && "macho doesn't support this directive"); + } virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { assert(0 && "macho doesn't support this directive"); } Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -54,6 +54,7 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass) {} virtual void EmitCOFFSymbolType(int Type) {} virtual void EndCOFFSymbolDef() {} + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {} virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Modified: llvm/trunk/lib/MC/MCPureStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCPureStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCPureStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -83,6 +83,9 @@ virtual void EndCOFFSymbolDef() { report_fatal_error("unsupported directive in pure streamer"); } + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { + report_fatal_error("unsupported directive in pure streamer"); + } virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { report_fatal_error("unsupported directive in pure streamer"); } Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Thu Feb 24 15:04:00 2011 @@ -705,6 +705,10 @@ else llvm_unreachable("unsupported relocation type"); break; + case X86::reloc_coff_secrel32: + Reloc.Data.Type = Is64Bit ? COFF::IMAGE_REL_AMD64_SREL32 + : COFF::IMAGE_REL_I386_SECREL; + break; default: llvm_unreachable("unsupported relocation type"); } Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original) +++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -31,6 +31,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" + +#include "../Target/X86/X86FixupKinds.h" + using namespace llvm; namespace { @@ -59,6 +62,7 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass); virtual void EmitCOFFSymbolType(int Type); virtual void EndCOFFSymbolDef(); + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment); @@ -290,6 +294,16 @@ CurSymbol = NULL; } +void WinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) +{ + MCDataFragment *DF = getOrCreateDataFragment(); + + DF->addFixup(MCFixup::Create(DF->getContents().size(), + MCSymbolRefExpr::Create (Symbol, getContext ()), + (MCFixupKind)X86::reloc_coff_secrel32)); + DF->getContents().resize(DF->getContents().size() + 4, 0); +} + void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { llvm_unreachable("not implemented"); } @@ -368,6 +382,10 @@ getCurrentSectionData()->setHasInstructions(true); + // Now that a machine instruction has been assembled into this section, make + // a line entry for any .loc directive that has been seen. + MCLineEntry::Make(this, getCurrentSection()); + MCInstFragment *Fragment = new MCInstFragment(Instruction, getCurrentSectionData()); Modified: llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp (original) +++ llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp Thu Feb 24 15:04:00 2011 @@ -124,6 +124,7 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass); virtual void EmitCOFFSymbolType(int Type); virtual void EndCOFFSymbolDef(); + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment); @@ -277,6 +278,8 @@ void PTXMCAsmStreamer::EndCOFFSymbolDef() {} +void PTXMCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {} + void PTXMCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} void PTXMCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Modified: llvm/trunk/lib/Target/X86/X86AsmBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmBackend.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmBackend.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmBackend.cpp Thu Feb 24 15:04:00 2011 @@ -40,6 +40,7 @@ case X86::reloc_riprel_4byte_movq_load: case X86::reloc_signed_4byte: case X86::reloc_global_offset_table: + case X86::reloc_coff_secrel32: case FK_Data_4: return 2; case FK_PCRel_8: case FK_Data_8: return 3; @@ -69,7 +70,8 @@ { "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel }, { "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel}, { "reloc_signed_4byte", 0, 4 * 8, 0}, - { "reloc_global_offset_table", 0, 4 * 8, 0} + { "reloc_global_offset_table", 0, 4 * 8, 0}, + { "reloc_coff_secrel32", 0, 4 * 8, 0} }; if (Kind < FirstTargetFixupKind) Modified: llvm/trunk/lib/Target/X86/X86FixupKinds.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FixupKinds.h?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FixupKinds.h (original) +++ llvm/trunk/lib/Target/X86/X86FixupKinds.h Thu Feb 24 15:04:00 2011 @@ -23,6 +23,8 @@ reloc_global_offset_table, // 32-bit, relative to the start // of the instruction. Used only // for _GLOBAL_OFFSET_TABLE_. + reloc_coff_secrel32, // PE-COFF section relative 32 + // (only valid for win32 COFF) // Marker LastTargetFixupKind, NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=126425&r1=126424&r2=126425&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Thu Feb 24 15:04:00 2011 @@ -113,4 +113,7 @@ AssemblerDialect = AsmWriterFlavor; TextAlignFillValue = 0x90; + + // Debug Information + SupportsDebugInformation = true; } From rafael.espindola at gmail.com Thu Feb 24 15:04:06 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 24 Feb 2011 21:04:06 -0000 Subject: [llvm-commits] [llvm] r126426 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOCodeGenerator.h lto.cpp Message-ID: <20110224210406.87C712A6C12D@llvm.org> Author: rafael Date: Thu Feb 24 15:04:06 2011 New Revision: 126426 URL: http://llvm.org/viewvc/llvm-project?rev=126426&view=rev Log: Switch LTO to use MC. This takes the linking of libxul.so from about 7m to 6m30. Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOCodeGenerator.h llvm/trunk/tools/lto/lto.cpp Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=126426&r1=126425&r2=126426&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu Feb 24 15:04:06 2011 @@ -71,10 +71,11 @@ _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL), _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false), _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC), - _nativeObjectFile(NULL), _assemblerPath(NULL) + _nativeObjectFile(NULL) { InitializeAllTargets(); InitializeAllAsmPrinters(); + InitializeAllAsmParsers(); } LTOCodeGenerator::~LTOCodeGenerator() @@ -126,21 +127,6 @@ _mCpu = mCpu; } -void LTOCodeGenerator::setAssemblerPath(const char* path) -{ - if ( _assemblerPath ) - delete _assemblerPath; - _assemblerPath = new sys::Path(path); -} - -void LTOCodeGenerator::setAssemblerArgs(const char** args, int nargs) -{ - for (int i = 0; i < nargs; ++i) { - const char *arg = args[i]; - _assemblerArgs.push_back(arg); - } -} - void LTOCodeGenerator::addMustPreserveSymbol(const char* sym) { _mustPreserveSymbols[sym] = 1; @@ -183,55 +169,42 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) { - // make unique temp .s file to put generated assembly code - sys::Path uniqueAsmPath("lto-llvm.s"); - if ( uniqueAsmPath.createTemporaryFileOnDisk(false, &errMsg) ) - return NULL; - sys::RemoveFileOnSignal(uniqueAsmPath); - - // generate assembly code - bool genResult = false; - { - tool_output_file asmFile(uniqueAsmPath.c_str(), errMsg); - if (!errMsg.empty()) - return NULL; - genResult = this->generateAssemblyCode(asmFile.os(), errMsg); - asmFile.os().close(); - if (asmFile.os().has_error()) { - asmFile.os().clear_error(); - return NULL; - } - asmFile.keep(); - } - if ( genResult ) { - uniqueAsmPath.eraseFromDisk(); - return NULL; - } - // make unique temp .o file to put generated object file sys::PathWithStatus uniqueObjPath("lto-llvm.o"); if ( uniqueObjPath.createTemporaryFileOnDisk(false, &errMsg) ) { - uniqueAsmPath.eraseFromDisk(); + uniqueObjPath.eraseFromDisk(); return NULL; } sys::RemoveFileOnSignal(uniqueObjPath); - // assemble the assembly code - const std::string& uniqueObjStr = uniqueObjPath.str(); - bool asmResult = this->assemble(uniqueAsmPath.str(), uniqueObjStr, errMsg); - if ( !asmResult ) { - // remove old buffer if compile() called twice - delete _nativeObjectFile; - - // read .o file into memory buffer - OwningPtr BuffPtr; - if (error_code ec = MemoryBuffer::getFile(uniqueObjStr.c_str(),BuffPtr)) - errMsg = ec.message(); - _nativeObjectFile = BuffPtr.take(); + // generate object file + bool genResult = false; + tool_output_file objFile(uniqueObjPath.c_str(), errMsg); + if (!errMsg.empty()) + return NULL; + genResult = this->generateObjectFile(objFile.os(), errMsg); + objFile.os().close(); + if (objFile.os().has_error()) { + objFile.os().clear_error(); + return NULL; + } + objFile.keep(); + if ( genResult ) { + uniqueObjPath.eraseFromDisk(); + return NULL; } + const std::string& uniqueObjStr = uniqueObjPath.str(); + // remove old buffer if compile() called twice + delete _nativeObjectFile; + + // read .o file into memory buffer + OwningPtr BuffPtr; + if (error_code ec = MemoryBuffer::getFile(uniqueObjStr.c_str(),BuffPtr)) + errMsg = ec.message(); + _nativeObjectFile = BuffPtr.take(); + // remove temp files - uniqueAsmPath.eraseFromDisk(); uniqueObjPath.eraseFromDisk(); // return buffer, unless error @@ -241,67 +214,6 @@ return _nativeObjectFile->getBufferStart(); } - -bool LTOCodeGenerator::assemble(const std::string& asmPath, - const std::string& objPath, std::string& errMsg) -{ - sys::Path tool; - bool needsCompilerOptions = true; - if ( _assemblerPath ) { - tool = *_assemblerPath; - needsCompilerOptions = false; - } else { - // find compiler driver - tool = sys::Program::FindProgramByName("gcc"); - if ( tool.isEmpty() ) { - errMsg = "can't locate gcc"; - return true; - } - } - - // build argument list - std::vector args; - llvm::Triple targetTriple(_linker.getModule()->getTargetTriple()); - const char *arch = targetTriple.getArchNameForAssembler(); - - args.push_back(tool.c_str()); - - if (targetTriple.getOS() == Triple::Darwin) { - // darwin specific command line options - if (arch != NULL) { - args.push_back("-arch"); - args.push_back(arch); - } - // add -static to assembler command line when code model requires - if ( (_assemblerPath != NULL) && - (_codeModel == LTO_CODEGEN_PIC_MODEL_STATIC) ) - args.push_back("-static"); - } - if ( needsCompilerOptions ) { - args.push_back("-c"); - args.push_back("-x"); - args.push_back("assembler"); - } else { - for (std::vector::iterator I = _assemblerArgs.begin(), - E = _assemblerArgs.end(); I != E; ++I) { - args.push_back(I->c_str()); - } - } - args.push_back("-o"); - args.push_back(objPath.c_str()); - args.push_back(asmPath.c_str()); - args.push_back(0); - - // invoke assembler - if ( sys::Program::ExecuteAndWait(tool, &args[0], 0, 0, 0, 0, &errMsg) ) { - errMsg = "error in assembly"; - return true; - } - return false; // success -} - - - bool LTOCodeGenerator::determineTarget(std::string& errMsg) { if ( _target == NULL ) { @@ -385,8 +297,8 @@ } /// Optimize merged modules using various IPO passes -bool LTOCodeGenerator::generateAssemblyCode(raw_ostream& out, - std::string& errMsg) +bool LTOCodeGenerator::generateObjectFile(raw_ostream& out, + std::string& errMsg) { if ( this->determineTarget(errMsg) ) return true; @@ -423,7 +335,7 @@ formatted_raw_ostream Out(out); if (_target->addPassesToEmitFile(*codeGenPasses, Out, - TargetMachine::CGFT_AssemblyFile, + TargetMachine::CGFT_ObjectFile, CodeGenOpt::Aggressive)) { errMsg = "target file type not supported"; return true; Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=126426&r1=126425&r2=126426&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Thu Feb 24 15:04:06 2011 @@ -37,18 +37,14 @@ bool setDebugInfo(lto_debug_model, std::string& errMsg); bool setCodePICModel(lto_codegen_model, std::string& errMsg); void setCpu(const char *cpu); - void setAssemblerPath(const char* path); - void setAssemblerArgs(const char** args, int nargs); void addMustPreserveSymbol(const char* sym); bool writeMergedModules(const char* path, std::string& errMsg); const void* compile(size_t* length, std::string& errMsg); void setCodeGenDebugOptions(const char *opts); private: - bool generateAssemblyCode(llvm::raw_ostream& out, - std::string& errMsg); - bool assemble(const std::string& asmPath, - const std::string& objPath, std::string& errMsg); + bool generateObjectFile(llvm::raw_ostream& out, + std::string& errMsg); void applyScopeRestrictions(); bool determineTarget(std::string& errMsg); @@ -63,9 +59,7 @@ StringSet _mustPreserveSymbols; llvm::MemoryBuffer* _nativeObjectFile; std::vector _codegenOptions; - llvm::sys::Path* _assemblerPath; std::string _mCpu; - std::vector _assemblerArgs; }; #endif // LTO_CODE_GENERATOR_H Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=126426&r1=126425&r2=126426&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Thu Feb 24 15:04:06 2011 @@ -231,7 +231,7 @@ // void lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path) { - cg->setAssemblerPath(path); + // In here only for backwards compatibility. We use MC now. } @@ -241,7 +241,7 @@ void lto_codegen_set_assembler_args(lto_code_gen_t cg, const char** args, int nargs) { - cg->setAssemblerArgs(args, nargs); + // In here only for backwards compatibility. We use MC now. } // From rafael.espindola at gmail.com Thu Feb 24 15:19:56 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Thu, 24 Feb 2011 16:19:56 -0500 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110224210023.GA6468@britannica.bec.de> References: <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> <4D65C523.9090209@gmail.com> <26511CEA-92A4-413D-8E28-32E51DBB0EDE@apple.com> <4D668395.5020707@gmail.com> <20110224210023.GA6468@britannica.bec.de> Message-ID: <4D66CB7C.3010103@gmail.com> On 11-02-24 04:00 PM, Joerg Sonnenberger wrote: > On Thu, Feb 24, 2011 at 11:13:09AM -0500, Rafael Avila de Espindola wrote: >> *) Disabled for Mach-O ARM >> *) Enabled for Mach-O X86 >> *) Enabled for ELF ARM and X86 >> >> It was also requested that the default be off. > > Attached patch does all that but Mach-O X86. I leave that part for the > Darwin folks. I think it is fine. I just tested on the x86-64 assembler that came with xcode 3.2.5 and it rejects bracket-exprs.s > Joerg > Cheers, Rafael From baldrick at free.fr Thu Feb 24 15:24:13 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 21:24:13 -0000 Subject: [llvm-commits] [dragonegg] r126434 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110224212414.0016C2A6C12C@llvm.org> Author: baldrick Date: Thu Feb 24 15:24:13 2011 New Revision: 126434 URL: http://llvm.org/viewvc/llvm-project?rev=126434&view=rev Log: Allocate memory for replacement strings (produced when parsing multiple alternative asm constraints) using a BumpPtrAllocator, rather than a hand crafted storage pool. This removes the danger of accidentally forgetting to free the memory. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126434&r1=126433&r2=126434&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Thu Feb 24 15:24:13 2011 @@ -3349,10 +3349,9 @@ /// gcc's algorithm for picking "the best" tuple is quite complicated, and /// is performed after things like SROA, not before. At the moment we are /// just trying to pick one that will work. This may get refined. -static void -ChooseConstraintTuple(gimple stmt, const char **Constraints, - unsigned NumChoices, const char **ReplacementStrings) -{ +static void ChooseConstraintTuple(gimple stmt, const char **Constraints, + unsigned NumChoices, + BumpPtrAllocator &ReplacementStrings) { unsigned NumInputs = gimple_asm_ninputs(stmt); unsigned NumOutputs = gimple_asm_noutputs(stmt); @@ -3437,27 +3436,19 @@ // For outputs, copy the leading = or +. char *newstring; if (i(end-start+1+1); newstring[0] = *(Constraints[i]); strncpy(newstring+1, start, end-start); newstring[end-start+1] = 0; } else { - newstring = (char *)xmalloc(end-start+1); + newstring = ReplacementStrings.Allocate(end-start+1); strncpy(newstring, start, end-start); newstring[end-start] = 0; } Constraints[i] = (const char *)newstring; - ReplacementStrings[i] = (const char*)newstring; } } -static void FreeConstTupleStrings(const char **ReplacementStrings, - unsigned int Size) { - if (ReplacementStrings) - for (unsigned int i=0; i(ReplacementStrings[i])); -} - //===----------------------------------------------------------------------===// // ... Helpers for Builtin Function Expansion ... @@ -6748,6 +6739,33 @@ const unsigned NumInputs = gimple_asm_ninputs(stmt); const unsigned NumClobbers = gimple_asm_nclobbers (stmt); + /// Constraints - The output/input constraints, concatenated together in array + /// form instead of list form. This way of doing things is forced on us by + /// GCC routines like parse_output_constraint which rummage around inside the + /// array. + const char **Constraints = + (const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *)); + + // Initialize the Constraints array. + for (unsigned i = 0; i != NumOutputs; ++i) { + tree Output = gimple_asm_output_op(stmt, i); + // If there's an erroneous arg then bail out. + if (TREE_TYPE(TREE_VALUE(Output)) == error_mark_node) return; + // Record the output constraint. + const char *Constraint = + TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Output))); + Constraints[i] = Constraint; + } + for (unsigned i = 0; i != NumInputs; ++i) { + tree Input = gimple_asm_input_op(stmt, i); + // If there's an erroneous arg then bail out. + if (TREE_TYPE(TREE_VALUE(Input)) == error_mark_node) return; + // Record the input constraint. + const char *Constraint = + TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Input))); + Constraints[NumOutputs+i] = Constraint; + } + // Look for multiple alternative constraints: multiple alternatives separated // by commas. unsigned NumChoices = 0; // sentinal; real value is always at least 1. @@ -6776,42 +6794,12 @@ NumChoices = NumOutputChoices; } - /// Constraints - The output/input constraints, concatenated together in array - /// form instead of list form. This way of doing things is forced on us by - /// GCC routines like parse_output_constraint which rummage around inside the - /// array. - const char **Constraints = - (const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *)); - - // Initialize the Constraints array. - for (unsigned i = 0; i != NumOutputs; ++i) { - tree Output = gimple_asm_output_op(stmt, i); - // If there's an erroneous arg then bail out. - if (TREE_TYPE(TREE_VALUE(Output)) == error_mark_node) return; - // Record the output constraint. - const char *Constraint = - TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Output))); - Constraints[i] = Constraint; - } - for (unsigned i = 0; i != NumInputs; ++i) { - tree Input = gimple_asm_input_op(stmt, i); - // If there's an erroneous arg then bail out. - if (TREE_TYPE(TREE_VALUE(Input)) == error_mark_node) return; - // Record the input constraint. - const char *Constraint = - TREE_STRING_POINTER(TREE_VALUE(TREE_PURPOSE(Input))); - Constraints[NumOutputs+i] = Constraint; - } - // If there are multiple constraint tuples, pick one. Constraints is // altered to point to shorter strings (which are malloc'ed), and everything // below Just Works as in the NumChoices==1 case. - const char** ReplacementStrings = 0; - if (NumChoices>1) { - ReplacementStrings = - (const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *)); + BumpPtrAllocator ReplacementStrings; + if (NumChoices > 1) ChooseConstraintTuple(stmt, Constraints, NumChoices, ReplacementStrings); - } std::vector CallOps; std::vector CallArgTypes; @@ -6835,10 +6823,8 @@ const char *Constraint = Constraints[i]; bool IsInOut, AllowsReg, AllowsMem; if (!parse_output_constraint(&Constraint, i, NumInputs, NumOutputs, - &AllowsMem, &AllowsReg, &IsInOut)) { - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + &AllowsMem, &AllowsReg, &IsInOut)) return; - } assert(Constraint[0] == '=' && "Not an output constraint?"); assert(!IsInOut && "asm expression not gimplified?"); @@ -6914,10 +6900,8 @@ bool AllowsReg, AllowsMem; if (!parse_input_constraint(Constraints+NumOutputs+i, i, NumInputs, NumOutputs, 0, - Constraints, &AllowsMem, &AllowsReg)) { - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); + Constraints, &AllowsMem, &AllowsReg)) return; - } bool isIndirect = false; if (AllowsReg || !AllowsMem) { // Register operand. const Type *LLVMTy = ConvertType(type); @@ -6992,7 +6976,6 @@ error_at(gimple_location(stmt), "unsupported inline asm: input constraint with a matching " "output constraint of incompatible type!"); - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } unsigned OTyBits = TD.getTypeSizeInBits(OTy); @@ -7012,7 +6995,6 @@ error_at(gimple_location(stmt), "unsupported inline asm: input constraint with a matching " "output constraint of incompatible type!"); - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } else if (OTyBits > OpTyBits) { Op = CastToAnyType(Op, !TYPE_UNSIGNED(type), @@ -7105,7 +7087,6 @@ case -2: // Invalid. error_at(gimple_location(stmt), "unknown register name %qs in %", RegName); - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; case -3: // cc ConstraintStr += ",~{cc}"; @@ -7143,7 +7124,6 @@ // Make sure we're created a valid inline asm expression. if (!InlineAsm::Verify(FTy, ConstraintStr)) { error_at(gimple_location(stmt), "Invalid or unsupported inline assembly!"); - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return; } @@ -7176,8 +7156,6 @@ // llvm.bswap. if (const TargetLowering *TLI = TheTarget->getTargetLowering()) TLI->ExpandInlineAsm(CV); - - FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); } void TreeToLLVM::RenderGIMPLE_ASSIGN(gimple stmt) { From baldrick at free.fr Thu Feb 24 15:33:09 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 22:33:09 +0100 Subject: [llvm-commits] [llvm] r126424 - in /llvm/trunk: docs/LangRef.html lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/vec_anyext.ll test/CodeGen/X86/vec_sext.ll In-Reply-To: <20110224210135.32FE72A6C12C@llvm.org> References: <20110224210135.32FE72A6C12C@llvm.org> Message-ID: <4D66CE95.9040104@free.fr> Hi Nadav, > - if (ISD::isNON_EXTLoad(N0.getNode())&& > + // None of the supported targets knows how to perform load and sign extend > + // in one instruction. We only perform this transformation on scalars. I think in your comment (and the other similar ones) you should make clear that you mean that no supported targets know how to do this for vectors. Right now it sounds like no target can do it for scalars either. > + // Currenly we only perform this optimization on scalars because vectors Currenly -> Currently Ciao, Duncan. From akyrtzi at gmail.com Thu Feb 24 15:33:49 2011 From: akyrtzi at gmail.com (Argyrios Kyrtzidis) Date: Thu, 24 Feb 2011 21:33:49 -0000 Subject: [llvm-commits] [llvm] r126436 - /llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Message-ID: <20110224213349.957392A6C12D@llvm.org> Author: akirtzidis Date: Thu Feb 24 15:33:49 2011 New Revision: 126436 URL: http://llvm.org/viewvc/llvm-project?rev=126436&view=rev Log: In utils/TableGen/ClangSACheckersEmitter.cpp, set the 'Hidden' bit for checkers. Modified: llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Modified: llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp?rev=126436&r1=126435&r2=126436&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Thu Feb 24 15:33:49 2011 @@ -148,6 +148,7 @@ // Create a pseudo-group to hold this checker. std::string fullName = getCheckerFullName(R); GroupInfo &info = groupInfoByName[fullName]; + info.Hidden = R->getValueAsBit("Hidden"); recordGroupMap[R] = &info; info.Checkers.push_back(R); } else { From baldrick at free.fr Thu Feb 24 15:33:51 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Feb 2011 21:33:51 -0000 Subject: [llvm-commits] [dragonegg] r126437 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110224213351.61F602A6C12C@llvm.org> Author: baldrick Date: Thu Feb 24 15:33:51 2011 New Revision: 126437 URL: http://llvm.org/viewvc/llvm-project?rev=126437&view=rev Log: Fix what looks like a clear thinko: using Match to look up the sign in the call outputs sign array. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126437&r1=126436&r2=126437&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Thu Feb 24 15:33:51 2011 @@ -6960,12 +6960,14 @@ // This output might have gotten put in either CallResult or CallArg // depending whether it's a register or not. Find its type. const Type *OTy = 0; + unsigned OutputIndex = ~0U; if (Match < OutputLocations.size()) { // Indices here known to be within range. + OutputIndex = OutputLocations[Match].second; if (OutputLocations[Match].first) - OTy = CallResultTypes[OutputLocations[Match].second]; + OTy = CallResultTypes[OutputIndex]; else { - OTy = CallArgTypes[OutputLocations[Match].second]; + OTy = CallArgTypes[OutputIndex]; assert(OTy->isPointerTy() && "Expected pointer type!"); OTy = cast(OTy)->getElementType(); } @@ -6998,7 +7000,7 @@ return; } else if (OTyBits > OpTyBits) { Op = CastToAnyType(Op, !TYPE_UNSIGNED(type), - OTy, CallResultIsSigned[Match]); + OTy, CallResultIsSigned[OutputIndex]); if (BYTES_BIG_ENDIAN) { Constant *ShAmt = ConstantInt::get(Op->getType(), OTyBits-OpTyBits); From sabre at nondot.org Thu Feb 24 15:53:03 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Feb 2011 21:53:03 -0000 Subject: [llvm-commits] [llvm] r126441 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <20110224215303.7EFE52A6C12C@llvm.org> Author: lattner Date: Thu Feb 24 15:53:03 2011 New Revision: 126441 URL: http://llvm.org/viewvc/llvm-project?rev=126441&view=rev Log: remove command line option debugging hook. 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=126441&r1=126440&r2=126441&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Feb 24 15:53:03 2011 @@ -45,7 +45,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/VectorExtras.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/ErrorHandling.h" @@ -56,10 +55,6 @@ STATISTIC(NumTailCalls, "Number of tail calls"); -static cl::opt -Disable256Bit("disable-256bit", cl::Hidden, - cl::desc("Disable use of 256-bit vectors")); - // Forward declarations. static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1, SDValue V2); @@ -4337,7 +4332,6 @@ // use shuffles to put them in place. if (VT.getSizeInBits() > 256 && Subtarget->hasAVX() && - !Disable256Bit && !ISD::isBuildVectorAllZeros(Op.getNode())) { SmallVector V; V.resize(NumElems); From grosbach at apple.com Thu Feb 24 15:57:30 2011 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 24 Feb 2011 13:57:30 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110224210023.GA6468@britannica.bec.de> References: <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110223195442.GA29117@britannica.bec.de> <16132883-7514-4704-98CE-8926EBEC1078@apple.com> <20110223203249.GA12162@britannica.bec.de> <32CCA794-93BF-438A-AA37-A6831ADF472B@apple.com> <20110223215523.GA15835@britannica.bec.de> <5D3142EE-630C-4633-842D-7CFEEE3D11FB@apple.com> <4D65C523.9090209@gmail.com> <26511CEA-92A4-413D-8E28-32E51DBB0EDE@apple.com> <4D668395.5020707@gmail.com> <20110224210023.GA6468@britannica.bec.de> Message-ID: On Feb 24, 2011, at 1:00 PM, Joerg Sonnenberger wrote: > On Thu, Feb 24, 2011 at 11:13:09AM -0500, Rafael Avila de Espindola wrote: >> *) Disabled for Mach-O ARM >> *) Enabled for Mach-O X86 >> *) Enabled for ELF ARM and X86 >> >> It was also requested that the default be off. > > Attached patch does all that but Mach-O X86. I leave that part for the > Darwin folks. Excellent! Thank you, Joerg. This looks good to me. Please commit. Regards, -Jim From joerg at bec.de Thu Feb 24 15:59:22 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Thu, 24 Feb 2011 21:59:22 -0000 Subject: [llvm-commits] [llvm] r126443 - in /llvm/trunk: include/llvm/MC/MCParser/MCAsmParserExtension.h lib/MC/MCParser/AsmParser.cpp lib/MC/MCParser/ELFAsmParser.cpp lib/MC/MCParser/MCAsmParserExtension.cpp test/MC/ARM/bracket-darwin.s test/MC/ELF/bracket-exprs.s test/MC/ELF/bracket.s Message-ID: <20110224215922.5470C2A6C12C@llvm.org> Author: joerg Date: Thu Feb 24 15:59:22 2011 New Revision: 126443 URL: http://llvm.org/viewvc/llvm-project?rev=126443&view=rev Log: Restore r125595 (reverted in r126336) with modifications: Introduce a variable in the AsmParserExtension whether [] is valid in an expression. If it is true, parse them like (). Enable this for ELF only. Added: llvm/trunk/test/MC/ARM/bracket-darwin.s llvm/trunk/test/MC/ELF/bracket-exprs.s llvm/trunk/test/MC/ELF/bracket.s Modified: llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h llvm/trunk/lib/MC/MCParser/AsmParser.cpp llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp Modified: llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h?rev=126443&r1=126442&r2=126443&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h (original) +++ llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h Thu Feb 24 15:59:22 2011 @@ -38,6 +38,8 @@ return (Obj->*Handler)(Directive, DirectiveLoc); } + bool BracketExpressionsSupported; + public: virtual ~MCAsmParserExtension(); @@ -68,6 +70,8 @@ const AsmToken &getTok() { return getParser().getTok(); } + bool HasBracketExpressions() const { return BracketExpressionsSupported; } + /// @} }; Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=126443&r1=126442&r2=126443&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Feb 24 15:59:22 2011 @@ -173,6 +173,7 @@ bool ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc); bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res, SMLoc &EndLoc); bool ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc); + bool ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc); /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) /// and set \arg Res to the identifier contents. @@ -492,6 +493,20 @@ return false; } +/// ParseBracketExpr - Parse a bracket expression and return it. +/// NOTE: This assumes the leading '[' has already been consumed. +/// +/// bracketexpr ::= expr] +/// +bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) { + if (ParseExpression(Res)) return true; + if (Lexer.isNot(AsmToken::RBrac)) + return TokError("expected ']' in brackets expression"); + EndLoc = Lexer.getLoc(); + Lex(); + return false; +} + /// ParsePrimaryExpr - Parse a primary expression and return it. /// primaryexpr ::= (parenexpr /// primaryexpr ::= symbol @@ -587,6 +602,11 @@ case AsmToken::LParen: Lex(); // Eat the '('. return ParseParenExpr(Res, EndLoc); + case AsmToken::LBrac: + if (!PlatformParser->HasBracketExpressions()) + return TokError("brackets expression not supported on this target"); + Lex(); // Eat the '['. + return ParseBracketExpr(Res, EndLoc); case AsmToken::Minus: Lex(); // Eat the operator. if (ParsePrimaryExpr(Res, EndLoc)) Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=126443&r1=126442&r2=126443&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Thu Feb 24 15:59:22 2011 @@ -33,7 +33,9 @@ bool SeenIdent; public: - ELFAsmParser() : SeenIdent(false) {} + ELFAsmParser() : SeenIdent(false) { + BracketExpressionsSupported = true; + } virtual void Initialize(MCAsmParser &Parser) { // Call the base implementation. Modified: llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp?rev=126443&r1=126442&r2=126443&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp (original) +++ llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp Thu Feb 24 15:59:22 2011 @@ -10,7 +10,8 @@ #include "llvm/MC/MCParser/MCAsmParserExtension.h" using namespace llvm; -MCAsmParserExtension::MCAsmParserExtension() { +MCAsmParserExtension::MCAsmParserExtension() : + BracketExpressionsSupported(false) { } MCAsmParserExtension::~MCAsmParserExtension() { Added: llvm/trunk/test/MC/ARM/bracket-darwin.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/bracket-darwin.s?rev=126443&view=auto ============================================================================== --- llvm/trunk/test/MC/ARM/bracket-darwin.s (added) +++ llvm/trunk/test/MC/ARM/bracket-darwin.s Thu Feb 24 15:59:22 2011 @@ -0,0 +1,5 @@ +// RUN: not llvm-mc -triple arm-apple-darwin %s 2> %t +// RUN: FileCheck -input-file %t %s + +// CHECK: error: brackets expression not supported on this target +.byte [4-3] Added: llvm/trunk/test/MC/ELF/bracket-exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/bracket-exprs.s?rev=126443&view=auto ============================================================================== --- llvm/trunk/test/MC/ELF/bracket-exprs.s (added) +++ llvm/trunk/test/MC/ELF/bracket-exprs.s Thu Feb 24 15:59:22 2011 @@ -0,0 +1,16 @@ +// RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s +// RUN: llvm-mc -triple arm-unknown-linux %s | FileCheck %s + +// CHECK: .byte 1 +.if [~0 >> 1] == -1 +.byte 1 +.else +.byte 2 +.endif + +// CHECK: .byte 3 +.if 4 * [4 + (3 + [2 * 2] + 1)] == 48 +.byte 3 +.else +.byte 4 +.endif Added: llvm/trunk/test/MC/ELF/bracket.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/bracket.s?rev=126443&view=auto ============================================================================== --- llvm/trunk/test/MC/ELF/bracket.s (added) +++ llvm/trunk/test/MC/ELF/bracket.s Thu Feb 24 15:59:22 2011 @@ -0,0 +1,8 @@ +// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t1 > %t2 +// RUN: FileCheck < %t1 %s + +// CHECK: error: expected ']' in brackets expression +.size x, [.-x) + +// CHECK: error: expected ')' in parentheses expression +.size y, (.-y] From clattner at apple.com Thu Feb 24 16:43:21 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 24 Feb 2011 14:43:21 -0800 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: <4D65DCFB.90205@gmail.com> References: <4D65DCFB.90205@gmail.com> Message-ID: <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> On Feb 23, 2011, at 8:22 PM, Rafael ?vila de Esp?ndola wrote: > I was updating my patch for disabling .globl matching on ELF targets and > decided I should at least try to see how hard it would be to implement > the proper solution with MC. > > The first step is probably to switch LTO to use MC. It wouldn't make a > lot of sense to have LTO require MC for finding definitions and then > passing assembly to 'as'. > > The attached patch converts LTO to using MC for object emission. It > simplifies the code a lot, since now all the assembler logic is in LLVM > itself. It also has a nice impact on performance. With the patch > libxul.so now links in 6m30, which is about 30s less than before :-) Very nice Rafael! Do you have a breakdown of how much of that 6:30 is spent reading bitcode files, doing IR linking, doing optimization, doing codegen, and doing native linking? I'm just curious where the time is going. I would not have expected 30s for the asmprinter + native assembler :) -Chris From clattner at apple.com Thu Feb 24 16:44:20 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 24 Feb 2011 14:44:20 -0800 Subject: [llvm-commits] [llvm] r126382 - /llvm/trunk/include/llvm/Target/TargetLowering.h In-Reply-To: <4D66AE54.3020304@free.fr> References: <20110224115418.DFF4C2A6C12C@llvm.org> <31DE9452-CDB6-414E-AC94-C3B4C24F137D@apple.com> <4D66AE54.3020304@free.fr> Message-ID: On Feb 24, 2011, at 11:15 AM, Duncan Sands wrote: > Hi Chris, > >>> Rewrite the vector part of getExtendedTypeAction to make it more >>> understandable (at least I find it easier to understand like this). >>> No intended functionality change. >> >> While you're here, can you move this out of line? It's huge :) > > I actually tried this once but failed because it created circular > library dependencies. Ok thanks. We need to split TargetLowering into two separate classes: one for IR lowering info (used by LSR), and one used by the selectiondag stuff. Not today though :) -Chris From benny.kra at googlemail.com Thu Feb 24 16:46:12 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Thu, 24 Feb 2011 22:46:12 -0000 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll Message-ID: <20110224224612.21E8B2A6C12C@llvm.org> Author: d0k Date: Thu Feb 24 16:46:11 2011 New Revision: 126445 URL: http://llvm.org/viewvc/llvm-project?rev=126445&view=rev Log: SimplifyCFG: GEPs with constant indices are cheap enough to be executed unconditionally. Added: llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=126445&r1=126444&r2=126445&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Feb 24 16:46:11 2011 @@ -247,6 +247,11 @@ if (PBB->getFirstNonPHIOrDbg() != I) return false; break; + case Instruction::GetElementPtr: + // GEPs are cheap if all indices are constant. + if (!cast(I)->hasAllConstantIndices()) + return false; + break; case Instruction::Add: case Instruction::Sub: case Instruction::And: Added: llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll?rev=126445&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll (added) +++ llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll Thu Feb 24 16:46:11 2011 @@ -0,0 +1,20 @@ +; RUN: opt -S -simplifycfg %s | FileCheck %s + +define i8* @test1(i8* %x) nounwind { +entry: + %tmp1 = load i8* %x, align 1 + %cmp = icmp eq i8 %tmp1, 47 + br i1 %cmp, label %if.then, label %if.end + +if.then: + %incdec.ptr = getelementptr inbounds i8* %x, i64 1 + br label %if.end + +if.end: + %x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %x, %entry ] + ret i8* %x.addr + +; CHECK: @test1 +; CHECK: %x.addr = select i1 %cmp, i8* %incdec.ptr, i8* %x +; CHECK: ret i8* %x.addr +} From fvbommel at gmail.com Thu Feb 24 17:00:58 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Fri, 25 Feb 2011 00:00:58 +0100 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: <20110224224612.21E8B2A6C12C@llvm.org> References: <20110224224612.21E8B2A6C12C@llvm.org> Message-ID: On Thu, Feb 24, 2011 at 11:46 PM, Benjamin Kramer wrote: > SimplifyCFG: GEPs with constant indices are cheap enough to be executed unconditionally. > > + ?case Instruction::GetElementPtr: > + ? ?// GEPs are cheap if all indices are constant. > + ? ?if (!cast(I)->hasAllConstantIndices()) > + ? ? ?return false; > + ? ?break; > ? case Instruction::Add: > ? case Instruction::Sub: > ? case Instruction::And: Since it also allows add/sub/etc., it should maybe also allow GEPs with one non-constant index? From stuart at apple.com Thu Feb 24 16:57:52 2011 From: stuart at apple.com (Stuart Hastings) Date: Thu, 24 Feb 2011 22:57:52 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r126446 - /llvm-gcc-4.2/trunk/build_gcc Message-ID: <20110224225752.31F8B2A6C12C@llvm.org> Author: stuart Date: Thu Feb 24 16:57:52 2011 New Revision: 126446 URL: http://llvm.org/viewvc/llvm-project?rev=126446&view=rev Log: Omit lto.h from the LLVM-GCC result; henceforth, this will be supplied by clang. Radar 9042056. Modified: llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=126446&r1=126445&r2=126446&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Thu Feb 24 16:57:52 2011 @@ -777,6 +777,9 @@ fi fi +# Remove lto.h from the install directory; clang will supply. +find $DEST_DIR -name lto.h -print | xargs rm || exit 1 + # LLVM LOCAL end find $DEST_DIR -name \*.dSYM -print | xargs rm -r || exit 1 From nicholas at mxc.ca Thu Feb 24 17:15:43 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 24 Feb 2011 23:15:43 -0000 Subject: [llvm-commits] [llvm] r126450 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Message-ID: <20110224231543.952302A6C12C@llvm.org> Author: nicholas Date: Thu Feb 24 17:15:43 2011 New Revision: 126450 URL: http://llvm.org/viewvc/llvm-project?rev=126450&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=126450&r1=126449&r2=126450&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Thu Feb 24 17:15:43 2011 @@ -177,7 +177,7 @@ void AsmPrinter::EmitSectionOffset(const MCSymbol *Label, const MCSymbol *SectionLabel) const { // On COFF targets, we have to emit the special .secrel32 directive. - if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) { + if (MAI->getDwarfSectionOffsetDirective()) { OutStreamer.EmitCOFFSecRel32(Label); return; } From stoklund at 2pi.dk Thu Feb 24 17:21:36 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 24 Feb 2011 23:21:36 -0000 Subject: [llvm-commits] [llvm] r126451 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110224232136.4D7152A6C12C@llvm.org> Author: stoklund Date: Thu Feb 24 17:21:36 2011 New Revision: 126451 URL: http://llvm.org/viewvc/llvm-project?rev=126451&view=rev Log: Tweak the register allocator priority queue some more. New live ranges are assigned in long -> short order, but live ranges that have been evicted at least once are deferred and assigned in short -> long order. Also disable splitting and spilling for live ranges seen for the first time. The intention is to create a realistic interference pattern from the heavy live ranges before starting splitting and spilling around it. 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=126451&r1=126450&r2=126451&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 24 17:21:36 2011 @@ -194,22 +194,26 @@ void RAGreedy::enqueue(LiveInterval *LI) { // Prioritize live ranges by size, assigning larger ranges first. // The queue holds (size, reg) pairs. - unsigned Size = LI->getSize(); - unsigned Reg = LI->reg; + const unsigned Size = LI->getSize(); + const unsigned Reg = LI->reg; assert(TargetRegisterInfo::isVirtualRegister(Reg) && "Can only enqueue virtual registers"); + const unsigned Hint = VRM->getRegAllocPref(Reg); + unsigned Prio; - // Boost ranges that have a physical register hint. - unsigned Hint = VRM->getRegAllocPref(Reg); - if (TargetRegisterInfo::isPhysicalRegister(Hint)) - Size |= (1u << 30); - - // Boost ranges that we see for the first time. Generation.grow(Reg); if (++Generation[Reg] == 1) - Size |= (1u << 31); + // 1st generation ranges are handled first, long -> short. + Prio = (1u << 31) + Size; + else + // Repeat offenders are handled second, short -> long + Prio = (1u << 30) - Size; - Queue.push(std::make_pair(Size, Reg)); + // Boost ranges that have a physical register hint. + if (TargetRegisterInfo::isPhysicalRegister(Hint)) + Prio |= (1u << 30); + + Queue.push(std::make_pair(Prio, Reg)); } LiveInterval *RAGreedy::dequeue() { @@ -1311,6 +1315,14 @@ assert(NewVRegs.empty() && "Cannot append to existing NewVRegs"); + // The first time we see a live range, don't try to split or spill. + // Wait until the second time, when all smaller ranges have been allocated. + // This gives a better picture of the interference to split around. + if (Generation[VirtReg.reg] == 1) { + NewVRegs.push_back(&VirtReg); + return 0; + } + // Try splitting VirtReg or interferences. unsigned PhysReg = trySplit(VirtReg, Order, NewVRegs); if (PhysReg || !NewVRegs.empty()) From benny.kra at googlemail.com Thu Feb 24 17:26:09 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Thu, 24 Feb 2011 23:26:09 -0000 Subject: [llvm-commits] [llvm] r126452 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll Message-ID: <20110224232609.40A2E2A6C12C@llvm.org> Author: d0k Date: Thu Feb 24 17:26:09 2011 New Revision: 126452 URL: http://llvm.org/viewvc/llvm-project?rev=126452&view=rev Log: SimplifyCFG: GEPs with just one non-constant index are also cheap. Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=126452&r1=126451&r2=126452&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Feb 24 17:26:09 2011 @@ -247,11 +247,13 @@ if (PBB->getFirstNonPHIOrDbg() != I) return false; break; - case Instruction::GetElementPtr: - // GEPs are cheap if all indices are constant. - if (!cast(I)->hasAllConstantIndices()) + case Instruction::GetElementPtr: { + // GEPs are cheap if all indices are constant or if there's only one index. + GetElementPtrInst *GEP = cast(I); + if (!GEP->hasAllConstantIndices() && GEP->getNumIndices() > 1) return false; break; + } case Instruction::Add: case Instruction::Sub: case Instruction::And: Modified: llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll?rev=126452&r1=126451&r2=126452&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll Thu Feb 24 17:26:09 2011 @@ -1,13 +1,13 @@ ; RUN: opt -S -simplifycfg %s | FileCheck %s -define i8* @test1(i8* %x) nounwind { +define i8* @test1(i8* %x, i64 %y) nounwind { entry: %tmp1 = load i8* %x, align 1 %cmp = icmp eq i8 %tmp1, 47 br i1 %cmp, label %if.then, label %if.end if.then: - %incdec.ptr = getelementptr inbounds i8* %x, i64 1 + %incdec.ptr = getelementptr inbounds i8* %x, i64 %y br label %if.end if.end: @@ -18,3 +18,23 @@ ; CHECK: %x.addr = select i1 %cmp, i8* %incdec.ptr, i8* %x ; CHECK: ret i8* %x.addr } + +%ST = type { i8, i8 } + +define i8* @test2(%ST* %x, i8* %y) nounwind { +entry: + %cmp = icmp eq %ST* %x, null + br i1 %cmp, label %if.then, label %if.end + +if.then: + %incdec.ptr = getelementptr %ST* %x, i32 0, i32 1 + br label %if.end + +if.end: + %x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %y, %entry ] + ret i8* %x.addr + +; CHECK: @test2 +; CHECK: %x.addr = select i1 %cmp, i8* %incdec.ptr, i8* %y +; CHECK: ret i8* %x.addr +} From benny.kra at googlemail.com Thu Feb 24 17:31:01 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Fri, 25 Feb 2011 00:31:01 +0100 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: References: <20110224224612.21E8B2A6C12C@llvm.org> Message-ID: On 25.02.2011, at 00:00, Frits van Bommel wrote: > On Thu, Feb 24, 2011 at 11:46 PM, Benjamin Kramer > wrote: >> SimplifyCFG: GEPs with constant indices are cheap enough to be executed unconditionally. >> >> + case Instruction::GetElementPtr: >> + // GEPs are cheap if all indices are constant. >> + if (!cast(I)->hasAllConstantIndices()) >> + return false; >> + break; >> case Instruction::Add: >> case Instruction::Sub: >> case Instruction::And: > > Since it also allows add/sub/etc., it should maybe also allow GEPs > with one non-constant index? Yup, added in r126452. From gohman at apple.com Thu Feb 24 17:37:37 2011 From: gohman at apple.com (Dan Gohman) Date: Thu, 24 Feb 2011 15:37:37 -0800 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: References: <20110224224612.21E8B2A6C12C@llvm.org> Message-ID: <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> On Feb 24, 2011, at 3:00 PM, Frits van Bommel wrote: > On Thu, Feb 24, 2011 at 11:46 PM, Benjamin Kramer > wrote: >> SimplifyCFG: GEPs with constant indices are cheap enough to be executed unconditionally. >> >> + case Instruction::GetElementPtr: >> + // GEPs are cheap if all indices are constant. >> + if (!cast(I)->hasAllConstantIndices()) >> + return false; >> + break; >> case Instruction::Add: >> case Instruction::Sub: >> case Instruction::And: > > Since it also allows add/sub/etc., it should maybe also allow GEPs > with one non-constant index? A gep with one non-constant index is a multiply and an add. How speculative are you feeling? ;-) Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110224/07416dd4/attachment.html From evan.cheng at apple.com Thu Feb 24 18:24:46 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Feb 2011 00:24:46 -0000 Subject: [llvm-commits] [llvm] r126457 - /llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Message-ID: <20110225002446.E3A2A2A6C12C@llvm.org> Author: evancheng Date: Thu Feb 24 18:24:46 2011 New Revision: 126457 URL: http://llvm.org/viewvc/llvm-project?rev=126457&view=rev Log: Each prologue may have multiple vpush instructions to store callee-saved D registers since the vpush list may not have gaps. Make sure the stack adjustment instruction isn't moved between them. Ditto for vpop in epilogues. Sorry, can't reduce a small test case. rdar://9043312 Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=126457&r1=126456&r2=126457&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Thu Feb 24 18:24:46 2011 @@ -215,7 +215,13 @@ AFI->setDPRCalleeSavedAreaOffset(DPRCSOffset); // Move past area 3. - if (DPRCSSize > 0) MBBI++; + if (DPRCSSize > 0) { + MBBI++; + // Since vpush register list cannot have gaps, there may be multiple vpush + // instructions in the epilogue. + while (MBBI->getOpcode() == ARM::VSTMDDB_UPD) + MBBI++; + } NumBytes = DPRCSOffset; if (NumBytes) { @@ -370,7 +376,13 @@ emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); // Increment past our save areas. - if (AFI->getDPRCalleeSavedAreaSize()) MBBI++; + if (AFI->getDPRCalleeSavedAreaSize()) { + MBBI++; + // Since vpop register list cannot have gaps, there may be multiple vpop + // instructions in the epilogue. + while (MBBI->getOpcode() == ARM::VLDMDIA_UPD) + MBBI++; + } if (AFI->getGPRCalleeSavedArea2Size()) MBBI++; if (AFI->getGPRCalleeSavedArea1Size()) MBBI++; } From stoklund at 2pi.dk Thu Feb 24 19:04:23 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 25 Feb 2011 01:04:23 -0000 Subject: [llvm-commits] [llvm] r126463 - in /llvm/trunk/lib/CodeGen: AllocationOrder.h RegAllocGreedy.cpp Message-ID: <20110225010423.2342B2A6C12C@llvm.org> Author: stoklund Date: Thu Feb 24 19:04:22 2011 New Revision: 126463 URL: http://llvm.org/viewvc/llvm-project?rev=126463&view=rev Log: Try harder to get the hint by preferring to evict hint interference. Modified: llvm/trunk/lib/CodeGen/AllocationOrder.h llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/AllocationOrder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AllocationOrder.h?rev=126463&r1=126462&r2=126463&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AllocationOrder.h (original) +++ llvm/trunk/lib/CodeGen/AllocationOrder.h Thu Feb 24 19:04:22 2011 @@ -47,6 +47,8 @@ /// rewind - Start over from the beginning. void rewind() { Pos = 0; } + /// isHint - Return true if PhysReg is a preferred register. + bool isHint(unsigned PhysReg) const { return PhysReg == Hint; } }; } // end namespace llvm Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=126463&r1=126462&r2=126463&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 24 19:04:22 2011 @@ -379,6 +379,9 @@ // Best so far. BestPhys = PhysReg; BestWeight = Weight; + // Stop if the hint can be used. + if (Order.isHint(PhysReg)) + break; } if (!BestPhys) From zwarich at apple.com Thu Feb 24 19:10:55 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Fri, 25 Feb 2011 01:10:55 -0000 Subject: [llvm-commits] [llvm] r126464 - /llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Message-ID: <20110225011055.8891D2A6C12D@llvm.org> Author: zwarich Date: Thu Feb 24 19:10:55 2011 New Revision: 126464 URL: http://llvm.org/viewvc/llvm-project?rev=126464&view=rev Log: We only want to zero extend the existing information if the bit width is actually larger. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=126464&r1=126463&r2=126464&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Thu Feb 24 19:10:55 2011 @@ -269,7 +269,7 @@ if (!LOI->IsValid) return NULL; - if (BitWidth >= LOI->KnownZero.getBitWidth()) { + if (BitWidth > LOI->KnownZero.getBitWidth()) { LOI->KnownZero = LOI->KnownZero.zextOrTrunc(BitWidth); LOI->KnownOne = LOI->KnownOne.zextOrTrunc(BitWidth); } From zwarich at apple.com Thu Feb 24 19:11:01 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Fri, 25 Feb 2011 01:11:01 -0000 Subject: [llvm-commits] [llvm] r126465 - /llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Message-ID: <20110225011101.BAD472A6C12E@llvm.org> Author: zwarich Date: Thu Feb 24 19:11:01 2011 New Revision: 126465 URL: http://llvm.org/viewvc/llvm-project?rev=126465&view=rev Log: Set NumSignBits to 1 if KnownZero/KnownOne are being zero extended. In theory it is possible to do better if the high bit is set in either KnownZero/KnownOne, but in practice NumSignBits is always 1 when we are zero extending because nothing is known about that register. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=126465&r1=126464&r2=126465&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Thu Feb 24 19:11:01 2011 @@ -270,6 +270,7 @@ return NULL; if (BitWidth > LOI->KnownZero.getBitWidth()) { + LOI->NumSignBits = 1; LOI->KnownZero = LOI->KnownZero.zextOrTrunc(BitWidth); LOI->KnownOne = LOI->KnownOne.zextOrTrunc(BitWidth); } From clattner at apple.com Thu Feb 24 19:24:20 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 24 Feb 2011 17:24:20 -0800 Subject: [llvm-commits] [llvm] r126452 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: <20110224232609.40A2E2A6C12C@llvm.org> References: <20110224232609.40A2E2A6C12C@llvm.org> Message-ID: On Feb 24, 2011, at 3:26 PM, Benjamin Kramer wrote: > +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Feb 24 17:26:09 2011 > @@ -247,11 +247,13 @@ > if (PBB->getFirstNonPHIOrDbg() != I) > return false; > break; > - case Instruction::GetElementPtr: > - // GEPs are cheap if all indices are constant. > - if (!cast(I)->hasAllConstantIndices()) > + case Instruction::GetElementPtr: { > + // GEPs are cheap if all indices are constant or if there's only one index. > + GetElementPtrInst *GEP = cast(I); > + if (!GEP->hasAllConstantIndices() && GEP->getNumIndices() > 1) > return false; > break; > + } FYI getNumIndices() will return 2 for "gep x, 0, i". I tend to agree with Dan that we should only allow a variable index if the scale is 1. -Chris From evan.cheng at apple.com Thu Feb 24 19:29:29 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Feb 2011 01:29:29 -0000 Subject: [llvm-commits] [llvm] r126467 - /llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Message-ID: <20110225012929.5AC872A6C12C@llvm.org> Author: evancheng Date: Thu Feb 24 19:29:29 2011 New Revision: 126467 URL: http://llvm.org/viewvc/llvm-project?rev=126467&view=rev Log: Fix typo. Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=126467&r1=126466&r2=126467&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Thu Feb 24 19:29:29 2011 @@ -218,7 +218,7 @@ if (DPRCSSize > 0) { MBBI++; // Since vpush register list cannot have gaps, there may be multiple vpush - // instructions in the epilogue. + // instructions in the prologue. while (MBBI->getOpcode() == ARM::VSTMDDB_UPD) MBBI++; } From gkistanova at gmail.com Thu Feb 24 19:34:23 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Thu, 24 Feb 2011 17:34:23 -0800 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash In-Reply-To: References: <4D66165D.909@free.fr> Message-ID: > This commit looks like it can be reverted independently. > Galina, does reverting it fix the problem? Yes, after reverting tot builds OK. Thanks Galina On Thu, Feb 24, 2011 at 12:46 AM, Anton Korobeynikov wrote: >> so commit 124059 is the cause of the crash? >> >> ------------------------------------------------------------------------ >> r124059 | rafael | 2011-01-23 06:43:40 +0100 (Sun, 23 Jan 2011) | 2 lines >> >> Delay the creation of eh_frame so that the user can change the defaults. >> Add support for SHT_X86_64_UNWIND. >> ------------------------------------------------------------------------ > This commit looks like it can be reverted independently. > Galina, does reverting it fix the problem? > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University > From rafael.espindola at gmail.com Thu Feb 24 21:24:49 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Thu, 24 Feb 2011 22:24:49 -0500 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash In-Reply-To: References: <4D66165D.909@free.fr> Message-ID: <4D672101.7030207@gmail.com> On 2011-02-24 20:34, Galina Kistanova wrote: >> This commit looks like it can be reverted independently. >> Galina, does reverting it fix the problem? > > Yes, after reverting tot builds OK. Can you build without reverting by syncing past 126421? > Thanks > > Galina Cheers, Rafael From rafael.espindola at gmail.com Thu Feb 24 21:35:23 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Thu, 24 Feb 2011 22:35:23 -0500 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> References: <4D65DCFB.90205@gmail.com> <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> Message-ID: <4D67237B.6060306@gmail.com> > Very nice Rafael! Do you have a breakdown of how much of that 6:30 > is spent reading bitcode files, doing IR linking, doing optimization, > doing codegen, and doing native linking? I'm just curious where the > time is going. I would not have expected 30s for the asmprinter + > native assembler :) I did some basic experiments, but they have to be updated. I remember the assembler taking about 12s and llvm-mc being a bit faster going from .s to .o. I was also surprised when the final time reduction was 30s. Doing llvm-link of all the IL files is about 3m if I remember correctly. There is also some overhead just in managing so much memory. The largest speedup I go so far was just by merging modules as we read them. Another thing on these lines is trying to reuse gold mmaps. Right now we map the files again or malloc+read them (in the case of archive members). I will try to upload a "small" test with all the .o files, both elf and IL so that it is easy to redo just link. > -Chris Cheers, Rafael From grosbach at apple.com Thu Feb 24 21:59:03 2011 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 25 Feb 2011 03:59:03 -0000 Subject: [llvm-commits] [llvm] r126471 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <20110225035903.45BF62A6C12C@llvm.org> Author: grosbach Date: Thu Feb 24 21:59:03 2011 New Revision: 126471 URL: http://llvm.org/viewvc/llvm-project?rev=126471&view=rev Log: Fix formatting of debug helper string. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=126471&r1=126470&r2=126471&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 24 21:59:03 2011 @@ -1916,7 +1916,7 @@ DEBUG(dbgs() << "Lowering jump table\n" << "First entry: " << First << ". Last entry: " << Last << '\n' << "Range: " << Range - << "Size: " << TSize << ". Density: " << Density << "\n\n"); + << ". Size: " << TSize << ". Density: " << Density << "\n\n"); // Get the MachineFunction which holds the current MBB. This is used when // inserting any additional MBBs necessary to represent the switch. From jaykang10 at imrc.kist.re.kr Thu Feb 24 22:24:33 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Fri, 25 Feb 2011 13:24:33 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D64CC05.2050802@free.fr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr> Hi Duncan I send patches about NoFolder. NoFolder's functions return pointer of Constant because llvm-gcc's codes which call TheFolder's functions wait for pointer of Constant. and some of get() functions in ConstantExpr have a additional argument "DoFold" which decide to enable or disable fold. This implementation may be inefficient because there are additional arguments and 'if' statements. Please comment about this. In this patch, bitcast is folded unconditionally due to a little of problems. For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low and high values to ConstantInt which is folded to integer constant.and The part of codes does not accept unfolded bitcast ConstantExpr. (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make ConstantInt, bitcast is generated on types with other bitwidths) I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using this patch and tested test-suite. There are not compilation and execution errors on x86-32bit. Patch files are as following: 1. llvm patch 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" Please review these patches. Thanks, Jin-Gu Kang ________________________________________ From: Duncan Sands [baldrick at free.fr] Sent: Wednesday, February 23, 2011 5:57 PM To: Jin Gu Kang Cc: Chris Lattner; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Hi Jin Gu Kang, > while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, > StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different > from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). > Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. > > so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. it is true that disabling all constant folding may be helpful for beginners who want to read the bitcode and understand how it relates to the original C. This is not so easy to achieve however because a minimal amount of constant folding always occurs. For example you can change llvm-gcc from using TargetFolder to ConstantFolder. This will result in less constant folding because it will no longer use information about the target when constant folding. However the fold you mentioned (bitcast turned into deeper GEP) will occur anyway because doing it does not require knowing the target. There is also a NoFolder class which does no folding whatsoever, by creating instructions rather than constants, but I hear that it doesn't work anymore (it used to, but perhaps bitrotted because no one uses it). If you want to disable all constant folding in llvm-gcc then I suggest you change all instances of TargetFolder to NoFolder in llvm-internal.h and llvm-backend.cpp. This line TheFolder = new TargetFolder(TheTarget->getTargetData()); probably needs to become something like this: TheFolder = new NoFolder(getGlobalContext()); However as I mentioned it probably will require some work on IRBuilder and NoFolder to get it working properly. If you succeed please send in a patch. Ciao, Duncan. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm-NoFolder.patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/275eeff5/attachment-0002.pl -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm-gcc-NoFolder-test.patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/275eeff5/attachment-0003.pl From aggarwa4 at illinois.edu Thu Feb 24 22:31:19 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Fri, 25 Feb 2011 04:31:19 -0000 Subject: [llvm-commits] [poolalloc] r126473 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <20110225043119.A0B652A6C12C@llvm.org> Author: aggarwa4 Date: Thu Feb 24 22:31:19 2011 New Revision: 126473 URL: http://llvm.org/viewvc/llvm-project?rev=126473&view=rev Log: Added rewind. Added comment. Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=126473&r1=126472&r2=126473&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Thu Feb 24 22:31:19 2011 @@ -6,7 +6,8 @@ //===----------------------------------------------------------------------===// // // Recognize common standard c library functions and generate graphs for them -// +// FIXME: Move table to separate analysis pass, so that even the Local Pass +// may query it. //===----------------------------------------------------------------------===// #include "llvm/ADT/Statistic.h" @@ -209,15 +210,16 @@ {"perror", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"feof", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fflush", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fpurge", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fclose", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fopen", {NRET_YARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, - {"ftell", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fseek", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, true}}, - {"ferror", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fwrite", {NRET_YARGS, NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, + {"feof", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fflush", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fpurge", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fclose", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fopen", {NRET_YARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, + {"ftell", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fseek", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, true}}, + {"rewind", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, true}}, + {"ferror", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fwrite", {NRET_YARGS, NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, {"fread", {NRET_NYARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, {"fdopen", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, From aggarwa4 at illinois.edu Thu Feb 24 22:43:48 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Fri, 25 Feb 2011 04:43:48 -0000 Subject: [llvm-commits] [poolalloc] r126474 - /poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Message-ID: <20110225044348.B61EC2A6C12C@llvm.org> Author: aggarwa4 Date: Thu Feb 24 22:43:48 2011 New Revision: 126474 URL: http://llvm.org/viewvc/llvm-project?rev=126474&view=rev Log: I was wrong. Constant Expression GEPs return pointer to the type calculated, hence skip an offset when merging. Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=126474&r1=126473&r2=126474&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (original) +++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Thu Feb 24 22:43:48 2011 @@ -94,7 +94,7 @@ ConstantExpr *CE = cast(C); SmallVector Indices; Indices.append(CE->op_begin()+1, CE->op_end()); - Indices.append(GEP1->idx_begin(), GEP1->idx_end()); + Indices.append(GEP1->idx_begin()+1, GEP1->idx_end()); GetElementPtrInst *GEPNew = GetElementPtrInst::Create(CE->getOperand(0), Indices.begin(), Indices.end(), From nicholas at mxc.ca Fri Feb 25 00:02:32 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 24 Feb 2011 22:02:32 -0800 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr> Message-ID: <4D6745F8.10305@mxc.ca> Jin Gu Kang wrote: > Hi Duncan > > I send patches about NoFolder. The idea behind llvm::NoFolder is that you create instructions instead of constants; that's what prevents the folding. When IRBuilder.CreateAdd(i32 1, i32 1) is called it should create an add instruction (instead of a constant) with i32 1 and i32 1 as arguments, and no folding will occur. Adding a DoFold argument to every Constant constructor is not an acceptable solution to commit to LLVM. Nick > NoFolder's functions return pointer of Constant because llvm-gcc's codes which > call TheFolder's functions wait for pointer of Constant. and some of get() functions > in ConstantExpr have a additional argument "DoFold" which decide to enable or > disable fold. This implementation may be inefficient because there are additional > arguments and 'if' statements. Please comment about this. > > In this patch, bitcast is folded unconditionally due to a little of problems. > For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low > and high values to ConstantInt which is folded to integer constant.and > The part of codes does not accept unfolded bitcast ConstantExpr. > (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make > ConstantInt, bitcast is generated on types with other bitwidths) > > I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using this patch > and tested test-suite. There are not compilation and execution errors on x86-32bit. > > Patch files are as following: > 1. llvm patch > 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" > > Please review these patches. > > Thanks, > Jin-Gu Kang > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Wednesday, February 23, 2011 5:57 PM > To: Jin Gu Kang > Cc: Chris Lattner; llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, >> StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different >> from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). >> Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. >> >> so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. > > it is true that disabling all constant folding may be helpful for beginners who > want to read the bitcode and understand how it relates to the original C. This > is not so easy to achieve however because a minimal amount of constant folding > always occurs. For example you can change llvm-gcc from using TargetFolder to > ConstantFolder. This will result in less constant folding because it will no > longer use information about the target when constant folding. However the fold > you mentioned (bitcast turned into deeper GEP) will occur anyway because doing > it does not require knowing the target. There is also a NoFolder class which > does no folding whatsoever, by creating instructions rather than constants, but > I hear that it doesn't work anymore (it used to, but perhaps bitrotted because > no one uses it). If you want to disable all constant folding in llvm-gcc then > I suggest you change all instances of TargetFolder to NoFolder in > llvm-internal.h and llvm-backend.cpp. This line > TheFolder = new TargetFolder(TheTarget->getTargetData()); > probably needs to become something like this: > TheFolder = new NoFolder(getGlobalContext()); > However as I mentioned it probably will require some work on IRBuilder and > NoFolder to get it working properly. If you succeed please send in a patch. > > Ciao, Duncan. > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jaykang10 at imrc.kist.re.kr Fri Feb 25 00:17:22 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Fri, 25 Feb 2011 15:17:22 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D6745F8.10305@mxc.ca> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr>, <4D6745F8.10305@mxc.ca> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D88000@base.imrc.kist.re.kr> Hi Nick It was difficult for me to decide implementation style. Is it acceptable to make new named Constant constructors which make unfoled Constants? For example, like getNoFoldAdd(). Thanks, Jin-Gu Kang ________________________________________ From: Nick Lewycky [nicholas at mxc.ca] Sent: Friday, February 25, 2011 3:02 PM To: Jin Gu Kang Cc: Duncan Sands; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Jin Gu Kang wrote: > Hi Duncan > > I send patches about NoFolder. The idea behind llvm::NoFolder is that you create instructions instead of constants; that's what prevents the folding. When IRBuilder.CreateAdd(i32 1, i32 1) is called it should create an add instruction (instead of a constant) with i32 1 and i32 1 as arguments, and no folding will occur. Adding a DoFold argument to every Constant constructor is not an acceptable solution to commit to LLVM. Nick > NoFolder's functions return pointer of Constant because llvm-gcc's codes which > call TheFolder's functions wait for pointer of Constant. and some of get() functions > in ConstantExpr have a additional argument "DoFold" which decide to enable or > disable fold. This implementation may be inefficient because there are additional > arguments and 'if' statements. Please comment about this. > > In this patch, bitcast is folded unconditionally due to a little of problems. > For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low > and high values to ConstantInt which is folded to integer constant.and > The part of codes does not accept unfolded bitcast ConstantExpr. > (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make > ConstantInt, bitcast is generated on types with other bitwidths) > > I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using this patch > and tested test-suite. There are not compilation and execution errors on x86-32bit. > > Patch files are as following: > 1. llvm patch > 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" > > Please review these patches. > > Thanks, > Jin-Gu Kang > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Wednesday, February 23, 2011 5:57 PM > To: Jin Gu Kang > Cc: Chris Lattner; llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, >> StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different >> from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). >> Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. >> >> so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. > > it is true that disabling all constant folding may be helpful for beginners who > want to read the bitcode and understand how it relates to the original C. This > is not so easy to achieve however because a minimal amount of constant folding > always occurs. For example you can change llvm-gcc from using TargetFolder to > ConstantFolder. This will result in less constant folding because it will no > longer use information about the target when constant folding. However the fold > you mentioned (bitcast turned into deeper GEP) will occur anyway because doing > it does not require knowing the target. There is also a NoFolder class which > does no folding whatsoever, by creating instructions rather than constants, but > I hear that it doesn't work anymore (it used to, but perhaps bitrotted because > no one uses it). If you want to disable all constant folding in llvm-gcc then > I suggest you change all instances of TargetFolder to NoFolder in > llvm-internal.h and llvm-backend.cpp. This line > TheFolder = new TargetFolder(TheTarget->getTargetData()); > probably needs to become something like this: > TheFolder = new NoFolder(getGlobalContext()); > However as I mentioned it probably will require some work on IRBuilder and > NoFolder to get it working properly. If you succeed please send in a patch. > > Ciao, Duncan. > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jaykang10 at imrc.kist.re.kr Fri Feb 25 00:27:56 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Fri, 25 Feb 2011 15:27:56 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D6745F8.10305@mxc.ca> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D63756B.8090201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FEF@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr>, <4D6745F8.10305@mxc.ca> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D88001@base.imrc.kist.re.kr> I am sorry Nick. I misunderstood your e-mail that NoFolder's functions have to return instructions. When NoFolder's functions return instructoins, existing codes which waits Constant make errors. so I made NoFolder which returns Constant. ______________________________________ From: Nick Lewycky [nicholas at mxc.ca] Sent: Friday, February 25, 2011 3:02 PM To: Jin Gu Kang Cc: Duncan Sands; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Jin Gu Kang wrote: > Hi Duncan > > I send patches about NoFolder. The idea behind llvm::NoFolder is that you create instructions instead of constants; that's what prevents the folding. When IRBuilder.CreateAdd(i32 1, i32 1) is called it should create an add instruction (instead of a constant) with i32 1 and i32 1 as arguments, and no folding will occur. Adding a DoFold argument to every Constant constructor is not an acceptable solution to commit to LLVM. Nick > NoFolder's functions return pointer of Constant because llvm-gcc's codes which > call TheFolder's functions wait for pointer of Constant. and some of get() functions > in ConstantExpr have a additional argument "DoFold" which decide to enable or > disable fold. This implementation may be inefficient because there are additional > arguments and 'if' statements. Please comment about this. > > In this patch, bitcast is folded unconditionally due to a little of problems. > For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low > and high values to ConstantInt which is folded to integer constant.and > The part of codes does not accept unfolded bitcast ConstantExpr. > (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make > ConstantInt, bitcast is generated on types with other bitwidths) > > I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using this patch > and tested test-suite. There are not compilation and execution errors on x86-32bit. > > Patch files are as following: > 1. llvm patch > 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" > > Please review these patches. > > Thanks, > Jin-Gu Kang > ________________________________________ > From: Duncan Sands [baldrick at free.fr] > Sent: Wednesday, February 23, 2011 5:57 PM > To: Jin Gu Kang > Cc: Chris Lattner; llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Hi Jin Gu Kang, > >> while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, >> StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different >> from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). >> Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. >> >> so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. > > it is true that disabling all constant folding may be helpful for beginners who > want to read the bitcode and understand how it relates to the original C. This > is not so easy to achieve however because a minimal amount of constant folding > always occurs. For example you can change llvm-gcc from using TargetFolder to > ConstantFolder. This will result in less constant folding because it will no > longer use information about the target when constant folding. However the fold > you mentioned (bitcast turned into deeper GEP) will occur anyway because doing > it does not require knowing the target. There is also a NoFolder class which > does no folding whatsoever, by creating instructions rather than constants, but > I hear that it doesn't work anymore (it used to, but perhaps bitrotted because > no one uses it). If you want to disable all constant folding in llvm-gcc then > I suggest you change all instances of TargetFolder to NoFolder in > llvm-internal.h and llvm-backend.cpp. This line > TheFolder = new TargetFolder(TheTarget->getTargetData()); > probably needs to become something like this: > TheFolder = new NoFolder(getGlobalContext()); > However as I mentioned it probably will require some work on IRBuilder and > NoFolder to get it working properly. If you succeed please send in a patch. > > Ciao, Duncan. > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicholas at mxc.ca Fri Feb 25 00:31:23 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 24 Feb 2011 22:31:23 -0800 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D88000@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr>, <4D6745F8.10305@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88000@base.imrc.kist.re.kr> Message-ID: <4D674CBB.4050302@mxc.ca> Jin Gu Kang wrote: > Hi Nick > > It was difficult for me to decide implementation style. > > Is it acceptable to make new named Constant constructors > which make unfoled Constants? > For example, like getNoFoldAdd(). Why do you ever want unfolded constants? It isn't an accident that they're impossible to create in LLVM. You would need an *excellent* reason to add them to LLVM regardless of how they're implemented. (Put another way, do you realize what else needs to change if we add these? The optimizers will *never* fold them because they assume that such constants are impossible. Simple things like "1+1 == 2" will fail. You could argue that the rest of LLVM doesn't need to create them, but if the rest of LLVM doesn't support them, why should they exist at all?) If you're learning LLVM and are having trouble seeing generated IR because it gets constant folded away, then you should use the IRBuilder with NoFolder. Nick > Thanks, > Jin-Gu Kang > ________________________________________ > From: Nick Lewycky [nicholas at mxc.ca] > Sent: Friday, February 25, 2011 3:02 PM > To: Jin Gu Kang > Cc: Duncan Sands; llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Jin Gu Kang wrote: >> Hi Duncan >> >> I send patches about NoFolder. > > The idea behind llvm::NoFolder is that you create instructions instead > of constants; that's what prevents the folding. When IRBuilder NoFolder>.CreateAdd(i32 1, i32 1) is called it should create an add > instruction (instead of a constant) with i32 1 and i32 1 as arguments, > and no folding will occur. > > Adding a DoFold argument to every Constant constructor is not an > acceptable solution to commit to LLVM. > > Nick > >> NoFolder's functions return pointer of Constant because llvm-gcc's codes which >> call TheFolder's functions wait for pointer of Constant. and some of get() functions >> in ConstantExpr have a additional argument "DoFold" which decide to enable or >> disable fold. This implementation may be inefficient because there are additional >> arguments and 'if' statements. Please comment about this. >> >> In this patch, bitcast is folded unconditionally due to a little of problems. >> For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low >> and high values to ConstantInt which is folded to integer constant.and >> The part of codes does not accept unfolded bitcast ConstantExpr. >> (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make >> ConstantInt, bitcast is generated on types with other bitwidths) >> >> I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using this patch >> and tested test-suite. There are not compilation and execution errors on x86-32bit. >> >> Patch files are as following: >> 1. llvm patch >> 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" >> >> Please review these patches. >> >> Thanks, >> Jin-Gu Kang >> ________________________________________ >> From: Duncan Sands [baldrick at free.fr] >> Sent: Wednesday, February 23, 2011 5:57 PM >> To: Jin Gu Kang >> Cc: Chris Lattner; llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >> Hi Jin Gu Kang, >> >>> while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, >>> StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different >>> from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). >>> Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. >>> >>> so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. >> >> it is true that disabling all constant folding may be helpful for beginners who >> want to read the bitcode and understand how it relates to the original C. This >> is not so easy to achieve however because a minimal amount of constant folding >> always occurs. For example you can change llvm-gcc from using TargetFolder to >> ConstantFolder. This will result in less constant folding because it will no >> longer use information about the target when constant folding. However the fold >> you mentioned (bitcast turned into deeper GEP) will occur anyway because doing >> it does not require knowing the target. There is also a NoFolder class which >> does no folding whatsoever, by creating instructions rather than constants, but >> I hear that it doesn't work anymore (it used to, but perhaps bitrotted because >> no one uses it). If you want to disable all constant folding in llvm-gcc then >> I suggest you change all instances of TargetFolder to NoFolder in >> llvm-internal.h and llvm-backend.cpp. This line >> TheFolder = new TargetFolder(TheTarget->getTargetData()); >> probably needs to become something like this: >> TheFolder = new NoFolder(getGlobalContext()); >> However as I mentioned it probably will require some work on IRBuilder and >> NoFolder to get it working properly. If you succeed please send in a patch. >> >> Ciao, Duncan. >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From bob.wilson at apple.com Fri Feb 25 00:42:42 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Feb 2011 06:42:42 -0000 Subject: [llvm-commits] [llvm] r126477 - in /llvm/trunk: lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMInstrNEON.td test/CodeGen/ARM/vstlane.ll Message-ID: <20110225064242.EEC4D2A6C12C@llvm.org> Author: bwilson Date: Fri Feb 25 00:42:42 2011 New Revision: 126477 URL: http://llvm.org/viewvc/llvm-project?rev=126477&view=rev Log: Add patterns to use post-increment addressing for Neon VST1-lane instructions. Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrNEON.td llvm/trunk/test/CodeGen/ARM/vstlane.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=126477&r1=126476&r2=126477&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Fri Feb 25 00:42:42 2011 @@ -126,6 +126,7 @@ bool SelectAddrMode5(SDValue N, SDValue &Base, SDValue &Offset); bool SelectAddrMode6(SDNode *Parent, SDValue N, SDValue &Addr,SDValue &Align); + bool SelectAddrMode6Offset(SDNode *Op, SDValue N, SDValue &Offset); bool SelectAddrModePC(SDValue N, SDValue &Offset, SDValue &Label); @@ -886,6 +887,20 @@ return true; } +bool ARMDAGToDAGISel::SelectAddrMode6Offset(SDNode *Op, SDValue N, + SDValue &Offset) { + LSBaseSDNode *LdSt = cast(Op); + ISD::MemIndexedMode AM = LdSt->getAddressingMode(); + if (AM != ISD::POST_INC) + return false; + Offset = N; + if (ConstantSDNode *NC = dyn_cast(N)) { + if (NC->getZExtValue() * 8 == LdSt->getMemoryVT().getSizeInBits()) + Offset = CurDAG->getRegister(0, MVT::i32); + } + return true; +} + bool ARMDAGToDAGISel::SelectAddrModePC(SDValue N, SDValue &Offset, SDValue &Label) { if (N.getOpcode() == ARMISD::PIC_ADD && N.hasOneUse()) { Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=126477&r1=126476&r2=126477&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Fri Feb 25 00:42:42 2011 @@ -561,7 +561,9 @@ let EncoderMethod = "getAddrMode6AddressOpValue"; } -def am6offset : Operand { +def am6offset : Operand, + ComplexPattern { let PrintMethod = "printAddrMode6OffsetOperand"; let MIOperandInfo = (ops GPR); let EncoderMethod = "getAddrMode6OffsetOpValue"; Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=126477&r1=126476&r2=126477&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Fri Feb 25 00:42:42 2011 @@ -1402,31 +1402,42 @@ def : Pat<(store (extractelt (v4f32 QPR:$src), imm:$lane), addrmode6:$addr), (VST1LNq32Pseudo addrmode6:$addr, QPR:$src, imm:$lane)>; -let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in { - // ...with address register writeback: -class VST1LNWB op11_8, bits<4> op7_4, string Dt> +class VST1LNWB op11_8, bits<4> op7_4, string Dt, ValueType Ty, + PatFrag StoreOp, SDNode ExtractOp> : NLdStLn<1, 0b00, op11_8, op7_4, (outs GPR:$wb), (ins addrmode6:$Rn, am6offset:$Rm, DPR:$Vd, nohash_imm:$lane), IIC_VST1lnu, "vst1", Dt, "\\{$Vd[$lane]\\}, $Rn$Rm", - "$Rn.addr = $wb", []>; + "$Rn.addr = $wb", + [(set GPR:$wb, (StoreOp (ExtractOp (Ty DPR:$Vd), imm:$lane), + addrmode6:$Rn, am6offset:$Rm))]>; +class VST1QLNWBPseudo + : VSTQLNWBPseudo { + let Pattern = [(set GPR:$wb, (StoreOp (ExtractOp (Ty QPR:$src), imm:$lane), + addrmode6:$addr, am6offset:$offset))]; +} -def VST1LNd8_UPD : VST1LNWB<0b0000, {?,?,?,0}, "8"> { +def VST1LNd8_UPD : VST1LNWB<0b0000, {?,?,?,0}, "8", v8i8, post_truncsti8, + NEONvgetlaneu> { let Inst{7-5} = lane{2-0}; } -def VST1LNd16_UPD : VST1LNWB<0b0100, {?,?,0,?}, "16"> { +def VST1LNd16_UPD : VST1LNWB<0b0100, {?,?,0,?}, "16", v4i16, post_truncsti16, + NEONvgetlaneu> { let Inst{7-6} = lane{1-0}; let Inst{4} = Rn{5}; } -def VST1LNd32_UPD : VST1LNWB<0b1000, {?,0,?,?}, "32"> { +def VST1LNd32_UPD : VST1LNWB<0b1000, {?,0,?,?}, "32", v2i32, post_store, + extractelt> { let Inst{7} = lane{0}; let Inst{5-4} = Rn{5-4}; } -def VST1LNq8Pseudo_UPD : VSTQLNWBPseudo; -def VST1LNq16Pseudo_UPD : VSTQLNWBPseudo; -def VST1LNq32Pseudo_UPD : VSTQLNWBPseudo; +def VST1LNq8Pseudo_UPD : VST1QLNWBPseudo; +def VST1LNq16Pseudo_UPD : VST1QLNWBPseudo; +def VST1LNq32Pseudo_UPD : VST1QLNWBPseudo; + +let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in { // VST2LN : Vector Store (single 2-element structure from one lane) class VST2LN op11_8, bits<4> op7_4, string Dt> Modified: llvm/trunk/test/CodeGen/ARM/vstlane.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vstlane.ll?rev=126477&r1=126476&r2=126477&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vstlane.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vstlane.ll Fri Feb 25 00:42:42 2011 @@ -10,6 +10,19 @@ ret void } +;Check for a post-increment updating store. +define void @vst1lanei8_update(i8** %ptr, <8 x i8>* %B) nounwind { +;CHECK: vst1lanei8_update: +;CHECK: vst1.8 {d16[3]}, [r2]! + %A = load i8** %ptr + %tmp1 = load <8 x i8>* %B + %tmp2 = extractelement <8 x i8> %tmp1, i32 3 + store i8 %tmp2, i8* %A, align 8 + %tmp3 = getelementptr i8* %A, i32 1 + store i8* %tmp3, i8** %ptr + ret void +} + define void @vst1lanei16(i16* %A, <4 x i16>* %B) nounwind { ;CHECK: vst1lanei16: ;Check the alignment value. Max for this instruction is 16 bits: @@ -66,6 +79,19 @@ ret void } +;Check for a post-increment updating store. +define void @vst1laneQi32_update(i32** %ptr, <4 x i32>* %B) nounwind { +;CHECK: vst1laneQi32_update: +;CHECK: vst1.32 {d17[1]}, [r1, :32]! + %A = load i32** %ptr + %tmp1 = load <4 x i32>* %B + %tmp2 = extractelement <4 x i32> %tmp1, i32 3 + store i32 %tmp2, i32* %A, align 8 + %tmp3 = getelementptr i32* %A, i32 1 + store i32* %tmp3, i32** %ptr + ret void +} + define void @vst1laneQf(float* %A, <4 x float>* %B) nounwind { ;CHECK: vst1laneQf: ;CHECK: vst1.32 {d17[1]}, [r0] From jaykang10 at imrc.kist.re.kr Fri Feb 25 00:47:59 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Fri, 25 Feb 2011 15:47:59 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D674CBB.4050302@mxc.ca> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D637A95.10109@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF2@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr>, <4D6745F8.10305@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88000@base.imrc.kist.re.kr>, <4D674CBB.4050302@mxc.ca> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D88002@base.imrc.kist.re.kr> I am sorry Nick. This patch is related to previous e-mails with Duncan. On previous e-mail with Duncan, Duncan said: > ... > If you want to disable all constant folding in llvm-gcc then > I suggest you change all instances of TargetFolder to NoFolder in > llvm-internal.h and llvm-backend.cpp. This line > TheFolder = new TargetFolder(TheTarget->getTargetData()); > probably needs to become something like this: > TheFolder = new NoFolder(getGlobalContext()); > However as I mentioned it probably will require some work on IRBuilder and > NoFolder to get it working properly. If you succeed please send in a patch. As you can see on above statements, I made this patch because of disabling all constant folding in llvm-gcc. Thanks, Jin-Gu Kang ________________________________________ From: Nick Lewycky [nicholas at mxc.ca] Sent: Friday, February 25, 2011 3:31 PM To: Jin Gu Kang Cc: Duncan Sands; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr Jin Gu Kang wrote: > Hi Nick > > It was difficult for me to decide implementation style. > > Is it acceptable to make new named Constant constructors > which make unfoled Constants? > For example, like getNoFoldAdd(). Why do you ever want unfolded constants? It isn't an accident that they're impossible to create in LLVM. You would need an *excellent* reason to add them to LLVM regardless of how they're implemented. (Put another way, do you realize what else needs to change if we add these? The optimizers will *never* fold them because they assume that such constants are impossible. Simple things like "1+1 == 2" will fail. You could argue that the rest of LLVM doesn't need to create them, but if the rest of LLVM doesn't support them, why should they exist at all?) If you're learning LLVM and are having trouble seeing generated IR because it gets constant folded away, then you should use the IRBuilder with NoFolder. Nick > Thanks, > Jin-Gu Kang > ________________________________________ > From: Nick Lewycky [nicholas at mxc.ca] > Sent: Friday, February 25, 2011 3:02 PM > To: Jin Gu Kang > Cc: Duncan Sands; llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Jin Gu Kang wrote: >> Hi Duncan >> >> I send patches about NoFolder. > > The idea behind llvm::NoFolder is that you create instructions instead > of constants; that's what prevents the folding. When IRBuilder NoFolder>.CreateAdd(i32 1, i32 1) is called it should create an add > instruction (instead of a constant) with i32 1 and i32 1 as arguments, > and no folding will occur. > > Adding a DoFold argument to every Constant constructor is not an > acceptable solution to commit to LLVM. > > Nick > >> NoFolder's functions return pointer of Constant because llvm-gcc's codes which >> call TheFolder's functions wait for pointer of Constant. and some of get() functions >> in ConstantExpr have a additional argument "DoFold" which decide to enable or >> disable fold. This implementation may be inefficient because there are additional >> arguments and 'if' statements. Please comment about this. >> >> In this patch, bitcast is folded unconditionally due to a little of problems. >> For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low >> and high values to ConstantInt which is folded to integer constant.and >> The part of codes does not accept unfolded bitcast ConstantExpr. >> (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make >> ConstantInt, bitcast is generated on types with other bitwidths) >> >> I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using this patch >> and tested test-suite. There are not compilation and execution errors on x86-32bit. >> >> Patch files are as following: >> 1. llvm patch >> 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" >> >> Please review these patches. >> >> Thanks, >> Jin-Gu Kang >> ________________________________________ >> From: Duncan Sands [baldrick at free.fr] >> Sent: Wednesday, February 23, 2011 5:57 PM >> To: Jin Gu Kang >> Cc: Chris Lattner; llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >> Hi Jin Gu Kang, >> >>> while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, >>> StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different >>> from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). >>> Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. >>> >>> so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. >> >> it is true that disabling all constant folding may be helpful for beginners who >> want to read the bitcode and understand how it relates to the original C. This >> is not so easy to achieve however because a minimal amount of constant folding >> always occurs. For example you can change llvm-gcc from using TargetFolder to >> ConstantFolder. This will result in less constant folding because it will no >> longer use information about the target when constant folding. However the fold >> you mentioned (bitcast turned into deeper GEP) will occur anyway because doing >> it does not require knowing the target. There is also a NoFolder class which >> does no folding whatsoever, by creating instructions rather than constants, but >> I hear that it doesn't work anymore (it used to, but perhaps bitrotted because >> no one uses it). If you want to disable all constant folding in llvm-gcc then >> I suggest you change all instances of TargetFolder to NoFolder in >> llvm-internal.h and llvm-backend.cpp. This line >> TheFolder = new TargetFolder(TheTarget->getTargetData()); >> probably needs to become something like this: >> TheFolder = new NoFolder(getGlobalContext()); >> However as I mentioned it probably will require some work on IRBuilder and >> NoFolder to get it working properly. If you succeed please send in a patch. >> >> Ciao, Duncan. >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From fvbommel at gmail.com Fri Feb 25 01:08:46 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Fri, 25 Feb 2011 08:08:46 +0100 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> References: <20110224224612.21E8B2A6C12C@llvm.org> <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> Message-ID: On Fri, Feb 25, 2011 at 12:37 AM, Dan Gohman wrote: > A gep with one non-constant index is a multiply and an add. How > speculative are you feeling? ;-) Good point. Maybe just if we know that one non-constant index indexes over a type whose size is a power of two (including 1) then? From evan.cheng at apple.com Fri Feb 25 01:14:26 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Feb 2011 23:14:26 -0800 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: References: <20110224224612.21E8B2A6C12C@llvm.org> <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> Message-ID: Speculation is nice, but I would feel a lot better if there are hard numbers to back this up. Are we sure these changes are improving performance? Evan On Feb 24, 2011, at 11:08 PM, Frits van Bommel wrote: > On Fri, Feb 25, 2011 at 12:37 AM, Dan Gohman wrote: >> A gep with one non-constant index is a multiply and an add. How >> speculative are you feeling? ;-) > > Good point. Maybe just if we know that one non-constant index indexes > over a type whose size is a power of two (including 1) then? > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Fri Feb 25 01:14:42 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 24 Feb 2011 23:14:42 -0800 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: <4D67237B.6060306@gmail.com> References: <4D65DCFB.90205@gmail.com> <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> <4D67237B.6060306@gmail.com> Message-ID: <3B27AD7C-DE66-4564-BA79-3C958D6D3E72@apple.com> On Feb 24, 2011, at 7:35 PM, Rafael ?vila de Esp?ndola wrote: >> Very nice Rafael! Do you have a breakdown of how much of that 6:30 >> is spent reading bitcode files, doing IR linking, doing optimization, >> doing codegen, and doing native linking? I'm just curious where the >> time is going. I would not have expected 30s for the asmprinter + >> native assembler :) > > I did some basic experiments, but they have to be updated. I remember > the assembler taking about 12s and llvm-mc being a bit faster going from > .s to .o. I was also surprised when the final time reduction was 30s. Interesting! > Doing llvm-link of all the IL files is about 3m if I remember correctly. Wow. Out of curiosity, is much of that time spent in type resolution stuff? I expect that to disappear when the (post 2.9) type system rewrite happens. I think we can make the "loading + linking" process much faster :) > There is also some overhead just in managing so much memory. The largest > speedup I go so far was just by merging modules as we read them. Another > thing on these lines is trying to reuse gold mmaps. Right now we map the > files again or malloc+read them (in the case of archive members). Aha, very nice. That should be possible by just reusing a memorybuffer or something. Thanks for pushing LTO compile times forward! -Chris From nicholas at mxc.ca Fri Feb 25 01:13:35 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 25 Feb 2011 07:13:35 -0000 Subject: [llvm-commits] [llvm] r126479 - /llvm/trunk/include/llvm/Support/NoFolder.h Message-ID: <20110225071336.088412A6C12C@llvm.org> Author: nicholas Date: Fri Feb 25 01:13:35 2011 New Revision: 126479 URL: http://llvm.org/viewvc/llvm-project?rev=126479&view=rev Log: Update the NoFolder to work with current IRBuilder. Modified: llvm/trunk/include/llvm/Support/NoFolder.h Modified: llvm/trunk/include/llvm/Support/NoFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=126479&r1=126478&r2=126479&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/NoFolder.h (original) +++ llvm/trunk/include/llvm/Support/NoFolder.h Fri Feb 25 01:13:35 2011 @@ -38,8 +38,12 @@ // Binary Operators //===--------------------------------------------------------------------===// - Instruction *CreateAdd(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateAdd(LHS, RHS); + Instruction *CreateAdd(Constant *LHS, Constant *RHS, + bool HasNUW = false, bool HasNSW = false) const { + BinaryOperator *BO = BinaryOperator::CreateAdd(LHS, RHS); + if (HasNUW) BO->setHasNoUnsignedWrap(); + if (HasNSW) BO->setHasNoSignedWrap(); + return BO; } Instruction *CreateNSWAdd(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateNSWAdd(LHS, RHS); @@ -50,8 +54,12 @@ Instruction *CreateFAdd(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateFAdd(LHS, RHS); } - Instruction *CreateSub(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateSub(LHS, RHS); + Instruction *CreateSub(Constant *LHS, Constant *RHS, + bool HasNUW = false, bool HasNSW = false) const { + BinaryOperator *BO = BinaryOperator::CreateSub(LHS, RHS); + if (HasNUW) BO->setHasNoUnsignedWrap(); + if (HasNSW) BO->setHasNoSignedWrap(); + return BO; } Instruction *CreateNSWSub(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateNSWSub(LHS, RHS); @@ -62,8 +70,12 @@ Instruction *CreateFSub(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateFSub(LHS, RHS); } - Instruction *CreateMul(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateMul(LHS, RHS); + Instruction *CreateMul(Constant *LHS, Constant *RHS, + bool HasNUW = false, bool HasNSW = false) const { + BinaryOperator *BO = BinaryOperator::CreateMul(LHS, RHS); + if (HasNUW) BO->setHasNoUnsignedWrap(); + if (HasNSW) BO->setHasNoSignedWrap(); + return BO; } Instruction *CreateNSWMul(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateNSWMul(LHS, RHS); @@ -74,14 +86,20 @@ Instruction *CreateFMul(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateFMul(LHS, RHS); } - Instruction *CreateUDiv(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateUDiv(LHS, RHS); + Instruction *CreateUDiv(Constant *LHS, Constant *RHS, + bool isExact = false) const { + if (!isExact) + return BinaryOperator::CreateUDiv(LHS, RHS); + return BinaryOperator::CreateExactUDiv(LHS, RHS); } Instruction *CreateExactUDiv(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateExactUDiv(LHS, RHS); } - Instruction *CreateSDiv(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateSDiv(LHS, RHS); + Instruction *CreateSDiv(Constant *LHS, Constant *RHS, + bool isExact = false) const { + if (!isExact) + return BinaryOperator::CreateSDiv(LHS, RHS); + return BinaryOperator::CreateExactSDiv(LHS, RHS); } Instruction *CreateExactSDiv(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateExactSDiv(LHS, RHS); @@ -98,14 +116,24 @@ Instruction *CreateFRem(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateFRem(LHS, RHS); } - Instruction *CreateShl(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateShl(LHS, RHS); - } - Instruction *CreateLShr(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateLShr(LHS, RHS); - } - Instruction *CreateAShr(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateAShr(LHS, RHS); + Instruction *CreateShl(Constant *LHS, Constant *RHS, bool HasNUW = false, + bool HasNSW = false) const { + BinaryOperator *BO = BinaryOperator::CreateShl(LHS, RHS); + if (HasNUW) BO->setHasNoUnsignedWrap(); + if (HasNSW) BO->setHasNoSignedWrap(); + return BO; + } + Instruction *CreateLShr(Constant *LHS, Constant *RHS, + bool isExact = false) const { + if (!isExact) + return BinaryOperator::CreateLShr(LHS, RHS); + return BinaryOperator::CreateExactLShr(LHS, RHS); + } + Instruction *CreateAShr(Constant *LHS, Constant *RHS, + bool isExact = false) const { + if (!isExact) + return BinaryOperator::CreateAShr(LHS, RHS); + return BinaryOperator::CreateExactAShr(LHS, RHS); } Instruction *CreateAnd(Constant *LHS, Constant *RHS) const { return BinaryOperator::CreateAnd(LHS, RHS); @@ -126,8 +154,12 @@ // Unary Operators //===--------------------------------------------------------------------===// - Instruction *CreateNeg(Constant *C) const { - return BinaryOperator::CreateNeg(C); + Instruction *CreateNeg(Constant *C, + bool HasNUW = false, bool HasNSW = false) const { + BinaryOperator *BO = BinaryOperator::CreateNeg(C); + if (HasNUW) BO->setHasNoUnsignedWrap(); + if (HasNSW) BO->setHasNoSignedWrap(); + return BO; } Instruction *CreateNSWNeg(Constant *C) const { return BinaryOperator::CreateNSWNeg(C); From nicholas at mxc.ca Fri Feb 25 01:30:28 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 24 Feb 2011 23:30:28 -0800 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <3E94D039A2B82544B3E7D48F924B0B25DFA3D88002@base.imrc.kist.re.kr> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr>, <4D6745F8.10305@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88000@base.imrc.kist.re.kr>, <4D674CBB.4050302@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88002@base.imrc.kist.re.kr> Message-ID: <4D675A94.9060403@mxc.ca> Jin Gu Kang wrote: > I am sorry Nick. > > This patch is related to previous e-mails with Duncan. > > On previous e-mail with Duncan, > > Duncan said: >> ... >> If you want to disable all constant folding in llvm-gcc then >> I suggest you change all instances of TargetFolder to NoFolder in >> llvm-internal.h and llvm-backend.cpp. This line >> TheFolder = new TargetFolder(TheTarget->getTargetData()); >> probably needs to become something like this: >> TheFolder = new NoFolder(getGlobalContext()); >> However as I mentioned it probably will require some work on IRBuilder and >> NoFolder to get it working properly. If you succeed please send in a patch. > > As you can see on above statements, I made this patch because of disabling > all constant folding in llvm-gcc. Okay, I follow you now. I just committed a fix to llvm to make the NoFolder work with the IRBuilder again, and I'm doing a build of llvm-gcc with the NoFolder now. Now, for various reasons, I didn't turn off *all* of llvm-gcc's use of constant folding, but I turned off the huge majority of it. There are some things like this snippet: // If a previous proto existed with the wrong type, replace any uses of it // with the actual function and delete the proto. if (FnEntry) { FnEntry->replaceAllUsesWith( TheFolder->CreateBitCast(Fn, FnEntry->getType()) ); changeLLVMConstant(FnEntry, Fn); FnEntry->eraseFromParent(); } which works by replacing one constant with another. In theory, you could find all uses of the constant and instead create a new bitcast instruction that casts the constant then switch the users to use that instruction, but it's not trivial to update this code like that. This code creates a single replacement value. To do it with instructions you would need to put one new instruction in each function the constant is used. That's not impossible, I just don't think it's worth-while to update every spot llvm-gcc does this sort of thing. The places we can't remove constants are initializers for global variables (because there's no function to put instructions in) and some llvm intrinsics which demand constant values (debug info? others?). The attached patch includes my changes to llvm-gcc, but be sure to update to the latest llvm to pick up my NoFolder change. Nick PS. Duncan, may I commit the "Builder.getFolder()" --> "TheFolder" part of this patch? > Thanks, > Jin-Gu Kang > ________________________________________ > From: Nick Lewycky [nicholas at mxc.ca] > Sent: Friday, February 25, 2011 3:31 PM > To: Jin Gu Kang > Cc: Duncan Sands; llvm-commits at cs.uiuc.edu > Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr > > Jin Gu Kang wrote: >> Hi Nick >> >> It was difficult for me to decide implementation style. >> >> Is it acceptable to make new named Constant constructors >> which make unfoled Constants? >> For example, like getNoFoldAdd(). > > Why do you ever want unfolded constants? It isn't an accident that > they're impossible to create in LLVM. You would need an *excellent* > reason to add them to LLVM regardless of how they're implemented. (Put > another way, do you realize what else needs to change if we add these? > The optimizers will *never* fold them because they assume that such > constants are impossible. Simple things like "1+1 == 2" will fail. You > could argue that the rest of LLVM doesn't need to create them, but if > the rest of LLVM doesn't support them, why should they exist at all?) > > If you're learning LLVM and are having trouble seeing generated IR > because it gets constant folded away, then you should use the IRBuilder > with NoFolder. > > Nick > >> Thanks, >> Jin-Gu Kang >> ________________________________________ >> From: Nick Lewycky [nicholas at mxc.ca] >> Sent: Friday, February 25, 2011 3:02 PM >> To: Jin Gu Kang >> Cc: Duncan Sands; llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >> >> Jin Gu Kang wrote: >>> Hi Duncan >>> >>> I send patches about NoFolder. >> >> The idea behind llvm::NoFolder is that you create instructions instead >> of constants; that's what prevents the folding. When IRBuilder> NoFolder>.CreateAdd(i32 1, i32 1) is called it should create an add >> instruction (instead of a constant) with i32 1 and i32 1 as arguments, >> and no folding will occur. >> >> Adding a DoFold argument to every Constant constructor is not an >> acceptable solution to commit to LLVM. >> >> Nick >> >>> NoFolder's functions return pointer of Constant because llvm-gcc's codes which >>> call TheFolder's functions wait for pointer of Constant. and some of get() functions >>> in ConstantExpr have a additional argument "DoFold" which decide to enable or >>> disable fold. This implementation may be inefficient because there are additional >>> arguments and 'if' statements. Please comment about this. >>> >>> In this patch, bitcast is folded unconditionally due to a little of problems. >>> For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low >>> and high values to ConstantInt which is folded to integer constant.and >>> The part of codes does not accept unfolded bitcast ConstantExpr. >>> (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make >>> ConstantInt, bitcast is generated on types with other bitwidths) >>> >>> I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using this patch >>> and tested test-suite. There are not compilation and execution errors on x86-32bit. >>> >>> Patch files are as following: >>> 1. llvm patch >>> 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" >>> >>> Please review these patches. >>> >>> Thanks, >>> Jin-Gu Kang >>> ________________________________________ >>> From: Duncan Sands [baldrick at free.fr] >>> Sent: Wednesday, February 23, 2011 5:57 PM >>> To: Jin Gu Kang >>> Cc: Chris Lattner; llvm-commits at cs.uiuc.edu >>> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr >>> >>> Hi Jin Gu Kang, >>> >>>> while processing "kang.temp.e = 1" in TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, >>>> StructAddrLV.Ptr which is returned from EmitLV() is bitcast ConstantExpr because type of kang's initializer is different >>>> from type of struct test and this StructAddrLV.Ptr is used as an argument by CreateStructGEP(). >>>> Later, this bitcast ConstantExpr is disappeared by SymbolicallyEvaluateGEP() like above ll code for getelementptr. >>>> >>>> so I suggested to keep this bitcast ConstantExpr in order to represent meaning of conversion. >>> >>> it is true that disabling all constant folding may be helpful for beginners who >>> want to read the bitcode and understand how it relates to the original C. This >>> is not so easy to achieve however because a minimal amount of constant folding >>> always occurs. For example you can change llvm-gcc from using TargetFolder to >>> ConstantFolder. This will result in less constant folding because it will no >>> longer use information about the target when constant folding. However the fold >>> you mentioned (bitcast turned into deeper GEP) will occur anyway because doing >>> it does not require knowing the target. There is also a NoFolder class which >>> does no folding whatsoever, by creating instructions rather than constants, but >>> I hear that it doesn't work anymore (it used to, but perhaps bitrotted because >>> no one uses it). If you want to disable all constant folding in llvm-gcc then >>> I suggest you change all instances of TargetFolder to NoFolder in >>> llvm-internal.h and llvm-backend.cpp. This line >>> TheFolder = new TargetFolder(TheTarget->getTargetData()); >>> probably needs to become something like this: >>> TheFolder = new NoFolder(getGlobalContext()); >>> However as I mentioned it probably will require some work on IRBuilder and >>> NoFolder to get it working properly. If you succeed please send in a patch. >>> >>> Ciao, Duncan. >>> >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-gcc-nofold.patch Type: text/x-patch Size: 4765 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110224/4682dc45/attachment.bin From nicholas at mxc.ca Fri Feb 25 01:38:34 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 24 Feb 2011 23:38:34 -0800 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D675A94.9060403@mxc.ca> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr>, <4D6745F8.10305@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88000@base.imrc.kist.re.kr>, <4D674CBB.4050302@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88002@base.imrc.kist.re.kr> <4D675A94.9060403@mxc.ca> Message-ID: <4D675C7A.6000601@mxc.ca> I'm sorry, of course after all that I attach the wrong patch. Here's the right one! Nick Nick Lewycky wrote: > Jin Gu Kang wrote: >> I am sorry Nick. >> >> This patch is related to previous e-mails with Duncan. >> >> On previous e-mail with Duncan, >> >> Duncan said: >>> ... >>> If you want to disable all constant folding in llvm-gcc then >>> I suggest you change all instances of TargetFolder to NoFolder in >>> llvm-internal.h and llvm-backend.cpp. This line >>> TheFolder = new TargetFolder(TheTarget->getTargetData()); >>> probably needs to become something like this: >>> TheFolder = new NoFolder(getGlobalContext()); >>> However as I mentioned it probably will require some work on >>> IRBuilder and >>> NoFolder to get it working properly. If you succeed please send in a >>> patch. >> >> As you can see on above statements, I made this patch because of >> disabling >> all constant folding in llvm-gcc. > > Okay, I follow you now. I just committed a fix to llvm to make the > NoFolder work with the IRBuilder again, and I'm doing a build of > llvm-gcc with the NoFolder now. > > Now, for various reasons, I didn't turn off *all* of llvm-gcc's use of > constant folding, but I turned off the huge majority of it. There are > some things like this snippet: > // If a previous proto existed with the wrong type, replace any uses of it > // with the actual function and delete the proto. > if (FnEntry) { > FnEntry->replaceAllUsesWith( > TheFolder->CreateBitCast(Fn, FnEntry->getType()) > ); > changeLLVMConstant(FnEntry, Fn); > FnEntry->eraseFromParent(); > } > which works by replacing one constant with another. In theory, you could > find all uses of the constant and instead create a new bitcast > instruction that casts the constant then switch the users to use that > instruction, but it's not trivial to update this code like that. This > code creates a single replacement value. To do it with instructions you > would need to put one new instruction in each function the constant is > used. That's not impossible, I just don't think it's worth-while to > update every spot llvm-gcc does this sort of thing. > > The places we can't remove constants are initializers for global > variables (because there's no function to put instructions in) and some > llvm intrinsics which demand constant values (debug info? others?). > > The attached patch includes my changes to llvm-gcc, but be sure to > update to the latest llvm to pick up my NoFolder change. > > Nick > > PS. Duncan, may I commit the "Builder.getFolder()" --> "TheFolder" part > of this patch? > >> Thanks, >> Jin-Gu Kang >> ________________________________________ >> From: Nick Lewycky [nicholas at mxc.ca] >> Sent: Friday, February 25, 2011 3:31 PM >> To: Jin Gu Kang >> Cc: Duncan Sands; llvm-commits at cs.uiuc.edu >> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - >> removal of redundant constantexpr >> >> Jin Gu Kang wrote: >>> Hi Nick >>> >>> It was difficult for me to decide implementation style. >>> >>> Is it acceptable to make new named Constant constructors >>> which make unfoled Constants? >>> For example, like getNoFoldAdd(). >> >> Why do you ever want unfolded constants? It isn't an accident that >> they're impossible to create in LLVM. You would need an *excellent* >> reason to add them to LLVM regardless of how they're implemented. (Put >> another way, do you realize what else needs to change if we add these? >> The optimizers will *never* fold them because they assume that such >> constants are impossible. Simple things like "1+1 == 2" will fail. You >> could argue that the rest of LLVM doesn't need to create them, but if >> the rest of LLVM doesn't support them, why should they exist at all?) >> >> If you're learning LLVM and are having trouble seeing generated IR >> because it gets constant folded away, then you should use the IRBuilder >> with NoFolder. >> >> Nick >> >>> Thanks, >>> Jin-Gu Kang >>> ________________________________________ >>> From: Nick Lewycky [nicholas at mxc.ca] >>> Sent: Friday, February 25, 2011 3:02 PM >>> To: Jin Gu Kang >>> Cc: Duncan Sands; llvm-commits at cs.uiuc.edu >>> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - >>> removal of redundant constantexpr >>> >>> Jin Gu Kang wrote: >>>> Hi Duncan >>>> >>>> I send patches about NoFolder. >>> >>> The idea behind llvm::NoFolder is that you create instructions instead >>> of constants; that's what prevents the folding. When IRBuilder>> NoFolder>.CreateAdd(i32 1, i32 1) is called it should create an add >>> instruction (instead of a constant) with i32 1 and i32 1 as arguments, >>> and no folding will occur. >>> >>> Adding a DoFold argument to every Constant constructor is not an >>> acceptable solution to commit to LLVM. >>> >>> Nick >>> >>>> NoFolder's functions return pointer of Constant because llvm-gcc's >>>> codes which >>>> call TheFolder's functions wait for pointer of Constant. and some of >>>> get() functions >>>> in ConstantExpr have a additional argument "DoFold" which decide to >>>> enable or >>>> disable fold. This implementation may be inefficient because there >>>> are additional >>>> arguments and 'if' statements. Please comment about this. >>>> >>>> In this patch, bitcast is folded unconditionally due to a little of >>>> problems. >>>> For example, EmitSWITCH_EXPR() on llvm-gcc-4.2 changes case's low >>>> and high values to ConstantInt which is folded to integer constant.and >>>> The part of codes does not accept unfolded bitcast ConstantExpr. >>>> (Because ConvertINTEGER_CST() uses Type::getInt64Ty(Context) to make >>>> ConstantInt, bitcast is generated on types with other bitwidths) >>>> >>>> I completed compilation of llvm-gcc-4.2 on x86-32bit and ARM using >>>> this patch >>>> and tested test-suite. There are not compilation and execution >>>> errors on x86-32bit. >>>> >>>> Patch files are as following: >>>> 1. llvm patch >>>> 2. llvm-gcc test patch - insertion of define "LLVM_TEST_NOFOLDER" >>>> >>>> Please review these patches. >>>> >>>> Thanks, >>>> Jin-Gu Kang >>>> ________________________________________ >>>> From: Duncan Sands [baldrick at free.fr] >>>> Sent: Wednesday, February 23, 2011 5:57 PM >>>> To: Jin Gu Kang >>>> Cc: Chris Lattner; llvm-commits at cs.uiuc.edu >>>> Subject: Re: [llvm-commits] Fold() function on TargetFolder class - >>>> removal of redundant constantexpr >>>> >>>> Hi Jin Gu Kang, >>>> >>>>> while processing "kang.temp.e = 1" in >>>>> TreeToLLVM::EmitLV_COMPONENT_REF() function on llvm-gcc-4.2, >>>>> StructAddrLV.Ptr which is returned from EmitLV() is bitcast >>>>> ConstantExpr because type of kang's initializer is different >>>>> from type of struct test and this StructAddrLV.Ptr is used as an >>>>> argument by CreateStructGEP(). >>>>> Later, this bitcast ConstantExpr is disappeared by >>>>> SymbolicallyEvaluateGEP() like above ll code for getelementptr. >>>>> >>>>> so I suggested to keep this bitcast ConstantExpr in order to >>>>> represent meaning of conversion. >>>> >>>> it is true that disabling all constant folding may be helpful for >>>> beginners who >>>> want to read the bitcode and understand how it relates to the >>>> original C. This >>>> is not so easy to achieve however because a minimal amount of >>>> constant folding >>>> always occurs. For example you can change llvm-gcc from using >>>> TargetFolder to >>>> ConstantFolder. This will result in less constant folding because it >>>> will no >>>> longer use information about the target when constant folding. >>>> However the fold >>>> you mentioned (bitcast turned into deeper GEP) will occur anyway >>>> because doing >>>> it does not require knowing the target. There is also a NoFolder >>>> class which >>>> does no folding whatsoever, by creating instructions rather than >>>> constants, but >>>> I hear that it doesn't work anymore (it used to, but perhaps >>>> bitrotted because >>>> no one uses it). If you want to disable all constant folding in >>>> llvm-gcc then >>>> I suggest you change all instances of TargetFolder to NoFolder in >>>> llvm-internal.h and llvm-backend.cpp. This line >>>> TheFolder = new TargetFolder(TheTarget->getTargetData()); >>>> probably needs to become something like this: >>>> TheFolder = new NoFolder(getGlobalContext()); >>>> However as I mentioned it probably will require some work on >>>> IRBuilder and >>>> NoFolder to get it working properly. If you succeed please send in a >>>> patch. >>>> >>>> Ciao, Duncan. >>>> >>>> >>>> >>>> _______________________________________________ >>>> 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 -------------- A non-text attachment was scrubbed... Name: llvm-gcc-nofold-2.patch Type: text/x-patch Size: 5075 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110224/c273f6cf/attachment-0001.bin From jaykang10 at imrc.kist.re.kr Fri Feb 25 02:19:07 2011 From: jaykang10 at imrc.kist.re.kr (Jin Gu Kang) Date: Fri, 25 Feb 2011 17:19:07 +0900 Subject: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr In-Reply-To: <4D675A94.9060403@mxc.ca> References: <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FED@base.imrc.kist.re.kr> <4D638055.6080201@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF4@base.imrc.kist.re.kr> <4D639C52.2060401@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF6@base.imrc.kist.re.kr> <4D63AA79.60904@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF7@base.imrc.kist.re.kr> <4D63B86D.7000203@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FF8@base.imrc.kist.re.kr>, <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFA@base.imrc.kist.re.kr>, <4D64BE54.8090603@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFC@base.imrc.kist.re.kr>, <4D64CC05.2050802@free.fr> <3E94D039A2B82544B3E7D48F924B0B25DFA3D87FFD@base.imrc.kist.re.kr>, <4D6745F8.10305@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88000@base.imrc.kist.re.kr>, <4D674CBB.4050302@mxc.ca> <3E94D039A2B82544B3E7D48F924B0B25DFA3D88002@base.imrc.kist.re.kr>, <4D675A94.9060403@mxc.ca> Message-ID: <3E94D039A2B82544B3E7D48F924B0B25DFA3D88003@base.imrc.kist.re.kr> > Now, for various reasons, I didn't turn off *all* of llvm-gcc's use of > constant folding, but I turned off the huge majority of it. There are > some things like this snippet: > // If a previous proto existed with the wrong type, replace any > uses of it > // with the actual function and delete the proto. > if (FnEntry) { > FnEntry->replaceAllUsesWith( > TheFolder->CreateBitCast(Fn, FnEntry->getType()) > ); > changeLLVMConstant(FnEntry, Fn); > FnEntry->eraseFromParent(); > } > which works by replacing one constant with another. In theory, you could > find all uses of the constant and instead create a new bitcast > instruction that casts the constant then switch the users to use that > instruction, but it's not trivial to update this code like that. This > code creates a single replacement value. To do it with instructions you > would need to put one new instruction in each function the constant is > used. That's not impossible, I just don't think it's worth-while to > update every spot llvm-gcc does this sort of thing. It was error-prone for me to modify all of llvm-gcc's spot which use Folder's functions and I didn't know side-effect on original llvm-gcc according to this working. Is it right to modify llvm-gcc to support NoFolder based on instruction? Thanks. Jin-Gu Kang From benny.kra at googlemail.com Fri Feb 25 04:33:33 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Fri, 25 Feb 2011 10:33:33 -0000 Subject: [llvm-commits] [llvm] r126481 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll Message-ID: <20110225103333.976A12A6C12C@llvm.org> Author: d0k Date: Fri Feb 25 04:33:33 2011 New Revision: 126481 URL: http://llvm.org/viewvc/llvm-project?rev=126481&view=rev Log: Revert "SimplifyCFG: GEPs with just one non-constant index are also cheap." Yes, there are other types than i8* and GEPs on them can produce an add+multiply. We don't consider that cheap enough to be speculatively executed. Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=126481&r1=126480&r2=126481&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Feb 25 04:33:33 2011 @@ -247,13 +247,11 @@ if (PBB->getFirstNonPHIOrDbg() != I) return false; break; - case Instruction::GetElementPtr: { - // GEPs are cheap if all indices are constant or if there's only one index. - GetElementPtrInst *GEP = cast(I); - if (!GEP->hasAllConstantIndices() && GEP->getNumIndices() > 1) + case Instruction::GetElementPtr: + // GEPs are cheap if all indices are constant. + if (!cast(I)->hasAllConstantIndices()) return false; break; - } case Instruction::Add: case Instruction::Sub: case Instruction::And: Modified: llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll?rev=126481&r1=126480&r2=126481&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/select-gep.ll Fri Feb 25 04:33:33 2011 @@ -15,7 +15,7 @@ ret i8* %x.addr ; CHECK: @test1 -; CHECK: %x.addr = select i1 %cmp, i8* %incdec.ptr, i8* %x +; CHECK-NOT: select ; CHECK: ret i8* %x.addr } From zwarich at apple.com Fri Feb 25 06:16:55 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Fri, 25 Feb 2011 04:16:55 -0800 Subject: [llvm-commits] [llvm] r126425 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/PTX/ lib/Target/X86/ In-Reply-To: <20110224210400.8E73B2A6C12C@llvm.org> References: <20110224210400.8E73B2A6C12C@llvm.org> Message-ID: <5ED62500-4C99-4FFD-A6A1-BDBA3B2AEA01@apple.com> There are some Dwarf-related failures on the bots at around the point this landed. I'm going to have to roll it out tomorrow and see if that fixes things. Sent from my iPhone On Feb 24, 2011, at 1:04 PM, Devang Patel wrote: > Author: dpatel > Date: Thu Feb 24 15:04:00 2011 > New Revision: 126425 > > URL: http://llvm.org/viewvc/llvm-project?rev=126425&view=rev > Log: > Enable DebugInfo support for COFF object files. > Patch by Nathan Jeffords! > > > Modified: > llvm/trunk/include/llvm/MC/MCStreamer.h > llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp > llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp > llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h > llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp > llvm/trunk/lib/MC/MCAsmStreamer.cpp > llvm/trunk/lib/MC/MCELFStreamer.cpp > llvm/trunk/lib/MC/MCLoggingStreamer.cpp > llvm/trunk/lib/MC/MCMachOStreamer.cpp > llvm/trunk/lib/MC/MCNullStreamer.cpp > llvm/trunk/lib/MC/MCPureStreamer.cpp > llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp > llvm/trunk/lib/MC/WinCOFFStreamer.cpp > llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp > llvm/trunk/lib/Target/X86/X86AsmBackend.cpp > llvm/trunk/lib/Target/X86/X86FixupKinds.h > llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp > > Modified: llvm/trunk/include/llvm/MC/MCStreamer.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) > +++ llvm/trunk/include/llvm/MC/MCStreamer.h Thu Feb 24 15:04:00 2011 > @@ -239,6 +239,11 @@ > /// EndCOFFSymbolDef - Marks the end of the symbol definition. > virtual void EndCOFFSymbolDef() = 0; > > + /// EmitCOFFSecRel32 - Emits a COFF section relative relocation. > + /// > + /// @param Symbol - Symbol the section relative realocation should point to. > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) = 0; > + > /// EmitELFSize - Emit an ELF .size directive. > /// > /// This corresponds to an assembler statement such as: > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Thu Feb 24 15:04:00 2011 > @@ -178,8 +178,7 @@ > const MCSymbol *SectionLabel) const { > // On COFF targets, we have to emit the special .secrel32 directive. > if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) { > - // FIXME: MCize. > - OutStreamer.EmitRawText(SecOffDir + Twine(Label->getName())); > + OutStreamer.EmitCOFFSecRel32(Label); > return; > } > > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Thu Feb 24 15:04:00 2011 > @@ -277,6 +277,29 @@ > #endif > > //===----------------------------------------------------------------------===// > +// DIESectionOffset Implementation > +//===----------------------------------------------------------------------===// > + > +/// EmitValue - Emit label value. > +/// > +void DIESectionOffset::EmitValue(AsmPrinter *AP, unsigned Form) const { > + AP->EmitSectionOffset (Label, Label); > +} > + > +/// SizeOf - Determine size of label value in bytes. > +/// > +unsigned DIESectionOffset::SizeOf(AsmPrinter *AP, unsigned Form) const { > + if (Form == dwarf::DW_FORM_data4) return 4; > + return AP->getTargetData().getPointerSize(); > +} > + > +#ifndef NDEBUG > +void DIESectionOffset::print(raw_ostream &O) { > + O << "SecRelLbl: " << Label->getName(); > +} > +#endif > + > +//===----------------------------------------------------------------------===// > // DIEDelta Implementation > //===----------------------------------------------------------------------===// > > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Thu Feb 24 15:04:00 2011 > @@ -333,6 +333,36 @@ > }; > > //===--------------------------------------------------------------------===// > + /// DIESectionOffset - A section relative label expression DIE. > + // > + class DIESectionOffset : public DIEValue { > + const MCSymbol *Label; > + public: > + explicit DIESectionOffset(const MCSymbol *L) : DIEValue(isSectionOffset), > + Label(L) {} > + > + /// EmitValue - Emit label value. > + /// > + virtual void EmitValue(AsmPrinter *AP, unsigned Form) const; > + > + /// getValue - Get MCSymbol. > + /// > + const MCSymbol *getValue() const { return Label; } > + > + /// SizeOf - Determine size of label value in bytes. > + /// > + virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const; > + > + // Implement isa/cast/dyncast. > + static bool classof(const DIELabel *) { return true; } > + static bool classof(const DIEValue *L) { return L->getType() == isSectionOffset; } > + > +#ifndef NDEBUG > + virtual void print(raw_ostream &O); > +#endif > + }; > + > + //===--------------------------------------------------------------------===// > /// DIEDelta - A simple label difference DIE. > /// > class DIEDelta : public DIEValue { > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Feb 24 15:04:00 2011 > @@ -481,6 +481,15 @@ > Die->addValue(Attribute, Form, Value); > } > > +/// addSectionOffset - Add a Dwarf section relative label attribute data and > +/// value. > +/// > +void DwarfDebug::addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, > + const MCSymbol *Label) { > + DIEValue *Value = new (DIEValueAllocator) DIESectionOffset(Label); > + Die->addValue(Attribute, Form, Value); > +} > + > /// addDelta - Add a label delta attribute data and value. > /// > void DwarfDebug::addDelta(DIE *Die, unsigned Attribute, unsigned Form, > @@ -1904,8 +1913,8 @@ > // DW_AT_stmt_list is a offset of line number information for this > // compile unit in debug_line section. > if (Asm->MAI->doesDwarfUsesAbsoluteLabelForStmtList()) > - addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, > - Asm->GetTempSymbol("section_line")); > + addSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, > + Asm->GetTempSymbol("section_line")); > else > addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0); > > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Feb 24 15:04:00 2011 > @@ -280,6 +280,12 @@ > void addLabel(DIE *Die, unsigned Attribute, unsigned Form, > const MCSymbol *Label); > > + /// addSectionOffset - Add a Dwarf section relative label attribute data and > + /// value. > + /// > + void addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, > + const MCSymbol *Label); > + > /// addDelta - Add a label delta attribute data and value. > /// > void addDelta(DIE *Die, unsigned Attribute, unsigned Form, > > Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original) > +++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Thu Feb 24 15:04:00 2011 > @@ -33,5 +33,6 @@ > HasLEB128 = true; // Target asm supports leb128 directives (little-endian) > SupportsDebugInformation = true; > DwarfSectionOffsetDirective = "\t.secrel32\t"; > + DwarfUsesAbsoluteLabelForStmtList = false; > HasMicrosoftFastStdCallMangling = true; > } > > Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) > +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -135,6 +135,7 @@ > virtual void EmitCOFFSymbolStorageClass(int StorageClass); > virtual void EmitCOFFSymbolType(int Type); > virtual void EndCOFFSymbolDef(); > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); > virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, > unsigned ByteAlignment); > @@ -384,6 +385,11 @@ > EmitEOL(); > } > > +void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) { > + OS << "\t.secrel32\t" << *Symbol << '\n'; > + EmitEOL(); > +} > + > void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { > assert(MAI.hasDotTypeDotSizeDirective()); > OS << "\t.size\t" << *Symbol << ", " << *Value << '\n'; > > Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCELFStreamer.cpp (original) > +++ llvm/trunk/lib/MC/MCELFStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -108,6 +108,10 @@ > assert(0 && "ELF doesn't support this directive"); > } > > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { > + assert(0 && "ELF doesn't support this directive"); > + } > + > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { > MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); > SD.setSize(Value); > > Modified: llvm/trunk/lib/MC/MCLoggingStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCLoggingStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCLoggingStreamer.cpp (original) > +++ llvm/trunk/lib/MC/MCLoggingStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -120,6 +120,11 @@ > return Child->EndCOFFSymbolDef(); > } > > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { > + LogCall("EndCOFFSymbolDef"); > + return Child->EmitCOFFSecRel32(Symbol); > + } > + > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { > LogCall("EmitELFSize"); > return Child->EmitELFSize(Symbol, Value); > > Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) > +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -63,6 +63,9 @@ > virtual void EndCOFFSymbolDef() { > assert(0 && "macho doesn't support this directive"); > } > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { > + assert(0 && "macho doesn't support this directive"); > + } > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { > assert(0 && "macho doesn't support this directive"); > } > > Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) > +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -54,6 +54,7 @@ > virtual void EmitCOFFSymbolStorageClass(int StorageClass) {} > virtual void EmitCOFFSymbolType(int Type) {} > virtual void EndCOFFSymbolDef() {} > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {} > > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} > virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, > > Modified: llvm/trunk/lib/MC/MCPureStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCPureStreamer.cpp (original) > +++ llvm/trunk/lib/MC/MCPureStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -83,6 +83,9 @@ > virtual void EndCOFFSymbolDef() { > report_fatal_error("unsupported directive in pure streamer"); > } > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { > + report_fatal_error("unsupported directive in pure streamer"); > + } > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { > report_fatal_error("unsupported directive in pure streamer"); > } > > Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original) > +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Thu Feb 24 15:04:00 2011 > @@ -705,6 +705,10 @@ > else > llvm_unreachable("unsupported relocation type"); > break; > + case X86::reloc_coff_secrel32: > + Reloc.Data.Type = Is64Bit ? COFF::IMAGE_REL_AMD64_SREL32 > + : COFF::IMAGE_REL_I386_SECREL; > + break; > default: > llvm_unreachable("unsupported relocation type"); > } > > Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original) > +++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -31,6 +31,9 @@ > #include "llvm/Support/Debug.h" > #include "llvm/Support/ErrorHandling.h" > #include "llvm/Support/raw_ostream.h" > + > +#include "../Target/X86/X86FixupKinds.h" > + > using namespace llvm; > > namespace { > @@ -59,6 +62,7 @@ > virtual void EmitCOFFSymbolStorageClass(int StorageClass); > virtual void EmitCOFFSymbolType(int Type); > virtual void EndCOFFSymbolDef(); > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); > virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, > unsigned ByteAlignment); > @@ -290,6 +294,16 @@ > CurSymbol = NULL; > } > > +void WinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) > +{ > + MCDataFragment *DF = getOrCreateDataFragment(); > + > + DF->addFixup(MCFixup::Create(DF->getContents().size(), > + MCSymbolRefExpr::Create (Symbol, getContext ()), > + (MCFixupKind)X86::reloc_coff_secrel32)); > + DF->getContents().resize(DF->getContents().size() + 4, 0); > +} > + > void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { > llvm_unreachable("not implemented"); > } > @@ -368,6 +382,10 @@ > > getCurrentSectionData()->setHasInstructions(true); > > + // Now that a machine instruction has been assembled into this section, make > + // a line entry for any .loc directive that has been seen. > + MCLineEntry::Make(this, getCurrentSection()); > + > MCInstFragment *Fragment = > new MCInstFragment(Instruction, getCurrentSectionData()); > > > Modified: llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp (original) > +++ llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp Thu Feb 24 15:04:00 2011 > @@ -124,6 +124,7 @@ > virtual void EmitCOFFSymbolStorageClass(int StorageClass); > virtual void EmitCOFFSymbolType(int Type); > virtual void EndCOFFSymbolDef(); > + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); > virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); > virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, > unsigned ByteAlignment); > @@ -277,6 +278,8 @@ > > void PTXMCAsmStreamer::EndCOFFSymbolDef() {} > > +void PTXMCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {} > + > void PTXMCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} > > void PTXMCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, > > Modified: llvm/trunk/lib/Target/X86/X86AsmBackend.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmBackend.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86AsmBackend.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86AsmBackend.cpp Thu Feb 24 15:04:00 2011 > @@ -40,6 +40,7 @@ > case X86::reloc_riprel_4byte_movq_load: > case X86::reloc_signed_4byte: > case X86::reloc_global_offset_table: > + case X86::reloc_coff_secrel32: > case FK_Data_4: return 2; > case FK_PCRel_8: > case FK_Data_8: return 3; > @@ -69,7 +70,8 @@ > { "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel }, > { "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel}, > { "reloc_signed_4byte", 0, 4 * 8, 0}, > - { "reloc_global_offset_table", 0, 4 * 8, 0} > + { "reloc_global_offset_table", 0, 4 * 8, 0}, > + { "reloc_coff_secrel32", 0, 4 * 8, 0} > }; > > if (Kind < FirstTargetFixupKind) > > Modified: llvm/trunk/lib/Target/X86/X86FixupKinds.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FixupKinds.h?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86FixupKinds.h (original) > +++ llvm/trunk/lib/Target/X86/X86FixupKinds.h Thu Feb 24 15:04:00 2011 > @@ -23,6 +23,8 @@ > reloc_global_offset_table, // 32-bit, relative to the start > // of the instruction. Used only > // for _GLOBAL_OFFSET_TABLE_. > + reloc_coff_secrel32, // PE-COFF section relative 32 > + // (only valid for win32 COFF) > // Marker > LastTargetFixupKind, > NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind > > Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=126425&r1=126424&r2=126425&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Thu Feb 24 15:04:00 2011 > @@ -113,4 +113,7 @@ > AssemblerDialect = AsmWriterFlavor; > > TextAlignFillValue = 0x90; > + > + // Debug Information > + SupportsDebugInformation = true; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Fri Feb 25 09:05:16 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Feb 2011 15:05:16 -0000 Subject: [llvm-commits] [dragonegg] r126483 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110225150516.73F452A6C12C@llvm.org> Author: baldrick Date: Fri Feb 25 09:05:16 2011 New Revision: 126483 URL: http://llvm.org/viewvc/llvm-project?rev=126483&view=rev Log: Rename ReplacementStrings to StringStorage and reduce the slab size from 4096 bytes to 256 bytes since typically the total amount allocated is less than a dozen bytes. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126483&r1=126482&r2=126483&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Fri Feb 25 09:05:16 2011 @@ -3342,7 +3342,7 @@ /// in Constraints[] with the shorter strings from that tuple (malloc'ed, /// caller is responsible for cleaning it up). Later processing can alter what /// Constraints points to, so to make sure we delete everything, the addresses -/// of everything we allocated also are returned in ReplacementStrings. +/// of everything we allocated also are returned in StringStorage. /// Casting back and forth from char* to const char* is Ugly, but we have to /// interface with C code that expects const char*. /// @@ -3351,7 +3351,7 @@ /// just trying to pick one that will work. This may get refined. static void ChooseConstraintTuple(gimple stmt, const char **Constraints, unsigned NumChoices, - BumpPtrAllocator &ReplacementStrings) { + BumpPtrAllocator &StringStorage) { unsigned NumInputs = gimple_asm_ninputs(stmt); unsigned NumOutputs = gimple_asm_noutputs(stmt); @@ -3436,12 +3436,12 @@ // For outputs, copy the leading = or +. char *newstring; if (i(end-start+1+1); + newstring = StringStorage.Allocate(end-start+1+1); newstring[0] = *(Constraints[i]); strncpy(newstring+1, start, end-start); newstring[end-start+1] = 0; } else { - newstring = ReplacementStrings.Allocate(end-start+1); + newstring = StringStorage.Allocate(end-start+1); strncpy(newstring, start, end-start); newstring[end-start] = 0; } @@ -6797,9 +6797,9 @@ // If there are multiple constraint tuples, pick one. Constraints is // altered to point to shorter strings (which are malloc'ed), and everything // below Just Works as in the NumChoices==1 case. - BumpPtrAllocator ReplacementStrings; + BumpPtrAllocator StringStorage(256, 256); if (NumChoices > 1) - ChooseConstraintTuple(stmt, Constraints, NumChoices, ReplacementStrings); + ChooseConstraintTuple(stmt, Constraints, NumChoices, StringStorage); std::vector CallOps; std::vector CallArgTypes; From benny.kra at googlemail.com Fri Feb 25 09:26:03 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Fri, 25 Feb 2011 16:26:03 +0100 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: References: <20110224224612.21E8B2A6C12C@llvm.org> <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> Message-ID: On 25.02.2011, at 08:14, Evan Cheng wrote: > Speculation is nice, but I would feel a lot better if there are hard numbers to back this up. Are we sure these changes are improving performance? My unscientific test case (gcc compiled with clang -O3 parsing itself) showed a 0.25% speedup with the original patch (all-constant GEPs only, median of 5 runs, i386, penryn). I just retested with the change Frits suggested and it slowed down ~0.6% compared to the original run so I reverted it. I didn't test if it would be beneficial to apply the optimization to GEPs with a scale of one but I doubt it'll have a measurable impact. From baldrick at free.fr Fri Feb 25 09:51:18 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Feb 2011 15:51:18 -0000 Subject: [llvm-commits] [dragonegg] r126484 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110225155118.F27E42A6C12C@llvm.org> Author: baldrick Date: Fri Feb 25 09:51:18 2011 New Revision: 126484 URL: http://llvm.org/viewvc/llvm-project?rev=126484&view=rev Log: Explain and clean the code used to have an inline asm define an SSA name. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126484&r1=126483&r2=126484&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Fri Feb 25 09:51:18 2011 @@ -6801,18 +6801,25 @@ if (NumChoices > 1) ChooseConstraintTuple(stmt, Constraints, NumChoices, StringStorage); + // HasSideEffects - Whether the LLVM inline asm should be marked as having + // side effects. + bool HasSideEffects = gimple_asm_volatile_p(stmt) || (NumOutputs == 0); + std::vector CallOps; std::vector CallArgTypes; std::string ConstraintStr; - bool HasSideEffects = gimple_asm_volatile_p(stmt) || (NumOutputs == 0); // StoreCallResultAddr - The pointer to store the result of the call through. SmallVector StoreCallResultAddrs; SmallVector CallResultTypes; SmallVector CallResultIsSigned; SmallVector, 4> OutputLocations; - SmallVector CallResultSSANames; - SmallVector CallResultSSATemps; + + // SSADefinitions - If the asm defines an SSA name then the SSA name and a + // memory location are recorded here. The asm result defining the SSA name + // will be stored to the memory memory location, and loaded out afterwards + // to define the SSA name. + SmallVector, 4> SSADefinitions; // Process outputs. for (unsigned i = 0; i != NumOutputs; ++i) { @@ -6864,8 +6871,7 @@ // load it out again later as the ssa name. DestValTy = ConvertType(TREE_TYPE(Operand)); MemRef TmpLoc = CreateTempLoc(DestValTy); - CallResultSSANames.push_back(Operand); - CallResultSSATemps.push_back(TmpLoc); + SSADefinitions.push_back(std::make_pair(Operand, TmpLoc)); Dest = LValue(TmpLoc); } else { Dest = EmitLV(Operand); @@ -7146,11 +7152,11 @@ } // If the call defined any ssa names, associate them with their value. - for (unsigned i = 0, e = CallResultSSANames.size(); i != e; ++i) { - tree Op = CallResultSSANames[i]; - Value *Val = LoadRegisterFromMemory(CallResultSSATemps[i], TREE_TYPE(Op), - Builder); - DefineSSAName(Op, Val); + for (unsigned i = 0, e = SSADefinitions.size(); i != e; ++i) { + tree Name = SSADefinitions[i].first; + MemRef Loc = SSADefinitions[i].second; + Value *Val = LoadRegisterFromMemory(Loc, TREE_TYPE(Name), Builder); + DefineSSAName(Name, Val); } // Give the backend a chance to upgrade the inline asm to LLVM code. This From rafael.espindola at gmail.com Fri Feb 25 10:17:14 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Fri, 25 Feb 2011 11:17:14 -0500 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: <3B27AD7C-DE66-4564-BA79-3C958D6D3E72@apple.com> References: <4D65DCFB.90205@gmail.com> <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> <4D67237B.6060306@gmail.com> <3B27AD7C-DE66-4564-BA79-3C958D6D3E72@apple.com> Message-ID: <4D67D60A.9040401@gmail.com> >> Doing llvm-link of all the IL files is about 3m if I remember >> correctly. > > Wow. Out of curiosity, is much of that time spent in type resolution > stuff? I expect that to disappear when the (post 2.9) type system > rewrite happens. I think we can make the "loading + linking" process > much faster :) Not sure. I did noticed that it looks like the merge is done two modules at a time with no state saved. It might be possible to save some time in there. Btw, I have seen the 3.0 planned type changes mentioned some times, but I don't know what they are in detail. Is there a doc somewhere? > Aha, very nice. That should be possible by just reusing a > memorybuffer or something. Yes, I just need a way to represent MemoryBuffers that are not NULL terminated :-) > Thanks for pushing LTO compile times forward! My pleasure! It is a really cool optimisation in itself, but what I am really excited is looking for optimisation opportunities in the large .bc files it produces. Trying to avoid startup relocations would be a big win for Firefox for example. > -Chris > Cheers, Rafael From zwarich at apple.com Fri Feb 25 10:30:33 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Fri, 25 Feb 2011 16:30:33 -0000 Subject: [llvm-commits] [llvm] r126488 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/PTX/ lib/Target/X86/ Message-ID: <20110225163033.3BF5D2A6C12C@llvm.org> Author: zwarich Date: Fri Feb 25 10:30:32 2011 New Revision: 126488 URL: http://llvm.org/viewvc/llvm-project?rev=126488&view=rev Log: Roll out r126425 and r126450 to see if it fixes the failures on the buildbots. Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCELFStreamer.cpp llvm/trunk/lib/MC/MCLoggingStreamer.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp llvm/trunk/lib/MC/MCNullStreamer.cpp llvm/trunk/lib/MC/MCPureStreamer.cpp llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp llvm/trunk/lib/MC/WinCOFFStreamer.cpp llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp llvm/trunk/lib/Target/X86/X86AsmBackend.cpp llvm/trunk/lib/Target/X86/X86FixupKinds.h llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Fri Feb 25 10:30:32 2011 @@ -239,11 +239,6 @@ /// EndCOFFSymbolDef - Marks the end of the symbol definition. virtual void EndCOFFSymbolDef() = 0; - /// EmitCOFFSecRel32 - Emits a COFF section relative relocation. - /// - /// @param Symbol - Symbol the section relative realocation should point to. - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) = 0; - /// EmitELFSize - Emit an ELF .size directive. /// /// This corresponds to an assembler statement such as: Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Fri Feb 25 10:30:32 2011 @@ -177,8 +177,9 @@ void AsmPrinter::EmitSectionOffset(const MCSymbol *Label, const MCSymbol *SectionLabel) const { // On COFF targets, we have to emit the special .secrel32 directive. - if (MAI->getDwarfSectionOffsetDirective()) { - OutStreamer.EmitCOFFSecRel32(Label); + if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) { + // FIXME: MCize. + OutStreamer.EmitRawText(SecOffDir + Twine(Label->getName())); return; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Fri Feb 25 10:30:32 2011 @@ -277,29 +277,6 @@ #endif //===----------------------------------------------------------------------===// -// DIESectionOffset Implementation -//===----------------------------------------------------------------------===// - -/// EmitValue - Emit label value. -/// -void DIESectionOffset::EmitValue(AsmPrinter *AP, unsigned Form) const { - AP->EmitSectionOffset (Label, Label); -} - -/// SizeOf - Determine size of label value in bytes. -/// -unsigned DIESectionOffset::SizeOf(AsmPrinter *AP, unsigned Form) const { - if (Form == dwarf::DW_FORM_data4) return 4; - return AP->getTargetData().getPointerSize(); -} - -#ifndef NDEBUG -void DIESectionOffset::print(raw_ostream &O) { - O << "SecRelLbl: " << Label->getName(); -} -#endif - -//===----------------------------------------------------------------------===// // DIEDelta Implementation //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Fri Feb 25 10:30:32 2011 @@ -333,36 +333,6 @@ }; //===--------------------------------------------------------------------===// - /// DIESectionOffset - A section relative label expression DIE. - // - class DIESectionOffset : public DIEValue { - const MCSymbol *Label; - public: - explicit DIESectionOffset(const MCSymbol *L) : DIEValue(isSectionOffset), - Label(L) {} - - /// EmitValue - Emit label value. - /// - virtual void EmitValue(AsmPrinter *AP, unsigned Form) const; - - /// getValue - Get MCSymbol. - /// - const MCSymbol *getValue() const { return Label; } - - /// SizeOf - Determine size of label value in bytes. - /// - virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const; - - // Implement isa/cast/dyncast. - static bool classof(const DIELabel *) { return true; } - static bool classof(const DIEValue *L) { return L->getType() == isSectionOffset; } - -#ifndef NDEBUG - virtual void print(raw_ostream &O); -#endif - }; - - //===--------------------------------------------------------------------===// /// DIEDelta - A simple label difference DIE. /// class DIEDelta : public DIEValue { Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Feb 25 10:30:32 2011 @@ -481,15 +481,6 @@ Die->addValue(Attribute, Form, Value); } -/// addSectionOffset - Add a Dwarf section relative label attribute data and -/// value. -/// -void DwarfDebug::addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, - const MCSymbol *Label) { - DIEValue *Value = new (DIEValueAllocator) DIESectionOffset(Label); - Die->addValue(Attribute, Form, Value); -} - /// addDelta - Add a label delta attribute data and value. /// void DwarfDebug::addDelta(DIE *Die, unsigned Attribute, unsigned Form, @@ -1913,8 +1904,8 @@ // DW_AT_stmt_list is a offset of line number information for this // compile unit in debug_line section. if (Asm->MAI->doesDwarfUsesAbsoluteLabelForStmtList()) - addSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, - Asm->GetTempSymbol("section_line")); + addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, + Asm->GetTempSymbol("section_line")); else addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Feb 25 10:30:32 2011 @@ -280,12 +280,6 @@ void addLabel(DIE *Die, unsigned Attribute, unsigned Form, const MCSymbol *Label); - /// addSectionOffset - Add a Dwarf section relative label attribute data and - /// value. - /// - void addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, - const MCSymbol *Label); - /// addDelta - Add a label delta attribute data and value. /// void addDelta(DIE *Die, unsigned Attribute, unsigned Form, Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original) +++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Fri Feb 25 10:30:32 2011 @@ -33,6 +33,5 @@ HasLEB128 = true; // Target asm supports leb128 directives (little-endian) SupportsDebugInformation = true; DwarfSectionOffsetDirective = "\t.secrel32\t"; - DwarfUsesAbsoluteLabelForStmtList = false; HasMicrosoftFastStdCallMangling = true; } Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -135,7 +135,6 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass); virtual void EmitCOFFSymbolType(int Type); virtual void EndCOFFSymbolDef(); - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment); @@ -385,11 +384,6 @@ EmitEOL(); } -void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) { - OS << "\t.secrel32\t" << *Symbol << '\n'; - EmitEOL(); -} - void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { assert(MAI.hasDotTypeDotSizeDirective()); OS << "\t.size\t" << *Symbol << ", " << *Value << '\n'; Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCELFStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCELFStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -108,10 +108,6 @@ assert(0 && "ELF doesn't support this directive"); } - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { - assert(0 && "ELF doesn't support this directive"); - } - virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); SD.setSize(Value); Modified: llvm/trunk/lib/MC/MCLoggingStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCLoggingStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCLoggingStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCLoggingStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -120,11 +120,6 @@ return Child->EndCOFFSymbolDef(); } - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { - LogCall("EndCOFFSymbolDef"); - return Child->EmitCOFFSecRel32(Symbol); - } - virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { LogCall("EmitELFSize"); return Child->EmitELFSize(Symbol, Value); Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -63,9 +63,6 @@ virtual void EndCOFFSymbolDef() { assert(0 && "macho doesn't support this directive"); } - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { - assert(0 && "macho doesn't support this directive"); - } virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { assert(0 && "macho doesn't support this directive"); } Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -54,7 +54,6 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass) {} virtual void EmitCOFFSymbolType(int Type) {} virtual void EndCOFFSymbolDef() {} - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {} virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Modified: llvm/trunk/lib/MC/MCPureStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCPureStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCPureStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -83,9 +83,6 @@ virtual void EndCOFFSymbolDef() { report_fatal_error("unsupported directive in pure streamer"); } - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { - report_fatal_error("unsupported directive in pure streamer"); - } virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { report_fatal_error("unsupported directive in pure streamer"); } Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Fri Feb 25 10:30:32 2011 @@ -705,10 +705,6 @@ else llvm_unreachable("unsupported relocation type"); break; - case X86::reloc_coff_secrel32: - Reloc.Data.Type = Is64Bit ? COFF::IMAGE_REL_AMD64_SREL32 - : COFF::IMAGE_REL_I386_SECREL; - break; default: llvm_unreachable("unsupported relocation type"); } Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original) +++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -31,9 +31,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" - -#include "../Target/X86/X86FixupKinds.h" - using namespace llvm; namespace { @@ -62,7 +59,6 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass); virtual void EmitCOFFSymbolType(int Type); virtual void EndCOFFSymbolDef(); - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment); @@ -294,16 +290,6 @@ CurSymbol = NULL; } -void WinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) -{ - MCDataFragment *DF = getOrCreateDataFragment(); - - DF->addFixup(MCFixup::Create(DF->getContents().size(), - MCSymbolRefExpr::Create (Symbol, getContext ()), - (MCFixupKind)X86::reloc_coff_secrel32)); - DF->getContents().resize(DF->getContents().size() + 4, 0); -} - void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { llvm_unreachable("not implemented"); } @@ -382,10 +368,6 @@ getCurrentSectionData()->setHasInstructions(true); - // Now that a machine instruction has been assembled into this section, make - // a line entry for any .loc directive that has been seen. - MCLineEntry::Make(this, getCurrentSection()); - MCInstFragment *Fragment = new MCInstFragment(Instruction, getCurrentSectionData()); Modified: llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp (original) +++ llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp Fri Feb 25 10:30:32 2011 @@ -124,7 +124,6 @@ virtual void EmitCOFFSymbolStorageClass(int StorageClass); virtual void EmitCOFFSymbolType(int Type); virtual void EndCOFFSymbolDef(); - virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment); @@ -278,8 +277,6 @@ void PTXMCAsmStreamer::EndCOFFSymbolDef() {} -void PTXMCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {} - void PTXMCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} void PTXMCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Modified: llvm/trunk/lib/Target/X86/X86AsmBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmBackend.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmBackend.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmBackend.cpp Fri Feb 25 10:30:32 2011 @@ -40,7 +40,6 @@ case X86::reloc_riprel_4byte_movq_load: case X86::reloc_signed_4byte: case X86::reloc_global_offset_table: - case X86::reloc_coff_secrel32: case FK_Data_4: return 2; case FK_PCRel_8: case FK_Data_8: return 3; @@ -70,8 +69,7 @@ { "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel }, { "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel}, { "reloc_signed_4byte", 0, 4 * 8, 0}, - { "reloc_global_offset_table", 0, 4 * 8, 0}, - { "reloc_coff_secrel32", 0, 4 * 8, 0} + { "reloc_global_offset_table", 0, 4 * 8, 0} }; if (Kind < FirstTargetFixupKind) Modified: llvm/trunk/lib/Target/X86/X86FixupKinds.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FixupKinds.h?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FixupKinds.h (original) +++ llvm/trunk/lib/Target/X86/X86FixupKinds.h Fri Feb 25 10:30:32 2011 @@ -23,8 +23,6 @@ reloc_global_offset_table, // 32-bit, relative to the start // of the instruction. Used only // for _GLOBAL_OFFSET_TABLE_. - reloc_coff_secrel32, // PE-COFF section relative 32 - // (only valid for win32 COFF) // Marker LastTargetFixupKind, NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=126488&r1=126487&r2=126488&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Fri Feb 25 10:30:32 2011 @@ -113,7 +113,4 @@ AssemblerDialect = AsmWriterFlavor; TextAlignFillValue = 0x90; - - // Debug Information - SupportsDebugInformation = true; } From dpatel at apple.com Fri Feb 25 10:42:34 2011 From: dpatel at apple.com (Devang Patel) Date: Fri, 25 Feb 2011 08:42:34 -0800 Subject: [llvm-commits] [llvm] r126425 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/PTX/ lib/Target/X86/ In-Reply-To: <5ED62500-4C99-4FFD-A6A1-BDBA3B2AEA01@apple.com> References: <20110224210400.8E73B2A6C12C@llvm.org> <5ED62500-4C99-4FFD-A6A1-BDBA3B2AEA01@apple.com> Message-ID: <7C85D484-351A-474B-B102-4BDAB92CA839@apple.com> On Feb 25, 2011, at 4:16 AM, Cameron Zwarich wrote: > There are some Dwarf-related failures on the bots at around the point this landed. I'm going to have to roll it out tomorrow and see if that fixes things. OK, feel free. - Devang > > Sent from my iPhone > > On Feb 24, 2011, at 1:04 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Thu Feb 24 15:04:00 2011 >> New Revision: 126425 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=126425&view=rev >> Log: >> Enable DebugInfo support for COFF object files. >> Patch by Nathan Jeffords! >> >> >> Modified: >> llvm/trunk/include/llvm/MC/MCStreamer.h >> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp >> llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp >> llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h >> llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp >> llvm/trunk/lib/MC/MCAsmStreamer.cpp >> llvm/trunk/lib/MC/MCELFStreamer.cpp >> llvm/trunk/lib/MC/MCLoggingStreamer.cpp >> llvm/trunk/lib/MC/MCMachOStreamer.cpp >> llvm/trunk/lib/MC/MCNullStreamer.cpp >> llvm/trunk/lib/MC/MCPureStreamer.cpp >> llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp >> llvm/trunk/lib/MC/WinCOFFStreamer.cpp >> llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp >> llvm/trunk/lib/Target/X86/X86AsmBackend.cpp >> llvm/trunk/lib/Target/X86/X86FixupKinds.h >> llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp >> >> Modified: llvm/trunk/include/llvm/MC/MCStreamer.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) >> +++ llvm/trunk/include/llvm/MC/MCStreamer.h Thu Feb 24 15:04:00 2011 >> @@ -239,6 +239,11 @@ >> /// EndCOFFSymbolDef - Marks the end of the symbol definition. >> virtual void EndCOFFSymbolDef() = 0; >> >> + /// EmitCOFFSecRel32 - Emits a COFF section relative relocation. >> + /// >> + /// @param Symbol - Symbol the section relative realocation should point to. >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) = 0; >> + >> /// EmitELFSize - Emit an ELF .size directive. >> /// >> /// This corresponds to an assembler statement such as: >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Thu Feb 24 15:04:00 2011 >> @@ -178,8 +178,7 @@ >> const MCSymbol *SectionLabel) const { >> // On COFF targets, we have to emit the special .secrel32 directive. >> if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) { >> - // FIXME: MCize. >> - OutStreamer.EmitRawText(SecOffDir + Twine(Label->getName())); >> + OutStreamer.EmitCOFFSecRel32(Label); >> return; >> } >> >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Thu Feb 24 15:04:00 2011 >> @@ -277,6 +277,29 @@ >> #endif >> >> //===----------------------------------------------------------------------===// >> +// DIESectionOffset Implementation >> +//===----------------------------------------------------------------------===// >> + >> +/// EmitValue - Emit label value. >> +/// >> +void DIESectionOffset::EmitValue(AsmPrinter *AP, unsigned Form) const { >> + AP->EmitSectionOffset (Label, Label); >> +} >> + >> +/// SizeOf - Determine size of label value in bytes. >> +/// >> +unsigned DIESectionOffset::SizeOf(AsmPrinter *AP, unsigned Form) const { >> + if (Form == dwarf::DW_FORM_data4) return 4; >> + return AP->getTargetData().getPointerSize(); >> +} >> + >> +#ifndef NDEBUG >> +void DIESectionOffset::print(raw_ostream &O) { >> + O << "SecRelLbl: " << Label->getName(); >> +} >> +#endif >> + >> +//===----------------------------------------------------------------------===// >> // DIEDelta Implementation >> //===----------------------------------------------------------------------===// >> >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Thu Feb 24 15:04:00 2011 >> @@ -333,6 +333,36 @@ >> }; >> >> //===--------------------------------------------------------------------===// >> + /// DIESectionOffset - A section relative label expression DIE. >> + // >> + class DIESectionOffset : public DIEValue { >> + const MCSymbol *Label; >> + public: >> + explicit DIESectionOffset(const MCSymbol *L) : DIEValue(isSectionOffset), >> + Label(L) {} >> + >> + /// EmitValue - Emit label value. >> + /// >> + virtual void EmitValue(AsmPrinter *AP, unsigned Form) const; >> + >> + /// getValue - Get MCSymbol. >> + /// >> + const MCSymbol *getValue() const { return Label; } >> + >> + /// SizeOf - Determine size of label value in bytes. >> + /// >> + virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const; >> + >> + // Implement isa/cast/dyncast. >> + static bool classof(const DIELabel *) { return true; } >> + static bool classof(const DIEValue *L) { return L->getType() == isSectionOffset; } >> + >> +#ifndef NDEBUG >> + virtual void print(raw_ostream &O); >> +#endif >> + }; >> + >> + //===--------------------------------------------------------------------===// >> /// DIEDelta - A simple label difference DIE. >> /// >> class DIEDelta : public DIEValue { >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Feb 24 15:04:00 2011 >> @@ -481,6 +481,15 @@ >> Die->addValue(Attribute, Form, Value); >> } >> >> +/// addSectionOffset - Add a Dwarf section relative label attribute data and >> +/// value. >> +/// >> +void DwarfDebug::addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, >> + const MCSymbol *Label) { >> + DIEValue *Value = new (DIEValueAllocator) DIESectionOffset(Label); >> + Die->addValue(Attribute, Form, Value); >> +} >> + >> /// addDelta - Add a label delta attribute data and value. >> /// >> void DwarfDebug::addDelta(DIE *Die, unsigned Attribute, unsigned Form, >> @@ -1904,8 +1913,8 @@ >> // DW_AT_stmt_list is a offset of line number information for this >> // compile unit in debug_line section. >> if (Asm->MAI->doesDwarfUsesAbsoluteLabelForStmtList()) >> - addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, >> - Asm->GetTempSymbol("section_line")); >> + addSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr, >> + Asm->GetTempSymbol("section_line")); >> else >> addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0); >> >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Feb 24 15:04:00 2011 >> @@ -280,6 +280,12 @@ >> void addLabel(DIE *Die, unsigned Attribute, unsigned Form, >> const MCSymbol *Label); >> >> + /// addSectionOffset - Add a Dwarf section relative label attribute data and >> + /// value. >> + /// >> + void addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, >> + const MCSymbol *Label); >> + >> /// addDelta - Add a label delta attribute data and value. >> /// >> void addDelta(DIE *Die, unsigned Attribute, unsigned Form, >> >> Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original) >> +++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Thu Feb 24 15:04:00 2011 >> @@ -33,5 +33,6 @@ >> HasLEB128 = true; // Target asm supports leb128 directives (little-endian) >> SupportsDebugInformation = true; >> DwarfSectionOffsetDirective = "\t.secrel32\t"; >> + DwarfUsesAbsoluteLabelForStmtList = false; >> HasMicrosoftFastStdCallMangling = true; >> } >> >> Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) >> +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -135,6 +135,7 @@ >> virtual void EmitCOFFSymbolStorageClass(int StorageClass); >> virtual void EmitCOFFSymbolType(int Type); >> virtual void EndCOFFSymbolDef(); >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); >> virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, >> unsigned ByteAlignment); >> @@ -384,6 +385,11 @@ >> EmitEOL(); >> } >> >> +void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) { >> + OS << "\t.secrel32\t" << *Symbol << '\n'; >> + EmitEOL(); >> +} >> + >> void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { >> assert(MAI.hasDotTypeDotSizeDirective()); >> OS << "\t.size\t" << *Symbol << ", " << *Value << '\n'; >> >> Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/MCELFStreamer.cpp (original) >> +++ llvm/trunk/lib/MC/MCELFStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -108,6 +108,10 @@ >> assert(0 && "ELF doesn't support this directive"); >> } >> >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { >> + assert(0 && "ELF doesn't support this directive"); >> + } >> + >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { >> MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); >> SD.setSize(Value); >> >> Modified: llvm/trunk/lib/MC/MCLoggingStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCLoggingStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/MCLoggingStreamer.cpp (original) >> +++ llvm/trunk/lib/MC/MCLoggingStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -120,6 +120,11 @@ >> return Child->EndCOFFSymbolDef(); >> } >> >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { >> + LogCall("EndCOFFSymbolDef"); >> + return Child->EmitCOFFSecRel32(Symbol); >> + } >> + >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { >> LogCall("EmitELFSize"); >> return Child->EmitELFSize(Symbol, Value); >> >> Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) >> +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -63,6 +63,9 @@ >> virtual void EndCOFFSymbolDef() { >> assert(0 && "macho doesn't support this directive"); >> } >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { >> + assert(0 && "macho doesn't support this directive"); >> + } >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { >> assert(0 && "macho doesn't support this directive"); >> } >> >> Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) >> +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -54,6 +54,7 @@ >> virtual void EmitCOFFSymbolStorageClass(int StorageClass) {} >> virtual void EmitCOFFSymbolType(int Type) {} >> virtual void EndCOFFSymbolDef() {} >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {} >> >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} >> virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, >> >> Modified: llvm/trunk/lib/MC/MCPureStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/MCPureStreamer.cpp (original) >> +++ llvm/trunk/lib/MC/MCPureStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -83,6 +83,9 @@ >> virtual void EndCOFFSymbolDef() { >> report_fatal_error("unsupported directive in pure streamer"); >> } >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) { >> + report_fatal_error("unsupported directive in pure streamer"); >> + } >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { >> report_fatal_error("unsupported directive in pure streamer"); >> } >> >> Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original) >> +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Thu Feb 24 15:04:00 2011 >> @@ -705,6 +705,10 @@ >> else >> llvm_unreachable("unsupported relocation type"); >> break; >> + case X86::reloc_coff_secrel32: >> + Reloc.Data.Type = Is64Bit ? COFF::IMAGE_REL_AMD64_SREL32 >> + : COFF::IMAGE_REL_I386_SECREL; >> + break; >> default: >> llvm_unreachable("unsupported relocation type"); >> } >> >> Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original) >> +++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -31,6 +31,9 @@ >> #include "llvm/Support/Debug.h" >> #include "llvm/Support/ErrorHandling.h" >> #include "llvm/Support/raw_ostream.h" >> + >> +#include "../Target/X86/X86FixupKinds.h" >> + >> using namespace llvm; >> >> namespace { >> @@ -59,6 +62,7 @@ >> virtual void EmitCOFFSymbolStorageClass(int StorageClass); >> virtual void EmitCOFFSymbolType(int Type); >> virtual void EndCOFFSymbolDef(); >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); >> virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, >> unsigned ByteAlignment); >> @@ -290,6 +294,16 @@ >> CurSymbol = NULL; >> } >> >> +void WinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) >> +{ >> + MCDataFragment *DF = getOrCreateDataFragment(); >> + >> + DF->addFixup(MCFixup::Create(DF->getContents().size(), >> + MCSymbolRefExpr::Create (Symbol, getContext ()), >> + (MCFixupKind)X86::reloc_coff_secrel32)); >> + DF->getContents().resize(DF->getContents().size() + 4, 0); >> +} >> + >> void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { >> llvm_unreachable("not implemented"); >> } >> @@ -368,6 +382,10 @@ >> >> getCurrentSectionData()->setHasInstructions(true); >> >> + // Now that a machine instruction has been assembled into this section, make >> + // a line entry for any .loc directive that has been seen. >> + MCLineEntry::Make(this, getCurrentSection()); >> + >> MCInstFragment *Fragment = >> new MCInstFragment(Instruction, getCurrentSectionData()); >> >> >> Modified: llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp (original) >> +++ llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp Thu Feb 24 15:04:00 2011 >> @@ -124,6 +124,7 @@ >> virtual void EmitCOFFSymbolStorageClass(int StorageClass); >> virtual void EmitCOFFSymbolType(int Type); >> virtual void EndCOFFSymbolDef(); >> + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); >> virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); >> virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, >> unsigned ByteAlignment); >> @@ -277,6 +278,8 @@ >> >> void PTXMCAsmStreamer::EndCOFFSymbolDef() {} >> >> +void PTXMCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {} >> + >> void PTXMCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} >> >> void PTXMCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, >> >> Modified: llvm/trunk/lib/Target/X86/X86AsmBackend.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmBackend.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86AsmBackend.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86AsmBackend.cpp Thu Feb 24 15:04:00 2011 >> @@ -40,6 +40,7 @@ >> case X86::reloc_riprel_4byte_movq_load: >> case X86::reloc_signed_4byte: >> case X86::reloc_global_offset_table: >> + case X86::reloc_coff_secrel32: >> case FK_Data_4: return 2; >> case FK_PCRel_8: >> case FK_Data_8: return 3; >> @@ -69,7 +70,8 @@ >> { "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel }, >> { "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel}, >> { "reloc_signed_4byte", 0, 4 * 8, 0}, >> - { "reloc_global_offset_table", 0, 4 * 8, 0} >> + { "reloc_global_offset_table", 0, 4 * 8, 0}, >> + { "reloc_coff_secrel32", 0, 4 * 8, 0} >> }; >> >> if (Kind < FirstTargetFixupKind) >> >> Modified: llvm/trunk/lib/Target/X86/X86FixupKinds.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FixupKinds.h?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86FixupKinds.h (original) >> +++ llvm/trunk/lib/Target/X86/X86FixupKinds.h Thu Feb 24 15:04:00 2011 >> @@ -23,6 +23,8 @@ >> reloc_global_offset_table, // 32-bit, relative to the start >> // of the instruction. Used only >> // for _GLOBAL_OFFSET_TABLE_. >> + reloc_coff_secrel32, // PE-COFF section relative 32 >> + // (only valid for win32 COFF) >> // Marker >> LastTargetFixupKind, >> NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind >> >> Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=126425&r1=126424&r2=126425&view=diff >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Thu Feb 24 15:04:00 2011 >> @@ -113,4 +113,7 @@ >> AssemblerDialect = AsmWriterFlavor; >> >> TextAlignFillValue = 0x90; >> + >> + // Debug Information >> + SupportsDebugInformation = true; >> } >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Fri Feb 25 10:43:47 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Feb 2011 16:43:47 -0000 Subject: [llvm-commits] [dragonegg] r126490 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110225164347.BC1212A6C12C@llvm.org> Author: baldrick Date: Fri Feb 25 10:43:47 2011 New Revision: 126490 URL: http://llvm.org/viewvc/llvm-project?rev=126490&view=rev Log: Comment and clean the handling of the result types of the asm call. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126490&r1=126489&r2=126490&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Fri Feb 25 10:43:47 2011 @@ -6807,14 +6807,20 @@ std::vector CallOps; std::vector CallArgTypes; - std::string ConstraintStr; // StoreCallResultAddr - The pointer to store the result of the call through. SmallVector StoreCallResultAddrs; - SmallVector CallResultTypes; - SmallVector CallResultIsSigned; + + // CallResultTypes - The inline asm call may return one or more results. The + // types of the results are recorded here along with a flag indicating whether + // the corresponding GCC type is signed. + SmallVector, 4> CallResultTypes; + SmallVector, 4> OutputLocations; + // ConstraintStr - The string of constraints in LLVM format. + std::string ConstraintStr; + // SSADefinitions - If the asm defines an SSA name then the SSA name and a // memory location are recorded here. The asm result defining the SSA name // will be stored to the memory memory location, and loaded out afterwards @@ -6883,8 +6889,8 @@ StoreCallResultAddrs.push_back(Dest.Ptr); ConstraintStr += ",="; ConstraintStr += SimplifiedConstraint; - CallResultTypes.push_back(DestValTy); - CallResultIsSigned.push_back(!TYPE_UNSIGNED(TREE_TYPE(Operand))); + bool IsSigned = !TYPE_UNSIGNED(TREE_TYPE(Operand)); + CallResultTypes.push_back(std::make_pair(DestValTy, IsSigned)); OutputLocations.push_back(std::make_pair(true, CallResultTypes.size()-1)); } else { ConstraintStr += ",=*"; @@ -6971,7 +6977,7 @@ // Indices here known to be within range. OutputIndex = OutputLocations[Match].second; if (OutputLocations[Match].first) - OTy = CallResultTypes[OutputIndex]; + OTy = CallResultTypes[OutputIndex].first; else { OTy = CallArgTypes[OutputIndex]; assert(OTy->isPointerTy() && "Expected pointer type!"); @@ -7006,7 +7012,7 @@ return; } else if (OTyBits > OpTyBits) { Op = CastToAnyType(Op, !TYPE_UNSIGNED(type), - OTy, CallResultIsSigned[OutputIndex]); + OTy, CallResultTypes[OutputIndex].second); if (BYTES_BIG_ENDIAN) { Constant *ShAmt = ConstantInt::get(Op->getType(), OTyBits-OpTyBits); @@ -7111,14 +7117,20 @@ } } + // Compute the return type to use for the asm call. const Type *CallResultType; switch (CallResultTypes.size()) { + // If there are no results then the return type is void! case 0: CallResultType = Type::getVoidTy(Context); break; - case 1: CallResultType = CallResultTypes[0]; break; + // If there is one result then use the result's type as the return type. + case 1: CallResultType = CallResultTypes[0].first; break; + // If the asm returns multiple results then create a struct type with the + // result types as its fields, and use it for the return type. default: - std::vector TmpVec(CallResultTypes.begin(), - CallResultTypes.end()); - CallResultType = StructType::get(Context, TmpVec); + std::vector Fields(CallResultTypes.size()); + for (unsigned i = 0, e = CallResultTypes.size(); i != e; ++i) + Fields[i] = CallResultTypes[i].first; + CallResultType = StructType::get(Context, Fields); break; } From daniel at zuster.org Fri Feb 25 10:45:24 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Feb 2011 16:45:24 -0000 Subject: [llvm-commits] [zorg] r126492 - /zorg/trunk/llvmlab/llvmlab/util.py Message-ID: <20110225164524.55AB72A6C12D@llvm.org> Author: ddunbar Date: Fri Feb 25 10:45:24 2011 New Revision: 126492 URL: http://llvm.org/viewvc/llvm-project?rev=126492&view=rev Log: llvmlab.util: Add multidict helper class. Modified: zorg/trunk/llvmlab/llvmlab/util.py Modified: zorg/trunk/llvmlab/llvmlab/util.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/util.py?rev=126492&r1=126491&r2=126492&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/util.py (original) +++ zorg/trunk/llvmlab/llvmlab/util.py Fri Feb 25 10:45:24 2011 @@ -1,5 +1,7 @@ import colorsys +__all__ = [] + class simple_repr_mixin(object): def __repr__(self): return "%s(%s)" % (self.__class__.__name__, @@ -17,4 +19,28 @@ v = 0.8 return colorsys.hsv_to_rgb(h,0.9+s*.1,v) -__all__ = [] +class multidict(object): + def __init__(self, elts=()): + self.data = {} + for key,value in elts: + self[key] = value + + def __contains__(self, item): + return item in self.data + def __getitem__(self, item): + return self.data[item] + def __setitem__(self, key, value): + if key in self.data: + self.data[key].append(value) + else: + self.data[key] = [value] + def items(self): + return self.data.items() + def values(self): + return self.data.values() + def keys(self): + return self.data.keys() + def __len__(self): + return len(self.data) + def get(self, key, default=None): + return self.data.get(key, default) From daniel at zuster.org Fri Feb 25 10:45:27 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Feb 2011 16:45:27 -0000 Subject: [llvm-commits] [zorg] r126493 - in /zorg/trunk/llvmlab/llvmlab/ui: ci/views.py templates/build_chart.html templates/buildbot_monitor.html Message-ID: <20110225164527.CBC5D2A6C12E@llvm.org> Author: ddunbar Date: Fri Feb 25 10:45:27 2011 New Revision: 126493 URL: http://llvm.org/viewvc/llvm-project?rev=126493&view=rev Log: llvmlab: Add a 'ci/build_chart' which shows a Gantt chart of where builds were done of the past N days. Added: zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html Modified: zorg/trunk/llvmlab/llvmlab/ui/ci/views.py zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html Modified: zorg/trunk/llvmlab/llvmlab/ui/ci/views.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/ci/views.py?rev=126493&r1=126492&r2=126493&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/ci/views.py (original) +++ zorg/trunk/llvmlab/llvmlab/ui/ci/views.py Fri Feb 25 10:45:27 2011 @@ -47,6 +47,70 @@ return render_template("buildbot_monitor.html", bb_status=current_app.config.status) + at ci.route('/build_chart') +def build_chart(): + import time + + # Determine the render constants. + k_days_data = int(request.args.get('days', 1)) + k_pixels_per_minute = float(request.args.get('pixels_per_minute', .5)) + + # Aggregate builds by slave, for completed builds within the desired time + # frame. + current_time = time.time() + builders = current_app.config.status.builders + slave_builders = util.multidict( + (build.slave, build) + for builds in builders.values() + for build in builds + if build.end_time is not None + if current_time - build.start_time < 60 * 60 * 24 * k_days_data) + + # Compute the build chart. + class ChartItem(object): + def __init__(self, build, color, left, width): + self.build = build + self.color = color + self.left = left + self.width = width + builder_colors = dict((name, util.make_dark_color(float(i) / len(builders))) + for i,name in enumerate(builders)) + build_chart_data = {} + max_x = 0 + min_time = min(build.start_time + for builds in slave_builders.values() + for build in builds) + for slave, builders in slave_builders.items(): + # Order the builders by time. + builders.sort(key = lambda b: b.start_time) + + # Aggregate builds by builder type. + builds_by_type = util.multidict( + (build.name, build) + for build in builders) + + # Create the char items. + rows = [] + for name,builds in util.sorted(builds_by_type.items()): + color = builder_colors[name] + hex_color = '%02x%02x%02x' % tuple(int(x*255) + for x in color) + rows.append([]) + for build in builds: + elapsed = build.end_time - build.start_time + width = max(1, int(k_pixels_per_minute * elapsed / 60)) + left = int(k_pixels_per_minute * + (build.start_time - min_time) / 60) + max_x = max(max_x, left + width) + rows[-1].append(ChartItem(build, hex_color, left, width)) + build_chart_data[slave] = rows + + build_chart = { 'data' : build_chart_data, + 'max_x' : max_x } + return render_template("build_chart.html", + bb_status = current_app.config.status, + build_chart = build_chart) + @ci.route('/phase_description/') def phase_description(index): cfg = current_app.config.summary.config Added: zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html?rev=126493&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html (added) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html Fri Feb 25 10:45:27 2011 @@ -0,0 +1,64 @@ +{% extends "layout.html" %} +{% block title %}build chart{% endblock %} +{% block head %} + +{% endblock %} +{% block body %} + +

Build Chart

+ + +{% for slave,builds in build_chart.data|dictsort %} + + + + +{% endfor %} +
{{ slave }} + + {% for row in builds %} + + + + {% endfor %} +
+
+ {% for item in row %} + +
+ {% endfor %} +
+
+ +{% endblock %} Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html?rev=126493&r1=126492&r2=126493&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html (original) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html Fri Feb 25 10:45:27 2011 @@ -18,6 +18,7 @@ Result Start Time End Time + Slave {% for build in builds %} @@ -27,6 +28,7 @@ {{ build.result }} {{ build.start_time }} {{ build.end_time }} + {{ build.slave }} {% endfor %} From jan_sjodin at yahoo.com Fri Feb 25 11:02:40 2011 From: jan_sjodin at yahoo.com (Jan Sjodin) Date: Fri, 25 Feb 2011 09:02:40 -0800 (PST) Subject: [llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp Message-ID: <960821.36942.qm@web55604.mail.re4.yahoo.com> Removed duplicated code by putting shared functions in MCELF.h/cpp and made the rest of the C-style static functions static methods in the corresponding classes. - Jan -------------- next part -------------- A non-text attachment was scrubbed... Name: 0038_mcelf.patch Type: application/octet-stream Size: 20973 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/40f5aced/attachment.obj From evan.cheng at apple.com Fri Feb 25 11:25:57 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Feb 2011 09:25:57 -0800 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: References: <20110224224612.21E8B2A6C12C@llvm.org> <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> Message-ID: On Feb 25, 2011, at 7:26 AM, Benjamin Kramer wrote: > > On 25.02.2011, at 08:14, Evan Cheng wrote: > >> Speculation is nice, but I would feel a lot better if there are hard numbers to back this up. Are we sure these changes are improving performance? > > My unscientific test case (gcc compiled with clang -O3 parsing itself) showed a 0.25% speedup with the original patch (all-constant GEPs only, median of 5 runs, i386, penryn). I just retested with the change Frits suggested and it slowed down ~0.6% compared to the original run so I reverted it. Thanks. What tests are you using to evaluate this? Evan > > I didn't test if it would be beneficial to apply the optimization to GEPs with a scale of one but I doubt it'll have a measurable impact. From benny.kra at googlemail.com Fri Feb 25 11:48:40 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Fri, 25 Feb 2011 18:48:40 +0100 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: References: <20110224224612.21E8B2A6C12C@llvm.org> <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> Message-ID: On 25.02.2011, at 18:25, Evan Cheng wrote: > > On Feb 25, 2011, at 7:26 AM, Benjamin Kramer wrote: > >> >> On 25.02.2011, at 08:14, Evan Cheng wrote: >> >>> Speculation is nice, but I would feel a lot better if there are hard numbers to back this up. Are we sure these changes are improving performance? >> >> My unscientific test case (gcc compiled with clang -O3 parsing itself) showed a 0.25% speedup with the original patch (all-constant GEPs only, median of 5 runs, i386, penryn). I just retested with the change Frits suggested and it slowed down ~0.6% compared to the original run so I reverted it. > > Thanks. What tests are you using to evaluate this? I routinely use the nice C files from http://people.csail.mit.edu/smcc/projects/single-file-programs/ which are easy to handle and large enough to get meaningful results for both compile time and run time. They're extracted from programs that are also part of SPEC CINT, so I'm confident the improvements will also show up there :) From justin.holewinski at gmail.com Fri Feb 25 07:38:40 2011 From: justin.holewinski at gmail.com (Justin Holewinski) Date: Fri, 25 Feb 2011 08:38:40 -0500 Subject: [llvm-commits] [PATCH] PTX Backend: Add basic f32 support Message-ID: This patch adds preliminary 32-bit floating-point support to the PTX Backend. Floating-point add, sub, and mul instructions can now be emitted, with the appropriate infrastructure to support the .f32 type in PTX. I have also added updated test cases for all of the added functionality. As this is my first patch submitted to the list, please let me know if I am missing anything important needed for this patch to be accepted. :) -- Thanks, Justin Holewinski -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/c88bdad8/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: ptx-f32-prelim.patch Type: text/x-patch Size: 18624 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/c88bdad8/attachment.bin From daniel at zuster.org Fri Feb 25 10:45:22 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Feb 2011 16:45:22 -0000 Subject: [llvm-commits] [zorg] r126491 - /zorg/trunk/llvmlab/llvmlab/ci/status.py Message-ID: <20110225164522.0D2452A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 25 10:45:21 2011 New Revision: 126491 URL: http://llvm.org/viewvc/llvm-project?rev=126491&view=rev Log: llvmlab.ci.status: Track build slave information. Modified: zorg/trunk/llvmlab/llvmlab/ci/status.py Modified: zorg/trunk/llvmlab/llvmlab/ci/status.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ci/status.py?rev=126491&r1=126490&r2=126491&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ci/status.py (original) +++ zorg/trunk/llvmlab/llvmlab/ci/status.py Fri Feb 25 10:45:21 2011 @@ -14,29 +14,36 @@ @staticmethod def fromdata(data): version = data['version'] - if version != 0: + if version not in (0, 1): raise ValueError, "Unknown version" + if version == 0: + slave = None + else: + slave = data['slave'] return BuildStatus(data['name'], data['number'], data['source_stamp'], - data['result'], data['start_time'], data['end_time']) + data['result'], data['start_time'], data['end_time'], + slave) def todata(self): - return { 'version' : 0, + return { 'version' : 1, 'name' : self.name, 'number' : self.number, 'source_stamp' : self.source_stamp, 'result' : self.result, 'start_time' : self.start_time, - 'end_time' : self.end_time } + 'end_time' : self.end_time, + 'slave' : self.slave } def __init__(self, name, number, source_stamp, - result, start_time, end_time): + result, start_time, end_time, slave): self.name = name self.number = number self.source_stamp = source_stamp self.result = result self.start_time = start_time self.end_time = end_time + self.slave = slave class StatusMonitor(threading.Thread): def __init__(self, app, status): @@ -97,7 +104,8 @@ add_build = False if build is None: add_build = True - build = BuildStatus(name, id, None, None, None, None) + build = BuildStatus(name, id, None, None, None, None, + None) # Get the build information. try: @@ -111,6 +119,7 @@ build.source_stamp = res['sourceStamp']['revision'] build.start_time = res['times'][0] build.end_time = res['times'][1] + build.slave = res['slave'] if add_build: # Add to the builds list, maintaining order. From resistor at mac.com Fri Feb 25 12:35:42 2011 From: resistor at mac.com (Owen Anderson) Date: Fri, 25 Feb 2011 10:35:42 -0800 Subject: [llvm-commits] [llvm] r126426 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOCodeGenerator.h lto.cpp In-Reply-To: <20110224210406.87C712A6C12D@llvm.org> References: <20110224210406.87C712A6C12D@llvm.org> Message-ID: <8D0F51AA-584B-43ED-BAE2-5E19B858BA3F@mac.com> Should this apply to all targets, or only the same ones for which -integrated-as is the default? --Owen On Feb 24, 2011, at 1:04 PM, Rafael Espindola wrote: > Author: rafael > Date: Thu Feb 24 15:04:06 2011 > New Revision: 126426 > > URL: http://llvm.org/viewvc/llvm-project?rev=126426&view=rev > Log: > Switch LTO to use MC. This takes the linking of libxul.so from about 7m to > 6m30. > > Modified: > llvm/trunk/tools/lto/LTOCodeGenerator.cpp > llvm/trunk/tools/lto/LTOCodeGenerator.h > llvm/trunk/tools/lto/lto.cpp > > Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=126426&r1=126425&r2=126426&view=diff > ============================================================================== > --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) > +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu Feb 24 15:04:06 2011 > @@ -71,10 +71,11 @@ > _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL), > _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false), > _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC), > - _nativeObjectFile(NULL), _assemblerPath(NULL) > + _nativeObjectFile(NULL) > { > InitializeAllTargets(); > InitializeAllAsmPrinters(); > + InitializeAllAsmParsers(); > } > > LTOCodeGenerator::~LTOCodeGenerator() > @@ -126,21 +127,6 @@ > _mCpu = mCpu; > } > > -void LTOCodeGenerator::setAssemblerPath(const char* path) > -{ > - if ( _assemblerPath ) > - delete _assemblerPath; > - _assemblerPath = new sys::Path(path); > -} > - > -void LTOCodeGenerator::setAssemblerArgs(const char** args, int nargs) > -{ > - for (int i = 0; i < nargs; ++i) { > - const char *arg = args[i]; > - _assemblerArgs.push_back(arg); > - } > -} > - > void LTOCodeGenerator::addMustPreserveSymbol(const char* sym) > { > _mustPreserveSymbols[sym] = 1; > @@ -183,55 +169,42 @@ > > const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) > { > - // make unique temp .s file to put generated assembly code > - sys::Path uniqueAsmPath("lto-llvm.s"); > - if ( uniqueAsmPath.createTemporaryFileOnDisk(false, &errMsg) ) > - return NULL; > - sys::RemoveFileOnSignal(uniqueAsmPath); > - > - // generate assembly code > - bool genResult = false; > - { > - tool_output_file asmFile(uniqueAsmPath.c_str(), errMsg); > - if (!errMsg.empty()) > - return NULL; > - genResult = this->generateAssemblyCode(asmFile.os(), errMsg); > - asmFile.os().close(); > - if (asmFile.os().has_error()) { > - asmFile.os().clear_error(); > - return NULL; > - } > - asmFile.keep(); > - } > - if ( genResult ) { > - uniqueAsmPath.eraseFromDisk(); > - return NULL; > - } > - > // make unique temp .o file to put generated object file > sys::PathWithStatus uniqueObjPath("lto-llvm.o"); > if ( uniqueObjPath.createTemporaryFileOnDisk(false, &errMsg) ) { > - uniqueAsmPath.eraseFromDisk(); > + uniqueObjPath.eraseFromDisk(); > return NULL; > } > sys::RemoveFileOnSignal(uniqueObjPath); > > - // assemble the assembly code > - const std::string& uniqueObjStr = uniqueObjPath.str(); > - bool asmResult = this->assemble(uniqueAsmPath.str(), uniqueObjStr, errMsg); > - if ( !asmResult ) { > - // remove old buffer if compile() called twice > - delete _nativeObjectFile; > - > - // read .o file into memory buffer > - OwningPtr BuffPtr; > - if (error_code ec = MemoryBuffer::getFile(uniqueObjStr.c_str(),BuffPtr)) > - errMsg = ec.message(); > - _nativeObjectFile = BuffPtr.take(); > + // generate object file > + bool genResult = false; > + tool_output_file objFile(uniqueObjPath.c_str(), errMsg); > + if (!errMsg.empty()) > + return NULL; > + genResult = this->generateObjectFile(objFile.os(), errMsg); > + objFile.os().close(); > + if (objFile.os().has_error()) { > + objFile.os().clear_error(); > + return NULL; > + } > + objFile.keep(); > + if ( genResult ) { > + uniqueObjPath.eraseFromDisk(); > + return NULL; > } > > + const std::string& uniqueObjStr = uniqueObjPath.str(); > + // remove old buffer if compile() called twice > + delete _nativeObjectFile; > + > + // read .o file into memory buffer > + OwningPtr BuffPtr; > + if (error_code ec = MemoryBuffer::getFile(uniqueObjStr.c_str(),BuffPtr)) > + errMsg = ec.message(); > + _nativeObjectFile = BuffPtr.take(); > + > // remove temp files > - uniqueAsmPath.eraseFromDisk(); > uniqueObjPath.eraseFromDisk(); > > // return buffer, unless error > @@ -241,67 +214,6 @@ > return _nativeObjectFile->getBufferStart(); > } > > - > -bool LTOCodeGenerator::assemble(const std::string& asmPath, > - const std::string& objPath, std::string& errMsg) > -{ > - sys::Path tool; > - bool needsCompilerOptions = true; > - if ( _assemblerPath ) { > - tool = *_assemblerPath; > - needsCompilerOptions = false; > - } else { > - // find compiler driver > - tool = sys::Program::FindProgramByName("gcc"); > - if ( tool.isEmpty() ) { > - errMsg = "can't locate gcc"; > - return true; > - } > - } > - > - // build argument list > - std::vector args; > - llvm::Triple targetTriple(_linker.getModule()->getTargetTriple()); > - const char *arch = targetTriple.getArchNameForAssembler(); > - > - args.push_back(tool.c_str()); > - > - if (targetTriple.getOS() == Triple::Darwin) { > - // darwin specific command line options > - if (arch != NULL) { > - args.push_back("-arch"); > - args.push_back(arch); > - } > - // add -static to assembler command line when code model requires > - if ( (_assemblerPath != NULL) && > - (_codeModel == LTO_CODEGEN_PIC_MODEL_STATIC) ) > - args.push_back("-static"); > - } > - if ( needsCompilerOptions ) { > - args.push_back("-c"); > - args.push_back("-x"); > - args.push_back("assembler"); > - } else { > - for (std::vector::iterator I = _assemblerArgs.begin(), > - E = _assemblerArgs.end(); I != E; ++I) { > - args.push_back(I->c_str()); > - } > - } > - args.push_back("-o"); > - args.push_back(objPath.c_str()); > - args.push_back(asmPath.c_str()); > - args.push_back(0); > - > - // invoke assembler > - if ( sys::Program::ExecuteAndWait(tool, &args[0], 0, 0, 0, 0, &errMsg) ) { > - errMsg = "error in assembly"; > - return true; > - } > - return false; // success > -} > - > - > - > bool LTOCodeGenerator::determineTarget(std::string& errMsg) > { > if ( _target == NULL ) { > @@ -385,8 +297,8 @@ > } > > /// Optimize merged modules using various IPO passes > -bool LTOCodeGenerator::generateAssemblyCode(raw_ostream& out, > - std::string& errMsg) > +bool LTOCodeGenerator::generateObjectFile(raw_ostream& out, > + std::string& errMsg) > { > if ( this->determineTarget(errMsg) ) > return true; > @@ -423,7 +335,7 @@ > formatted_raw_ostream Out(out); > > if (_target->addPassesToEmitFile(*codeGenPasses, Out, > - TargetMachine::CGFT_AssemblyFile, > + TargetMachine::CGFT_ObjectFile, > CodeGenOpt::Aggressive)) { > errMsg = "target file type not supported"; > return true; > > Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=126426&r1=126425&r2=126426&view=diff > ============================================================================== > --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) > +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Thu Feb 24 15:04:06 2011 > @@ -37,18 +37,14 @@ > bool setDebugInfo(lto_debug_model, std::string& errMsg); > bool setCodePICModel(lto_codegen_model, std::string& errMsg); > void setCpu(const char *cpu); > - void setAssemblerPath(const char* path); > - void setAssemblerArgs(const char** args, int nargs); > void addMustPreserveSymbol(const char* sym); > bool writeMergedModules(const char* path, > std::string& errMsg); > const void* compile(size_t* length, std::string& errMsg); > void setCodeGenDebugOptions(const char *opts); > private: > - bool generateAssemblyCode(llvm::raw_ostream& out, > - std::string& errMsg); > - bool assemble(const std::string& asmPath, > - const std::string& objPath, std::string& errMsg); > + bool generateObjectFile(llvm::raw_ostream& out, > + std::string& errMsg); > void applyScopeRestrictions(); > bool determineTarget(std::string& errMsg); > > @@ -63,9 +59,7 @@ > StringSet _mustPreserveSymbols; > llvm::MemoryBuffer* _nativeObjectFile; > std::vector _codegenOptions; > - llvm::sys::Path* _assemblerPath; > std::string _mCpu; > - std::vector _assemblerArgs; > }; > > #endif // LTO_CODE_GENERATOR_H > > Modified: llvm/trunk/tools/lto/lto.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=126426&r1=126425&r2=126426&view=diff > ============================================================================== > --- llvm/trunk/tools/lto/lto.cpp (original) > +++ llvm/trunk/tools/lto/lto.cpp Thu Feb 24 15:04:06 2011 > @@ -231,7 +231,7 @@ > // > void lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path) > { > - cg->setAssemblerPath(path); > + // In here only for backwards compatibility. We use MC now. > } > > > @@ -241,7 +241,7 @@ > void lto_codegen_set_assembler_args(lto_code_gen_t cg, const char** args, > int nargs) > { > - cg->setAssemblerArgs(args, nargs); > + // In here only for backwards compatibility. We use MC now. > } > > // > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gkistanova at gmail.com Fri Feb 25 13:01:40 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Fri, 25 Feb 2011 11:01:40 -0800 Subject: [llvm-commits] Possible bug - starting from the revion 124059 llvm-gcc cross to ARM build failing with the ld.exe crash In-Reply-To: <4D672101.7030207@gmail.com> References: <4D66165D.909@free.fr> <4D672101.7030207@gmail.com> Message-ID: TotT builds OK now. Here is builder with this configuration: http://google1.osuosl.org:8011/builders/llvm-gcc-mingw32-cross-arm-linux-gnueabi-hard-float Thanks Galina 2011/2/24 Rafael ?vila de Esp?ndola : > On 2011-02-24 20:34, Galina Kistanova wrote: >>> This commit looks like it can be reverted independently. >>> Galina, does reverting it fix the problem? >> >> Yes, after reverting tot builds OK. > > Can you build without reverting by syncing past 126421? > >> Thanks >> >> Galina > > Cheers, > Rafael > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From rafael.espindola at gmail.com Fri Feb 25 13:09:12 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Fri, 25 Feb 2011 14:09:12 -0500 Subject: [llvm-commits] [llvm] r126426 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOCodeGenerator.h lto.cpp In-Reply-To: <8D0F51AA-584B-43ED-BAE2-5E19B858BA3F@mac.com> References: <20110224210406.87C712A6C12D@llvm.org> <8D0F51AA-584B-43ED-BAE2-5E19B858BA3F@mac.com> Message-ID: <4D67FE58.9010008@gmail.com> On 11-02-25 01:35 PM, Owen Anderson wrote: > Should this apply to all targets, or only the same ones for which -integrated-as is the default? Do you have a target for which you need LTO but MC is not working yet? This patch was intended as a stepping stone for requiring MC for finding definitions and uses in global asm, so if there is still a target with no MC that needs LTO, it is probably better to just revert this for now :-( > --Owen Cheers, Rafael From sabre at nondot.org Fri Feb 25 13:06:35 2011 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Feb 2011 19:06:35 -0000 Subject: [llvm-commits] [llvm] r126500 - in /llvm/trunk/test/MC: ARM/bracket-exprs.s ELF/bracket-exprs.s Message-ID: <20110225190635.C3B312A6C12C@llvm.org> Author: lattner Date: Fri Feb 25 13:06:35 2011 New Revision: 126500 URL: http://llvm.org/viewvc/llvm-project?rev=126500&view=rev Log: split this test into arch specific pieces, so the ARM test isn't run when the arm backend isn't built. This fixes PR9327 Added: llvm/trunk/test/MC/ARM/bracket-exprs.s Modified: llvm/trunk/test/MC/ELF/bracket-exprs.s Added: llvm/trunk/test/MC/ARM/bracket-exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/bracket-exprs.s?rev=126500&view=auto ============================================================================== --- llvm/trunk/test/MC/ARM/bracket-exprs.s (added) +++ llvm/trunk/test/MC/ARM/bracket-exprs.s Fri Feb 25 13:06:35 2011 @@ -0,0 +1,15 @@ +// RUN: llvm-mc -triple arm-unknown-linux %s | FileCheck %s + +// CHECK: .byte 1 +.if [~0 >> 1] == -1 +.byte 1 +.else +.byte 2 +.endif + +// CHECK: .byte 3 +.if 4 * [4 + (3 + [2 * 2] + 1)] == 48 +.byte 3 +.else +.byte 4 +.endif Modified: llvm/trunk/test/MC/ELF/bracket-exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/bracket-exprs.s?rev=126500&r1=126499&r2=126500&view=diff ============================================================================== --- llvm/trunk/test/MC/ELF/bracket-exprs.s (original) +++ llvm/trunk/test/MC/ELF/bracket-exprs.s Fri Feb 25 13:06:35 2011 @@ -1,5 +1,4 @@ // RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s -// RUN: llvm-mc -triple arm-unknown-linux %s | FileCheck %s // CHECK: .byte 1 .if [~0 >> 1] == -1 From resistor at mac.com Fri Feb 25 13:18:52 2011 From: resistor at mac.com (Owen Anderson) Date: Fri, 25 Feb 2011 11:18:52 -0800 Subject: [llvm-commits] [llvm] r126426 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOCodeGenerator.h lto.cpp In-Reply-To: <4D67FE58.9010008@gmail.com> References: <20110224210406.87C712A6C12D@llvm.org> <8D0F51AA-584B-43ED-BAE2-5E19B858BA3F@mac.com> <4D67FE58.9010008@gmail.com> Message-ID: <54BBC0F6-E4D8-439A-B233-EF4FEE08B915@mac.com> On Feb 25, 2011, at 11:09 AM, Rafael Avila de Espindola wrote: > On 11-02-25 01:35 PM, Owen Anderson wrote: >> Should this apply to all targets, or only the same ones for which -integrated-as is the default? > > Do you have a target for which you need LTO but MC is not working yet? This patch was intended as a stepping stone for requiring MC for finding definitions and uses in global asm, so if there is still a target with no MC that needs LTO, it is probably better to just revert this for now :-( There are shipping LLVM compilers with LTO support that target ARM, but ARM MC is not 100% functional yet. That said, this does make sense. My point was just that it should be enabled by default on a per-target basis, just like clang's -integrated-as is. --Owen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/4abae506/attachment.html From rafael.espindola at gmail.com Fri Feb 25 13:24:52 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Fri, 25 Feb 2011 14:24:52 -0500 Subject: [llvm-commits] [llvm] r126426 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOCodeGenerator.h lto.cpp In-Reply-To: <54BBC0F6-E4D8-439A-B233-EF4FEE08B915@mac.com> References: <20110224210406.87C712A6C12D@llvm.org> <8D0F51AA-584B-43ED-BAE2-5E19B858BA3F@mac.com> <4D67FE58.9010008@gmail.com> <54BBC0F6-E4D8-439A-B233-EF4FEE08B915@mac.com> Message-ID: <4D680204.2080102@gmail.com> > There are shipping LLVM compilers with LTO support that target ARM, but > ARM MC is not 100% functional yet. > > That said, this /does/ make sense. My point was just that it should be > enabled by default on a per-target basis, just like clang's > -integrated-as is. Well, the problem is that I should soon replace the .globl grepping with a custom streamer, so it doesn't make a lot of sense to require a working asm parser in libLTO and not use it while producing .o files. If this is an off tree compiler, it is probably reasonable to ask them to just not pull this patch, no? > --Owen Cheers, Rafael From jan_sjodin at yahoo.com Fri Feb 25 13:37:26 2011 From: jan_sjodin at yahoo.com (Jan Sjodin) Date: Fri, 25 Feb 2011 11:37:26 -0800 (PST) Subject: [llvm-commits] Change DwarfUsesAbsoluteLabelForStmtList to false for X86ELFMCAsmInfo. Message-ID: <133510.39411.qm@web55604.mail.re4.yahoo.com> Dwarfdump gives an error and gdb fails when generating code in memory (but happens to accept it in a .o file) in Linux when DwarfUsesAbsoluteLabelForStmtList = true, this patch sets it to false to fix this issue. I don't know if this is true for other targets, but the change is limited to X86ELFMCAsmInfo. - Jan -------------- next part -------------- A non-text attachment was scrubbed... Name: 0039_dwarflabel.patch Type: application/octet-stream Size: 449 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/02087c56/attachment.obj From rafael.espindola at gmail.com Fri Feb 25 13:46:10 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Fri, 25 Feb 2011 14:46:10 -0500 Subject: [llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp In-Reply-To: <960821.36942.qm@web55604.mail.re4.yahoo.com> References: <960821.36942.qm@web55604.mail.re4.yahoo.com> Message-ID: <4D680702.2040101@gmail.com> On 11-02-25 12:02 PM, Jan Sjodin wrote: > Removed duplicated code by putting shared functions in MCELF.h/cpp and made the > rest of the C-style static functions static methods in the corresponding > classes. Moving the duplicated functions to a new file is OK, but why convert the function only used in the ELFObjectWriter to static methods? > - Jan Cheers, Rafael From jan_sjodin at yahoo.com Fri Feb 25 14:05:02 2011 From: jan_sjodin at yahoo.com (Jan Sjodin) Date: Fri, 25 Feb 2011 12:05:02 -0800 (PST) Subject: [llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp In-Reply-To: <4D680702.2040101@gmail.com> References: <960821.36942.qm@web55604.mail.re4.yahoo.com> <4D680702.2040101@gmail.com> Message-ID: <470208.84552.qm@web55602.mail.re4.yahoo.com> Just to keep the code more object-oriented. If a sub-class (I intend to inherit from these classes) needs the functions, they will not be available if they are hidden as static functions. - Jan ----- Original Message ---- > From: Rafael Avila de Espindola > To: llvm-commits at cs.uiuc.edu > Sent: Fri, February 25, 2011 2:46:10 PM > Subject: Re: [llvm-commits] Code refactoring of MCELFStreamer.cpp and >ELFObjectWriter.cpp > > On 11-02-25 12:02 PM, Jan Sjodin wrote: > > Removed duplicated code by putting shared functions in MCELF.h/cpp and made >the > > rest of the C-style static functions static methods in the corresponding > > classes. > > Moving the duplicated functions to a new file is OK, but why convert the > function only used in the ELFObjectWriter to static methods? > > > - Jan > > Cheers, > Rafael > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dimitry at andric.com Fri Feb 25 14:21:21 2011 From: dimitry at andric.com (Dimitry Andric) Date: Fri, 25 Feb 2011 21:21:21 +0100 Subject: [llvm-commits] [patch] Fix getDriver().getInstalledDir() comparisons Message-ID: <4D680F41.1070008@andric.com> Since getDriver().getInstalledDir() returns a const char *, don't try to compare it with getDriver().Dir.c_str(), since that is a pointer comparison, not a "are these strings equal" comparison. Instead, just compare with getDriver().Dir directly, so both sides will get promoted to std::string, and the regular std::string comparison operator applies. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: clang-driver-dir-1.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/8c7710aa/attachment.pl From dimitry at andric.com Fri Feb 25 14:21:30 2011 From: dimitry at andric.com (Dimitry Andric) Date: Fri, 25 Feb 2011 21:21:30 +0100 Subject: [llvm-commits] [patch] Set default CPU on FreeBSD Message-ID: <4D680F4A.7040402@andric.com> The default CPU on FreeBSD for 32-bit should be i486, not pentium4. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: clang-freebsd-defcpu-1.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/fbf69efe/attachment.pl From dimitry at andric.com Fri Feb 25 14:21:35 2011 From: dimitry at andric.com (Dimitry Andric) Date: Fri, 25 Feb 2011 21:21:35 +0100 Subject: [llvm-commits] [patch] Don't add /usr/local/include to default include path on FreeBSD Message-ID: <4D680F4F.4090403@andric.com> On FreeBSD, make sure /usr/local/include is *not* in the default include path. This avoids accidentally including the wrong headers. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: clang-freebsd-nolocal-1.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/c8015ada/attachment.pl From dimitry at andric.com Fri Feb 25 14:21:40 2011 From: dimitry at andric.com (Dimitry Andric) Date: Fri, 25 Feb 2011 21:21:40 +0100 Subject: [llvm-commits] [patch] Cleanup FilePaths and ProgramPaths for FreeBSD Message-ID: <4D680F54.3040009@andric.com> On FreeBSD, we don't want 'getDriver().Dir + "/../lib"' added to the ToolChain's FilePaths. If clang is installed as a port in /usr/local, it is *not* supposed to use /usr/local/lib by default, for example. Additionally, there are no clang-related executables in either /usr/libexec, or getDriver().Dir + "/../libexec", anymore, so remove that from the ToolChain's ProgramPaths. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: clang-freebsd-tcpaths-1.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/ba23c9f6/attachment.pl From dimitry at andric.com Fri Feb 25 14:21:48 2011 From: dimitry at andric.com (Dimitry Andric) Date: Fri, 25 Feb 2011 21:21:48 +0100 Subject: [llvm-commits] [patch] Fix library path on linker command line for FreeBSD Message-ID: <4D680F5C.2070006@andric.com> For linking on FreeBSD, don't add a hardcoded "-L/usr/lib", but retrieve the library paths from the ToolChain object instead. Copy the relevant code from linuxtools::Link::ConstructJob(), and replace the std::string stuff with llvm::StringRef, while we're here. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: clang-freebsd-libpath-1.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/65642b91/attachment.pl From gkistanova at gmail.com Fri Feb 25 14:22:42 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Fri, 25 Feb 2011 20:22:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r126506 - /llvm-gcc-4.2/trunk/extras/build-self-4-mingw32 Message-ID: <20110225202242.327612A6C12C@llvm.org> Author: gkistanova Date: Fri Feb 25 14:22:42 2011 New Revision: 126506 URL: http://llvm.org/viewvc/llvm-project?rev=126506&view=rev Log: Some build script code cleaning for two-stage scripted builder. Modified: llvm-gcc-4.2/trunk/extras/build-self-4-mingw32 Modified: llvm-gcc-4.2/trunk/extras/build-self-4-mingw32 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/extras/build-self-4-mingw32?rev=126506&r1=126505&r2=126506&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/extras/build-self-4-mingw32 (original) +++ llvm-gcc-4.2/trunk/extras/build-self-4-mingw32 Fri Feb 25 14:22:42 2011 @@ -40,8 +40,8 @@ LLVM_GCC_src=llvm-gcc.src # The LLVM-GCC source code root directory name. LLVM_obj_1=llvm-1.obj # The LLVM build root directory name. LLVM_GCC_obj_1=llvm-gcc-1.obj # The LLVM-GCC build root directory name. -LLVM_obj_2=llvm-2.obj # The LLVM build root directory name for Stage2. -LLVM_GCC_obj_2=llvm-gcc-2.obj # The LLVM-GCC build root directory name for Stage2. +LLVM_obj_2=llvm-2.obj # The LLVM build directory name for Stage2. +LLVM_GCC_obj_2=llvm-gcc-2.obj # The LLVM-GCC build directory name for Stage2. INSTALL=install # Where the result will be installed. # CFLAGS and CXXFLAGS must not be set during the building of cross-tools. @@ -51,6 +51,12 @@ BUILD_ROOT=$PWD # Where build happens. PRIVATE_INSTALL=${BUILD_ROOT}/${INSTALL} # Where the result will be installed. +export PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin +export PATH=$PATH:/mingw_build_tools/install_with_gcc/bin + +# Make sure our just built tools will be selected first. +export PATH=${PRIVATE_INSTALL}/bin:$PATH + #------------------------------------------------------------------------------ # Define build steps, parse and validate input parameters #------------------------------------------------------------------------------ @@ -66,7 +72,6 @@ do_install_llvmgcc_1=no # Install LLVM-GCC. do_configure_llvm_2=no # Configure LLVM for Stage2. do_make_llvm_2=no # Make LLVM for Stage2. -do_test_llvm_2=no # Test LLVM for Stage2. do_configure_llvmgcc_2=no # Configure LLVM-GCC for Stage2. do_make_llvmgcc_2=no # Make LLVM-GCC for Stage2. do_install_llvmgcc_2=no # Install LLVM-GCC for Stage2. @@ -91,7 +96,6 @@ install_llvmgcc_1 | \ configure_llvm_2 | \ make_llvm_2 | \ - test_llvm_2 | \ configure_llvmgcc_2 | \ make_llvmgcc_2 | \ install_llvmgcc_2 | \ @@ -118,7 +122,6 @@ do_install_llvmgcc_1=yes do_configure_llvm_2=yes do_make_llvm_2=yes - do_test_llvm_2=yes do_configure_llvmgcc_2=yes do_make_llvmgcc_2=yes do_install_llvmgcc_2=yes @@ -143,7 +146,8 @@ # We need a local copy of binutils, system libraries and headers, # since we will be installing there. - cp -RL /cross-tools/ ${PRIVATE_INSTALL} + + cp -RL /mingw_build_tools/install_with_gcc/ ${PRIVATE_INSTALL} fi @@ -249,10 +253,6 @@ #------------------------------------------------------------------------------ if [ "$do_configure_llvm_2" == "yes" ] ; then - # Make sure our just built tools will be selected first. - # Note: Always set this, even when do_all has been requested. - export PATH=${PRIVATE_INSTALL}/bin:${PATH} - # Remove previous build files if any. rm -rf ${BUILD_ROOT}/${LLVM_obj_2} mkdir -p ${BUILD_ROOT}/${LLVM_obj_2} @@ -273,11 +273,6 @@ #------------------------------------------------------------------------------ if [ "$do_make_llvm_2" == "yes" ] ; then - if [ "$do_all" == "no" ] ; then - # Make sure our just built tools will be selected first. - export PATH=${PRIVATE_INSTALL}/bin:${PATH} - fi - cd ${BUILD_ROOT}/${LLVM_obj_2} # NOTE: Do not use make ENABLE_OPTIMIZED=1. Some tests fail because of that. nice -n 20 make VERBOSE=1 \ @@ -286,31 +281,10 @@ fi #------------------------------------------------------------------------------ -# Step: Stage2. Test LLVM. -#------------------------------------------------------------------------------ -if [ "$do_test_llvm_2" == "yes" ] ; then - - if [ "$do_all" == "no" ] ; then - # Make sure our just built tools will be selected first. - export PATH=${PRIVATE_INSTALL}/bin:${PATH} - fi - - cd ${BUILD_ROOT}/${LLVM_obj_2} - make check-lit VERBOSE=1 \ - $@ # Extra args if any - -fi - -#------------------------------------------------------------------------------ # Step: Stage2. Configure LLVM-GCC. #------------------------------------------------------------------------------ if [ "$do_configure_llvmgcc_2" == "yes" ] ; then - if [ "$do_all" == "no" ] ; then - # Make sure our just built tools will be selected first. - export PATH=${PRIVATE_INSTALL}/bin:${PATH} - fi - # Remove previous build files if any. rm -rf ${BUILD_ROOT}/${LLVM_GCC_obj_2} mkdir -p ${BUILD_ROOT}/${LLVM_GCC_obj_2} @@ -334,11 +308,6 @@ #------------------------------------------------------------------------------ if [ "$do_make_llvmgcc_2" == "yes" ] ; then - if [ "$do_all" == "no" ] ; then - # Make sure our just built tools will be selected first. - export PATH=${PRIVATE_INSTALL}/bin:${PATH} - fi - cd ${BUILD_ROOT}/${LLVM_GCC_obj_2} nice -n 20 make \ $@ # Extra args if any @@ -350,11 +319,6 @@ #------------------------------------------------------------------------------ if [ "$do_install_llvmgcc_2" == "yes" ] ; then - if [ "$do_all" == "no" ] ; then - # Make sure our just built tools will be selected first. - export PATH=${PRIVATE_INSTALL}/bin:${PATH} - fi - cd ${BUILD_ROOT}/${LLVM_GCC_obj_2} nice -n 20 make install \ $@ # Extra args if any From stuart at apple.com Fri Feb 25 14:42:39 2011 From: stuart at apple.com (Stuart Hastings) Date: Fri, 25 Feb 2011 20:42:39 -0000 Subject: [llvm-commits] [llvm] r126507 - /llvm/trunk/utils/buildit/build_llvm Message-ID: <20110225204239.DD1722A6C12C@llvm.org> Author: stuart Date: Fri Feb 25 14:42:39 2011 New Revision: 126507 URL: http://llvm.org/viewvc/llvm-project?rev=126507&view=rev Log: Omit lto.h from the llvmCore result; henceforth, this will be supplied by clang. Radar 9042056. Modified: llvm/trunk/utils/buildit/build_llvm Modified: llvm/trunk/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=126507&r1=126506&r2=126507&view=diff ============================================================================== --- llvm/trunk/utils/buildit/build_llvm (original) +++ llvm/trunk/utils/buildit/build_llvm Fri Feb 25 14:42:39 2011 @@ -341,6 +341,9 @@ fi rm -f lib/libLTO.a lib/libLTO.la +// Omit lto.h from the result. Clang will supply. +find $DEST_DIR$DEST_ROOT -name lto.h -delete + ################################################################################ # Remove debugging information from DEST_DIR. From greened at obbligato.org Fri Feb 25 14:51:27 2011 From: greened at obbligato.org (David Greene) Date: Fri, 25 Feb 2011 20:51:27 -0000 Subject: [llvm-commits] [llvm] r126510 - /llvm/trunk/utils/llvmbuild Message-ID: <20110225205127.A05AC2A6C12C@llvm.org> Author: greened Date: Fri Feb 25 14:51:27 2011 New Revision: 126510 URL: http://llvm.org/viewvc/llvm-project?rev=126510&view=rev Log: Add some options for building LLVM in different environments: --force-configure to force running configure before building. --extra-llvm-config-flags --extra-llvm-gcc-config-flags --extra-gcc-config-flags Pass additional argument to the various configure invocations. This also eliminates a default build flavor because explicitly specifying builds could result in build flavors being run repeatedly. Finally, turn off fortran builds for the moment because install appears to be broken. Modified: llvm/trunk/utils/llvmbuild Modified: llvm/trunk/utils/llvmbuild URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvmbuild?rev=126510&r1=126509&r2=126510&view=diff ============================================================================== --- llvm/trunk/utils/llvmbuild (original) +++ llvm/trunk/utils/llvmbuild Fri Feb 25 14:51:27 2011 @@ -163,7 +163,7 @@ " [default: %default]")) parser.add_option("--src", action="append", help=("Top-level source directory [default: %default]")) - parser.add_option("--build", action="append", default=["debug"], + parser.add_option("--build", action="append", help=("Build types to run [default: %default]")) parser.add_option("--branch", action="append", help=("Source branch to build [default: %default]")) @@ -181,6 +181,14 @@ help=("Root install directory [default: %default]")) parser.add_option("--builddir", help=("Root build directory [default: %default]")) + parser.add_option("--extra-llvm-config-flags", default="", + help=("Extra flags to pass to llvm configure [default: %default]")) + parser.add_option("--extra-llvm-gcc-config-flags", default="", + help=("Extra flags to pass to llvm-gcc configure [default: %default]")) + parser.add_option("--extra-gcc-config-flags", default="", + help=("Extra flags to pass to gcc configure [default: %default]")) + parser.add_option("--force-configure", default=False, action="store_true", + help=("Force reconfigure of all components")) return def check_options(parser, options, valid_builds): @@ -284,18 +292,20 @@ class ExecutableNotFound(Exception): pass class FileNotExecutable(Exception): pass - def __init__(self, work_queue, jobs, cc, cxx, build_abbrev, source_abbrev, - branch_abbrev, build_prefix, install_prefix): + def __init__(self, work_queue, jobs, + build_abbrev, source_abbrev, branch_abbrev, + options): super().__init__() self.work_queue = work_queue self.jobs = jobs - self.cc = cc - self.cxx = cxx + self.cc = options.cc + self.cxx = options.cxx self.build_abbrev = build_abbrev self.source_abbrev = source_abbrev self.branch_abbrev = branch_abbrev - self.build_prefix = build_prefix - self.install_prefix = install_prefix + self.build_prefix = options.builddir + self.install_prefix = options.prefix + self.options = options self.component_abbrev = dict( llvm="llvm", llvm_gcc="lgcc", @@ -399,13 +409,16 @@ configure_flags = dict( llvm=dict(debug=["--prefix=" + self.install_prefix, + "--with-extra-options=-Werror", "--with-cxx-include-root=" + cxxroot, "--with-cxx-include-arch=" + cxxarch], release=["--prefix=" + self.install_prefix, + "--with-extra-options=-Werror", "--enable-optimized", "--with-cxx-include-root=" + cxxroot, "--with-cxx-include-arch=" + cxxarch], paranoid=["--prefix=" + self.install_prefix, + "--with-extra-options=-Werror", "--enable-expensive-checks", "--with-cxx-include-root=" + cxxroot, "--with-cxx-include-arch=" + cxxarch]), @@ -413,26 +426,35 @@ "--enable-checking", "--program-prefix=llvm-", "--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix, - "--enable-languages=c,c++,fortran"], +# Fortran install seems to be broken. +# "--enable-languages=c,c++,fortran"], + "--enable-languages=c,c++"], release=["--prefix=" + self.install_prefix, "--program-prefix=llvm-", "--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix, - "--enable-languages=c,c++,fortran"], +# Fortran install seems to be broken. +# "--enable-languages=c,c++,fortran"], + "--enable-languages=c,c++"], paranoid=["--prefix=" + self.install_prefix, "--enable-checking", "--program-prefix=llvm-", "--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix, - "--enable-languages=c,c++,fortran"]), +# Fortran install seems to be broken. +# "--enable-languages=c,c++,fortran"]), + "--enable-languages=c,c++"]), llvm2=dict(debug=["--prefix=" + self.install_prefix, + "--with-extra-options=-Werror", "--with-llvmgccdir=" + self.install_prefix + "/bin", "--with-cxx-include-root=" + cxxroot, "--with-cxx-include-arch=" + cxxarch], release=["--prefix=" + self.install_prefix, + "--with-extra-options=-Werror", "--enable-optimized", "--with-llvmgccdir=" + self.install_prefix + "/bin", "--with-cxx-include-root=" + cxxroot, "--with-cxx-include-arch=" + cxxarch], paranoid=["--prefix=" + self.install_prefix, + "--with-extra-options=-Werror", "--enable-expensive-checks", "--with-llvmgccdir=" + self.install_prefix + "/bin", "--with-cxx-include-root=" + cxxroot, @@ -599,28 +621,37 @@ if (branch is not None): srcdir += "/" + branch + comp_key = comp.replace("-", "_") + + config_args = configure_flags[comp_key][build][:] + config_args.extend(getattr(self.options, + "extra_" + comp_key + + "_config_flags").split()) + self.logger.info("Configuring " + component + " in " + builddir) self.configure(component, srcdir, builddir, - configure_flags[comp.replace("-", "_")][build], - configure_env[comp.replace("-", "_")][build]) + config_args, + configure_env[comp_key][build]) self.logger.info("Building " + component + " in " + builddir) self.make(component, srcdir, builddir, - make_flags[comp.replace("-", "_")][build], - make_env[comp.replace("-", "_")][build]) + make_flags[comp_key][build], + make_env[comp_key][build]) self.logger.info("Installing " + component + " in " + installdir) self.make(component, srcdir, builddir, - make_install_flags[comp.replace("-", "_")][build], - make_install_env[comp.replace("-", "_")][build]) + make_install_flags[comp_key][build], + make_install_env[comp_key][build]) self.logger.info("Testing " + component + " in " + builddir) self.make(component, srcdir, builddir, - make_check_flags[comp.replace("-", "_")][build], - make_check_env[comp.replace("-", "_")][build]) + make_check_flags[comp_key][build], + make_check_env[comp_key][build]) def configure(self, component, srcdir, builddir, flags, env): + self.logger.debug("Configure " + str(flags)) + configure_files = dict( llvm=[(srcdir + "/configure", builddir + "/Makefile")], llvm_gcc=[(srcdir + "/configure", builddir + "/Makefile"), @@ -630,8 +661,11 @@ (srcdir + "/gcc/configure", builddir + "/gcc/Makefile")], dragonegg=[()]) + doconfig = False for conf, mf in configure_files[component.replace("-", "_")]: + if not os.path.exists(conf): + return if os.path.exists(conf) and os.path.exists(mf): confstat = os.stat(conf) makestat = os.stat(mf) @@ -642,7 +676,7 @@ doconfig = True break - if not doconfig: + if not doconfig and not self.options.force_configure: return program = srcdir + "/configure" @@ -689,9 +723,9 @@ for t in range(options.threads): jobs = options.jobs // options.threads - builder = Builder(work_queue, jobs, options.cc.strip(), options.cxx.strip(), + builder = Builder(work_queue, jobs, build_abbrev, source_abbrev, branch_abbrev, - options.builddir.strip(), options.prefix.strip()) + options) builder.daemon = True builder.start() From baldrick at free.fr Fri Feb 25 14:55:08 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Feb 2011 20:55:08 -0000 Subject: [llvm-commits] [dragonegg] r126511 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110225205508.C1DA52A6C12C@llvm.org> Author: baldrick Date: Fri Feb 25 14:55:08 2011 New Revision: 126511 URL: http://llvm.org/viewvc/llvm-project?rev=126511&view=rev Log: Reject multiple alternative asm constraints which are not consistent in the number of alternatives. Use the same error message as GCC rather than asserting. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126511&r1=126510&r2=126511&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Fri Feb 25 14:55:08 2011 @@ -6776,8 +6776,11 @@ *p; ++p) if (*p == ',') ++NumInputChoices; - assert((!NumChoices || NumChoices == NumInputChoices) && - "invalid constraints!"); + if (NumChoices && (NumInputChoices != NumChoices)) { + error_at(gimple_location(stmt), "operand constraints for % differ " + "in number of alternatives"); + return; + } if (NumChoices == 0) NumChoices = NumInputChoices; } @@ -6788,8 +6791,11 @@ *p; ++p) if (*p == ',') ++NumOutputChoices; - assert((!NumChoices || NumChoices == NumOutputChoices) && - "invalid constraints!"); + if (NumChoices && (NumOutputChoices != NumChoices)) { + error_at(gimple_location(stmt), "operand constraints for % differ " + "in number of alternatives"); + return; + } if (NumChoices == 0) NumChoices = NumOutputChoices; } From baldrick at free.fr Fri Feb 25 15:16:45 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Feb 2011 21:16:45 -0000 Subject: [llvm-commits] [dragonegg] r126512 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110225211645.876EC2A6C12C@llvm.org> Author: baldrick Date: Fri Feb 25 15:16:45 2011 New Revision: 126512 URL: http://llvm.org/viewvc/llvm-project?rev=126512&view=rev Log: Add some infrastructure which allows us to alter the result type of an inline asm and have it be corrected to the expected type before being used. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126512&r1=126511&r2=126512&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Fri Feb 25 15:16:45 2011 @@ -6814,14 +6814,18 @@ std::vector CallOps; std::vector CallArgTypes; - // StoreCallResultAddr - The pointer to store the result of the call through. - SmallVector StoreCallResultAddrs; - // CallResultTypes - The inline asm call may return one or more results. The // types of the results are recorded here along with a flag indicating whether // the corresponding GCC type is signed. SmallVector, 4> CallResultTypes; + // CallResultDests - Each result returned by the inline asm call is stored in + // a memory location. These are listed here along with a flag indicating if + // the GCC type corresponding to the memory location is signed. The type of + // the memory location is allowed to differ from the type of the call result, + // in which case the result is converted before being stored. + SmallVector, 4> CallResultDests; + SmallVector, 4> OutputLocations; // ConstraintStr - The string of constraints in LLVM format. @@ -6877,25 +6881,25 @@ } LValue Dest; - const Type *DestValTy; + const Type *DestValTy = ConvertType(TREE_TYPE(Operand)); if (TREE_CODE(Operand) == SSA_NAME) { // The ASM is defining an ssa name. Store the output to a temporary, then // load it out again later as the ssa name. - DestValTy = ConvertType(TREE_TYPE(Operand)); MemRef TmpLoc = CreateTempLoc(DestValTy); SSADefinitions.push_back(std::make_pair(Operand, TmpLoc)); Dest = LValue(TmpLoc); } else { Dest = EmitLV(Operand); - DestValTy = cast(Dest.Ptr->getType())->getElementType(); + assert(cast(Dest.Ptr->getType())->getElementType() == + DestValTy && "LValue has wrong type!"); } assert(!Dest.isBitfield() && "Cannot assign into a bitfield!"); if (!AllowsMem && DestValTy->isSingleValueType()) {// Reg dest -> asm return - StoreCallResultAddrs.push_back(Dest.Ptr); ConstraintStr += ",="; ConstraintStr += SimplifiedConstraint; bool IsSigned = !TYPE_UNSIGNED(TREE_TYPE(Operand)); + CallResultDests.push_back(std::make_pair(Dest.Ptr, IsSigned)); CallResultTypes.push_back(std::make_pair(DestValTy, IsSigned)); OutputLocations.push_back(std::make_pair(true, CallResultTypes.size()-1)); } else { @@ -7160,13 +7164,17 @@ CV->setDoesNotThrow(); // If the call produces a value, store it into the destination. - if (StoreCallResultAddrs.size() == 1) - Builder.CreateStore(CV, StoreCallResultAddrs[0]); - else if (unsigned NumResults = StoreCallResultAddrs.size()) { - for (unsigned i = 0; i != NumResults; ++i) { - Value *ValI = Builder.CreateExtractValue(CV, i, "asmresult"); - Builder.CreateStore(ValI, StoreCallResultAddrs[i]); - } + for (unsigned i = 0, NumResults = CallResultTypes.size(); i != NumResults; + ++i) { + Value *Val = NumResults == 1 ? + CV : Builder.CreateExtractValue(CV, i, "asmresult"); + bool ValIsSigned = CallResultTypes[i].second; + + Value *Dest = CallResultDests[i].first; + const Type *DestTy = cast(Dest->getType())->getElementType(); + bool DestIsSigned = CallResultDests[i].second; + Val = CastToAnyType(Val, ValIsSigned, DestTy, DestIsSigned); + Builder.CreateStore(Val, Dest); } // If the call defined any ssa names, associate them with their value. From resistor at mac.com Fri Feb 25 15:41:48 2011 From: resistor at mac.com (Owen Anderson) Date: Fri, 25 Feb 2011 21:41:48 -0000 Subject: [llvm-commits] [llvm] r126518 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/Alpha/ lib/Target/Blackfin/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/PowerPC/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ Message-ID: <20110225214149.7F04A2A6C12C@llvm.org> Author: resistor Date: Fri Feb 25 15:41:48 2011 New Revision: 126518 URL: http://llvm.org/viewvc/llvm-project?rev=126518&view=rev Log: Allow targets to specify a the type of the RHS of a shift parameterized on the type of the LHS. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Fri Feb 25 15:41:48 2011 @@ -111,7 +111,7 @@ bool isBigEndian() const { return !IsLittleEndian; } bool isLittleEndian() const { return IsLittleEndian; } MVT getPointerTy() const { return PointerTy; } - MVT getShiftAmountTy() const { return ShiftAmountTy; } + virtual MVT getShiftAmountTy(EVT LHSTy) const; /// isSelectExpensive - Return true if the select operation is expensive for /// this target. @@ -210,7 +210,7 @@ /// ValueTypeActions - For each value type, keep a LegalizeAction enum /// that indicates how instruction selection should deal with the type. uint8_t ValueTypeActions[MVT::LAST_VALUETYPE]; - + LegalizeAction getExtendedTypeAction(EVT VT) const { // Handle non-vector integers. if (!VT.isVector()) { @@ -260,17 +260,17 @@ ValueTypeActionImpl() { std::fill(ValueTypeActions, array_endof(ValueTypeActions), 0); } - + LegalizeAction getTypeAction(EVT VT) const { if (!VT.isExtended()) return getTypeAction(VT.getSimpleVT()); return getExtendedTypeAction(VT); } - + LegalizeAction getTypeAction(MVT VT) const { return (LegalizeAction)ValueTypeActions[VT.SimpleTy]; } - + void setTypeAction(EVT VT, LegalizeAction Action) { unsigned I = VT.getSimpleVT().SimpleTy; ValueTypeActions[I] = Action; @@ -291,7 +291,7 @@ LegalizeAction getTypeAction(MVT VT) const { return ValueTypeActions.getTypeAction(VT); } - + /// getTypeToTransformTo - For types supported by the target, this is an /// identity function. For types that must be promoted to larger types, this /// returns the larger type to promote to. For integer types that are larger @@ -324,7 +324,7 @@ EVT NVT = VT.getRoundIntegerType(Context); if (NVT == VT) // Size is a power of two - expand to half the size. return EVT::getIntegerVT(Context, VT.getSizeInBits() / 2); - + // Promote to a power of two size, avoiding multi-step promotion. return getTypeAction(NVT) == Promote ? getTypeToTransformTo(Context, NVT) : NVT; @@ -997,10 +997,6 @@ // protected: - /// setShiftAmountType - Describe the type that should be used for shift - /// amounts. This type defaults to the pointer type. - void setShiftAmountType(MVT VT) { ShiftAmountTy = VT; } - /// setBooleanContents - Specify how the target extends the result of a /// boolean value from i1 to a wider type. See getBooleanContents. void setBooleanContents(BooleanContent Ty) { BooleanContents = Ty; } @@ -1047,12 +1043,12 @@ /// SelectIsExpensive - Tells the code generator not to expand operations /// into sequences that use the select operations if possible. - void setSelectIsExpensive(bool isExpensive = true) { - SelectIsExpensive = isExpensive; + void setSelectIsExpensive(bool isExpensive = true) { + SelectIsExpensive = isExpensive; } - /// JumpIsExpensive - Tells the code generator not to expand sequence of - /// operations into a seperate sequences that increases the amount of + /// JumpIsExpensive - Tells the code generator not to expand sequence of + /// operations into a seperate sequences that increases the amount of /// flow control. void setJumpIsExpensive(bool isExpensive = true) { JumpIsExpensive = isExpensive; @@ -1369,7 +1365,7 @@ CW_Good = 1, // Good weight. CW_Better = 2, // Better weight. CW_Best = 3, // Best weight. - + // Well-known weights. CW_SpecificReg = CW_Okay, // Specific register operands. CW_Register = CW_Good, // Register operands. @@ -1422,21 +1418,21 @@ CallOperandVal(0), ConstraintVT(MVT::Other) { } }; - + typedef std::vector AsmOperandInfoVector; - + /// ParseConstraints - Split up the constraint string from the inline /// assembly value into the specific constraints and their prefixes, /// and also tie in the associated operand values. /// If this returns an empty vector, and if the constraint string itself /// isn't empty, there was an error parsing. virtual AsmOperandInfoVector ParseConstraints(ImmutableCallSite CS) const; - + /// Examine constraint type and operand type and determine a weight value. /// The operand object must already have been set up with the operand type. virtual ConstraintWeight getMultipleConstraintMatchWeight( AsmOperandInfo &info, int maIndex) const; - + /// Examine constraint string and operand type and determine a weight value. /// The operand object must already have been set up with the operand type. virtual ConstraintWeight getSingleConstraintMatchWeight( @@ -1446,7 +1442,7 @@ /// type to use for the specific AsmOperandInfo, setting /// OpInfo.ConstraintCode and OpInfo.ConstraintType. If the actual operand /// being passed in is available, it can be passed in as Op, otherwise an - /// empty SDValue can be passed. + /// empty SDValue can be passed. virtual void ComputeConstraintToUse(AsmOperandInfo &OpInfo, SDValue Op, SelectionDAG *DAG = 0) const; @@ -1660,10 +1656,6 @@ /// llvm.longjmp. Defaults to false. bool UseUnderscoreLongJmp; - /// ShiftAmountTy - The type to use for shift amounts, usually i8 or whatever - /// PointerTy is. - MVT ShiftAmountTy; - /// BooleanContents - Information about the contents of the high-bits in /// boolean values held in a type wider than i1. See getBooleanContents. BooleanContent BooleanContents; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Feb 25 15:41:48 2011 @@ -279,8 +279,8 @@ /// getShiftAmountTy - Returns a type large enough to hold any valid /// shift amount - before type legalization these can be huge. - EVT getShiftAmountTy() { - return LegalTypes ? TLI.getShiftAmountTy() : TLI.getPointerTy(); + EVT getShiftAmountTy(EVT LHSTy) { + return LegalTypes ? TLI.getShiftAmountTy(LHSTy) : TLI.getPointerTy(); } /// isTypeLegal - This method returns true if we are running before type @@ -670,7 +670,7 @@ if (LoadSDNode *LD = dyn_cast(Op)) { EVT MemVT = LD->getMemoryVT(); ISD::LoadExtType ExtType = ISD::isNON_EXTLoad(LD) - ? (TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT) ? ISD::ZEXTLOAD + ? (TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT) ? ISD::ZEXTLOAD : ISD::EXTLOAD) : LD->getExtensionType(); Replace = true; @@ -894,7 +894,7 @@ LoadSDNode *LD = cast(N); EVT MemVT = LD->getMemoryVT(); ISD::LoadExtType ExtType = ISD::isNON_EXTLoad(LD) - ? (TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT) ? ISD::ZEXTLOAD + ? (TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT) ? ISD::ZEXTLOAD : ISD::EXTLOAD) : LD->getExtensionType(); SDValue NewLD = DAG.getExtLoad(ExtType, dl, PVT, @@ -1521,7 +1521,7 @@ // Since it may not be valid to emit a fold to zero for vector initializers // check if we can before folding. static SDValue tryFoldToZero(DebugLoc DL, const TargetLowering &TLI, EVT VT, - SelectionDAG &DAG, bool LegalOperations) { + SelectionDAG &DAG, bool LegalOperations) { if (!VT.isVector()) { return DAG.getConstant(0, VT); } else if (!LegalOperations || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)) { @@ -1647,7 +1647,7 @@ if (N1C && N1C->getAPIntValue().isPowerOf2()) return DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0, DAG.getConstant(N1C->getAPIntValue().logBase2(), - getShiftAmountTy())); + getShiftAmountTy(N0.getValueType()))); // fold (mul x, -(1 << c)) -> -(x << c) or (-x) << c if (N1C && (-N1C->getAPIntValue()).isPowerOf2()) { unsigned Log2Val = (-N1C->getAPIntValue()).logBase2(); @@ -1656,7 +1656,8 @@ return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, DAG.getConstant(0, VT), DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0, - DAG.getConstant(Log2Val, getShiftAmountTy()))); + DAG.getConstant(Log2Val, + getShiftAmountTy(N0.getValueType())))); } // (mul (shl X, c1), c2) -> (mul X, c2 << c1) if (N1C && N0.getOpcode() == ISD::SHL && @@ -1753,18 +1754,18 @@ // Splat the sign bit into the register SDValue SGN = DAG.getNode(ISD::SRA, N->getDebugLoc(), VT, N0, DAG.getConstant(VT.getSizeInBits()-1, - getShiftAmountTy())); + getShiftAmountTy(N0.getValueType()))); AddToWorkList(SGN.getNode()); // Add (N0 < 0) ? abs2 - 1 : 0; SDValue SRL = DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, SGN, DAG.getConstant(VT.getSizeInBits() - lg2, - getShiftAmountTy())); + getShiftAmountTy(SGN.getValueType()))); SDValue ADD = DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, N0, SRL); AddToWorkList(SRL.getNode()); AddToWorkList(ADD.getNode()); // Divide by pow2 SDValue SRA = DAG.getNode(ISD::SRA, N->getDebugLoc(), VT, ADD, - DAG.getConstant(lg2, getShiftAmountTy())); + DAG.getConstant(lg2, getShiftAmountTy(ADD.getValueType()))); // If we're dividing by a positive value, we're done. Otherwise, we must // negate the result. @@ -1814,7 +1815,7 @@ if (N1C && N1C->getAPIntValue().isPowerOf2()) return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0, DAG.getConstant(N1C->getAPIntValue().logBase2(), - getShiftAmountTy())); + getShiftAmountTy(N0.getValueType()))); // fold (udiv x, (shl c, y)) -> x >>u (log2(c)+y) iff c is power of 2 if (N1.getOpcode() == ISD::SHL) { if (ConstantSDNode *SHC = dyn_cast(N1.getOperand(0))) { @@ -1955,7 +1956,7 @@ if (N1C && N1C->getAPIntValue() == 1) return DAG.getNode(ISD::SRA, N->getDebugLoc(), N0.getValueType(), N0, DAG.getConstant(N0.getValueType().getSizeInBits() - 1, - getShiftAmountTy())); + getShiftAmountTy(N0.getValueType()))); // fold (mulhs x, undef) -> 0 if (N0.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF) return DAG.getConstant(0, VT); @@ -1971,11 +1972,11 @@ N1 = DAG.getNode(ISD::SIGN_EXTEND, DL, NewVT, N1); N1 = DAG.getNode(ISD::MUL, DL, NewVT, N0, N1); N1 = DAG.getNode(ISD::SRL, DL, NewVT, N1, - DAG.getConstant(SimpleSize, getShiftAmountTy())); + DAG.getConstant(SimpleSize, getShiftAmountTy(N1.getValueType()))); return DAG.getNode(ISD::TRUNCATE, DL, VT, N1); } } - + return SDValue(); } @@ -2007,11 +2008,11 @@ N1 = DAG.getNode(ISD::ZERO_EXTEND, DL, NewVT, N1); N1 = DAG.getNode(ISD::MUL, DL, NewVT, N0, N1); N1 = DAG.getNode(ISD::SRL, DL, NewVT, N1, - DAG.getConstant(SimpleSize, getShiftAmountTy())); + DAG.getConstant(SimpleSize, getShiftAmountTy(N1.getValueType()))); return DAG.getNode(ISD::TRUNCATE, DL, VT, N1); } } - + return SDValue(); } @@ -2090,14 +2091,14 @@ Lo = DAG.getNode(ISD::MUL, DL, NewVT, Lo, Hi); // Compute the high part as N1. Hi = DAG.getNode(ISD::SRL, DL, NewVT, Lo, - DAG.getConstant(SimpleSize, getShiftAmountTy())); + DAG.getConstant(SimpleSize, getShiftAmountTy(Lo.getValueType()))); Hi = DAG.getNode(ISD::TRUNCATE, DL, VT, Hi); // Compute the low part as N0. Lo = DAG.getNode(ISD::TRUNCATE, DL, VT, Lo); return CombineTo(N, Lo, Hi); } } - + return SDValue(); } @@ -2107,7 +2108,7 @@ EVT VT = N->getValueType(0); DebugLoc DL = N->getDebugLoc(); - + // If the type twice as wide is legal, transform the mulhu to a wider multiply // plus a shift. if (VT.isSimple() && !VT.isVector()) { @@ -2120,14 +2121,14 @@ Lo = DAG.getNode(ISD::MUL, DL, NewVT, Lo, Hi); // Compute the high part as N1. Hi = DAG.getNode(ISD::SRL, DL, NewVT, Lo, - DAG.getConstant(SimpleSize, getShiftAmountTy())); + DAG.getConstant(SimpleSize, getShiftAmountTy(Lo.getValueType()))); Hi = DAG.getNode(ISD::TRUNCATE, DL, VT, Hi); // Compute the low part as N0. Lo = DAG.getNode(ISD::TRUNCATE, DL, VT, Lo); return CombineTo(N, Lo, Hi); } } - + return SDValue(); } @@ -3004,7 +3005,7 @@ N0.getOpcode() == ISD::SIGN_EXTEND) && N0.getOperand(0).getOpcode() == ISD::SHL && isa(N0.getOperand(0)->getOperand(1))) { - uint64_t c1 = + uint64_t c1 = cast(N0.getOperand(0)->getOperand(1))->getZExtValue(); uint64_t c2 = N1C->getZExtValue(); EVT InnerShiftVT = N0.getOperand(0).getValueType(); @@ -3133,7 +3134,8 @@ TLI.isOperationLegalOrCustom(ISD::TRUNCATE, VT) && TLI.isTruncateFree(VT, TruncVT)) { - SDValue Amt = DAG.getConstant(ShiftAmt, getShiftAmountTy()); + SDValue Amt = DAG.getConstant(ShiftAmt, + getShiftAmountTy(N0.getOperand(0).getValueType())); SDValue Shift = DAG.getNode(ISD::SRL, N0.getDebugLoc(), VT, N0.getOperand(0), Amt); SDValue Trunc = DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(), TruncVT, @@ -3180,7 +3182,7 @@ LargeShiftAmt->getZExtValue()) { SDValue Amt = DAG.getConstant(LargeShiftAmt->getZExtValue() + N1C->getZExtValue(), - getShiftAmountTy()); + getShiftAmountTy(N0.getOperand(0).getOperand(0).getValueType())); SDValue SRA = DAG.getNode(ISD::SRA, N->getDebugLoc(), LargeVT, N0.getOperand(0).getOperand(0), Amt); return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, SRA); @@ -3245,7 +3247,7 @@ if (N1C && N0.getOpcode() == ISD::TRUNCATE && N0.getOperand(0).getOpcode() == ISD::SRL && isa(N0.getOperand(0)->getOperand(1))) { - uint64_t c1 = + uint64_t c1 = cast(N0.getOperand(0)->getOperand(1))->getZExtValue(); uint64_t c2 = N1C->getZExtValue(); EVT InnerShiftVT = N0.getOperand(0).getValueType(); @@ -3256,7 +3258,7 @@ if (c1 + c2 >= InnerShiftSize) return DAG.getConstant(0, VT); return DAG.getNode(ISD::TRUNCATE, N0->getDebugLoc(), VT, - DAG.getNode(ISD::SRL, N0->getDebugLoc(), InnerShiftVT, + DAG.getNode(ISD::SRL, N0->getDebugLoc(), InnerShiftVT, N0.getOperand(0)->getOperand(0), DAG.getConstant(c1 + c2, ShiftCountVT))); } @@ -3320,7 +3322,7 @@ if (ShAmt) { Op = DAG.getNode(ISD::SRL, N0.getDebugLoc(), VT, Op, - DAG.getConstant(ShAmt, getShiftAmountTy())); + DAG.getConstant(ShAmt, getShiftAmountTy(Op.getValueType()))); AddToWorkList(Op.getNode()); } @@ -4025,11 +4027,11 @@ } DebugLoc DL = N->getDebugLoc(); - - // Ensure that the shift amount is wide enough for the shifted value. + + // Ensure that the shift amount is wide enough for the shifted value. if (VT.getSizeInBits() >= 256) ShAmt = DAG.getNode(ISD::ZERO_EXTEND, DL, MVT::i32, ShAmt); - + return DAG.getNode(N0.getOpcode(), DL, VT, DAG.getNode(ISD::ZERO_EXTEND, DL, VT, N0.getOperand(0)), ShAmt); @@ -4278,12 +4280,12 @@ return SDValue(); unsigned EVTBits = ExtVT.getSizeInBits(); - + // Do not generate loads of non-round integer types since these can // be expensive (and would be wrong if the type is not byte sized). if (!ExtVT.isRound()) return SDValue(); - + unsigned ShAmt = 0; if (N0.getOpcode() == ISD::SRL && N0.hasOneUse()) { if (ConstantSDNode *N01 = dyn_cast(N0.getOperand(1))) { @@ -4298,7 +4300,7 @@ // At this point, we must have a load or else we can't do the transform. if (!isa(N0)) return SDValue(); - + // If the shift amount is larger than the input type then we're not // accessing any of the loaded bytes. If the load was a zextload/extload // then the result of the shift+trunc is zero/undef (handled elsewhere). @@ -4319,18 +4321,18 @@ N0 = N0.getOperand(0); } } - + // If we haven't found a load, we can't narrow it. Don't transform one with // multiple uses, this would require adding a new load. if (!isa(N0) || !N0.hasOneUse() || // Don't change the width of a volatile load. cast(N0)->isVolatile()) return SDValue(); - + // Verify that we are actually reducing a load width here. if (cast(N0)->getMemoryVT().getSizeInBits() < EVTBits) return SDValue(); - + LoadSDNode *LN0 = cast(N0); EVT PtrType = N0.getOperand(1).getValueType(); @@ -4368,7 +4370,7 @@ // Shift the result left, if we've swallowed a left shift. SDValue Result = Load; if (ShLeftAmt != 0) { - EVT ShImmTy = getShiftAmountTy(); + EVT ShImmTy = getShiftAmountTy(Result.getValueType()); if (!isUIntN(ShImmTy.getSizeInBits(), ShLeftAmt)) ShImmTy = VT; Result = DAG.getNode(ISD::SHL, N0.getDebugLoc(), VT, @@ -5984,7 +5986,8 @@ // shifted by ByteShift and truncated down to NumBytes. if (ByteShift) IVal = DAG.getNode(ISD::SRL, IVal->getDebugLoc(), IVal.getValueType(), IVal, - DAG.getConstant(ByteShift*8, DC->getShiftAmountTy())); + DAG.getConstant(ByteShift*8, + DC->getShiftAmountTy(IVal.getValueType()))); // Figure out the offset for the store and the alignment of the access. unsigned StOffset; @@ -6399,7 +6402,7 @@ EVT VT = InVec.getValueType(); - // If we can't generate a legal BUILD_VECTOR, exit + // If we can't generate a legal BUILD_VECTOR, exit if (LegalOperations && !TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)) return SDValue(); @@ -7107,7 +7110,8 @@ if (N2C && ((N2C->getAPIntValue() & (N2C->getAPIntValue()-1)) == 0)) { unsigned ShCtV = N2C->getAPIntValue().logBase2(); ShCtV = XType.getSizeInBits()-ShCtV-1; - SDValue ShCt = DAG.getConstant(ShCtV, getShiftAmountTy()); + SDValue ShCt = DAG.getConstant(ShCtV, + getShiftAmountTy(N0.getValueType())); SDValue Shift = DAG.getNode(ISD::SRL, N0.getDebugLoc(), XType, N0, ShCt); AddToWorkList(Shift.getNode()); @@ -7123,7 +7127,7 @@ SDValue Shift = DAG.getNode(ISD::SRA, N0.getDebugLoc(), XType, N0, DAG.getConstant(XType.getSizeInBits()-1, - getShiftAmountTy())); + getShiftAmountTy(N0.getValueType()))); AddToWorkList(Shift.getNode()); if (XType.bitsGT(AType)) { @@ -7151,13 +7155,15 @@ // Shift the tested bit over the sign bit. APInt AndMask = ConstAndRHS->getAPIntValue(); SDValue ShlAmt = - DAG.getConstant(AndMask.countLeadingZeros(), getShiftAmountTy()); + DAG.getConstant(AndMask.countLeadingZeros(), + getShiftAmountTy(AndLHS.getValueType())); SDValue Shl = DAG.getNode(ISD::SHL, N0.getDebugLoc(), VT, AndLHS, ShlAmt); // Now arithmetic right shift it all the way over, so the result is either // all-ones, or zero. SDValue ShrAmt = - DAG.getConstant(AndMask.getBitWidth()-1, getShiftAmountTy()); + DAG.getConstant(AndMask.getBitWidth()-1, + getShiftAmountTy(Shl.getValueType())); SDValue Shr = DAG.getNode(ISD::SRA, N0.getDebugLoc(), VT, Shl, ShrAmt); return DAG.getNode(ISD::AND, DL, VT, Shr, N3); @@ -7201,7 +7207,7 @@ // shl setcc result by log2 n2c return DAG.getNode(ISD::SHL, DL, N2.getValueType(), Temp, DAG.getConstant(N2C->getAPIntValue().logBase2(), - getShiftAmountTy())); + getShiftAmountTy(Temp.getValueType()))); } // Check to see if this is the equivalent of setcc @@ -7224,7 +7230,7 @@ SDValue Ctlz = DAG.getNode(ISD::CTLZ, N0.getDebugLoc(), XType, N0); return DAG.getNode(ISD::SRL, DL, XType, Ctlz, DAG.getConstant(Log2_32(XType.getSizeInBits()), - getShiftAmountTy())); + getShiftAmountTy(Ctlz.getValueType()))); } // fold (setgt X, 0) -> (srl (and (-X, ~X), size(X)-1)) if (N1C && N1C->isNullValue() && CC == ISD::SETGT) { @@ -7234,13 +7240,13 @@ return DAG.getNode(ISD::SRL, DL, XType, DAG.getNode(ISD::AND, DL, XType, NegN0, NotN0), DAG.getConstant(XType.getSizeInBits()-1, - getShiftAmountTy())); + getShiftAmountTy(XType))); } // fold (setgt X, -1) -> (xor (srl (X, size(X)-1), 1)) if (N1C && N1C->isAllOnesValue() && CC == ISD::SETGT) { SDValue Sign = DAG.getNode(ISD::SRL, N0.getDebugLoc(), XType, N0, DAG.getConstant(XType.getSizeInBits()-1, - getShiftAmountTy())); + getShiftAmountTy(N0.getValueType()))); return DAG.getNode(ISD::XOR, DL, XType, Sign, DAG.getConstant(1, XType)); } } @@ -7267,7 +7273,7 @@ SDValue Shift = DAG.getNode(ISD::SRA, N0.getDebugLoc(), XType, N0, DAG.getConstant(XType.getSizeInBits()-1, - getShiftAmountTy())); + getShiftAmountTy(N0.getValueType()))); SDValue Add = DAG.getNode(ISD::ADD, N0.getDebugLoc(), XType, N0, Shift); AddToWorkList(Shift.getNode()); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Feb 25 15:41:48 2011 @@ -87,7 +87,7 @@ // If someone requests legalization of the new node, return itself. if (From != To) LegalizedNodes.insert(std::make_pair(To, To)); - + // Transfer SDDbgValues. DAG.TransferDbgValues(From, To); } @@ -498,7 +498,8 @@ int IncrementSize = NumBits / 8; // Divide the stored value in two parts. - SDValue ShiftAmount = DAG.getConstant(NumBits, TLI.getShiftAmountTy()); + SDValue ShiftAmount = DAG.getConstant(NumBits, + TLI.getShiftAmountTy(Val.getValueType())); SDValue Lo = Val; SDValue Hi = DAG.getNode(ISD::SRL, dl, VT, Val, ShiftAmount); @@ -645,7 +646,8 @@ } // aggregate the two parts - SDValue ShiftAmount = DAG.getConstant(NumBits, TLI.getShiftAmountTy()); + SDValue ShiftAmount = DAG.getConstant(NumBits, + TLI.getShiftAmountTy(Hi.getValueType())); SDValue Result = DAG.getNode(ISD::SHL, dl, VT, Hi, ShiftAmount); Result = DAG.getNode(ISD::OR, dl, VT, Result, Lo); @@ -1264,7 +1266,8 @@ // Move the top bits to the right place. Hi = DAG.getNode(ISD::SHL, dl, Hi.getValueType(), Hi, - DAG.getConstant(RoundWidth, TLI.getShiftAmountTy())); + DAG.getConstant(RoundWidth, + TLI.getShiftAmountTy(Hi.getValueType()))); // Join the hi and lo parts. Result = DAG.getNode(ISD::OR, dl, Node->getValueType(0), Lo, Hi); @@ -1293,7 +1296,8 @@ // Move the top bits to the right place. Hi = DAG.getNode(ISD::SHL, dl, Hi.getValueType(), Hi, - DAG.getConstant(ExtraWidth, TLI.getShiftAmountTy())); + DAG.getConstant(ExtraWidth, + TLI.getShiftAmountTy(Hi.getValueType()))); // Join the hi and lo parts. Result = DAG.getNode(ISD::OR, dl, Node->getValueType(0), Lo, Hi); @@ -1482,7 +1486,8 @@ Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2, DAG.getIntPtrConstant(IncrementSize)); Hi = DAG.getNode(ISD::SRL, dl, Tmp3.getValueType(), Tmp3, - DAG.getConstant(RoundWidth, TLI.getShiftAmountTy())); + DAG.getConstant(RoundWidth, + TLI.getShiftAmountTy(Tmp3.getValueType()))); Hi = DAG.getTruncStore(Tmp1, dl, Hi, Tmp2, ST->getPointerInfo().getWithOffset(IncrementSize), ExtraVT, isVolatile, isNonTemporal, @@ -1492,7 +1497,8 @@ // TRUNCSTORE:i24 X -> TRUNCSTORE:i16 (srl X, 8), TRUNCSTORE at +2:i8 X // Store the top RoundWidth bits. Hi = DAG.getNode(ISD::SRL, dl, Tmp3.getValueType(), Tmp3, - DAG.getConstant(ExtraWidth, TLI.getShiftAmountTy())); + DAG.getConstant(ExtraWidth, + TLI.getShiftAmountTy(Tmp3.getValueType()))); Hi = DAG.getTruncStore(Tmp1, dl, Hi, Tmp2, ST->getPointerInfo(), RoundVT, isVolatile, isNonTemporal, Alignment); @@ -1727,7 +1733,8 @@ assert(BitShift < LoadTy.getSizeInBits() && "Pointer advanced wrong?"); if (BitShift) SignBit = DAG.getNode(ISD::SHL, dl, LoadTy, SignBit, - DAG.getConstant(BitShift,TLI.getShiftAmountTy())); + DAG.getConstant(BitShift, + TLI.getShiftAmountTy(SignBit.getValueType()))); } } // Now get the sign bit proper, by seeing whether the value is negative. @@ -2207,7 +2214,8 @@ if (!isSigned) { SDValue Fast = DAG.getNode(ISD::SINT_TO_FP, dl, MVT::f32, Op0); - SDValue ShiftConst = DAG.getConstant(1, TLI.getShiftAmountTy()); + SDValue ShiftConst = + DAG.getConstant(1, TLI.getShiftAmountTy(Op0.getValueType())); SDValue Shr = DAG.getNode(ISD::SRL, dl, MVT::i64, Op0, ShiftConst); SDValue AndConst = DAG.getConstant(1, MVT::i64); SDValue And = DAG.getNode(ISD::AND, dl, MVT::i64, Op0, AndConst); @@ -2226,7 +2234,6 @@ } // Otherwise, implement the fully general conversion. - EVT SHVT = TLI.getShiftAmountTy(); SDValue And = DAG.getNode(ISD::AND, dl, MVT::i64, Op0, DAG.getConstant(UINT64_C(0xfffffffffffff800), MVT::i64)); @@ -2241,6 +2248,7 @@ Op0, DAG.getConstant(UINT64_C(0x0020000000000000), MVT::i64), ISD::SETUGE); SDValue Sel2 = DAG.getNode(ISD::SELECT, dl, MVT::i64, Ge, Sel, Op0); + EVT SHVT = TLI.getShiftAmountTy(Sel2.getValueType()); SDValue Sh = DAG.getNode(ISD::SRL, dl, MVT::i64, Sel2, DAG.getConstant(32, SHVT)); @@ -2387,7 +2395,7 @@ /// SDValue SelectionDAGLegalize::ExpandBSWAP(SDValue Op, DebugLoc dl) { EVT VT = Op.getValueType(); - EVT SHVT = TLI.getShiftAmountTy(); + EVT SHVT = TLI.getShiftAmountTy(VT); SDValue Tmp1, Tmp2, Tmp3, Tmp4, Tmp5, Tmp6, Tmp7, Tmp8; switch (VT.getSimpleVT().SimpleTy) { default: assert(0 && "Unhandled Expand type in BSWAP!"); @@ -2450,7 +2458,7 @@ default: assert(0 && "Cannot expand this yet!"); case ISD::CTPOP: { EVT VT = Op.getValueType(); - EVT ShVT = TLI.getShiftAmountTy(); + EVT ShVT = TLI.getShiftAmountTy(VT); unsigned Len = VT.getSizeInBits(); assert(VT.isInteger() && Len <= 128 && Len % 8 == 0 && @@ -2487,7 +2495,7 @@ Op = DAG.getNode(ISD::SRL, dl, VT, DAG.getNode(ISD::MUL, dl, VT, Op, Mask01), DAG.getConstant(Len - 8, ShVT)); - + return Op; } case ISD::CTLZ: { @@ -2501,7 +2509,7 @@ // // but see also: http://www.hackersdelight.org/HDcode/nlz.cc EVT VT = Op.getValueType(); - EVT ShVT = TLI.getShiftAmountTy(); + EVT ShVT = TLI.getShiftAmountTy(VT); unsigned len = VT.getSizeInBits(); for (unsigned i = 0; (1U << i) <= (len / 2); ++i) { SDValue Tmp3 = DAG.getConstant(1ULL << i, ShVT); @@ -2737,7 +2745,7 @@ // SAR. However, it is doubtful that any exist. EVT ExtraVT = cast(Node->getOperand(1))->getVT(); EVT VT = Node->getValueType(0); - EVT ShiftAmountTy = TLI.getShiftAmountTy(); + EVT ShiftAmountTy = TLI.getShiftAmountTy(VT); if (VT.isVector()) ShiftAmountTy = VT; unsigned BitsDiff = VT.getScalarType().getSizeInBits() - @@ -2901,7 +2909,7 @@ // 1 -> Hi Tmp1 = DAG.getNode(ISD::SRL, dl, OpTy, Node->getOperand(0), DAG.getConstant(OpTy.getSizeInBits()/2, - TLI.getShiftAmountTy())); + TLI.getShiftAmountTy(Node->getOperand(0).getValueType()))); Tmp1 = DAG.getNode(ISD::TRUNCATE, dl, Node->getValueType(0), Tmp1); } else { // 0 -> Lo @@ -3260,7 +3268,7 @@ assert(LC != RTLIB::UNKNOWN_LIBCALL && "Cannot expand this operation!"); LHS = DAG.getNode(Ops[isSigned][2], dl, WideVT, LHS); RHS = DAG.getNode(Ops[isSigned][2], dl, WideVT, RHS); - + SDValue Ret = ExpandLibCall(LC, Node, isSigned); BottomHalf = DAG.getNode(ISD::TRUNCATE, dl, VT, Ret); TopHalf = DAG.getNode(ISD::SRL, dl, Ret.getValueType(), Ret, @@ -3268,7 +3276,8 @@ TopHalf = DAG.getNode(ISD::TRUNCATE, dl, VT, TopHalf); } if (isSigned) { - Tmp1 = DAG.getConstant(VT.getSizeInBits() - 1, TLI.getShiftAmountTy()); + Tmp1 = DAG.getConstant(VT.getSizeInBits() - 1, + TLI.getShiftAmountTy(BottomHalf.getValueType())); Tmp1 = DAG.getNode(ISD::SRA, dl, VT, BottomHalf, Tmp1); TopHalf = DAG.getSetCC(dl, TLI.getSetCCResultType(VT), TopHalf, Tmp1, ISD::SETNE); @@ -3286,7 +3295,7 @@ Tmp2 = DAG.getNode(ISD::ANY_EXTEND, dl, PairTy, Node->getOperand(1)); Tmp2 = DAG.getNode(ISD::SHL, dl, PairTy, Tmp2, DAG.getConstant(PairTy.getSizeInBits()/2, - TLI.getShiftAmountTy())); + TLI.getShiftAmountTy(PairTy))); Results.push_back(DAG.getNode(ISD::OR, dl, PairTy, Tmp1, Tmp2)); break; } @@ -3464,7 +3473,7 @@ Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Node->getOperand(0)); Tmp1 = DAG.getNode(ISD::BSWAP, dl, NVT, Tmp1); Tmp1 = DAG.getNode(ISD::SRL, dl, NVT, Tmp1, - DAG.getConstant(DiffBits, TLI.getShiftAmountTy())); + DAG.getConstant(DiffBits, TLI.getShiftAmountTy(NVT))); Results.push_back(Tmp1); break; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Fri Feb 25 15:41:48 2011 @@ -177,25 +177,27 @@ // First get the sign bit of second operand. SDValue SignBit = DAG.getNode(ISD::SHL, dl, RVT, DAG.getConstant(1, RVT), DAG.getConstant(RSize - 1, - TLI.getShiftAmountTy())); + TLI.getShiftAmountTy(RVT))); SignBit = DAG.getNode(ISD::AND, dl, RVT, RHS, SignBit); // Shift right or sign-extend it if the two operands have different types. int SizeDiff = RVT.getSizeInBits() - LVT.getSizeInBits(); if (SizeDiff > 0) { SignBit = DAG.getNode(ISD::SRL, dl, RVT, SignBit, - DAG.getConstant(SizeDiff, TLI.getShiftAmountTy())); + DAG.getConstant(SizeDiff, + TLI.getShiftAmountTy(SignBit.getValueType()))); SignBit = DAG.getNode(ISD::TRUNCATE, dl, LVT, SignBit); } else if (SizeDiff < 0) { SignBit = DAG.getNode(ISD::ANY_EXTEND, dl, LVT, SignBit); SignBit = DAG.getNode(ISD::SHL, dl, LVT, SignBit, - DAG.getConstant(-SizeDiff, TLI.getShiftAmountTy())); + DAG.getConstant(-SizeDiff, + TLI.getShiftAmountTy(SignBit.getValueType()))); } // Clear the sign bit of the first operand. SDValue Mask = DAG.getNode(ISD::SHL, dl, LVT, DAG.getConstant(1, LVT), DAG.getConstant(LSize - 1, - TLI.getShiftAmountTy())); + TLI.getShiftAmountTy(LVT))); Mask = DAG.getNode(ISD::SUB, dl, LVT, Mask, DAG.getConstant(1, LVT)); LHS = DAG.getNode(ISD::AND, dl, LVT, LHS, Mask); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Feb 25 15:41:48 2011 @@ -1420,7 +1420,7 @@ /// the target's desired shift amount type. SDValue SelectionDAG::getShiftAmountOperand(SDValue Op) { EVT OpTy = Op.getValueType(); - MVT ShTy = TLI.getShiftAmountTy(); + MVT ShTy = TLI.getShiftAmountTy(OpTy); if (OpTy == ShTy || OpTy.isVector()) return Op; ISD::NodeType Opcode = OpTy.bitsGT(ShTy) ? ISD::TRUNCATE : ISD::ZERO_EXTEND; @@ -2048,7 +2048,7 @@ return; } break; - + default: // Allow the target to implement this method for its nodes. if (Op.getOpcode() >= ISD::BUILTIN_OP_END) { @@ -2292,12 +2292,12 @@ if ((Op.getOpcode() != ISD::ADD && Op.getOpcode() != ISD::OR) || !isa(Op.getOperand(1))) return false; - - if (Op.getOpcode() == ISD::OR && + + if (Op.getOpcode() == ISD::OR && !MaskedValueIsZero(Op.getOperand(0), cast(Op.getOperand(1))->getAPIntValue())) return false; - + return true; } @@ -2748,7 +2748,7 @@ // i8, which is easy to fall into in generic code that uses // TLI.getShiftAmount(). assert(N2.getValueType().getSizeInBits() >= - Log2_32_Ceil(N1.getValueType().getSizeInBits()) && + Log2_32_Ceil(N1.getValueType().getSizeInBits()) && "Invalid use of small shift amount with oversized value!"); // Always fold shifts of i1 values so the code generator doesn't need to Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Feb 25 15:41:48 2011 @@ -909,7 +909,7 @@ Val.getResNo(), Offset, dl, DbgSDNodeOrder); DAG.AddDbgValue(SDV, Val.getNode(), false); } - } else + } else DEBUG(dbgs() << "Dropping debug info for " << DI); DanglingDebugInfoMap[V] = DanglingDebugInfo(); } @@ -1418,7 +1418,7 @@ // jle foo // if (const BinaryOperator *BOp = dyn_cast(CondVal)) { - if (!TLI.isJumpExpensive() && + if (!TLI.isJumpExpensive() && BOp->hasOneUse() && (BOp->getOpcode() == Instruction::And || BOp->getOpcode() == Instruction::Or)) { @@ -2409,19 +2409,19 @@ void SelectionDAGBuilder::visitShift(const User &I, unsigned Opcode) { SDValue Op1 = getValue(I.getOperand(0)); SDValue Op2 = getValue(I.getOperand(1)); - - MVT ShiftTy = TLI.getShiftAmountTy(); - + + MVT ShiftTy = TLI.getShiftAmountTy(Op2.getValueType()); + // Coerce the shift amount to the right type if we can. if (!I.getType()->isVectorTy() && Op2.getValueType() != ShiftTy) { unsigned ShiftSize = ShiftTy.getSizeInBits(); unsigned Op2Size = Op2.getValueType().getSizeInBits(); DebugLoc DL = getCurDebugLoc(); - + // If the operand is smaller than the shift count type, promote it. if (ShiftSize > Op2Size) Op2 = DAG.getNode(ISD::ZERO_EXTEND, DL, ShiftTy, Op2); - + // If the operand is larger than the shift count type but the shift // count type has enough bits to represent any shift value, truncate // it now. This is a common case and it exposes the truncate to Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Feb 25 15:41:48 2011 @@ -563,7 +563,7 @@ setOperationAction(ISD::TRAP, MVT::Other, Expand); IsLittleEndian = TD->isLittleEndian(); - ShiftAmountTy = PointerTy = MVT::getIntegerVT(8*TD->getPointerSize()); + PointerTy = MVT::getIntegerVT(8*TD->getPointerSize()); memset(RegClassForVT, 0,MVT::LAST_VALUETYPE*sizeof(TargetRegisterClass*)); memset(TargetDAGCombineArray, 0, array_lengthof(TargetDAGCombineArray)); maxStoresPerMemset = maxStoresPerMemcpy = maxStoresPerMemmove = 8; @@ -596,6 +596,10 @@ delete &TLOF; } +MVT TargetLowering::getShiftAmountTy(EVT LHSTy) const { + return MVT::getIntegerVT(8*TD->getPointerSize()); +} + /// canOpTrap - Returns true if the operation can trap for the value type. /// VT must be a legal type. bool TargetLowering::canOpTrap(unsigned Op, EVT VT) const { @@ -1401,7 +1405,7 @@ BitWidth - InnerVT.getSizeInBits()) & DemandedMask) == 0 && isTypeDesirableForOp(ISD::SHL, InnerVT)) { - EVT ShTy = getShiftAmountTy(); + EVT ShTy = getShiftAmountTy(InnerVT); if (!APInt(BitWidth, ShAmt).isIntN(ShTy.getSizeInBits())) ShTy = InnerVT; SDValue NarrowShl = @@ -2188,7 +2192,7 @@ if (ConstantSDNode *AndRHS = dyn_cast(N0.getOperand(1))) { EVT ShiftTy = DCI.isBeforeLegalize() ? - getPointerTy() : getShiftAmountTy(); + getPointerTy() : getShiftAmountTy(N0.getValueType()); if (Cond == ISD::SETNE && C1 == 0) {// (X & 8) != 0 --> (X & 8) >> 3 // Perform the xform if the AND RHS is a single bit. if (AndRHS->getAPIntValue().isPowerOf2()) { @@ -2359,7 +2363,7 @@ // (Z-X) == X --> Z == X<<1 SDValue SH = DAG.getNode(ISD::SHL, dl, N1.getValueType(), N1, - DAG.getConstant(1, getShiftAmountTy())); + DAG.getConstant(1, getShiftAmountTy(N1.getValueType()))); if (!DCI.isCalledByLegalizer()) DCI.AddToWorklist(SH.getNode()); return DAG.getSetCC(dl, VT, N0.getOperand(0), SH, Cond); @@ -2381,7 +2385,7 @@ assert(N1.getOpcode() == ISD::SUB && "Unexpected operation!"); // X == (Z-X) --> X<<1 == Z SDValue SH = DAG.getNode(ISD::SHL, dl, N1.getValueType(), N0, - DAG.getConstant(1, getShiftAmountTy())); + DAG.getConstant(1, getShiftAmountTy(N0.getValueType()))); if (!DCI.isCalledByLegalizer()) DCI.AddToWorklist(SH.getNode()); return DAG.getSetCC(dl, VT, SH, N1.getOperand(0), Cond); @@ -2493,7 +2497,7 @@ } } } - + return false; } @@ -3141,14 +3145,14 @@ // Shift right algebraic if shift value is nonzero if (magics.s > 0) { Q = DAG.getNode(ISD::SRA, dl, VT, Q, - DAG.getConstant(magics.s, getShiftAmountTy())); + DAG.getConstant(magics.s, getShiftAmountTy(Q.getValueType()))); if (Created) Created->push_back(Q.getNode()); } // Extract the sign bit and add it to the quotient SDValue T = DAG.getNode(ISD::SRL, dl, VT, Q, DAG.getConstant(VT.getSizeInBits()-1, - getShiftAmountTy())); + getShiftAmountTy(Q.getValueType()))); if (Created) Created->push_back(T.getNode()); return DAG.getNode(ISD::ADD, dl, VT, Q, T); @@ -3192,19 +3196,19 @@ assert(magics.s < N1C->getAPIntValue().getBitWidth() && "We shouldn't generate an undefined shift!"); return DAG.getNode(ISD::SRL, dl, VT, Q, - DAG.getConstant(magics.s, getShiftAmountTy())); + DAG.getConstant(magics.s, getShiftAmountTy(Q.getValueType()))); } else { SDValue NPQ = DAG.getNode(ISD::SUB, dl, VT, N->getOperand(0), Q); if (Created) Created->push_back(NPQ.getNode()); NPQ = DAG.getNode(ISD::SRL, dl, VT, NPQ, - DAG.getConstant(1, getShiftAmountTy())); + DAG.getConstant(1, getShiftAmountTy(NPQ.getValueType()))); if (Created) Created->push_back(NPQ.getNode()); NPQ = DAG.getNode(ISD::ADD, dl, VT, NPQ, Q); if (Created) Created->push_back(NPQ.getNode()); return DAG.getNode(ISD::SRL, dl, VT, NPQ, - DAG.getConstant(magics.s-1, getShiftAmountTy())); + DAG.getConstant(magics.s-1, getShiftAmountTy(NPQ.getValueType()))); } } Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -48,7 +48,6 @@ : TargetLowering(TM, new TargetLoweringObjectFileELF()) { // Set up the TargetLowering object. //I am having problems with shr n i8 1 - setShiftAmountType(MVT::i64); setBooleanContents(ZeroOrOneBooleanContent); addRegisterClass(MVT::i64, Alpha::GPRCRegisterClass); Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Fri Feb 25 15:41:48 2011 @@ -31,25 +31,25 @@ /// GPRelHi/GPRelLo - These represent the high and low 16-bit /// parts of a global address respectively. - GPRelHi, GPRelLo, + GPRelHi, GPRelLo, /// RetLit - Literal Relocation of a Global RelLit, /// GlobalRetAddr - used to restore the return address GlobalRetAddr, - + /// CALL - Normal call. CALL, /// DIVCALL - used for special library calls for div and rem DivCall, - + /// return flag operand RET_FLAG, /// CHAIN = COND_BRANCH CHAIN, OPC, (G|F)PRC, DESTBB [, INFLAG] - This - /// corresponds to the COND_BRANCH pseudo instruction. + /// corresponds to the COND_BRANCH pseudo instruction. /// *PRC is the input register to compare to zero, /// OPC is the branch opcode to use (e.g. Alpha::BEQ), /// DESTBB is the destination block to branch to, and INFLAG is @@ -62,7 +62,9 @@ class AlphaTargetLowering : public TargetLowering { public: explicit AlphaTargetLowering(TargetMachine &TM); - + + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i64; } + /// getSetCCResultType - Get the SETCC result ValueType virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const; @@ -92,7 +94,7 @@ ConstraintWeight getSingleConstraintMatchWeight( AsmOperandInfo &info, const char *constraint) const; - std::vector + std::vector getRegClassForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -41,7 +41,6 @@ BlackfinTargetLowering::BlackfinTargetLowering(TargetMachine &TM) : TargetLowering(TM, new TargetLoweringObjectFileELF()) { - setShiftAmountType(MVT::i16); setBooleanContents(ZeroOrOneBooleanContent); setStackPointerRegisterToSaveRestore(BF::SP); setIntDivIsCheap(false); Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.h Fri Feb 25 15:41:48 2011 @@ -32,6 +32,7 @@ class BlackfinTargetLowering : public TargetLowering { public: BlackfinTargetLowering(TargetMachine &TM); + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i16; } virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const; virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; virtual void ReplaceNodeResults(SDNode *N, Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -435,7 +435,6 @@ setOperationAction(ISD::FDIV, MVT::v4f32, Legal); - setShiftAmountType(MVT::i32); setBooleanContents(ZeroOrNegativeOneBooleanContent); setStackPointerRegisterToSaveRestore(SPU::R1); @@ -2190,7 +2189,7 @@ { SDValue N0 = Op.getOperand(0); // Everything has at least one operand DebugLoc dl = Op.getDebugLoc(); - EVT ShiftVT = TLI.getShiftAmountTy(); + EVT ShiftVT = TLI.getShiftAmountTy(N0.getValueType()); assert(Op.getValueType() == MVT::i8); switch (Opc) { @@ -3112,7 +3111,7 @@ switch (*constraint) { default: weight = TargetLowering::getSingleConstraintMatchWeight(info, constraint); - break; + break; //FIXME: Seems like the supported constraint letters were just copied // from PPC, as the following doesn't correspond to the GCC docs. // I'm leaving it so until someone adds the corresponding lowering support. Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h Fri Feb 25 15:41:48 2011 @@ -109,6 +109,8 @@ /// getSetCCResultType - Return the ValueType for ISD::SETCC virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const; + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i32; } + //! Custom lowering hooks virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; @@ -179,9 +181,9 @@ virtual bool isLegalICmpImmediate(int64_t Imm) const; - virtual bool isLegalAddressingMode(const AddrMode &AM, + virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty) const; - + /// After allocating this many registers, the allocator should feel /// register pressure. The value is a somewhat random guess, based on the /// number of non callee saved registers in the C calling convention. Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -77,10 +77,6 @@ // Division is expensive setIntDivIsCheap(false); - // Even if we have only 1 bit shift here, we can perform - // shifts of the whole bitwidth 1 bit per step. - setShiftAmountType(MVT::i8); - setStackPointerRegisterToSaveRestore(MSP430::SPW); setBooleanContents(ZeroOrOneBooleanContent); setSchedulingPreference(Sched::Latency); @@ -330,7 +326,7 @@ // Arguments passed in registers EVT RegVT = VA.getLocVT(); switch (RegVT.getSimpleVT().SimpleTy) { - default: + default: { #ifndef NDEBUG errs() << "LowerFormalArguments Unhandled argument type: " Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h Fri Feb 25 15:41:48 2011 @@ -73,6 +73,8 @@ public: explicit MSP430TargetLowering(MSP430TargetMachine &TM); + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i8; } + /// LowerOperation - Provide custom lowering hooks for some operations. virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -362,7 +362,6 @@ setOperationAction(ISD::BUILD_VECTOR, MVT::v4f32, Custom); } - setShiftAmountType(MVT::i32); setBooleanContents(ZeroOrOneBooleanContent); if (TM.getSubtarget().isPPC64()) { Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Fri Feb 25 15:41:48 2011 @@ -29,36 +29,36 @@ /// FSEL - Traditional three-operand fsel node. /// FSEL, - + /// FCFID - The FCFID instruction, taking an f64 operand and producing /// and f64 value containing the FP representation of the integer that /// was temporarily in the f64 operand. FCFID, - - /// FCTI[D,W]Z - The FCTIDZ and FCTIWZ instructions, taking an f32 or f64 + + /// FCTI[D,W]Z - The FCTIDZ and FCTIWZ instructions, taking an f32 or f64 /// operand, producing an f64 value containing the integer representation /// of that FP value. FCTIDZ, FCTIWZ, - + /// STFIWX - The STFIWX instruction. The first operand is an input token /// chain, then an f64 value to store, then an address to store it to. STFIWX, - + // VMADDFP, VNMSUBFP - The VMADDFP and VNMSUBFP instructions, taking // three v4f32 operands and producing a v4f32 result. VMADDFP, VNMSUBFP, - + /// VPERM - The PPC VPERM Instruction. /// VPERM, - + /// Hi/Lo - These represent the high and low 16-bit parts of a global /// address respectively. These nodes have two operands, the first of /// which must be a TargetGlobalAddress, and the second of which must be a /// Constant. Selected naively, these turn into 'lis G+C' and 'li G+C', /// though these are usually folded into other nodes. Hi, Lo, - + TOC_ENTRY, /// The following three target-specific nodes are used for calls through @@ -80,37 +80,37 @@ /// This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to /// compute an allocation on the stack. DYNALLOC, - + /// GlobalBaseReg - On Darwin, this node represents the result of the mflr /// at function entry, used for PIC code. GlobalBaseReg, - + /// These nodes represent the 32-bit PPC shifts that operate on 6-bit /// shift amounts. These nodes are generated by the multi-precision shift /// code. SRL, SRA, SHL, - + /// EXTSW_32 - This is the EXTSW instruction for use with "32-bit" /// registers. EXTSW_32, /// CALL - A direct function call. CALL_Darwin, CALL_SVR4, - + /// NOP - Special NOP which follows 64-bit SVR4 calls. NOP, /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a /// MTCTR instruction. MTCTR, - + /// CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a /// BCTRL instruction. BCTRL_Darwin, BCTRL_SVR4, - + /// Return with a flag operand, matched by 'blr' RET_FLAG, - + /// R32 = MFCR(CRREG, INFLAG) - Represents the MFCRpseud/MFOCRF /// instructions. This copies the bits corresponding to the specified /// CRREG into the resultant GPR. Bits corresponding to other CR regs @@ -122,20 +122,20 @@ /// encoding for the OPC field to identify the compare. For example, 838 /// is VCMPGTSH. VCMP, - + /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the - /// altivec VCMP*o instructions. For lack of better number, we use the + /// altivec VCMP*o instructions. For lack of better number, we use the /// opcode number encoding for the OPC field to identify the compare. For /// example, 838 is VCMPGTSH. VCMPo, - + /// CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This /// corresponds to the COND_BRANCH pseudo instruction. CRRC is the /// condition register to branch on, OPC is the branch opcode to use (e.g. /// PPC::BLE), DESTBB is the destination block to branch to, and INFLAG is /// an optional input flag argument. COND_BRANCH, - + // The following 5 instructions are used only as part of the // long double-to-int conversion sequence. @@ -150,7 +150,7 @@ MTFSB1, /// F8RC, OUTFLAG = FADDRTZ F8RC, F8RC, INFLAG - This is an FADD done with - /// rounding towards zero. It has flags added so it won't move past the + /// rounding towards zero. It has flags added so it won't move past the /// FPSCR-setting instructions. FADDRTZ, @@ -174,14 +174,14 @@ /// STD_32 - This is the STD instruction for use with "32-bit" registers. STD_32 = ISD::FIRST_TARGET_MEMORY_OPCODE, - - /// CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a + + /// CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a /// byte-swapping store instruction. It byte-swaps the low "Type" bits of /// the GPRC input, then stores it through Ptr. Type can be either i16 or /// i32. - STBRX, - - /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a + STBRX, + + /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a /// byte-swapping load instruction. It loads "Type" bits, byte swaps it, /// then puts it in the bottom bits of the GPRC. TYPE can be either i16 /// or i32. @@ -194,7 +194,7 @@ /// isVPKUHUMShuffleMask - Return true if this is the shuffle mask for a /// VPKUHUM instruction. bool isVPKUHUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary); - + /// isVPKUWUMShuffleMask - Return true if this is the shuffle mask for a /// VPKUWUM instruction. bool isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary); @@ -208,16 +208,16 @@ /// a VRGH* instruction with the specified unit size (1,2 or 4 bytes). bool isVMRGHShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize, bool isUnary); - + /// isVSLDOIShuffleMask - If this is a vsldoi shuffle mask, return the shift /// amount, otherwise return -1. int isVSLDOIShuffleMask(SDNode *N, bool isUnary); - + /// isSplatShuffleMask - Return true if the specified VECTOR_SHUFFLE operand /// specifies a splat of a single element that is suitable for input to /// VSPLTB/VSPLTH/VSPLTW. bool isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize); - + /// isAllNegativeZeroVector - Returns true if all elements of build_vector /// are -0.0. bool isAllNegativeZeroVector(SDNode *N); @@ -225,24 +225,26 @@ /// getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the /// specified isSplatShuffleMask VECTOR_SHUFFLE mask. unsigned getVSPLTImmediate(SDNode *N, unsigned EltSize); - + /// get_VSPLTI_elt - If this is a build_vector of constants which can be /// formed by using a vspltis[bhw] instruction of the specified element /// size, return the constant being splatted. The ByteSize field indicates /// the number of bytes of each element [124] -> [bhw]. SDValue get_VSPLTI_elt(SDNode *N, unsigned ByteSize, SelectionDAG &DAG); } - + class PPCTargetLowering : public TargetLowering { const PPCSubtarget &PPCSubTarget; public: explicit PPCTargetLowering(PPCTargetMachine &TM); - + /// getTargetNodeName() - This method returns the name of a target specific /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i32; } + /// getSetCCResultType - Return the ISD::SETCC ValueType virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const; @@ -253,19 +255,19 @@ SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const; - + /// SelectAddressRegReg - Given the specified addressed, check to see if it /// can be represented as an indexed [r+r] operation. Returns false if it /// can be more efficiently represented with [r+imm]. bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index, SelectionDAG &DAG) const; - + /// SelectAddressRegImm - Returns true if the address N can be represented /// by a base register plus a signed 16-bit displacement [r+imm], and if it /// is not better represented as reg+reg. bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base, SelectionDAG &DAG) const; - + /// SelectAddressRegRegOnly - Given the specified addressed, force it to be /// represented as an indexed [r+r] operation. bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index, @@ -277,7 +279,7 @@ bool SelectAddressRegImmShift(SDValue N, SDValue &Disp, SDValue &Base, SelectionDAG &DAG) const; - + /// LowerOperation - Provide custom lowering hooks for some operations. /// virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; @@ -289,10 +291,10 @@ SelectionDAG &DAG) const; virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; - + virtual void computeMaskedBitsForTargetNode(const SDValue Op, const APInt &Mask, - APInt &KnownZero, + APInt &KnownZero, APInt &KnownOne, const SelectionDAG &DAG, unsigned Depth = 0) const; @@ -300,13 +302,13 @@ virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const; - MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI, + MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI, MachineBasicBlock *MBB, bool is64Bit, unsigned BinOpcode) const; - MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr *MI, - MachineBasicBlock *MBB, + MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr *MI, + MachineBasicBlock *MBB, bool is8bit, unsigned Opcode) const; - + ConstraintType getConstraintType(const std::string &Constraint) const; /// Examine constraint string and operand type and determine a weight value. @@ -314,7 +316,7 @@ ConstraintWeight getSingleConstraintMatchWeight( AsmOperandInfo &info, const char *constraint) const; - std::pair + std::pair getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; @@ -329,11 +331,11 @@ char ConstraintLetter, std::vector &Ops, SelectionDAG &DAG) const; - + /// isLegalAddressingMode - Return true if the addressing mode represented /// by AM is legal for this target, for a load/store of the specified type. virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty)const; - + /// isLegalAddressImmediate - Return true if the integer value can be used /// as the offset of the target addressing mode for load / store of the /// given type. @@ -344,7 +346,7 @@ virtual bool isLegalAddressImmediate(GlobalValue *GV) const; virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; - + /// getOptimalMemOpType - Returns the target specific optimal type for load /// and store operations as a result of memset, memcpy, and memmove /// lowering. If DstAlign is zero that means it's safe to destination Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -59,9 +59,6 @@ // Compute derived properties from the register classes computeRegisterProperties(); - // Set shifts properties - setShiftAmountType(MVT::i64); - // Provide all sorts of operation actions setLoadExtAction(ISD::SEXTLOAD, MVT::i1, Promote); setLoadExtAction(ISD::ZEXTLOAD, MVT::i1, Promote); Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h Fri Feb 25 15:41:48 2011 @@ -57,6 +57,8 @@ public: explicit SystemZTargetLowering(SystemZTargetMachine &TM); + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i64; } + /// LowerOperation - Provide custom lowering hooks for some operations. virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -220,7 +220,6 @@ static MVT IntVTs[] = { MVT::i8, MVT::i16, MVT::i32, MVT::i64 }; // X86 is weird, it always uses i8 for shift amounts and setcc results. - setShiftAmountType(MVT::i8); setBooleanContents(ZeroOrOneBooleanContent); setSchedulingPreference(Sched::RegPressure); setStackPointerRegisterToSaveRestore(X86StackPtr); @@ -4181,7 +4180,8 @@ SrcOp = DAG.getNode(ISD::BITCAST, dl, ShVT, SrcOp); return DAG.getNode(ISD::BITCAST, dl, VT, DAG.getNode(Opc, dl, ShVT, SrcOp, - DAG.getConstant(NumBits, TLI.getShiftAmountTy()))); + DAG.getConstant(NumBits, + TLI.getShiftAmountTy(SrcOp.getValueType())))); } SDValue @@ -4330,15 +4330,15 @@ // For AVX-length vectors, build the individual 128-bit pieces and // use shuffles to put them in place. - if (VT.getSizeInBits() > 256 && - Subtarget->hasAVX() && + if (VT.getSizeInBits() > 256 && + Subtarget->hasAVX() && !ISD::isBuildVectorAllZeros(Op.getNode())) { SmallVector V; V.resize(NumElems); for (unsigned i = 0; i < NumElems; ++i) { V[i] = Op.getOperand(i); } - + EVT HVT = EVT::getVectorVT(*DAG.getContext(), ExtVT, NumElems/2); // Build the lower subvector. @@ -5046,7 +5046,8 @@ DAG.getIntPtrConstant(Elt1 / 2)); if ((Elt1 & 1) == 0) InsElt = DAG.getNode(ISD::SHL, dl, MVT::i16, InsElt, - DAG.getConstant(8, TLI.getShiftAmountTy())); + DAG.getConstant(8, + TLI.getShiftAmountTy(InsElt.getValueType()))); else if (Elt0 >= 0) InsElt = DAG.getNode(ISD::AND, dl, MVT::i16, InsElt, DAG.getConstant(0xFF00, MVT::i16)); @@ -5060,7 +5061,8 @@ Elt0Src, DAG.getIntPtrConstant(Elt0 / 2)); if ((Elt0 & 1) != 0) InsElt0 = DAG.getNode(ISD::SRL, dl, MVT::i16, InsElt0, - DAG.getConstant(8, TLI.getShiftAmountTy())); + DAG.getConstant(8, + TLI.getShiftAmountTy(InsElt0.getValueType()))); else if (Elt1 >= 0) InsElt0 = DAG.getNode(ISD::AND, dl, MVT::i16, InsElt0, DAG.getConstant(0x00FF, MVT::i16)); @@ -5477,7 +5479,7 @@ // Both of them can't be memory operations though. if (MayFoldVectorLoad(V1) && MayFoldVectorLoad(V2)) CanFoldLoad = false; - + if (CanFoldLoad) { if (HasSSE2 && NumElems == 2) return getTargetShuffleNode(X86ISD::MOVLPD, dl, VT, V1, V2, DAG); @@ -6090,7 +6092,7 @@ SDValue ScaledN2 = N2; if (Upper) ScaledN2 = DAG.getNode(ISD::SUB, dl, N2.getValueType(), N2, - DAG.getConstant(NumElems / + DAG.getConstant(NumElems / (VT.getSizeInBits() / 128), N2.getValueType())); Op = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, SubN0.getValueType(), SubN0, Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Feb 25 15:41:48 2011 @@ -159,16 +159,16 @@ /// PSHUFB - Shuffle 16 8-bit values within a vector. PSHUFB, - + /// PANDN - and with not'd value. PANDN, - + /// PSIGNB/W/D - Copy integer sign. - PSIGNB, PSIGNW, PSIGND, - + PSIGNB, PSIGNW, PSIGND, + /// PBLENDVB - Variable blend PBLENDVB, - + /// FMAX, FMIN - Floating point max and min. /// FMAX, FMIN, @@ -212,7 +212,7 @@ // ADD, SUB, SMUL, etc. - Arithmetic operations with FLAGS results. ADD, SUB, ADC, SBB, SMUL, INC, DEC, OR, XOR, AND, - + UMUL, // LOW, HI, FLAGS = umul LHS, RHS // MUL_IMM - X86 specific multiply by immediate. @@ -467,6 +467,8 @@ virtual unsigned getJumpTableEncoding() const; + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i8; } + virtual const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid, Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Fri Feb 25 15:41:48 2011 @@ -42,9 +42,9 @@ using namespace llvm; const char *XCoreTargetLowering:: -getTargetNodeName(unsigned Opcode) const +getTargetNodeName(unsigned Opcode) const { - switch (Opcode) + switch (Opcode) { case XCoreISD::BL : return "XCoreISD::BL"; case XCoreISD::PCRelativeWrapper : return "XCoreISD::PCRelativeWrapper"; @@ -77,7 +77,6 @@ // Division is expensive setIntDivIsCheap(false); - setShiftAmountType(MVT::i32); setStackPointerRegisterToSaveRestore(XCore::SP); setSchedulingPreference(Sched::RegPressure); @@ -95,7 +94,7 @@ // Stop the combiner recombining select and set_cc setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); - + // 64bit setOperationAction(ISD::ADD, MVT::i64, Custom); setOperationAction(ISD::SUB, MVT::i64, Custom); @@ -106,14 +105,14 @@ setOperationAction(ISD::SHL_PARTS, MVT::i32, Expand); setOperationAction(ISD::SRA_PARTS, MVT::i32, Expand); setOperationAction(ISD::SRL_PARTS, MVT::i32, Expand); - + // Bit Manipulation setOperationAction(ISD::CTPOP, MVT::i32, Expand); setOperationAction(ISD::ROTL , MVT::i32, Expand); setOperationAction(ISD::ROTR , MVT::i32, Expand); - + setOperationAction(ISD::TRAP, MVT::Other, Legal); - + // Jump tables. setOperationAction(ISD::BR_JT, MVT::Other, Custom); @@ -122,7 +121,7 @@ // Thread Local Storage setOperationAction(ISD::GlobalTLSAddress, MVT::i32, Custom); - + // Conversion of i64 -> double produces constantpool nodes setOperationAction(ISD::ConstantPool, MVT::i32, Custom); @@ -143,7 +142,7 @@ setOperationAction(ISD::VACOPY, MVT::Other, Expand); setOperationAction(ISD::VAARG, MVT::Other, Custom); setOperationAction(ISD::VASTART, MVT::Other, Custom); - + // Dynamic stack setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); @@ -163,7 +162,7 @@ SDValue XCoreTargetLowering:: LowerOperation(SDValue Op, SelectionDAG &DAG) const { - switch (Op.getOpcode()) + switch (Op.getOpcode()) { case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG); case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG); @@ -414,7 +413,7 @@ SDValue Chain = LD->getChain(); SDValue BasePtr = LD->getBasePtr(); DebugLoc DL = Op.getDebugLoc(); - + SDValue Base; int64_t Offset; if (!LD->isVolatile() && @@ -437,10 +436,10 @@ SDValue HighOffset = DAG.getConstant((Offset & ~0x3) + 4, MVT::i32); SDValue LowShift = DAG.getConstant((Offset & 0x3) * 8, MVT::i32); SDValue HighShift = DAG.getConstant(32 - (Offset & 0x3) * 8, MVT::i32); - + SDValue LowAddr = DAG.getNode(ISD::ADD, DL, MVT::i32, Base, LowOffset); SDValue HighAddr = DAG.getNode(ISD::ADD, DL, MVT::i32, Base, HighOffset); - + SDValue Low = DAG.getLoad(getPointerTy(), DL, Chain, LowAddr, MachinePointerInfo(), false, false, 0); SDValue High = DAG.getLoad(getPointerTy(), DL, Chain, @@ -453,7 +452,7 @@ SDValue Ops[] = { Result, Chain }; return DAG.getMergeValues(Ops, 2, DL); } - + if (LD->getAlignment() == 2) { SDValue Low = DAG.getExtLoad(ISD::ZEXTLOAD, DL, MVT::i32, Chain, BasePtr, LD->getPointerInfo(), MVT::i16, @@ -473,16 +472,16 @@ SDValue Ops[] = { Result, Chain }; return DAG.getMergeValues(Ops, 2, DL); } - + // Lower to a call to __misaligned_load(BasePtr). const Type *IntPtrTy = getTargetData()->getIntPtrType(*DAG.getContext()); TargetLowering::ArgListTy Args; TargetLowering::ArgListEntry Entry; - + Entry.Ty = IntPtrTy; Entry.Node = BasePtr; Args.push_back(Entry); - + std::pair CallResult = LowerCallTo(Chain, IntPtrTy, false, false, false, false, 0, CallingConv::C, false, @@ -515,7 +514,7 @@ SDValue BasePtr = ST->getBasePtr(); SDValue Value = ST->getValue(); DebugLoc dl = Op.getDebugLoc(); - + if (ST->getAlignment() == 2) { SDValue Low = Value; SDValue High = DAG.getNode(ISD::SRL, dl, MVT::i32, Value, @@ -532,19 +531,19 @@ ST->isNonTemporal(), 2); return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, StoreLow, StoreHigh); } - + // Lower to a call to __misaligned_store(BasePtr, Value). const Type *IntPtrTy = getTargetData()->getIntPtrType(*DAG.getContext()); TargetLowering::ArgListTy Args; TargetLowering::ArgListEntry Entry; - + Entry.Ty = IntPtrTy; Entry.Node = BasePtr; Args.push_back(Entry); - + Entry.Node = Value; Args.push_back(Entry); - + std::pair CallResult = LowerCallTo(Chain, Type::getVoidTy(*DAG.getContext()), false, false, false, false, 0, CallingConv::C, false, @@ -722,7 +721,7 @@ } DebugLoc dl = N->getDebugLoc(); - + // Extract components SDValue LHSL = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, N->getOperand(0), DAG.getConstant(0, MVT::i32)); @@ -732,7 +731,7 @@ N->getOperand(1), DAG.getConstant(0, MVT::i32)); SDValue RHSH = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, N->getOperand(1), DAG.getConstant(1, MVT::i32)); - + // Expand unsigned Opcode = (N->getOpcode() == ISD::ADD) ? XCoreISD::LADD : XCoreISD::LSUB; @@ -740,7 +739,7 @@ SDValue Carry = DAG.getNode(Opcode, dl, DAG.getVTList(MVT::i32, MVT::i32), LHSL, RHSL, Zero); SDValue Lo(Carry.getNode(), 1); - + SDValue Ignored = DAG.getNode(Opcode, dl, DAG.getVTList(MVT::i32, MVT::i32), LHSH, RHSH, Carry); SDValue Hi(Ignored.getNode(), 1); @@ -761,8 +760,8 @@ Node->getOperand(1), MachinePointerInfo(V), false, false, 0); // Increment the pointer, VAList, to the next vararg - SDValue Tmp3 = DAG.getNode(ISD::ADD, dl, getPointerTy(), VAList, - DAG.getConstant(VT.getSizeInBits(), + SDValue Tmp3 = DAG.getNode(ISD::ADD, dl, getPointerTy(), VAList, + DAG.getConstant(VT.getSizeInBits(), getPointerTy())); // Store the incremented VAList to the legalized pointer Tmp3 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Node->getOperand(1), @@ -781,20 +780,20 @@ MachineFunction &MF = DAG.getMachineFunction(); XCoreFunctionInfo *XFI = MF.getInfo(); SDValue Addr = DAG.getFrameIndex(XFI->getVarArgsFrameIndex(), MVT::i32); - return DAG.getStore(Op.getOperand(0), dl, Addr, Op.getOperand(1), + return DAG.getStore(Op.getOperand(0), dl, Addr, Op.getOperand(1), MachinePointerInfo(), false, false, 0); } SDValue XCoreTargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const { DebugLoc dl = Op.getDebugLoc(); - // Depths > 0 not supported yet! + // Depths > 0 not supported yet! if (cast(Op.getOperand(0))->getZExtValue() > 0) return SDValue(); - + MachineFunction &MF = DAG.getMachineFunction(); const TargetRegisterInfo *RegInfo = getTargetMachine().getRegisterInfo(); - return DAG.getCopyFromReg(DAG.getEntryNode(), dl, + return DAG.getCopyFromReg(DAG.getEntryNode(), dl, RegInfo->getFrameRegister(MF), MVT::i32); } @@ -919,7 +918,7 @@ // Get a count of how many bytes are to be pushed on the stack. unsigned NumBytes = CCInfo.getNextStackOffset(); - Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(NumBytes, + Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(NumBytes, getPointerTy(), true)); SmallVector, 4> RegsToPass; @@ -944,8 +943,8 @@ Arg = DAG.getNode(ISD::ANY_EXTEND, dl, VA.getLocVT(), Arg); break; } - - // Arguments that can be passed on register must be kept at + + // Arguments that can be passed on register must be kept at // RegsToPass vector if (VA.isRegLoc()) { RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg)); @@ -954,7 +953,7 @@ int Offset = VA.getLocMemOffset(); - MemOpChains.push_back(DAG.getNode(XCoreISD::STWSP, dl, MVT::Other, + MemOpChains.push_back(DAG.getNode(XCoreISD::STWSP, dl, MVT::Other, Chain, Arg, DAG.getConstant(Offset/4, MVT::i32))); } @@ -963,16 +962,16 @@ // Transform all store nodes into one single node because // all store nodes are independent of each other. if (!MemOpChains.empty()) - Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, + Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &MemOpChains[0], MemOpChains.size()); - // Build a sequence of copy-to-reg nodes chained together with token + // Build a sequence of copy-to-reg nodes chained together with token // chain and flag operands which copy the outgoing args into registers. // The InFlag in necessary since all emited instructions must be // stuck together. SDValue InFlag; for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { - Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, + Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, RegsToPass[i].second, InFlag); InFlag = Chain.getValue(1); } @@ -986,7 +985,7 @@ Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32); // XCoreBranchLink = #chain, #target_address, #opt_in_flags... - // = Chain, Callee, Reg#1, Reg#2, ... + // = Chain, Callee, Reg#1, Reg#2, ... // // Returns a chain & a flag for retval copy to use. SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue); @@ -994,7 +993,7 @@ Ops.push_back(Chain); Ops.push_back(Callee); - // Add argument registers to the end of the list so that they are + // Add argument registers to the end of the list so that they are // known live into the call. for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) Ops.push_back(DAG.getRegister(RegsToPass[i].first, @@ -1098,11 +1097,11 @@ unsigned StackSlotSize = XCoreFrameLowering::stackSlotSize(); unsigned LRSaveSize = StackSlotSize; - + for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) { CCValAssign &VA = ArgLocs[i]; - + if (VA.isRegLoc()) { // Arguments passed in registers EVT RegVT = VA.getLocVT(); @@ -1139,12 +1138,12 @@ // Create the SelectionDAG nodes corresponding to a load //from this parameter SDValue FIN = DAG.getFrameIndex(FI, MVT::i32); - InVals.push_back(DAG.getLoad(VA.getLocVT(), dl, Chain, FIN, + InVals.push_back(DAG.getLoad(VA.getLocVT(), dl, Chain, FIN, MachinePointerInfo::getFixedStack(FI), false, false, 0)); } } - + if (isVarArg) { /* Argument registers */ static const unsigned ArgRegs[] = { @@ -1186,7 +1185,7 @@ true)); } } - + return Chain; } @@ -1222,7 +1221,7 @@ // Analize return values. CCInfo.AnalyzeReturn(Outs, RetCC_XCore); - // If this is the first return lowered for this function, add + // If this is the first return lowered for this function, add // the regs to the liveout set for the function. if (DAG.getMachineFunction().getRegInfo().liveout_empty()) { for (unsigned i = 0; i != RVLocs.size(); ++i) @@ -1237,7 +1236,7 @@ CCValAssign &VA = RVLocs[i]; assert(VA.isRegLoc() && "Can only return in registers!"); - Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), + Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), OutVals[i], Flag); // guarantee that all emitted copies are @@ -1265,7 +1264,7 @@ DebugLoc dl = MI->getDebugLoc(); assert((MI->getOpcode() == XCore::SELECT_CC) && "Unexpected instr type to insert"); - + // To "insert" a SELECT_CC instruction, we actually have to insert the diamond // control-flow pattern. The incoming instruction knows the destination vreg // to set, the condition code register to branch on, the true/false values to @@ -1273,7 +1272,7 @@ const BasicBlock *LLVM_BB = BB->getBasicBlock(); MachineFunction::iterator It = BB; ++It; - + // thisMBB: // ... // TrueVal = ... @@ -1296,7 +1295,7 @@ // Next, add the true and fallthrough blocks as its successors. BB->addSuccessor(copy0MBB); BB->addSuccessor(sinkMBB); - + BuildMI(BB, dl, TII.get(XCore::BRFT_lru6)) .addReg(MI->getOperand(1).getReg()).addMBB(sinkMBB); @@ -1304,10 +1303,10 @@ // %FalseValue = ... // # fallthrough to sinkMBB BB = copy0MBB; - + // Update machine-CFG edges BB->addSuccessor(sinkMBB); - + // sinkMBB: // %Result = phi [ %FalseValue, copy0MBB ], [ %TrueValue, thisMBB ] // ... @@ -1316,7 +1315,7 @@ TII.get(XCore::PHI), MI->getOperand(0).getReg()) .addReg(MI->getOperand(3).getReg()).addMBB(copy0MBB) .addReg(MI->getOperand(2).getReg()).addMBB(thisMBB); - + MI->eraseFromParent(); // The pseudo instruction is gone now. return BB; } @@ -1354,7 +1353,7 @@ // fold (ladd x, 0, y) -> 0, add x, y iff carry is unused and y has only the // low bit set - if (N1C && N1C->isNullValue() && N->hasNUsesOfValue(0, 0)) { + if (N1C && N1C->isNullValue() && N->hasNUsesOfValue(0, 0)) { APInt KnownZero, KnownOne; APInt Mask = APInt::getHighBitsSet(VT.getSizeInBits(), VT.getSizeInBits() - 1); @@ -1377,7 +1376,7 @@ EVT VT = N0.getValueType(); // fold (lsub 0, 0, x) -> x, -x iff x has only the low bit set - if (N0C && N0C->isNullValue() && N1C && N1C->isNullValue()) { + if (N0C && N0C->isNullValue() && N1C && N1C->isNullValue()) { APInt KnownZero, KnownOne; APInt Mask = APInt::getHighBitsSet(VT.getSizeInBits(), VT.getSizeInBits() - 1); @@ -1393,7 +1392,7 @@ // fold (lsub x, 0, y) -> 0, sub x, y iff borrow is unused and y has only the // low bit set - if (N1C && N1C->isNullValue() && N->hasNUsesOfValue(0, 0)) { + if (N1C && N1C->isNullValue() && N->hasNUsesOfValue(0, 0)) { APInt KnownZero, KnownOne; APInt Mask = APInt::getHighBitsSet(VT.getSizeInBits(), VT.getSizeInBits() - 1); @@ -1557,7 +1556,7 @@ /// isLegalAddressingMode - Return true if the addressing mode represented /// by AM is legal for this target, for a load/store of the specified type. bool -XCoreTargetLowering::isLegalAddressingMode(const AddrMode &AM, +XCoreTargetLowering::isLegalAddressingMode(const AddrMode &AM, const Type *Ty) const { if (Ty->getTypeID() == Type::VoidTyID) return AM.Scale == 0 && isImmUs(AM.BaseOffs) && isImmUs4(AM.BaseOffs); @@ -1568,7 +1567,7 @@ return Size >= 4 && !AM.HasBaseReg && AM.Scale == 0 && AM.BaseOffs%4 == 0; } - + switch (Size) { case 1: // reg + imm @@ -1593,7 +1592,7 @@ // reg + reg<<2 return AM.Scale == 4 && AM.BaseOffs == 0; } - + return false; } @@ -1603,7 +1602,7 @@ std::vector XCoreTargetLowering:: getRegClassForInlineAsmConstraint(const std::string &Constraint, - EVT VT) const + EVT VT) const { if (Constraint.size() != 1) return std::vector(); @@ -1611,9 +1610,9 @@ switch (Constraint[0]) { default : break; case 'r': - return make_vector(XCore::R0, XCore::R1, XCore::R2, - XCore::R3, XCore::R4, XCore::R5, - XCore::R6, XCore::R7, XCore::R8, + return make_vector(XCore::R0, XCore::R1, XCore::R2, + XCore::R3, XCore::R4, XCore::R5, + XCore::R6, XCore::R7, XCore::R8, XCore::R9, XCore::R10, XCore::R11, 0); break; } Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.h?rev=126518&r1=126517&r2=126518&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.h (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Fri Feb 25 15:41:48 2011 @@ -20,11 +20,11 @@ #include "XCore.h" namespace llvm { - + // Forward delcarations class XCoreSubtarget; class XCoreTargetMachine; - + namespace XCoreISD { enum NodeType { // Start the numbering where the builtin ops and target ops leave off. @@ -38,16 +38,16 @@ // dp relative address DPRelativeWrapper, - + // cp relative address CPRelativeWrapper, - + // Store word to stack STWSP, // Corresponds to retsp instruction RETSP, - + // Corresponds to LADD instruction LADD, @@ -74,13 +74,14 @@ //===--------------------------------------------------------------------===// // TargetLowering Implementation //===--------------------------------------------------------------------===// - class XCoreTargetLowering : public TargetLowering + class XCoreTargetLowering : public TargetLowering { public: explicit XCoreTargetLowering(XCoreTargetMachine &TM); virtual unsigned getJumpTableEncoding() const; + virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i32; } /// LowerOperation - Provide custom lowering hooks for some operations. virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; @@ -91,10 +92,10 @@ virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl&Results, SelectionDAG &DAG) const; - /// getTargetNodeName - This method returns the name of a target specific + /// getTargetNodeName - This method returns the name of a target specific // DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; - + virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const; @@ -108,7 +109,7 @@ private: const XCoreTargetMachine &TM; const XCoreSubtarget &Subtarget; - + // Lower Operand helpers SDValue LowerCCCArguments(SDValue Chain, CallingConv::ID CallConv, @@ -148,12 +149,12 @@ SDValue LowerSMUL_LOHI(SDValue Op, SelectionDAG &DAG) const; SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; SDValue LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) const; - + // Inline asm support std::vector getRegClassForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; - + // Expand specifics SDValue TryExpandADDWithMul(SDNode *Op, SelectionDAG &DAG) const; SDValue ExpandADDSUB(SDNode *Op, SelectionDAG &DAG) const; From clattner at apple.com Fri Feb 25 15:49:23 2011 From: clattner at apple.com (Chris Lattner) Date: Fri, 25 Feb 2011 13:49:23 -0800 Subject: [llvm-commits] [llvm] r126518 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/Alpha/ lib/Target/Blackfin/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/PowerPC/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ In-Reply-To: <20110225214149.7F04A2A6C12C@llvm.org> References: <20110225214149.7F04A2A6C12C@llvm.org> Message-ID: On Feb 25, 2011, at 1:41 PM, Owen Anderson wrote: > Author: resistor > Date: Fri Feb 25 15:41:48 2011 > New Revision: 126518 > > URL: http://llvm.org/viewvc/llvm-project?rev=126518&view=rev > Log: > Allow targets to specify a the type of the RHS of a shift parameterized on the type of the LHS. Ok, but please don't conflate massive "remove trailing whitespace" changes into patches like this. -Chris From dmalyshev at accesssoftek.com Fri Feb 25 16:14:38 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Fri, 25 Feb 2011 14:14:38 -0800 Subject: [llvm-commits] Console input should be opened in binary mode on Windows (Python setting) Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE17E1229176@mail.accesssoftek.com> Hello All, Some tests on Windows fail because these tests use python scripts for analyze binary output from console, but python open it in the text mode. Attached patch fix it. The patch fixes the following tests: LLVM :: CodeGen/ARM/2010-12-13-reloc-pic.ll LLVM :: MC/ARM/elf-reloc-01.ll LLVM :: MC/COFF/symbol-alias.s LLVM :: MC/ELF/align.s LLVM :: MC/ELF/cfi.s LLVM :: MC/ELF/relocation.s LLVM :: MC/ELF/tls-i386.s LLVM :: MC/ELF/weakref.s Tested in MinGW and Ubuntu. Thank you, Danil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/1d367d09/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: python-binary-console-01.patch Type: application/octet-stream Size: 503 bytes Desc: python-binary-console-01.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/1d367d09/attachment.obj From dmalyshev at accesssoftek.com Fri Feb 25 16:17:02 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Fri, 25 Feb 2011 14:17:02 -0800 Subject: [llvm-commits] ExecutionEngine regress tests should be skipped for cross LLVM build when host CPU different then target CPU Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE17E1229178@mail.accesssoftek.com> Hello All, These tests use LLI interpreter, but this interpreter cannot normally work if LLVM target CPU different current system CPU. So, these tests should be skipped. Please, review the attached patch with this feature. Unit tests ExecutionEngine should be skipped too, I will do it in the next patch. Thank you, Danil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/fdf3d384/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: skip-tests-01.patch Type: application/octet-stream Size: 2436 bytes Desc: skip-tests-01.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110225/fdf3d384/attachment.obj From stuart at apple.com Fri Feb 25 16:47:58 2011 From: stuart at apple.com (Stuart Hastings) Date: Fri, 25 Feb 2011 22:47:58 -0000 Subject: [llvm-commits] [llvm] r126525 - /llvm/trunk/utils/buildit/build_llvm Message-ID: <20110225224758.7A5D32A6C12C@llvm.org> Author: stuart Date: Fri Feb 25 16:47:58 2011 New Revision: 126525 URL: http://llvm.org/viewvc/llvm-project?rev=126525&view=rev Log: Fix bad comment marker. Modified: llvm/trunk/utils/buildit/build_llvm Modified: llvm/trunk/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=126525&r1=126524&r2=126525&view=diff ============================================================================== --- llvm/trunk/utils/buildit/build_llvm (original) +++ llvm/trunk/utils/buildit/build_llvm Fri Feb 25 16:47:58 2011 @@ -341,7 +341,7 @@ fi rm -f lib/libLTO.a lib/libLTO.la -// Omit lto.h from the result. Clang will supply. +# Omit lto.h from the result. Clang will supply. find $DEST_DIR$DEST_ROOT -name lto.h -delete ################################################################################ From grosbach at apple.com Fri Feb 25 16:53:20 2011 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 25 Feb 2011 22:53:20 -0000 Subject: [llvm-commits] [llvm] r126526 - /llvm/trunk/lib/CodeGen/LowerSubregs.cpp Message-ID: <20110225225320.F3DC02A6C12C@llvm.org> Author: grosbach Date: Fri Feb 25 16:53:20 2011 New Revision: 126526 URL: http://llvm.org/viewvc/llvm-project?rev=126526&view=rev Log: Trailing whitespace. Modified: llvm/trunk/lib/CodeGen/LowerSubregs.cpp Modified: llvm/trunk/lib/CodeGen/LowerSubregs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LowerSubregs.cpp?rev=126526&r1=126525&r2=126526&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LowerSubregs.cpp (original) +++ llvm/trunk/lib/CodeGen/LowerSubregs.cpp Fri Feb 25 16:53:20 2011 @@ -37,7 +37,7 @@ public: static char ID; // Pass identification, replacement for typeid LowerSubregsInstructionPass() : MachineFunctionPass(ID) {} - + const char *getPassName() const { return "Subregister lowering instruction pass"; } @@ -64,8 +64,8 @@ char LowerSubregsInstructionPass::ID = 0; } -FunctionPass *llvm::createLowerSubregsPass() { - return new LowerSubregsInstructionPass(); +FunctionPass *llvm::createLowerSubregsPass() { + return new LowerSubregsInstructionPass(); } /// TransferDeadFlag - MI is a pseudo-instruction with DstReg dead, @@ -192,9 +192,9 @@ /// copies. /// bool LowerSubregsInstructionPass::runOnMachineFunction(MachineFunction &MF) { - DEBUG(dbgs() << "Machine Function\n" + DEBUG(dbgs() << "Machine Function\n" << "********** LOWERING SUBREG INSTRS **********\n" - << "********** Function: " + << "********** Function: " << MF.getFunction()->getName() << '\n'); TRI = MF.getTarget().getRegisterInfo(); TII = MF.getTarget().getInstrInfo(); From jasonwkim at google.com Fri Feb 25 17:40:42 2011 From: jasonwkim at google.com (Jason Kim) Date: Fri, 25 Feb 2011 15:40:42 -0800 Subject: [llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp In-Reply-To: <470208.84552.qm@web55602.mail.re4.yahoo.com> References: <960821.36942.qm@web55604.mail.re4.yahoo.com> <4D680702.2040101@gmail.com> <470208.84552.qm@web55602.mail.re4.yahoo.com> Message-ID: On Fri, Feb 25, 2011 at 12:05 PM, Jan Sjodin wrote: > Just to keep the code more object-oriented. If a sub-class (I intend to inherit > from these classes) needs the functions, they will not be available if they are > hidden as static functions. Hi Jan, Just out of curiosity, what do you plan to do with MCELF inheritance wise? Thanks -jason > > - Jan > > > ----- Original Message ---- >> From: Rafael Avila de Espindola >> To: llvm-commits at cs.uiuc.edu >> Sent: Fri, February 25, 2011 2:46:10 PM >> Subject: Re: [llvm-commits] Code refactoring of MCELFStreamer.cpp and >>ELFObjectWriter.cpp >> >> On 11-02-25 12:02 PM, Jan Sjodin wrote: >> > Removed duplicated code by ?putting shared functions in MCELF.h/cpp and made >>the >> > rest of the C-style ?static functions static methods in the corresponding >> > ?classes. >> >> Moving the duplicated functions to a new file is OK, but why ?convert the >> function only used in the ELFObjectWriter to static ?methods? >> >> > - ?Jan >> >> Cheers, >> Rafael >> _______________________________________________ >> llvm-commits ?mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From aggarwa4 at illinois.edu Fri Feb 25 17:37:46 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Fri, 25 Feb 2011 23:37:46 -0000 Subject: [llvm-commits] [poolalloc] r126532 - /poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Message-ID: <20110225233746.720A32A6C12C@llvm.org> Author: aggarwa4 Date: Fri Feb 25 17:37:46 2011 New Revision: 126532 URL: http://llvm.org/viewvc/llvm-project?rev=126532&view=rev Log: call (bitcast F to ...) () should not cause F to be considered address taken, as that value is never really stored, and used elsewhere. Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp?rev=126532&r1=126531&r2=126532&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp (original) +++ poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Fri Feb 25 17:37:46 2011 @@ -48,8 +48,14 @@ if(isAddressTaken(U)) return true; } else { - // FIXME handle bitcasts to see if the resultant value - // is ever used in an address taken fashion + if (Constant *C = dyn_cast(U)) { + if (ConstantExpr *CE = dyn_cast(C)) { + if (CE->getOpcode() == Instruction::BitCast) { + return isAddressTaken(CE); + } + } + } + return true; } From dimitry at andric.com Fri Feb 25 17:41:33 2011 From: dimitry at andric.com (Dimitry Andric) Date: Sat, 26 Feb 2011 00:41:33 +0100 Subject: [llvm-commits] [patch] Fix getDriver().getInstalledDir() comparisons In-Reply-To: <4D680F41.1070008@andric.com> References: <4D680F41.1070008@andric.com> Message-ID: <4D683E2D.9050800@andric.com> Apologies for posting these patches here, please disregard them, they're really about clang. :) Copied to cfe-commits instead... From bob.wilson at apple.com Fri Feb 25 17:42:03 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Feb 2011 23:42:03 -0000 Subject: [llvm-commits] [llvm] r126533 - /llvm/trunk/utils/buildit/GNUmakefile Message-ID: <20110225234203.F04B72A6C12C@llvm.org> Author: bwilson Date: Fri Feb 25 17:42:03 2011 New Revision: 126533 URL: http://llvm.org/viewvc/llvm-project?rev=126533&view=rev Log: Add a new "Embedded" makefile target for Apple-style builds. This one just installs the default build into a different destination directory. Modified: llvm/trunk/utils/buildit/GNUmakefile Modified: llvm/trunk/utils/buildit/GNUmakefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/GNUmakefile?rev=126533&r1=126532&r2=126533&view=diff ============================================================================== --- llvm/trunk/utils/buildit/GNUmakefile (original) +++ llvm/trunk/utils/buildit/GNUmakefile Fri Feb 25 17:42:03 2011 @@ -80,6 +80,10 @@ export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`; \ $(MAKE) IOS_SIM_BUILD=yes PREFIX=$(SDKROOT)/usr/local install +Embedded: + ARM_PLATFORM=`xcodebuild -version -sdk iphoneos PlatformPath` && \ + $(MAKE) DSTROOT=$(DSTROOT)$$ARM_PLATFORM install + # installhdrs does nothing, because the headers aren't useful until # the compiler is installed. installhdrs: @@ -128,4 +132,4 @@ $(OBJROOT) $(SYMROOT) $(DSTROOT): mkdir -p $@ -.PHONY: install installsrc clean EmbeddedHosted EmbeddedSim +.PHONY: install installsrc clean EmbeddedHosted EmbeddedSim Embedded From rafael.espindola at gmail.com Fri Feb 25 18:15:27 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Fri, 25 Feb 2011 19:15:27 -0500 Subject: [llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp In-Reply-To: <470208.84552.qm@web55602.mail.re4.yahoo.com> References: <960821.36942.qm@web55604.mail.re4.yahoo.com> <4D680702.2040101@gmail.com> <470208.84552.qm@web55602.mail.re4.yahoo.com> Message-ID: <4D68461F.2090807@gmail.com> On 2011-02-25 15:05, Jan Sjodin wrote: > Just to keep the code more object-oriented. If a sub-class (I intend to inherit > from these classes) needs the functions, they will not be available if they are > hidden as static functions. So you intent to move the ELFObjectWriter class declaration to a header? I have the same question as Jason, what do you want to do with it? :-) > - Jan Cheers, Rafael From bob.wilson at apple.com Fri Feb 25 18:22:18 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Sat, 26 Feb 2011 00:22:18 -0000 Subject: [llvm-commits] [llvm] r126534 - /llvm/trunk/utils/buildit/build_llvm Message-ID: <20110226002218.175762A6C12C@llvm.org> Author: bwilson Date: Fri Feb 25 18:22:17 2011 New Revision: 126534 URL: http://llvm.org/viewvc/llvm-project?rev=126534&view=rev Log: Removed unnecessary dylibs from Apple builds, with or without "lib" prefix. Radar 9056686 Modified: llvm/trunk/utils/buildit/build_llvm Modified: llvm/trunk/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=126534&r1=126533&r2=126534&view=diff ============================================================================== --- llvm/trunk/utils/buildit/build_llvm (original) +++ llvm/trunk/utils/buildit/build_llvm Fri Feb 25 18:22:17 2011 @@ -267,8 +267,9 @@ # The Hello dylib is an example of how to build a pass. # The BugpointPasses module is only used to test bugpoint. # These unversioned dylibs cause verification failures, so do not install them. -rm $DEST_DIR$DEST_ROOT/lib/libLLVMHello.dylib -rm $DEST_DIR$DEST_ROOT/lib/libBugpointPasses.dylib +# (The wildcards are used to match a "lib" prefix if it is present.) +rm $DEST_DIR$DEST_ROOT/lib/*LLVMHello.dylib +rm $DEST_DIR$DEST_ROOT/lib/*BugpointPasses.dylib # Compress manpages MDIR=$DEST_DIR$DEST_ROOT/share/man/man1 From jan_sjodin at yahoo.com Fri Feb 25 19:54:30 2011 From: jan_sjodin at yahoo.com (Jan Sjodin) Date: Fri, 25 Feb 2011 17:54:30 -0800 (PST) Subject: [llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp In-Reply-To: <4D68461F.2090807@gmail.com> References: <960821.36942.qm@web55604.mail.re4.yahoo.com> <4D680702.2040101@gmail.com> <470208.84552.qm@web55602.mail.re4.yahoo.com> <4D68461F.2090807@gmail.com> Message-ID: <267631.76534.qm@web55603.mail.re4.yahoo.com> The JIT implementation I am working on (MCJIT which was renamed to JunkJIT) became a lot nicer when I decided to inherit MCELFStreamer and ELFObjectWriter. This was needed to make the debug information available to gdb since it expects ELF format. I basically reuse everything, the only thing that differs is that I use a mem_raw_outstream to emit code to memory and make sure that all sections are created before or during the post layout binding so that when RecordRelocation is called all symbol addresses are known. In the ELFObjectWriter, the code in WriteObject that creates sections is moved to the post layout binding, and the code that emits the object stays in place. This is perhaps not very clean, since it is not formalized in the interface, but it works okay and I only need to shuffle around the code a little. You could imagine that if section creation was restricted by the interface to only happenen before/during post layout, then a generic JunkJIT could be written for any object format. Each object writer would be required to compute offsets for the sections. I am currently not aiming to do this since the MCJIT proposal by Daniel separates the Streamer/ObjectWriter from figuring out relocations and external symbols. However, the code refactoring patches I have/will submit are fairly benign and enable a JIT (without lazy compilation) using the MC framework. - Jan ----- Original Message ---- > From: Rafael ?vila de Esp?ndola > To: Jan Sjodin > Cc: llvm-commits at cs.uiuc.edu > Sent: Fri, February 25, 2011 7:15:27 PM > Subject: Re: [llvm-commits] Code refactoring of MCELFStreamer.cpp and >ELFObjectWriter.cpp > > On 2011-02-25 15:05, Jan Sjodin wrote: > > Just to keep the code more object-oriented. If a sub-class (I intend to >inherit > > > from these classes) needs the functions, they will not be available if they >are > > > hidden as static functions. > > So you intent to move the ELFObjectWriter class declaration to a header? > I have the same question as Jason, what do you want to do with it? :-) > > > - Jan > > Cheers, > Rafael > From isanbard at gmail.com Fri Feb 25 21:09:12 2011 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 26 Feb 2011 03:09:12 -0000 Subject: [llvm-commits] [llvm] r126538 - in /llvm/trunk/utils/TableGen: AsmWriterEmitter.cpp AsmWriterEmitter.h Message-ID: <20110226030912.858682A6C12C@llvm.org> Author: void Date: Fri Feb 25 21:09:12 2011 New Revision: 126538 URL: http://llvm.org/viewvc/llvm-project?rev=126538&view=rev Log: A new TableGen feature! (Not turned on just yet.) InstAlias<{alias}, {aliasee}>; The InstAlias instruction should be able to go from the MCInst to the {alias}. All of the information is there to match the MCInst with the {aliasee}. From there, it's a simple matter to emit the {alias}, with the correct operands from the {aliasee}. The code this patch generates can be used by the InstPrinter to automatically print out the alias without having to write special C++ code to handle the situation. This is a WIP, and therefore are several limitations. For instance, it cannot handle AsmOperands at the moment. It also doesn't know what to do when two {alias}es match the same {aliasee}. (Currently, it just ignores those two cases and allows the printInstruction method to handle them.) Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp llvm/trunk/utils/TableGen/AsmWriterEmitter.h Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=126538&r1=126537&r2=126538&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Fri Feb 25 21:09:12 2011 @@ -542,7 +542,255 @@ << "}\n\n#endif\n"; } +void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { + CodeGenTarget Target(Records); + Record *AsmWriter = Target.getAsmWriter(); + O << "\n#ifdef PRINT_ALIAS_INSTR\n"; + O << "#undef PRINT_ALIAS_INSTR\n\n"; + + // Enumerate the register classes. + const std::vector &RegisterClasses = + Target.getRegisterClasses(); + + O << "namespace { // Register classes\n"; + O << " enum RegClass {\n"; + + // Emit the register enum value for each RegisterClass. + for (unsigned I = 0, E = RegisterClasses.size(); I != E; ++I) { + if (I != 0) O << ",\n"; + O << " RC_" << RegisterClasses[I].TheDef->getName(); + } + + O << "\n };\n"; + O << "} // end anonymous namespace\n\n"; + + // Emit a function that returns 'true' if a regsiter is part of a particular + // register class. I.e., RAX is part of GR64 on X86. + O << "static bool regIsInRegisterClass" + << "(unsigned RegClass, unsigned Reg) {\n"; + + // Emit the switch that checks if a register belongs to a particular register + // class. + O << " switch (RegClass) {\n"; + O << " default: break;\n"; + + for (unsigned I = 0, E = RegisterClasses.size(); I != E; ++I) { + const CodeGenRegisterClass &RC = RegisterClasses[I]; + + // Give the register class a legal C name if it's anonymous. + std::string Name = RC.TheDef->getName(); + O << " case RC_" << Name << ":\n"; + + // Emit the register list now. + unsigned IE = RC.Elements.size(); + if (IE == 1) { + O << " if (Reg == " << getQualifiedName(RC.Elements[0]) << ")\n"; + O << " return true;\n"; + } else { + O << " switch (Reg) {\n"; + O << " default: break;\n"; + + for (unsigned II = 0; II != IE; ++II) { + Record *Reg = RC.Elements[II]; + O << " case " << getQualifiedName(Reg) << ":\n"; + } + + O << " return true;\n"; + O << " }\n"; + } + + O << " break;\n"; + } + + O << " }\n\n"; + O << " return false;\n"; + O << "}\n\n"; + + // Emit the method that prints the alias instruction. + std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName"); + + bool isMC = AsmWriter->getValueAsBit("isMCAsmWriter"); + const char *MachineInstrClassName = isMC ? "MCInst" : "MachineInstr"; + + O << "bool " << Target.getName() << ClassName + << "::printAliasInstr(const " << MachineInstrClassName + << " *MI, raw_ostream &OS) {\n"; + + std::vector AllInstAliases = + Records.getAllDerivedDefinitions("InstAlias"); + + // Create a map from the qualified name to a list of potential matches. + std::map > AliasMap; + for (std::vector::iterator + I = AllInstAliases.begin(), E = AllInstAliases.end(); I != E; ++I) { + CodeGenInstAlias *Alias = new CodeGenInstAlias(*I, Target); + const Record *R = *I; + const DagInit *DI = R->getValueAsDag("ResultInst"); + const DefInit *Op = dynamic_cast(DI->getOperator()); + AliasMap[getQualifiedName(Op->getDef())].push_back(Alias); + } + + if (AliasMap.empty() || !isMC) { + // FIXME: Support MachineInstr InstAliases? + O << " return true;\n"; + O << "}\n\n"; + O << "#endif // PRINT_ALIAS_INSTR\n"; + return; + } + + O << " StringRef AsmString;\n"; + O << " std::map OpMap;\n"; + O << " switch (MI->getOpcode()) {\n"; + O << " default: return true;\n"; + + for (std::map >::iterator + I = AliasMap.begin(), E = AliasMap.end(); I != E; ++I) { + std::vector &Aliases = I->second; + + std::map CondCount; + std::map BodyMap; + + std::string AsmString = ""; + + for (std::vector::iterator + II = Aliases.begin(), IE = Aliases.end(); II != IE; ++II) { + const CodeGenInstAlias *CGA = *II; + AsmString = CGA->AsmString; + unsigned Indent = 8; + unsigned LastOpNo = CGA->ResultInstOperandIndex.size(); + + std::string Cond; + raw_string_ostream CondO(Cond); + + CondO << "if (MI->getNumOperands() == " << LastOpNo; + + std::map OpMap; + bool CantHandle = false; + + for (unsigned i = 0, e = LastOpNo; i != e; ++i) { + const CodeGenInstAlias::ResultOperand &RO = CGA->ResultOperands[i]; + + switch (RO.Kind) { + default: assert(0 && "unexpected InstAlias operand kind"); + case CodeGenInstAlias::ResultOperand::K_Record: { + const Record *Rec = RO.getRecord(); + StringRef ROName = RO.getName(); + + if (Rec->isSubClassOf("RegisterClass")) { + CondO << " &&\n"; + CondO.indent(Indent) << "MI->getOperand(" << i << ").isReg() &&\n"; + if (OpMap.find(ROName) == OpMap.end()) { + OpMap[ROName] = i; + CondO.indent(Indent) + << "regIsInRegisterClass(RC_" + << CGA->ResultOperands[i].getRecord()->getName() + << ", MI->getOperand(" << i << ").getReg())"; + } else { + CondO.indent(Indent) + << "MI->getOperand(" << i + << ").getReg() == MI->getOperand(" + << OpMap[ROName] << ").getReg()"; + } + } else { + assert(Rec->isSubClassOf("Operand") && "Unexpected operand!"); + // FIXME: We need to handle these situations. + CantHandle = true; + break; + } + + break; + } + case CodeGenInstAlias::ResultOperand::K_Imm: + CondO << " &&\n"; + CondO.indent(Indent) << "MI->getOperand(" << i << ").getImm() == "; + CondO << CGA->ResultOperands[i].getImm(); + break; + case CodeGenInstAlias::ResultOperand::K_Reg: + CondO << " &&\n"; + CondO.indent(Indent) << "MI->getOperand(" << i << ").getReg() == "; + CondO << Target.getName() << "::" + << CGA->ResultOperands[i].getRegister()->getName(); + break; + } + + if (CantHandle) break; + } + + if (CantHandle) continue; + + CondO << ")"; + + std::string Body; + raw_string_ostream BodyO(Body); + + BodyO << " // " << CGA->Result->getAsString() << "\n"; + BodyO << " AsmString = \"" << AsmString << "\";\n"; + + for (std::map::iterator + III = OpMap.begin(), IIE = OpMap.end(); III != IIE; ++III) + BodyO << " OpMap[\"" << III->first << "\"] = " + << III->second << ";\n"; + + ++CondCount[CondO.str()]; + BodyMap[CondO.str()] = BodyO.str(); + } + + std::string Code; + raw_string_ostream CodeO(Code); + + bool EmitElse = false; + for (std::map::iterator + II = CondCount.begin(), IE = CondCount.end(); II != IE; ++II) { + if (II->second != 1) continue; + CodeO << " "; + if (EmitElse) CodeO << "} else "; + CodeO << II->first << " {\n"; + CodeO << BodyMap[II->first]; + EmitElse = true; + } + + if (CodeO.str().empty()) continue; + + O << " case " << I->first << ":\n"; + O << CodeO.str(); + O << " }\n"; + O << " break;\n"; + } + + O << " }\n\n"; + + // Code that prints the alias, replacing the operands with the ones from the + // MCInst. + O << " if (AsmString.empty()) return true;\n"; + O << " std::pair ASM = AsmString.split(' ');\n"; + O << " OS << '\\t' << ASM.first;\n"; + + O << " if (!ASM.second.empty()) {\n"; + O << " OS << '\\t';\n"; + O << " for (StringRef::iterator\n"; + O << " I = ASM.second.begin(), E = ASM.second.end(); I != E; ) {\n"; + O << " if (*I == '$') {\n"; + O << " StringRef::iterator Start = ++I;\n"; + O << " while (I != E &&\n"; + O << " ((*I >= 'a' && *I <= 'z') ||\n"; + O << " (*I >= 'A' && *I <= 'Z') ||\n"; + O << " (*I >= '0' && *I <= '9') ||\n"; + O << " *I == '_'))\n"; + O << " ++I;\n"; + O << " StringRef Name(Start, I - Start);\n"; + O << " printOperand(MI, OpMap[Name], OS);\n"; + O << " } else {\n"; + O << " OS << *I++;\n"; + O << " }\n"; + O << " }\n"; + O << " }\n\n"; + + O << " return false;\n"; + O << "}\n\n"; + + O << "#endif // PRINT_ALIAS_INSTR\n"; +} void AsmWriterEmitter::run(raw_ostream &O) { EmitSourceFileHeader("Assembly Writer Source Fragment", O); @@ -550,5 +798,6 @@ EmitPrintInstruction(O); EmitGetRegisterName(O); EmitGetInstructionName(O); + EmitPrintAliasInstruction(O); } Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.h?rev=126538&r1=126537&r2=126538&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.h (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.h Fri Feb 25 21:09:12 2011 @@ -38,6 +38,7 @@ void EmitPrintInstruction(raw_ostream &o); void EmitGetRegisterName(raw_ostream &o); void EmitGetInstructionName(raw_ostream &o); + void EmitPrintAliasInstruction(raw_ostream &O); AsmWriterInst *getAsmWriterInstByID(unsigned ID) const { assert(ID < NumberedInstructions.size()); From zwarich at apple.com Sat Feb 26 02:03:28 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Sat, 26 Feb 2011 00:03:28 -0800 Subject: [llvm-commits] [llvm] r126425 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/PTX/ lib/Target/X86/ In-Reply-To: <20110224210400.8E73B2A6C12C@llvm.org> References: <20110224210400.8E73B2A6C12C@llvm.org> Message-ID: <35842674-99C6-4386-8E41-A1B17D7F30DE@apple.com> Unfortunately, this change caused failures on the selfhosting Linux bots, so I rolled it out. Hopefully you can diagnose the problem from the logs and submit a patch that fixes the problem. Cameron From evan.cheng at apple.com Sat Feb 26 02:23:42 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 26 Feb 2011 00:23:42 -0800 Subject: [llvm-commits] [llvm] r126445 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/select-gep.ll In-Reply-To: References: <20110224224612.21E8B2A6C12C@llvm.org> <9DA53217-C6FC-42E4-8D03-218F85893512@apple.com> Message-ID: <9D7E7806-AE6F-45BA-AB25-AFCB675AAFA3@apple.com> On Feb 25, 2011, at 9:48 AM, Benjamin Kramer wrote: > > On 25.02.2011, at 18:25, Evan Cheng wrote: > >> >> On Feb 25, 2011, at 7:26 AM, Benjamin Kramer wrote: >> >>> >>> On 25.02.2011, at 08:14, Evan Cheng wrote: >>> >>>> Speculation is nice, but I would feel a lot better if there are hard numbers to back this up. Are we sure these changes are improving performance? >>> >>> My unscientific test case (gcc compiled with clang -O3 parsing itself) showed a 0.25% speedup with the original patch (all-constant GEPs only, median of 5 runs, i386, penryn). I just retested with the change Frits suggested and it slowed down ~0.6% compared to the original run so I reverted it. >> >> Thanks. What tests are you using to evaluate this? > > I routinely use the nice C files from http://people.csail.mit.edu/smcc/projects/single-file-programs/ > which are easy to handle and large enough to get meaningful results for both compile time and run > time. They're extracted from programs that are also part of SPEC CINT, so I'm confident the > improvements will also show up there :) These are nice, but not quite enough. In this future, please at least run the llvm testsuite for anything that might affect performance. Thanks, Evan From anton at korobeynikov.info Sat Feb 26 06:36:00 2011 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Sat, 26 Feb 2011 15:36:00 +0300 Subject: [llvm-commits] Change DwarfUsesAbsoluteLabelForStmtList to false for X86ELFMCAsmInfo. In-Reply-To: <133510.39411.qm@web55604.mail.re4.yahoo.com> References: <133510.39411.qm@web55604.mail.re4.yahoo.com> Message-ID: Hello Jan, > Dwarfdump gives an error and gdb fails when generating code in memory (but > happens to accept it in a .o file) in Linux when > DwarfUsesAbsoluteLabelForStmtList = true, this patch sets it to false to fix > this issue. I don't know if this is true for other targets, but the change is > limited to X86ELFMCAsmInfo. How the patch was tested? How we might be sure this won't break non JIT case? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From baldrick at free.fr Sat Feb 26 07:39:45 2011 From: baldrick at free.fr (Duncan Sands) Date: Sat, 26 Feb 2011 13:39:45 -0000 Subject: [llvm-commits] [dragonegg] r126545 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110226133945.145D12A6C12C@llvm.org> Author: baldrick Date: Sat Feb 26 07:39:44 2011 New Revision: 126545 URL: http://llvm.org/viewvc/llvm-project?rev=126545&view=rev Log: If an error occurred then be cool and don't require every SSA name to have a proper definition. This prevents the compiler from crashing if we bailed out on an error condition without taking care to define some SSA name. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126545&r1=126544&r2=126545&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Sat Feb 26 07:39:44 2011 @@ -1008,15 +1008,33 @@ TheDebugInfo->EmitFunctionEnd(true); } -#ifndef NDEBUG - if (!errorcount && !sorrycount) +#ifdef NDEBUG + // When processing broken code it can be awkward to ensure that every SSA name + // that was used has a definition. So in this case we play it cool and create + // an artificial definition for such SSA names. The choice of definition does + // not matter because the compiler is going to exit with an error anyway. + if (errorcount || sorrycount) +#else + // When checks are enabled, complain if an SSA name was used but not defined. +#endif for (DenseMap >::const_iterator I = SSANames.begin(), - E = SSANames.end(); I != E; ++I) - if (isSSAPlaceholder(I->second)) { + E = SSANames.end(); I != E; ++I) { + Value *NameDef = I->second; + // If this is not a placeholder then the SSA name was defined. + if (!isSSAPlaceholder(NameDef)) + continue; + + // If an error occurred then replace the placeholder with undef. Thanks + // to this we can just bail out on errors, without having to worry about + // whether we defined every SSA name. + if (errorcount || sorrycount) { + NameDef->replaceAllUsesWith(UndefValue::get(NameDef->getType())); + delete NameDef; + } else { debug_tree(I->first); llvm_unreachable("SSA name never defined!"); } -#endif + } return Fn; } From jan_sjodin at yahoo.com Sat Feb 26 08:40:31 2011 From: jan_sjodin at yahoo.com (Jan Sjodin) Date: Sat, 26 Feb 2011 06:40:31 -0800 (PST) Subject: [llvm-commits] Change DwarfUsesAbsoluteLabelForStmtList to false for X86ELFMCAsmInfo. In-Reply-To: References: <133510.39411.qm@web55604.mail.re4.yahoo.com> Message-ID: <512414.14506.qm@web55606.mail.re4.yahoo.com> ----- Original Message ---- > From: Anton Korobeynikov > To: Jan Sjodin > Cc: llvm-commits at cs.uiuc.edu > Sent: Sat, February 26, 2011 7:36:00 AM > Subject: Re: [llvm-commits] Change DwarfUsesAbsoluteLabelForStmtList to false >for X86ELFMCAsmInfo. > > Hello Jan, > > > Dwarfdump gives an error and gdb fails when generating code in memory (but > > happens to accept it in a .o file) in Linux when > > DwarfUsesAbsoluteLabelForStmtList = true, this patch sets it to false to fix > > this issue. I don't know if this is true for other targets, but the change >is > > limited to X86ELFMCAsmInfo. > How the patch was tested? How we might be sure this won't break non JIT case? > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University > The question you are really asking is if there is a bug in dwarfdump or a bug in llvm, because dwarfdump always complains. I tried this on Linux 64-bit with clang and llvm trunk: file empty.c: --------------------------------------------------------------- int main() { return 42; } --------------------------------------------------------------- Compile and run dwarfdump: --------------------------------------------------------------- > clang -c -g -emit-llvm -o empty.bc empty.c > llc -filetype=obj empty.bc > dwarfdump empty.o .debug_info COMPILE_UNIT
: <0>< 11> DW_TAG_compile_unit DW_AT_producer clang version 2.9 (trunk 126545) DW_AT_language DW_LANG_C99 DW_AT_name empty.c DW_AT_entry_pc 0x0 DW_AT_stmt_list 0x0 DW_AT_comp_dir /home/jsjodin/Work/LLVM/Sandboxes/TOT/test LOCAL_SYMBOLS: <1>< 114> DW_TAG_base_type DW_AT_encoding DW_ATE_signed DW_AT_name int DW_AT_byte_size 4 <1>< 121> DW_TAG_subprogram DW_AT_name main DW_AT_decl_file 1 DW_AT_decl_line 2 DW_AT_type <114> DW_AT_external yes(1) DW_AT_low_pc 0x0 DW_AT_high_pc 0xe DW_AT_frame_base DW_OP_reg7 AT of 16359 (0x3fe7) is unknown to dwarfdump. Continuing. yes(1) .debug_line: line number info for a single cu dwarfdump ERROR: dwarf_srclines: DW_DLE_ATTR_FORM_BAD (114) --------------------------------------------------------------- dwarfdump cleary doesn't like what llc has produced. With the patch applied we try again: --------------------------------------------------------------- .debug_info COMPILE_UNIT
: <0>< 11> DW_TAG_compile_unit DW_AT_producer clang version 2.9 (trunk 126545) DW_AT_language DW_LANG_C99 DW_AT_name empty.c DW_AT_entry_pc 0x0 DW_AT_stmt_list 0 DW_AT_comp_dir /home/jsjodin/Work/LLVM/Sandboxes/TOT/test LOCAL_SYMBOLS: <1>< 110> DW_TAG_base_type DW_AT_encoding DW_ATE_signed DW_AT_name int DW_AT_byte_size 4 <1>< 117> DW_TAG_subprogram DW_AT_name main DW_AT_decl_file 1 /home/jsjodin/Work/LLVM/Sandboxes/TOT/test/empty.c DW_AT_decl_line 2 DW_AT_type <110> DW_AT_external yes(1) DW_AT_low_pc 0x0 DW_AT_high_pc 0xe DW_AT_frame_base DW_OP_reg7 AT of 16359 (0x3fe7) is unknown to dwarfdump. Continuing. yes(1) .debug_line: line number info for a single cu Source lines (from CU-DIE at .debug_info offset 11): [row,column] // means index section-offset begin-addr end-addr length-of-block-entry .debug_abbrev < 1>< 0> DW_TAG_compile_unit DW_children_yes < 3> DW_AT_producer DW_FORM_string < 5> DW_AT_language DW_FORM_data2 < 7> DW_AT_name DW_FORM_string < 9> DW_AT_entry_pc DW_FORM_addr < 11> DW_AT_stmt_list DW_FORM_data4 < 13> DW_AT_comp_dir DW_FORM_string < 2>< 17> DW_TAG_base_type DW_children_no < 20> DW_AT_encoding DW_FORM_data1 < 22> DW_AT_name DW_FORM_string < 24> DW_AT_byte_size DW_FORM_data1 < 3>< 28> DW_TAG_subprogram DW_children_no < 31> DW_AT_name DW_FORM_string < 33> DW_AT_decl_file DW_FORM_data1 < 35> DW_AT_decl_line DW_FORM_data1 < 37> DW_AT_type DW_FORM_ref4 < 39> DW_AT_external DW_FORM_flag < 41> DW_AT_low_pc DW_FORM_addr < 43> DW_AT_high_pc DW_FORM_addr < 45> DW_AT_frame_base DW_FORM_block1 < 47> AT of 16359 (0x3fe7) is unknown to dwarfdump. Continuing. DW_FORM_flag < 4>< 52> null .debug_abbrev entry .debug_string .debug_aranges .debug_frame fde: < 0><0x0:0xe>
0x00000000: .debug_static_func .debug_static_vars .debug_pubtypes .debug_weaknames --------------------------------------------------------------- From rafael.espindola at gmail.com Sat Feb 26 09:10:16 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Sat, 26 Feb 2011 10:10:16 -0500 Subject: [llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp In-Reply-To: <267631.76534.qm@web55603.mail.re4.yahoo.com> References: <960821.36942.qm@web55604.mail.re4.yahoo.com> <4D680702.2040101@gmail.com> <470208.84552.qm@web55602.mail.re4.yahoo.com> <4D68461F.2090807@gmail.com> <267631.76534.qm@web55603.mail.re4.yahoo.com> Message-ID: <4D6917D8.6030506@gmail.com> On 11-02-25 8:54 PM, Jan Sjodin wrote: > The JIT implementation I am working on (MCJIT which was renamed to JunkJIT) > became a lot nicer when I decided to inherit MCELFStreamer and ELFObjectWriter. > This was needed to make the debug information available to gdb since it expects > ELF format. I basically reuse everything, the only thing that differs is that I > use a mem_raw_outstream to emit code to memory and make sure that all sections > are created before or during the post layout binding so that when > RecordRelocation is called all symbol addresses are known. In the > ELFObjectWriter, the code in WriteObject that creates sections is moved to the > post layout binding, and the code that emits the object stays in place. This is > perhaps not very clean, since it is not formalized in the interface, but it > works okay and I only need to shuffle around the code a little. You could > imagine that if section creation was restricted by the interface to only > happenen before/during post layout, then a generic JunkJIT could be written for > any object format. Each object writer would be required to compute offsets for > the sections. I am currently not aiming to do this since the MCJIT proposal by > Daniel separates the Streamer/ObjectWriter from figuring out relocations and > external symbols. However, the code refactoring patches I have/will submit are > fairly benign and enable a JIT (without lazy compilation) using the MC > framework. Cool. The rafactoring patch is OK. > - Jan > Cheers, Rafael From rafael.espindola at gmail.com Sat Feb 26 09:49:38 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Sat, 26 Feb 2011 10:49:38 -0500 Subject: [llvm-commits] [patch][lto] Use MC to scan for symbol definitions and uses Message-ID: <4D692112.5030707@gmail.com> The attached patch changes LTO to use MC for scanning symbol definitions and uses. It is not as complete as it could be, but it already handles some interesting cases: * A single .globl produces an undefined reference * Uses with no definitions produce undefined references * Definitions are correctly tracked as being local or global * Macro expansions are handled correctly :-) The patch also changes LLVM's handling of module level asm to make sure it always ends in a new line. This makes it easy to just pass that string to MC and match what we would see if printing to a file. Cheers, Rafael -------------- next part -------------- A non-text attachment was scrubbed... Name: mc.patch Type: text/x-patch Size: 15447 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110226/b2157e50/attachment-0001.bin From rafael.espindola at gmail.com Sat Feb 26 10:44:13 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sat, 26 Feb 2011 16:44:13 -0000 Subject: [llvm-commits] [llvm] r126546 - /llvm/trunk/tools/gold/gold-plugin.cpp Message-ID: <20110226164413.D593F2A6C12C@llvm.org> Author: rafael Date: Sat Feb 26 10:44:13 2011 New Revision: 126546 URL: http://llvm.org/viewvc/llvm-project?rev=126546&view=rev Log: LTO uses MC now. Modified: llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=126546&r1=126545&r2=126546&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Sat Feb 26 10:44:13 2011 @@ -73,8 +73,6 @@ static generate_bc generate_bc_file = BC_NO; static std::string bc_path; static std::string obj_path; - static std::string as_path; - static std::vector as_args; static std::vector pass_through; static std::string extra_library_path; static std::string triple; @@ -96,16 +94,6 @@ generate_api_file = true; } else if (opt.startswith("mcpu=")) { mcpu = opt.substr(strlen("mcpu=")); - } else if (opt.startswith("as=")) { - if (!as_path.empty()) { - (*message)(LDPL_WARNING, "Path to as specified twice. " - "Discarding %s", opt_); - } else { - as_path = opt.substr(strlen("as=")); - } - } else if (opt.startswith("as-arg=")) { - llvm::StringRef item = opt.substr(strlen("as-arg=")); - as_args.push_back(item.str()); } else if (opt.startswith("extra-library-path=")) { extra_library_path = opt.substr(strlen("extra_library_path=")); } else if (opt.startswith("pass-through=")) { @@ -432,18 +420,6 @@ lto_codegen_set_pic_model(code_gen, output_type); lto_codegen_set_debug_model(code_gen, LTO_DEBUG_MODEL_DWARF); - if (!options::as_path.empty()) { - sys::Path p = sys::Program::FindProgramByName(options::as_path); - lto_codegen_set_assembler_path(code_gen, p.c_str()); - } - if (!options::as_args.empty()) { - std::vector as_args_p; - for (std::vector::iterator I = options::as_args.begin(), - E = options::as_args.end(); I != E; ++I) { - as_args_p.push_back(I->c_str()); - } - lto_codegen_set_assembler_args(code_gen, &as_args_p[0], as_args_p.size()); - } if (!options::mcpu.empty()) lto_codegen_set_cpu(code_gen, options::mcpu.c_str()); From fvbommel at gmail.com Sat Feb 26 11:10:33 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Sat, 26 Feb 2011 18:10:33 +0100 Subject: [llvm-commits] PATCH: instcombine switch on select of constants to br In-Reply-To: References: <893CFB3C-832C-4959-AE72-4186FCD61E99@gmail.com> <4D2A730F.2090207@mxc.ca> <130DB463-EF73-40A2-8166-5D3A014D9D12@gmail.com> Message-ID: Since there has been no progress here for over six weeks, I updated this patch myself. Does anyone mind if I commit this version? -------------- next part -------------- A non-text attachment was scrubbed... Name: simplify-switch-on-select.patch Type: text/x-patch Size: 5729 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110226/a36072e0/attachment.bin From baldrick at free.fr Sat Feb 26 11:08:15 2011 From: baldrick at free.fr (Duncan Sands) Date: Sat, 26 Feb 2011 17:08:15 -0000 Subject: [llvm-commits] [dragonegg] r126547 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110226170815.3E0DA2A6C12C@llvm.org> Author: baldrick Date: Sat Feb 26 11:08:15 2011 New Revision: 126547 URL: http://llvm.org/viewvc/llvm-project?rev=126547&view=rev Log: Fix PR3373: if an asm output is smaller than a tied input, promote the output to the size of the input. This is safe to do as long as the output is not explicitly mentioned in the asm string, so check this. (If it is explicitly mentioned then it might still be safe, but that requires a detailed analysis of the asm string). The logic already handled the case of an input that is smaller than a tied output, but did not check that the input is not explicitly mentioned in the asm string, so add this check. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126547&r1=126546&r2=126547&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Sat Feb 26 11:08:15 2011 @@ -3206,6 +3206,39 @@ } } +/// isOperandMentioned - Return true if the given operand is explicitly +/// mentioned in the asm string. For example if passed operand 1 then +/// this routine checks that the asm string does not contain "%1". +static bool isOperandMentioned(gimple stmt, unsigned OpNum) { + // If this is a non-extended ASM then the contents of the asm string are not + // to be interpreted. + if (gimple_asm_input_p(stmt)) + return false; + // Search for a non-escaped '%' character followed by OpNum. + for (const char *AsmStr = gimple_asm_string(stmt); *AsmStr; ++AsmStr) { + if (*AsmStr != '%') + // Not a '%', move on to next character. + continue; + char Next = AsmStr[1]; + // If this is "%%" then the '%' is escaped - skip both '%' characters. + if (Next == '%') { + ++AsmStr; + continue; + } + // Whitespace is not allowed between the '%' and the number, so check that + // the next character is a digit. + if (!ISDIGIT(Next)) + continue; + char *EndPtr; + // If this is an explicit reference to OpNum then we are done. + if (OpNum == strtoul(AsmStr+1, &EndPtr, 10)) + return true; + // Otherwise, skip over the number and keep scanning. + AsmStr = EndPtr - 1; + } + return false; +} + /// CanonicalizeConstraint - If we can canonicalize the constraint into /// something simpler, do so now. This turns register classes with a single /// register into the register itself, expands builtin constraints to multiple @@ -6934,6 +6967,7 @@ tree Input = gimple_asm_input_op(stmt, i); tree Val = TREE_VALUE(Input); tree type = TREE_TYPE(Val); + bool IsSigned = !TYPE_UNSIGNED(type); const char *Constraint = Constraints[NumOutputs+i]; @@ -7022,25 +7056,38 @@ } unsigned OTyBits = TD.getTypeSizeInBits(OTy); unsigned OpTyBits = TD.getTypeSizeInBits(OpTy); - if (OTyBits == 0 || OpTyBits == 0 || OTyBits < OpTyBits) { - // It's tempting to implement the OTyBits < OpTyBits case by - // truncating Op down to OTy, however that breaks in the case of an - // inline asm constraint that corresponds to a single register, - // because the user can write code that assumes the whole register - // is defined, despite the output operand being only a subset of the - // register. For example: - // - // asm ("sarl $10, %%eax" : "=a"(c) : "0"(1000000)); - // - // The expected behavior is for %eax to be fully defined with the - // value 1000000 immediately before the asm. - error_at(gimple_location(stmt), - "unsupported inline asm: input constraint with a matching " - "output constraint of incompatible type!"); + if (OTyBits == 0 || OpTyBits == 0) { + error_at(gimple_location(stmt), "unsupported inline asm: input " + "constraint with a matching output constraint of " + "incompatible type!"); return; + } else if (OTyBits < OpTyBits) { + // The output is smaller than the input. If the output is not a + // register then bail out. Likewise, if the output is explicitly + // mentioned in the asm string then we cannot safely promote it, + // so bail out in this case too. + if (!OutputLocations[Match].first || + isOperandMentioned(stmt, Match)) { + error_at(gimple_location(stmt), "unsupported inline asm: input " + "constraint with a matching output constraint of " + "incompatible type!"); + return; + } + // Use the input type for the output, and arrange for the result to + // be truncated to the original output type after the asm call. + CallResultTypes[OutputIndex] = std::make_pair(OpTy, IsSigned); } else if (OTyBits > OpTyBits) { - Op = CastToAnyType(Op, !TYPE_UNSIGNED(type), - OTy, CallResultTypes[OutputIndex].second); + // The input is smaller than the output. If the input is explicitly + // mentioned in the asm string then we cannot safely promote it, so + // bail out. + if (isOperandMentioned(stmt, NumOutputs + i)) { + error_at(gimple_location(stmt), "unsupported inline asm: input " + "constraint with a matching output constraint of " + "incompatible type!"); + return; + } + Op = CastToAnyType(Op, IsSigned, OTy, + CallResultTypes[OutputIndex].second); if (BYTES_BIG_ENDIAN) { Constant *ShAmt = ConstantInt::get(Op->getType(), OTyBits-OpTyBits); From aggarwa4 at illinois.edu Sat Feb 26 11:50:26 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 26 Feb 2011 17:50:26 -0000 Subject: [llvm-commits] [poolalloc] r126548 - /poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Message-ID: <20110226175026.0BABA2A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 26 11:50:25 2011 New Revision: 126548 URL: http://llvm.org/viewvc/llvm-project?rev=126548&view=rev Log: Fixed formatting. Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=126548&r1=126547&r2=126548&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (original) +++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Sat Feb 26 11:50:25 2011 @@ -44,67 +44,67 @@ GetElementPtrInst *GEP = cast(I); if(!isa(GEP->getType()->getElementType())) continue; - std::vector worklist; - for (Value::use_iterator UI = GEP->use_begin(), - UE = GEP->use_end(); UI != UE; ++UI){ - if(!isa(UI)) - break; - GetElementPtrInst *GEPUse = cast(UI); - worklist.push_back(GEPUse); - } - while(!worklist.empty()){ - GetElementPtrInst *GEPUse = worklist.back(); - worklist.pop_back(); - SmallVector Indices; - Indices.append(GEP->op_begin()+1, GEP->op_end()); - Indices.append(GEPUse->idx_begin()+1, GEPUse->idx_end()); - GetElementPtrInst *GEPNew = GetElementPtrInst::Create(GEP->getOperand(0), - Indices.begin(), - Indices.end(), - GEPUse->getName()+ "moda", - GEPUse); - GEPUse->replaceAllUsesWith(GEPNew); - GEPUse->eraseFromParent(); - found = true; - changed = true; - } + std::vector worklist; + for (Value::use_iterator UI = GEP->use_begin(), + UE = GEP->use_end(); UI != UE; ++UI){ + if(!isa(UI)) + break; + GetElementPtrInst *GEPUse = cast(UI); + worklist.push_back(GEPUse); + } + while(!worklist.empty()){ + GetElementPtrInst *GEPUse = worklist.back(); + worklist.pop_back(); + SmallVector Indices; + Indices.append(GEP->op_begin()+1, GEP->op_end()); + Indices.append(GEPUse->idx_begin()+1, GEPUse->idx_end()); + GetElementPtrInst *GEPNew = GetElementPtrInst::Create(GEP->getOperand(0), + Indices.begin(), + Indices.end(), + GEPUse->getName()+ "moda", + GEPUse); + GEPUse->replaceAllUsesWith(GEPNew); + GEPUse->eraseFromParent(); + found = true; + changed = true; + } } } - std::vector worklist; - for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { - for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) { - if(!(isa(I))) - continue; - GetElementPtrInst *GEP1 = cast(I); - if(!isa(GEP1->getType()->getElementType())) + std::vector worklist; + for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { + for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) { + if(!(isa(I))) + continue; + GetElementPtrInst *GEP1 = cast(I); + if(!isa(GEP1->getType()->getElementType())) continue; - if (Constant *C = dyn_cast(GEP1->getOperand(0))) { - if (ConstantExpr *CE = dyn_cast(C)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { + if (Constant *C = dyn_cast(GEP1->getOperand(0))) { + if (ConstantExpr *CE = dyn_cast(C)) { + if (CE->getOpcode() == Instruction::GetElementPtr) { worklist.push_back(GEP1); + } } } } } - } - while(!worklist.empty()) { - GetElementPtrInst *GEP1 = worklist.back(); - worklist.pop_back(); - Constant *C = cast(GEP1->getOperand(0)); - ConstantExpr *CE = cast(C); - SmallVector Indices; - Indices.append(CE->op_begin()+1, CE->op_end()); - Indices.append(GEP1->idx_begin()+1, GEP1->idx_end()); - GetElementPtrInst *GEPNew = GetElementPtrInst::Create(CE->getOperand(0), - Indices.begin(), - Indices.end(), - GEP1->getName()+ "modb", - GEP1); - GEP1->replaceAllUsesWith(GEPNew); - GEP1->eraseFromParent(); - changed = true; - found = true; - } + while(!worklist.empty()) { + GetElementPtrInst *GEP1 = worklist.back(); + worklist.pop_back(); + Constant *C = cast(GEP1->getOperand(0)); + ConstantExpr *CE = cast(C); + SmallVector Indices; + Indices.append(CE->op_begin()+1, CE->op_end()); + Indices.append(GEP1->idx_begin()+1, GEP1->idx_end()); + GetElementPtrInst *GEPNew = GetElementPtrInst::Create(CE->getOperand(0), + Indices.begin(), + Indices.end(), + GEP1->getName()+ "modb", + GEP1); + GEP1->replaceAllUsesWith(GEPNew); + GEP1->eraseFromParent(); + changed = true; + found = true; + } } }while(found); return changed; From aggarwa4 at illinois.edu Sat Feb 26 11:51:03 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 26 Feb 2011 17:51:03 -0000 Subject: [llvm-commits] [poolalloc] r126549 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <20110226175103.3FD752A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 26 11:51:03 2011 New Revision: 126549 URL: http://llvm.org/viewvc/llvm-project?rev=126549&view=rev Log: Fixed formatting. Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=126549&r1=126548&r2=126549&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Sat Feb 26 11:51:03 2011 @@ -77,7 +77,6 @@ #define NRET_YNARGS {0,1,0,0,0,0,0,0,0,0} #define YRET_YNARGS {1,1,0,0,0,0,0,0,0,0} - const struct { const char* name; libAction action; @@ -92,79 +91,79 @@ {"setrlimit", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, {"getcwd", {NRET_NYARGS, YRET_YNARGS, NRET_NARGS, YRET_YNARGS, false}}, - {"remove", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"rename", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"unlink", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fileno", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"create", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"write", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"read", {NRET_YARGS, YRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, - {"truncate", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"open", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"remove", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"rename", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"unlink", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fileno", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"create", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"write", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"read", {NRET_YARGS, YRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, + {"truncate", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"open", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"chdir", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"mkdir", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"rmdir", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"chdir", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"mkdir", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"rmdir", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"chmod", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fchmod", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"chmod", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fchmod", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"kill", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - - {"execl", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"execlp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"execle", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"execv", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"execvp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"kill", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"time", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"times", {NRET_YARGS, YRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, - {"ctime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"asctime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"utime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"localtime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"gmtime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"ftime", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, + {"execl", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"execlp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"execle", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"execv", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"execvp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + + {"time", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"times", {NRET_YARGS, YRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, + {"ctime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"asctime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"utime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"localtime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"gmtime", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"ftime", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, // printf not strictly true, %n could cause a write - {"printf", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, - {"sprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, - {"snprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, - {"vsnprintf", {NRET_YARGS, YRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, - {"sscanf", {NRET_YARGS, YRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, - {"scanf", {NRET_YARGS, YRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fscanf", {NRET_YARGS, YRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, + {"printf", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, + {"sprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, + {"snprintf", {NRET_YARGS, NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, + {"vsnprintf", {NRET_YARGS, YRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, + {"sscanf", {NRET_YARGS, YRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, + {"scanf", {NRET_YARGS, YRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fscanf", {NRET_YARGS, YRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, + + {"calloc", {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, + {"malloc", {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, + {"valloc", {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, + {"realloc", {NRET_NARGS, YRET_NARGS, YRET_YNARGS, YRET_YNARGS,false}}, + {"free", {NRET_NARGS, NRET_NARGS, NRET_YNARGS, NRET_NARGS, false}}, - {"calloc", {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, - {"malloc", {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, - {"valloc", {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}}, - {"realloc", {NRET_NARGS, YRET_NARGS, YRET_YNARGS, YRET_YNARGS,false}}, - {"free", {NRET_NARGS, NRET_NARGS, NRET_YNARGS, NRET_NARGS, false}}, - - {"strdup", {NRET_YARGS, YRET_NARGS, YRET_NARGS, YRET_YARGS, false}}, - {"__strdup", {NRET_YARGS, YRET_NARGS, YRET_NARGS, YRET_YARGS, false}}, - {"wcsdup", {NRET_YARGS, YRET_NARGS, YRET_NARGS, YRET_YARGS, false}}, - - {"strlen", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"wcslen", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - - {"atoi", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"atof", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"atol", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"atoll", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"atoq", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - - {"memcmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"strcmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"wcscmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"strncmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"wcsncmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"strcasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"wcscasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"strncasecmp",{NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"wcsncasecmp",{NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"strdup", {NRET_YARGS, YRET_NARGS, YRET_NARGS, YRET_YARGS, false}}, + {"__strdup", {NRET_YARGS, YRET_NARGS, YRET_NARGS, YRET_YARGS, false}}, + {"wcsdup", {NRET_YARGS, YRET_NARGS, YRET_NARGS, YRET_YARGS, false}}, + + {"strlen", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"wcslen", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + + {"atoi", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"atof", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"atol", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"atoll", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"atoq", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + + {"memcmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"strcmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"wcscmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"strncmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"wcsncmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"strcasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"wcscasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"strncasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"wcsncasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, {"strcat", {NRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YARGS, true}}, {"strncat", {NRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YARGS, true}}, @@ -219,11 +218,11 @@ {"fseek", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, true}}, {"rewind", {NRET_YARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, true}}, {"ferror", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"fwrite", {NRET_YARGS, NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}}, + {"fwrite", {NRET_YARGS, NRET_NYARGS,NRET_NARGS, NRET_NARGS, false}}, {"fread", {NRET_NYARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, {"fdopen", {NRET_YARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, - {"__errno_location", {NRET_NARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"__errno_location", {NRET_NARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, {"puts", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, {"gets", {NRET_NARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, false}}, @@ -377,7 +376,6 @@ if (!I->isDeclaration()) getOrCreateGraph(&*I); - //FIXME: Should this happen in a "StdLib" Pass??? // // Erase direct calls to functions that don't return a pointer and are marked // with the readnone annotation. From aggarwa4 at illinois.edu Sat Feb 26 12:00:25 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 26 Feb 2011 18:00:25 -0000 Subject: [llvm-commits] [poolalloc] r126550 - /poolalloc/trunk/lib/AssistDS/MergeArrayIndexGEP.cpp Message-ID: <20110226180025.E548B2A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 26 12:00:25 2011 New Revision: 126550 URL: http://llvm.org/viewvc/llvm-project?rev=126550&view=rev Log: Merge GEPs. Code copied from InstCombine. Added: poolalloc/trunk/lib/AssistDS/MergeArrayIndexGEP.cpp Added: poolalloc/trunk/lib/AssistDS/MergeArrayIndexGEP.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeArrayIndexGEP.cpp?rev=126550&view=auto ============================================================================== --- poolalloc/trunk/lib/AssistDS/MergeArrayIndexGEP.cpp (added) +++ poolalloc/trunk/lib/AssistDS/MergeArrayIndexGEP.cpp Sat Feb 26 12:00:25 2011 @@ -0,0 +1,125 @@ +//===-- MergeGEP.cpp - Merge GEPs for indexing in arrays ------------ ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "mergearraygep" + +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Instructions.h" +#include "llvm/Constants.h" +#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Debug.h" +#include + +using namespace llvm; + + +namespace { + class MergeArrayGEP : public ModulePass { + public: + static char ID; + MergeArrayGEP() : ModulePass(&ID) {} + bool runOnModule(Module& M) { + for (Module::iterator F = M.begin(); F != M.end(); ++F){ + for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { + for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE;) { + GetElementPtrInst *GEP = dyn_cast(I); + I++; + if(GEP == NULL) + continue; + simplifyGEP(GEP); + } + } + } + return true; + } + static void simplifyGEP(GetElementPtrInst *GEP) { + Value *PtrOp = GEP->getOperand(0); + if (GEPOperator *Src = dyn_cast(PtrOp)) { + // Note that if our source is a gep chain itself that we wait for that + // chain to be resolved before we perform this transformation. This + // avoids us creating a TON of code in some cases. + // + if (GetElementPtrInst *SrcGEP = + dyn_cast(Src->getOperand(0))) + if (SrcGEP->getNumOperands() == 2) + return; // Wait until our source is folded to completion. + + SmallVector Indices; + + // Find out whether the last index in the source GEP is a sequential idx. + bool EndsWithSequential = false; + for (gep_type_iterator I = gep_type_begin(*Src), E = gep_type_end(*Src); + I != E; ++I) + EndsWithSequential = !(*I)->isStructTy(); + + // Can we combine the two pointer arithmetics offsets? + if (EndsWithSequential) { + // Replace: gep (gep %P, long B), long A, ... + // With: T = long A+B; gep %P, T, ... + // + Value *Sum; + Value *SO1 = Src->getOperand(Src->getNumOperands()-1); + Value *GO1 = GEP->getOperand(1); + if (SO1 == Constant::getNullValue(SO1->getType())) { + Sum = GO1; + } else if (GO1 == Constant::getNullValue(GO1->getType())) { + Sum = SO1; + } else { + // If they aren't the same type, then the input hasn't been processed + // by the loop above yet (which canonicalizes sequential index types to + // intptr_t). Just avoid transforming this until the input has been + // normalized. + if (SO1->getType() != GO1->getType()) + return; + Sum = llvm::BinaryOperator::Create(BinaryOperator::Add,SO1, GO1, PtrOp->getName()+".sum",GEP); + } + + // Update the GEP in place if possible. + if (Src->getNumOperands() == 2) { + GEP->setOperand(0, Src->getOperand(0)); + GEP->setOperand(1, Sum); + return; + } + Indices.append(Src->op_begin()+1, Src->op_end()-1); + Indices.push_back(Sum); + Indices.append(GEP->op_begin()+2, GEP->op_end()); + } else if (isa(GEP->idx_begin()) && + cast(GEP->idx_begin())->isNullValue() && + Src->getNumOperands() != 1) { + // Otherwise we can do the fold if the first index of the GEP is a zero + Indices.append(Src->op_begin()+1, Src->op_end()); + Indices.append(GEP->idx_begin()+1, GEP->idx_end()); + } + + if (!Indices.empty()){ + GetElementPtrInst *GEPNew = (GEP->isInBounds() && Src->isInBounds()) ? + GetElementPtrInst::CreateInBounds(Src->getOperand(0), Indices.begin(), + Indices.end(), GEP->getName(), GEP) : + GetElementPtrInst::Create(Src->getOperand(0), Indices.begin(), + Indices.end(), GEP->getName(), GEP); + GEP->replaceAllUsesWith(GEPNew); + GEP->eraseFromParent(); + } + } + + + } + }; +} + +char MergeArrayGEP::ID = 0; +static RegisterPass +X("mergearrgep", "Merge GEPs for arrays indexing"); From aggarwa4 at illinois.edu Sat Feb 26 12:01:00 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 26 Feb 2011 18:01:00 -0000 Subject: [llvm-commits] [poolalloc] r126551 - /poolalloc/trunk/test/TEST.types.Makefile Message-ID: <20110226180100.77E402A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 26 12:01:00 2011 New Revision: 126551 URL: http://llvm.org/viewvc/llvm-project?rev=126551&view=rev Log: Add the new mergearrgep flag. Modified: poolalloc/trunk/test/TEST.types.Makefile Modified: poolalloc/trunk/test/TEST.types.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.Makefile?rev=126551&r1=126550&r2=126551&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.Makefile (original) +++ poolalloc/trunk/test/TEST.types.Makefile Sat Feb 26 12:01:00 2011 @@ -45,9 +45,13 @@ Output/%.temp1.bc: Output/%.llvm1.bc -$(RUNTOOLSAFELY) $(LLVMLD) -disable-opt $(SAFE_OPTS) -link-as-library $< $(PA_PRE_RT) -o $@ +$(PROGRAMS_TO_TEST:%=Output/%.opt1.bc): \ +Output/%.opt1.bc: Output/%.llvm1.bc $(LOPT) $(ASSIST_SO) + -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -simplifygep -die -mergegep -mergearrgep -die -globaldce -simplifycfg -deadargelim -arg-simplify -varargsfunc -indclone -funcspec -deadargelim -globaldce -die -simplifycfg -gep-args -deadargelim -die -mergegep -die -globaldce -stats -time-passes $< -f -o $@ + $(PROGRAMS_TO_TEST:%=Output/%.opt.bc): \ Output/%.opt.bc: Output/%.llvm1.bc $(LOPT) $(ASSIST_SO) - -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -simplifygep -die -mergegep -die -globaldce -simplifycfg -deadargelim -arg-simplify -varargsfunc -indclone -funcspec -deadargelim -globaldce -die -simplifycfg -gep-args -deadargelim -die -mergegep -die -globaldce -stats -time-passes $< -f -o $@ + -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -simplifygep -die -mergegep -die -mergearrgep -die -globaldce -simplifycfg -deadargelim -arg-simplify -die -varargsfunc -die -simplifycfg -globaldce -indclone -funcspec -deadargelim -globaldce -die -simplifycfg -gep-args -deadargelim -die -mergegep -die -mergearrgep -die -globaldce -stats -time-passes $< -f -o $@ $(PROGRAMS_TO_TEST:%=Output/%.temp2.bc): \ Output/%.temp2.bc: Output/%.temp1.bc $(LOPT) $(ASSIST_SO) @@ -203,6 +207,9 @@ @/bin/echo -n "CALLS1: " >> $@ - at grep 'Number of calls that could not be resolved' $@.time.1 >> $@ @echo >> $@ + @-if test -f Output/$*.opt.diff-nat; then \ + printf "RUN: 1" >> $@;\ + fi $(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ From clattner at apple.com Sat Feb 26 15:29:21 2011 From: clattner at apple.com (Chris Lattner) Date: Sat, 26 Feb 2011 13:29:21 -0800 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: <4D67D60A.9040401@gmail.com> References: <4D65DCFB.90205@gmail.com> <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> <4D67237B.6060306@gmail.com> <3B27AD7C-DE66-4564-BA79-3C958D6D3E72@apple.com> <4D67D60A.9040401@gmail.com> Message-ID: On Feb 25, 2011, at 8:17 AM, Rafael Avila de Espindola wrote: >>> Doing llvm-link of all the IL files is about 3m if I remember >>> correctly. >> >> Wow. Out of curiosity, is much of that time spent in type resolution >> stuff? I expect that to disappear when the (post 2.9) type system >> rewrite happens. I think we can make the "loading + linking" process >> much faster :) > > Not sure. I did noticed that it looks like the merge is done two modules at a time with no state saved. It might be possible to save some time in there. > > Btw, I have seen the 3.0 planned type changes mentioned some times, but I don't know what they are in detail. Is there a doc somewhere? I wrote them up and sent a link to llvmdev. >> Aha, very nice. That should be possible by just reusing a >> memorybuffer or something. > > Yes, I just need a way to represent MemoryBuffers that are not NULL terminated :-) I agree that having null termination be optional would be useful. Clang really wants this (to make its lexer faster) but I don't think anyone else cares. I'd be fine with eliminating this requirement in the MemBuffer API and giving MemoryBuffer::getFileOrSTDIN a flags argument, where one flag would be "RequiresNullTerminatedBuffer" or something like that. -Chris From benny.kra at googlemail.com Sat Feb 26 16:48:07 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sat, 26 Feb 2011 22:48:07 -0000 Subject: [llvm-commits] [llvm] r126557 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/Target/README.txt test/CodeGen/X86/adde-carry.ll Message-ID: <20110226224807.808922A6C12C@llvm.org> Author: d0k Date: Sat Feb 26 16:48:07 2011 New Revision: 126557 URL: http://llvm.org/viewvc/llvm-project?rev=126557&view=rev Log: Add some DAGCombines for (adde 0, 0, glue), which are useful to optimize legalized code for large integer arithmetic. 1. Inform users of ADDEs with two 0 operands that it never sets carry 2. Fold other ADDs or ADDCs into the ADDE if possible It would be neat if we could do the same thing for SETCC+ADD eventually, but we can't do that in target independent code. Added: llvm/trunk/test/CodeGen/X86/adde-carry.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=126557&r1=126556&r2=126557&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Feb 26 16:48:07 2011 @@ -1290,6 +1290,16 @@ return SDValue(); } +/// isCarryMaterialization - Returns true if V is an ADDE node that is known to +/// return 0 or 1 depending on the carry flag. +static bool isCarryMaterialization(SDValue V) { + if (V.getOpcode() != ISD::ADDE) + return false; + + ConstantSDNode *C = dyn_cast(V.getOperand(0)); + return C && C->isNullValue() && V.getOperand(0) == V.getOperand(1); +} + SDValue DAGCombiner::visitADD(SDNode *N) { SDValue N0 = N->getOperand(0); SDValue N1 = N->getOperand(1); @@ -1453,6 +1463,18 @@ return DAG.getNode(ISD::SUB, DL, VT, N1, ZExt); } + // add (adde 0, 0, glue), X -> adde X, 0, glue + if (N0->hasOneUse() && isCarryMaterialization(N0)) + return DAG.getNode(ISD::ADDE, N->getDebugLoc(), + DAG.getVTList(VT, MVT::Glue), N1, N0.getOperand(0), + N0.getOperand(2)); + + // add X, (adde 0, 0, glue) -> adde X, 0, glue + if (N1->hasOneUse() && isCarryMaterialization(N1)) + return DAG.getNode(ISD::ADDE, N->getDebugLoc(), + DAG.getVTList(VT, MVT::Glue), N0, N1.getOperand(0), + N1.getOperand(2)); + return SDValue(); } @@ -1496,6 +1518,16 @@ N->getDebugLoc(), MVT::Glue)); } + // addc (adde 0, 0, glue), X -> adde X, 0, glue + if (N0->hasOneUse() && isCarryMaterialization(N0)) + return DAG.getNode(ISD::ADDE, N->getDebugLoc(), N->getVTList(), N1, + DAG.getConstant(0, VT), N0.getOperand(2)); + + // addc X, (adde 0, 0, glue) -> adde X, 0, glue + if (N1->hasOneUse() && isCarryMaterialization(N1)) + return DAG.getNode(ISD::ADDE, N->getDebugLoc(), N->getVTList(), N0, + DAG.getConstant(0, VT), N1.getOperand(2)); + return SDValue(); } @@ -1506,6 +1538,12 @@ ConstantSDNode *N0C = dyn_cast(N0); ConstantSDNode *N1C = dyn_cast(N1); + // If both operands are null we know that carry out will always be false. + if (N0C && N0C->isNullValue() && N0 == N1) + DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1), DAG.getNode(ISD::CARRY_FALSE, + N->getDebugLoc(), + MVT::Glue)); + // canonicalize constant to RHS if (N0C && !N1C) return DAG.getNode(ISD::ADDE, N->getDebugLoc(), N->getVTList(), Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=126557&r1=126556&r2=126557&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Sat Feb 26 16:48:07 2011 @@ -1780,43 +1780,6 @@ //===---------------------------------------------------------------------===// -Take the following testcase on x86-64 (similar testcases exist for all targets -with addc/adde): - -define void @a(i64* nocapture %s, i64* nocapture %t, i64 %a, i64 %b, -i64 %c) nounwind { -entry: - %0 = zext i64 %a to i128 ; [#uses=1] - %1 = zext i64 %b to i128 ; [#uses=1] - %2 = add i128 %1, %0 ; [#uses=2] - %3 = zext i64 %c to i128 ; [#uses=1] - %4 = shl i128 %3, 64 ; [#uses=1] - %5 = add i128 %4, %2 ; [#uses=1] - %6 = lshr i128 %5, 64 ; [#uses=1] - %7 = trunc i128 %6 to i64 ; [#uses=1] - store i64 %7, i64* %s, align 8 - %8 = trunc i128 %2 to i64 ; [#uses=1] - store i64 %8, i64* %t, align 8 - ret void -} - -Generated code: - addq %rcx, %rdx - sbbq %rax, %rax - subq %rax, %r8 - movq %r8, (%rdi) - movq %rdx, (%rsi) - ret - -Expected code: - addq %rcx, %rdx - adcq $0, %r8 - movq %r8, (%rdi) - movq %rdx, (%rsi) - ret - -//===---------------------------------------------------------------------===// - Switch lowering generates less than ideal code for the following switch: define void @a(i32 %x) nounwind { entry: Added: llvm/trunk/test/CodeGen/X86/adde-carry.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/adde-carry.ll?rev=126557&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/adde-carry.ll (added) +++ llvm/trunk/test/CodeGen/X86/adde-carry.ll Sat Feb 26 16:48:07 2011 @@ -0,0 +1,26 @@ +; RUN: llc -march=x86-64 < %s | FileCheck %s -check-prefix=CHECK-64 +; RUN: llc -march=x86 < %s | FileCheck %s -check-prefix=CHECK-32 + +define void @a(i64* nocapture %s, i64* nocapture %t, i64 %a, i64 %b, i64 %c) nounwind { +entry: + %0 = zext i64 %a to i128 + %1 = zext i64 %b to i128 + %2 = add i128 %1, %0 + %3 = zext i64 %c to i128 + %4 = shl i128 %3, 64 + %5 = add i128 %4, %2 + %6 = lshr i128 %5, 64 + %7 = trunc i128 %6 to i64 + store i64 %7, i64* %s, align 8 + %8 = trunc i128 %2 to i64 + store i64 %8, i64* %t, align 8 + ret void + +; CHECK-32: addl +; CHECK-32: adcl +; CHECK-32: adcl $0 +; CHECK-32: adcl $0 + +; CHECK-64: addq +; CHECK-64: adcq $0 +} From daniel at zuster.org Sat Feb 26 17:07:34 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 26 Feb 2011 15:07:34 -0800 Subject: [llvm-commits] [patch][lto] Use MC to scan for symbol definitions and uses In-Reply-To: <4D692112.5030707@gmail.com> References: <4D692112.5030707@gmail.com> Message-ID: Very nice! Patch looks quite reasonable to me, my only concern would be whether it should wait for after 2.9 branch. It's probably safe, but it might be better to take it afterwards in case it needs to bake. Are you aware of situations the current code handles that this one doesn't? - Daniel 2011/2/26 Rafael ?vila de Esp?ndola : > The attached patch changes LTO to use MC for scanning symbol definitions > and uses. It is not as complete as it could be, but it already handles > some interesting cases: > > * A single .globl produces an undefined reference > * Uses with no definitions produce undefined references > * Definitions are correctly tracked as being local or global > * Macro expansions are handled correctly :-) > > The patch also changes LLVM's handling of module level asm to make sure > it always ends in a new line. This makes it easy to just pass that > string to MC and match what we would see if printing to a file. > > Cheers, > Rafael > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From daniel at zuster.org Sat Feb 26 17:17:12 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 26 Feb 2011 23:17:12 -0000 Subject: [llvm-commits] [llvm] r126558 - in /llvm/trunk: include/llvm/ADT/Statistic.h lib/Support/Statistic.cpp Message-ID: <20110226231712.A3B352A6C12C@llvm.org> Author: ddunbar Date: Sat Feb 26 17:17:12 2011 New Revision: 126558 URL: http://llvm.org/viewvc/llvm-project?rev=126558&view=rev Log: Support: Add llvm::AreStatisticsEnabled(). Modified: llvm/trunk/include/llvm/ADT/Statistic.h llvm/trunk/lib/Support/Statistic.cpp Modified: llvm/trunk/include/llvm/ADT/Statistic.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Statistic.h?rev=126558&r1=126557&r2=126558&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Statistic.h (original) +++ llvm/trunk/include/llvm/ADT/Statistic.h Sat Feb 26 17:17:12 2011 @@ -121,6 +121,9 @@ /// \brief Enable the collection and printing of statistics. void EnableStatistics(); +/// \brief Check if statistics are enabled. +bool AreStatisticsEnabled(); + /// \brief Print statistics to the file returned by CreateInfoOutputFile(). void PrintStatistics(); Modified: llvm/trunk/lib/Support/Statistic.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Statistic.cpp?rev=126558&r1=126557&r2=126558&view=diff ============================================================================== --- llvm/trunk/lib/Support/Statistic.cpp (original) +++ llvm/trunk/lib/Support/Statistic.cpp Sat Feb 26 17:17:12 2011 @@ -101,6 +101,10 @@ Enabled.setValue(true); } +bool llvm::AreStatisticsEnabled() { + return Enabled; +} + void llvm::PrintStatistics(raw_ostream &OS) { StatisticInfo &Stats = *StatInfo; From clattner at apple.com Sat Feb 26 20:36:04 2011 From: clattner at apple.com (Chris Lattner) Date: Sat, 26 Feb 2011 18:36:04 -0800 Subject: [llvm-commits] [Review request][Win64] Use pushq/popq GPRs in function prologue/epilogue In-Reply-To: References: Message-ID: Hi Takumi, Evan said (verbally) that this looks ok to him, go ahead and commit it, thanks! -Chris On Feb 21, 2011, at 6:23 PM, NAKAMURA Takumi wrote: > Ping. > > > On Fri, Feb 18, 2011 at 2:02 PM, NAKAMURA Takumi wrote: >> Ping. >> >> It would also resolve potential issue if other x86-64 targets had a >> new calling conversions to preserve XMMs. >> >> ...Takumi >> >> >> On Mon, Feb 7, 2011 at 8:49 PM, NAKAMURA Takumi wrote: >>> Anton, >>> >>> I attached an updated patch, refined and comments added, thank you. >>> It is at; https://github.com/chapuni/LLVM/commit/8da7419f8170e5a11063eb8e992ecb1ad40f9f6a >>> >>> >>> On the github, Anton wrote; >>>> View Commit: https://github.com/chapuni/LLVM/commit/d719f1b1ba5f01823e00904c1599adf356089a1d >>> >>>> This will pessimize non-win64 targets. Basically, the problem is that you cannot use pushq/popq for high xmm regs, which are callee-saved on win64-only (but not on linux / darwin, for example). >>> >>> I thought the patch does not affect to non-win64 targets, but it might >>> be dubious to check whether regs are GPR or not. >>> I rewrote checking expressions. >>> >>> I am sorry if I missed your point. >>> >>>> Another problem is function prologue emission. Have you verified that you always have proper stack frame? Even in case when high xmm regs (xmm5, etc.) are spilled? >>> >>> As far as spiller emits in order [pushq GPRs...] and [mov xmm to fp], >>> and restorer emits in order [mov xmm from fp] and [popq GPRs], >>> emitPrologue() and emitEpilogue() will emit adjusting %rsp onto proper place. >>> And I can expect spiller can place XMMs i128 aligned. >>> >>> ; for example >>> define void @foo() nounwind { >>> entry: >>> tail call void (...)* @bar() nounwind >>> tail call void asm sideeffect "nop", >>> "~{si},~{di},~{xmm13},~{xmm11},~{xmm15},~{dirflag},~{fpsr},~{flags}"() >>> nounwind >>> ret void >>> } >>> declare void @bar(...) >>> >>> #### -mtriple=x86_64-mingw32 >>> foo: >>> pushq %rsi >>> pushq %rdi >>> subq $88, %rsp >>> movaps %xmm15, 32(%rsp) # 16-byte Spill >>> movaps %xmm13, 48(%rsp) # 16-byte Spill >>> movaps %xmm11, 64(%rsp) # 16-byte Spill >>> callq bar >>> #APP >>> nop >>> #NO_APP >>> movaps 64(%rsp), %xmm11 # 16-byte Reload >>> movaps 48(%rsp), %xmm13 # 16-byte Reload >>> movaps 32(%rsp), %xmm15 # 16-byte Reload >>> addq $88, %rsp >>> popq %rdi >>> popq %rsi >>> ret >>> >>> And also, I have checked to build clang by 3 stage. >>> (x64-clang can build and test clang and llvm) >>> >>> >>> ...Takumi >>> >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From daniel at zuster.org Sat Feb 26 21:22:36 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Sun, 27 Feb 2011 03:22:36 -0000 Subject: [llvm-commits] [zorg] r126561 - /zorg/trunk/zorg/buildbot/builders/ClangBuilder.py Message-ID: <20110227032236.235DE2A6C12C@llvm.org> Author: ddunbar Date: Sat Feb 26 21:22:35 2011 New Revision: 126561 URL: http://llvm.org/viewvc/llvm-project?rev=126561&view=rev Log: buildbot: Add ClangBuilder.addClangGDBTests() Modified: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py Modified: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangBuilder.py?rev=126561&r1=126560&r2=126561&view=diff ============================================================================== --- zorg/trunk/zorg/buildbot/builders/ClangBuilder.py (original) +++ zorg/trunk/zorg/buildbot/builders/ClangBuilder.py Sat Feb 26 21:22:35 2011 @@ -346,8 +346,8 @@ return f -def addClangTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install", - languages = ('gcc', 'g++', 'objc', 'obj-c++')): +def addClangGCCTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install", + languages = ('gcc', 'g++', 'objc', 'obj-c++')): make_vars = [WithProperties( 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), WithProperties( @@ -365,6 +365,26 @@ logfiles={ 'dg.sum' : 'obj/%s/%s.sum' % (lang, lang) }, ignore=gcc_dg_ignores.get(lang, []))) +def addClangGDBTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install"): + make_vars = [WithProperties( + 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), + WithProperties( + 'CXX_UNDER_TEST=%s/bin/clang++' % install_prefix)] + f.addStep(SVN(name='svn-clang-tests', mode='update', + baseURL='http://llvm.org/svn/llvm-project/clang-tests/', + defaultBranch='trunk', workdir='clang-tests')) + gdb_dg_ignores = ignores.get('gdb-1472-testsuite', {}) + f.addStep(DejaGNUCommand.DejaGNUCommand( + name='test-gdb-1472-testsuite', + command=["make", "-k", "check"] + make_vars, + description="gdb-1472-testsuite", + workdir='clang-tests/gdb-1472-testsuite', + logfiles={ 'dg.sum' : 'obj/gdb.sum' }, + ignore=gdb_dg_ignores)) + +# FIXME: Deprecated. +addClangTests = addClangGCCTests + def getClangTestsIgnoresFromPath(path, key): def readList(path): if not os.path.exists(path): @@ -387,4 +407,12 @@ readList(os.path.join(lang_path, 'XPASS.txt'))) ignores['gcc-4_2-testsuite' ] = gcc_dg_ignores + ignores_path = os.path.join(path, 'gdb-1472-testsuite', 'expected_results', + key) + gdb_dg_ignores = ( + readList(os.path.join(ignores_path, 'FAIL.txt')) + + readList(os.path.join(ignores_path, 'UNRESOLVED.txt')) + + readList(os.path.join(ignores_path, 'XPASS.txt'))) + ignores['gdb-1472-testsuite' ] = gdb_dg_ignores + return ignores From grosser at fim.uni-passau.de Sat Feb 26 22:11:03 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Sun, 27 Feb 2011 04:11:03 -0000 Subject: [llvm-commits] [llvm] r126562 - in /llvm/trunk: include/llvm/Support/DOTGraphTraits.h include/llvm/Support/GraphWriter.h lib/CodeGen/ScheduleDAGPrinter.cpp lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <20110227041103.611FB2A6C12C@llvm.org> Author: grosser Date: Sat Feb 26 22:11:03 2011 New Revision: 126562 URL: http://llvm.org/viewvc/llvm-project?rev=126562&view=rev Log: Pass the graph to the DOTGraphTraits.getEdgeAttributes(). This follows the interface of getNodeAttributes. Modified: llvm/trunk/include/llvm/Support/DOTGraphTraits.h llvm/trunk/include/llvm/Support/GraphWriter.h llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/include/llvm/Support/DOTGraphTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DOTGraphTraits.h?rev=126562&r1=126561&r2=126562&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/DOTGraphTraits.h (original) +++ llvm/trunk/include/llvm/Support/DOTGraphTraits.h Sat Feb 26 22:11:03 2011 @@ -89,8 +89,9 @@ /// If you want to override the dot attributes printed for a particular edge, /// override this method. - template - static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { + template + static std::string getEdgeAttributes(const void *Node, EdgeIter EI, + const GraphType& Graph) { return ""; } Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=126562&r1=126561&r2=126562&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Sat Feb 26 22:11:03 2011 @@ -240,7 +240,7 @@ emitEdge(static_cast(Node), edgeidx, static_cast(TargetNode), DestPort, - DTraits.getEdgeAttributes(Node, EI)); + DTraits.getEdgeAttributes(Node, EI, G)); } } Modified: llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp?rev=126562&r1=126561&r2=126562&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp Sat Feb 26 22:11:03 2011 @@ -51,7 +51,8 @@ /// If you want to override the dot attributes printed for a particular /// edge, override this method. static std::string getEdgeAttributes(const SUnit *Node, - SUnitIterator EI) { + SUnitIterator EI, + const ScheduleDAG *Graph) { if (EI.isArtificialDep()) return "color=cyan,style=dashed"; if (EI.isCtrlDep()) Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=126562&r1=126561&r2=126562&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Sat Feb 26 22:11:03 2011 @@ -90,7 +90,8 @@ /// If you want to override the dot attributes printed for a particular /// edge, override this method. template - static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { + static std::string getEdgeAttributes(const void *Node, EdgeIter EI, + const SelectionDAG *Graph) { SDValue Op = EI.getNode()->getOperand(EI.getOperand()); EVT VT = Op.getValueType(); if (VT == MVT::Glue) From grosser at fim.uni-passau.de Sat Feb 26 22:11:05 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Sun, 27 Feb 2011 04:11:05 -0000 Subject: [llvm-commits] [llvm] r126563 - in /llvm/trunk: cmake/config-ix.cmake include/llvm/Config/config.h.cmake include/llvm/Config/llvm-config.h.cmake Message-ID: <20110227041105.A65582A6C12D@llvm.org> Author: grosser Date: Sat Feb 26 22:11:05 2011 New Revision: 126563 URL: http://llvm.org/viewvc/llvm-project?rev=126563&view=rev Log: cmake: Add xdot.py support as it already exists in autoconf. Modified: llvm/trunk/cmake/config-ix.cmake llvm/trunk/include/llvm/Config/config.h.cmake llvm/trunk/include/llvm/Config/llvm-config.h.cmake Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=126563&r1=126562&r2=126563&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Sat Feb 26 22:11:05 2011 @@ -224,6 +224,7 @@ # available programs checks function(llvm_find_program name) string(TOUPPER ${name} NAME) + string(REGEX REPLACE "\\." "_" NAME ${NAME}) find_program(LLVM_PATH_${NAME} ${name}) mark_as_advanced(LLVM_PATH_${NAME}) if(LLVM_PATH_${NAME}) @@ -241,6 +242,7 @@ llvm_find_program(fdp) llvm_find_program(dot) llvm_find_program(dotty) +llvm_find_program(xdot.py) if( LLVM_ENABLE_FFI ) find_path(FFI_INCLUDE_PATH ffi.h PATHS ${FFI_INCLUDE_DIR}) Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=126563&r1=126562&r2=126563&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Sat Feb 26 22:11:05 2011 @@ -453,7 +453,7 @@ #cmakedefine HAVE_WRITEV ${HAVE_WRITEV} /* Define if the xdot.py program is available */ -#undef HAVE_XDOT_PY +#cmakedefine HAVE_XDOT_PY ${HAVE_XDOT_PY} /* Have host's _alloca */ #cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} @@ -585,7 +585,7 @@ #cmakedefine LLVM_PATH_TWOPI "${LLVM_PATH_TWOPI}" /* Define to path to xdot.py program if found or 'echo xdot.py' otherwise */ -#undef LLVM_PATH_XDOT_PY +#cmakedefine LLVM_PATH_XDOT_PY "${LLVM_PATH_XDOT_PY}" /* Installation prefix directory */ #cmakedefine LLVM_PREFIX "${LLVM_PREFIX}" Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.cmake?rev=126563&r1=126562&r2=126563&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/llvm-config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/llvm-config.h.cmake Sat Feb 26 22:11:05 2011 @@ -91,6 +91,9 @@ /* Define to path to twopi program if found or 'echo twopi' otherwise */ #cmakedefine LLVM_PATH_TWOPI "${LLVM_PATH_TWOPI}" +/* Define to path to xdot.py program if found or 'echo xdot.py' otherwise */ +#cmakedefine LLVM_PATH_XDOT_PY "${LLVM_PATH_XDOT.PY}" + /* Installation prefix directory */ #cmakedefine LLVM_PREFIX "${LLVM_PREFIX}" From grosser at fim.uni-passau.de Sat Feb 26 22:11:07 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Sun, 27 Feb 2011 04:11:07 -0000 Subject: [llvm-commits] [llvm] r126564 - /llvm/trunk/lib/Analysis/RegionPrinter.cpp Message-ID: <20110227041107.92B962A6C12E@llvm.org> Author: grosser Date: Sat Feb 26 22:11:07 2011 New Revision: 126564 URL: http://llvm.org/viewvc/llvm-project?rev=126564&view=rev Log: RegionPrinter: Ignore back edges when layouting the graph Modified: llvm/trunk/lib/Analysis/RegionPrinter.cpp Modified: llvm/trunk/lib/Analysis/RegionPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionPrinter.cpp?rev=126564&r1=126563&r2=126564&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/RegionPrinter.cpp (original) +++ llvm/trunk/lib/Analysis/RegionPrinter.cpp Sat Feb 26 22:11:07 2011 @@ -70,6 +70,32 @@ G->getTopLevelRegion()); } + std::string getEdgeAttributes(RegionNode *srcNode, + GraphTraits::ChildIteratorType CI, RegionInfo *RI) { + + RegionNode *destNode = *CI; + + if (srcNode->isSubRegion() || destNode->isSubRegion()) + return ""; + + // In case of a backedge, do not use it to define the layout of the nodes. + BasicBlock *srcBB = srcNode->getNodeAs(); + BasicBlock *destBB = destNode->getNodeAs(); + + Region *R = RI->getRegionFor(destBB); + + while (R && R->getParent()) + if (R->getParent()->getEntry() == destBB) + R = R->getParent(); + else + break; + + if (R->getEntry() == destBB && R->contains(srcBB)) + return "constraint=false"; + + return ""; + } + // Print the cluster of the subregions. This groups the single basic blocks // and adds a different background color for each group. static void printRegionCluster(const Region *R, GraphWriter &GW, From nadav.rotem at intel.com Sun Feb 27 01:40:43 2011 From: nadav.rotem at intel.com (Nadav Rotem) Date: Sun, 27 Feb 2011 07:40:43 -0000 Subject: [llvm-commits] [llvm] r126565 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <20110227074043.DF08A2A6C12C@llvm.org> Author: nadav Date: Sun Feb 27 01:40:43 2011 New Revision: 126565 URL: http://llvm.org/viewvc/llvm-project?rev=126565&view=rev Log: Fix typos in the comments. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=126565&r1=126564&r2=126565&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Feb 27 01:40:43 2011 @@ -3726,7 +3726,8 @@ // fold (sext (load x)) -> (sext (truncate (sextload x))) // None of the supported targets knows how to perform load and sign extend - // in one instruction. We only perform this transformation on scalars. + // on vectors in one instruction. We only perform this transformation on + // scalars. if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() && ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::SEXTLOAD, N0.getValueType()))) { @@ -3930,7 +3931,8 @@ // fold (zext (load x)) -> (zext (truncate (zextload x))) // None of the supported targets knows how to perform load and vector_zext - // in one instruction. We only perform this transformation on scalar zext. + // on vectors in one instruction. We only perform this transformation on + // scalars. if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() && ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::ZEXTLOAD, N0.getValueType()))) { @@ -4139,7 +4141,8 @@ // fold (aext (load x)) -> (aext (truncate (extload x))) // None of the supported targets knows how to perform load and any_ext - // in one instruction. We only perform this transformation on scalars. + // on vectors in one instruction. We only perform this transformation on + // scalars. if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() && ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::EXTLOAD, N0.getValueType()))) { @@ -4552,7 +4555,7 @@ // See if we can simplify the input to this truncate through knowledge that // only the low bits are being used. // For example "trunc (or (shl x, 8), y)" // -> trunc y - // Currenly we only perform this optimization on scalars because vectors + // Currently we only perform this optimization on scalars because vectors // may have different active low bits. if (!VT.isVector()) { SDValue Shorter = From zwarich at apple.com Sun Feb 27 02:05:57 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Sun, 27 Feb 2011 08:05:57 -0000 Subject: [llvm-commits] [llvm] r126566 - in /llvm/trunk/test/CodeGen/X86: phi-bit-propagation.ll phi-constants.ll Message-ID: <20110227080557.CD64F2A6C12C@llvm.org> Author: zwarich Date: Sun Feb 27 02:05:57 2011 New Revision: 126566 URL: http://llvm.org/viewvc/llvm-project?rev=126566&view=rev Log: Give a test file a more sensible name so that it can hold more test cases. Added: llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll - copied, changed from r126565, llvm/trunk/test/CodeGen/X86/phi-constants.ll Removed: llvm/trunk/test/CodeGen/X86/phi-constants.ll Copied: llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll (from r126565, llvm/trunk/test/CodeGen/X86/phi-constants.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll?p2=llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll&p1=llvm/trunk/test/CodeGen/X86/phi-constants.ll&r1=126565&r2=126566&rev=126566&view=diff ============================================================================== (empty) Removed: llvm/trunk/test/CodeGen/X86/phi-constants.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/phi-constants.ll?rev=126565&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/phi-constants.ll (original) +++ llvm/trunk/test/CodeGen/X86/phi-constants.ll (removed) @@ -1,35 +0,0 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s - -%"class.std::bitset" = type { [8 x i8] } - -define zeroext i1 @_Z3fooPjmS_mRSt6bitsetILm32EE(i32* nocapture %a, i64 %asize, i32* nocapture %b, i64 %bsize, %"class.std::bitset"* %bits) nounwind readonly ssp noredzone { -entry: - %tmp.i.i.i.i = bitcast %"class.std::bitset"* %bits to i64* - br label %for.cond - -for.cond: ; preds = %for.inc, %entry - %0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] - %conv = zext i32 %0 to i64 - %cmp = icmp eq i64 %conv, %bsize - br i1 %cmp, label %return, label %for.body - -for.body: ; preds = %for.cond - %arrayidx = getelementptr inbounds i32* %b, i64 %conv - %tmp5 = load i32* %arrayidx, align 4 - %conv6 = zext i32 %tmp5 to i64 - %rem.i.i.i.i = and i64 %conv6, 63 - %tmp3.i = load i64* %tmp.i.i.i.i, align 8 - %shl.i.i = shl i64 1, %rem.i.i.i.i - %and.i = and i64 %shl.i.i, %tmp3.i - %cmp.i = icmp eq i64 %and.i, 0 - br i1 %cmp.i, label %for.inc, label %return - -for.inc: ; preds = %for.body - %inc = add i32 %0, 1 - br label %for.cond - -return: ; preds = %for.body, %for.cond -; CHECK-NOT: and - %retval.0 = phi i1 [ true, %for.body ], [ false, %for.cond ] - ret i1 %retval.0 -} From zwarich at apple.com Sun Feb 27 02:06:01 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Sun, 27 Feb 2011 08:06:01 -0000 Subject: [llvm-commits] [llvm] r126567 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h test/CodeGen/X86/phi-bit-propagation.ll Message-ID: <20110227080601.A40302A6C12D@llvm.org> Author: zwarich Date: Sun Feb 27 02:06:01 2011 New Revision: 126567 URL: http://llvm.org/viewvc/llvm-project?rev=126567&view=rev Log: Fix PR9324 / by handling the case where a PHI has no uses. Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126567&r1=126566&r2=126567&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Sun Feb 27 02:06:01 2011 @@ -187,7 +187,12 @@ /// InvalidatePHILiveOutRegInfo - Invalidates a PHI's LiveOutInfo, to be /// called when a block is visited before all of its predecessors. void InvalidatePHILiveOutRegInfo(const PHINode *PN) { - unsigned Reg = ValueMap[PN]; + // PHIs with no uses have no ValueMap entry. + DenseMap::const_iterator It = ValueMap.find(PN); + if (It == ValueMap.end()) + return; + + unsigned Reg = It->second; LiveOutRegInfo.grow(Reg); LiveOutRegInfo[Reg].IsValid = false; } Modified: llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll?rev=126567&r1=126566&r2=126567&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll (original) +++ llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll Sun Feb 27 02:06:01 2011 @@ -33,3 +33,23 @@ %retval.0 = phi i1 [ true, %for.body ], [ false, %for.cond ] ret i1 %retval.0 } + +; This test case caused an assertion failure; see PR9324. +define void @func_37() noreturn nounwind ssp { +entry: + br i1 undef, label %lbl_919, label %entry.for.inc_crit_edge + +entry.for.inc_crit_edge: ; preds = %entry + br label %for.inc + +lbl_919: ; preds = %for.cond7.preheader, %entry + br label %for.cond7.preheader + +for.cond7.preheader: ; preds = %for.inc, %lbl_919 + %storemerge.ph = phi i8 [ 0, %lbl_919 ], [ %add, %for.inc ] + br i1 undef, label %for.inc, label %lbl_919 + +for.inc: ; preds = %for.cond7.preheader, %entry.for.inc_crit_edge + %add = add i8 undef, 1 + br label %for.cond7.preheader +} From geek4civic at gmail.com Sun Feb 27 02:47:19 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sun, 27 Feb 2011 08:47:19 -0000 Subject: [llvm-commits] [llvm] r126568 - in /llvm/trunk: lib/Target/X86/X86FrameLowering.cpp test/CodeGen/X86/tailcallstack64.ll Message-ID: <20110227084719.99DDD2A6C12D@llvm.org> Author: chapuni Date: Sun Feb 27 02:47:19 2011 New Revision: 126568 URL: http://llvm.org/viewvc/llvm-project?rev=126568&view=rev Log: Target/X86: Always emit "push/pop GPRs" in prologue/epilogue and emit "spill/reload frames" for XMMs. It improves Win64's prologue/epilogue but it would not affect ia32 and amd64 (lack of nonvolatile XMMs). Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp llvm/trunk/test/CodeGen/X86/tailcallstack64.ll Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=126568&r1=126567&r2=126568&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Sun Feb 27 02:47:19 2011 @@ -892,7 +892,6 @@ MachineFunction &MF = *MBB.getParent(); - bool isWin64 = STI.isTargetWin64(); unsigned SlotSize = STI.is64Bit() ? 8 : 4; unsigned FPReg = TRI->getFrameRegister(MF); unsigned CalleeFrameSize = 0; @@ -900,25 +899,39 @@ const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); X86MachineFunctionInfo *X86FI = MF.getInfo(); + // Push GPRs. It increases frame size. unsigned Opc = STI.is64Bit() ? X86::PUSH64r : X86::PUSH32r; for (unsigned i = CSI.size(); i != 0; --i) { unsigned Reg = CSI[i-1].getReg(); + if (!X86::GR64RegClass.contains(Reg) && + !X86::GR32RegClass.contains(Reg)) + continue; // Add the callee-saved register as live-in. It's killed at the spill. MBB.addLiveIn(Reg); if (Reg == FPReg) // X86RegisterInfo::emitPrologue will handle spilling of frame register. continue; - if (!X86::VR128RegClass.contains(Reg) && !isWin64) { - CalleeFrameSize += SlotSize; - BuildMI(MBB, MI, DL, TII.get(Opc)).addReg(Reg, RegState::Kill); - } else { - const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg); - TII.storeRegToStackSlot(MBB, MI, Reg, true, CSI[i-1].getFrameIdx(), - RC, TRI); - } + CalleeFrameSize += SlotSize; + BuildMI(MBB, MI, DL, TII.get(Opc)).addReg(Reg, RegState::Kill); } X86FI->setCalleeSavedFrameSize(CalleeFrameSize); + + // Make XMM regs spilled. X86 does not have ability of push/pop XMM. + // It can be done by spilling XMMs to stack frame. + // Note that only Win64 ABI might spill XMMs. + for (unsigned i = CSI.size(); i != 0; --i) { + unsigned Reg = CSI[i-1].getReg(); + if (X86::GR64RegClass.contains(Reg) || + X86::GR32RegClass.contains(Reg)) + continue; + // Add the callee-saved register as live-in. It's killed at the spill. + MBB.addLiveIn(Reg); + const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg); + TII.storeRegToStackSlot(MBB, MI, Reg, true, CSI[i-1].getFrameIdx(), + RC, TRI); + } + return true; } @@ -933,21 +946,30 @@ MachineFunction &MF = *MBB.getParent(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); + + // Reload XMMs from stack frame. + for (unsigned i = 0, e = CSI.size(); i != e; ++i) { + unsigned Reg = CSI[i].getReg(); + if (X86::GR64RegClass.contains(Reg) || + X86::GR32RegClass.contains(Reg)) + continue; + const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg); + TII.loadRegFromStackSlot(MBB, MI, Reg, CSI[i].getFrameIdx(), + RC, TRI); + } + + // POP GPRs. unsigned FPReg = TRI->getFrameRegister(MF); - bool isWin64 = STI.isTargetWin64(); unsigned Opc = STI.is64Bit() ? X86::POP64r : X86::POP32r; for (unsigned i = 0, e = CSI.size(); i != e; ++i) { unsigned Reg = CSI[i].getReg(); + if (!X86::GR64RegClass.contains(Reg) && + !X86::GR32RegClass.contains(Reg)) + continue; if (Reg == FPReg) // X86RegisterInfo::emitEpilogue will handle restoring of frame register. continue; - if (!X86::VR128RegClass.contains(Reg) && !isWin64) { - BuildMI(MBB, MI, DL, TII.get(Opc), Reg); - } else { - const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg); - TII.loadRegFromStackSlot(MBB, MI, Reg, CSI[i].getFrameIdx(), - RC, TRI); - } + BuildMI(MBB, MI, DL, TII.get(Opc), Reg); } return true; } Modified: llvm/trunk/test/CodeGen/X86/tailcallstack64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcallstack64.ll?rev=126568&r1=126567&r2=126568&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/tailcallstack64.ll (original) +++ llvm/trunk/test/CodeGen/X86/tailcallstack64.ll Sun Feb 27 02:47:19 2011 @@ -2,7 +2,7 @@ ; RUN: llc < %s -tailcallopt -mtriple=x86_64-win32 -post-RA-scheduler=true | FileCheck %s ; FIXME: Redundant unused stack allocation could be eliminated. -; CHECK: subq ${{24|88}}, %rsp +; CHECK: subq ${{24|72}}, %rsp ; Check that lowered arguments on the stack do not overwrite each other. ; Add %in1 %p1 to a different temporary register (%eax). From geek4civic at gmail.com Sun Feb 27 02:51:59 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sun, 27 Feb 2011 17:51:59 +0900 Subject: [llvm-commits] [Review request][Win64] Use pushq/popq GPRs in function prologue/epilogue In-Reply-To: References: Message-ID: Applied in r126568, thank you! ...Takumi From baldrick at free.fr Sun Feb 27 07:24:02 2011 From: baldrick at free.fr (Duncan Sands) Date: Sun, 27 Feb 2011 13:24:02 -0000 Subject: [llvm-commits] [dragonegg] r126569 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110227132403.0BDF92A6C12C@llvm.org> Author: baldrick Date: Sun Feb 27 07:24:02 2011 New Revision: 126569 URL: http://llvm.org/viewvc/llvm-project?rev=126569&view=rev Log: Calculate the CallArgTypes vector from the call operands, eliminating the possibility of forgetting to update it. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126569&r1=126568&r2=126569&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Sun Feb 27 07:24:02 2011 @@ -6863,7 +6863,6 @@ bool HasSideEffects = gimple_asm_volatile_p(stmt) || (NumOutputs == 0); std::vector CallOps; - std::vector CallArgTypes; // CallResultTypes - The inline asm call may return one or more results. The // types of the results are recorded here along with a flag indicating whether @@ -6957,8 +6956,7 @@ ConstraintStr += ",=*"; ConstraintStr += SimplifiedConstraint; CallOps.push_back(Dest.Ptr); - CallArgTypes.push_back(Dest.Ptr->getType()); - OutputLocations.push_back(std::make_pair(false, CallArgTypes.size()-1)); + OutputLocations.push_back(std::make_pair(false, CallOps.size()-1)); } } @@ -7041,7 +7039,7 @@ if (OutputLocations[Match].first) OTy = CallResultTypes[OutputIndex].first; else { - OTy = CallArgTypes[OutputIndex]; + OTy = CallOps[OutputIndex]->getType(); assert(OTy->isPointerTy() && "Expected pointer type!"); OTy = cast(OTy)->getElementType(); } @@ -7098,14 +7096,12 @@ } CallOps.push_back(Op); - CallArgTypes.push_back(Op->getType()); } else { // Memory operand. mark_addressable(TREE_VALUE(Input)); isIndirect = true; LValue Src = EmitLV(Val); assert(!Src.isBitfield() && "Cannot read from a bitfield!"); CallOps.push_back(Src.Ptr); - CallArgTypes.push_back(Src.Ptr->getType()); } ConstraintStr += ','; @@ -7209,6 +7205,12 @@ break; } + // Compute the types of the arguments to the asm call. + std::vector CallArgTypes(CallOps.size()); + for (unsigned i = 0, e = CallOps.size(); i != e; ++i) + CallArgTypes[i] = CallOps[i]->getType(); + + // Get the type of the called asm "function". const FunctionType *FTy = FunctionType::get(CallResultType, CallArgTypes, false); From baldrick at free.fr Sun Feb 27 07:29:05 2011 From: baldrick at free.fr (Duncan Sands) Date: Sun, 27 Feb 2011 13:29:05 -0000 Subject: [llvm-commits] [dragonegg] r126570 - /dragonegg/trunk/llvm-convert.cpp Message-ID: <20110227132905.58F242A6C12C@llvm.org> Author: baldrick Date: Sun Feb 27 07:29:05 2011 New Revision: 126570 URL: http://llvm.org/viewvc/llvm-project?rev=126570&view=rev Log: Add descriptions of some variables using when processing inline asm. Modified: dragonegg/trunk/llvm-convert.cpp Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126570&r1=126569&r2=126570&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Sun Feb 27 07:29:05 2011 @@ -6862,8 +6862,6 @@ // side effects. bool HasSideEffects = gimple_asm_volatile_p(stmt) || (NumOutputs == 0); - std::vector CallOps; - // CallResultTypes - The inline asm call may return one or more results. The // types of the results are recorded here along with a flag indicating whether // the corresponding GCC type is signed. @@ -6876,10 +6874,15 @@ // in which case the result is converted before being stored. SmallVector, 4> CallResultDests; - SmallVector, 4> OutputLocations; + // CallOps - The operands pass to the inline asm call. + std::vector CallOps; - // ConstraintStr - The string of constraints in LLVM format. - std::string ConstraintStr; + // OutputLocations - For each output holds an index into CallOps (if the flag + // is false) or into CallResultTypes (if the flag is true). Outputs returned + // in memory are passed to the asm as an operand and thus appear in CallOps. + // Those returned in registers are obtained as one of the results of the asm + // call and thus correspond to an entry in CallResultTypes. + SmallVector, 4> OutputLocations; // SSADefinitions - If the asm defines an SSA name then the SSA name and a // memory location are recorded here. The asm result defining the SSA name @@ -6887,6 +6890,9 @@ // to define the SSA name. SmallVector, 4> SSADefinitions; + // ConstraintStr - The string of constraints in LLVM format. + std::string ConstraintStr; + // Process outputs. for (unsigned i = 0; i != NumOutputs; ++i) { tree Output = gimple_asm_output_op(stmt, i); From ofv at wanadoo.es Sun Feb 27 07:32:51 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Sun, 27 Feb 2011 13:32:51 -0000 Subject: [llvm-commits] [llvm] r126571 - /llvm/trunk/CMakeLists.txt Message-ID: <20110227133251.210962A6C12C@llvm.org> Author: ofv Date: Sun Feb 27 07:32:50 2011 New Revision: 126571 URL: http://llvm.org/viewvc/llvm-project?rev=126571&view=rev Log: Install include/llvm/Support/LICENSE.TXT. PR9321. Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=126571&r1=126570&r2=126571&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Sun Feb 27 07:32:50 2011 @@ -260,6 +260,7 @@ PATTERN "*.h" PATTERN "*.td" PATTERN "*.inc" + PATTERN "LICENSE.TXT" PATTERN ".svn" EXCLUDE ) From baldrick at free.fr Sun Feb 27 07:54:02 2011 From: baldrick at free.fr (Duncan Sands) Date: Sun, 27 Feb 2011 13:54:02 -0000 Subject: [llvm-commits] [llvm] r126573 - /llvm/trunk/docs/tutorial/LangImpl5.html Message-ID: <20110227135402.39E7B2A6C12C@llvm.org> Author: baldrick Date: Sun Feb 27 07:54:01 2011 New Revision: 126573 URL: http://llvm.org/viewvc/llvm-project?rev=126573&view=rev Log: Fix typo pointed out in pr9339. Modified: llvm/trunk/docs/tutorial/LangImpl5.html Modified: llvm/trunk/docs/tutorial/LangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=126573&r1=126572&r2=126573&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl5.html (original) +++ llvm/trunk/docs/tutorial/LangImpl5.html Sun Feb 27 07:54:01 2011 @@ -72,7 +72,7 @@

Extending Kaleidoscope to support if/then/else is quite straightforward. It -basically requires adding lexer support for this "new" concept to the lexer, +basically requires adding support for this "new" concept to the lexer, parser, AST, and LLVM code emitter. This example is nice, because it shows how easy it is to "grow" a language over time, incrementally extending it as new ideas are discovered.

From baldrick at free.fr Sun Feb 27 08:41:27 2011 From: baldrick at free.fr (Duncan Sands) Date: Sun, 27 Feb 2011 14:41:27 -0000 Subject: [llvm-commits] [llvm] r126574 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp test/CodeGen/Generic/2011-02-27-Fpextend.ll Message-ID: <20110227144127.B356F2A6C12C@llvm.org> Author: baldrick Date: Sun Feb 27 08:41:27 2011 New Revision: 126574 URL: http://llvm.org/viewvc/llvm-project?rev=126574&view=rev Log: Legalize support for fpextend of vector. PR9309. Added: llvm/trunk/test/CodeGen/Generic/2011-02-27-Fpextend.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=126574&r1=126573&r2=126574&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Sun Feb 27 08:41:27 2011 @@ -440,6 +440,7 @@ case ISD::FCEIL: case ISD::FRINT: case ISD::FNEARBYINT: + case ISD::FP_EXTEND: case ISD::FP_TO_SINT: case ISD::FP_TO_UINT: case ISD::SINT_TO_FP: @@ -2005,6 +2006,7 @@ case ISD::STORE: Res = WidenVecOp_STORE(N); break; case ISD::FP_ROUND: + case ISD::FP_EXTEND: case ISD::FP_TO_SINT: case ISD::FP_TO_UINT: case ISD::SINT_TO_FP: Added: llvm/trunk/test/CodeGen/Generic/2011-02-27-Fpextend.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2011-02-27-Fpextend.ll?rev=126574&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2011-02-27-Fpextend.ll (added) +++ llvm/trunk/test/CodeGen/Generic/2011-02-27-Fpextend.ll Sun Feb 27 08:41:27 2011 @@ -0,0 +1,7 @@ +; RUN: llc < %s +; PR9309 + +define <4 x double> @f_fu(<4 x float>) nounwind { + %float2double.i = fpext <4 x float> %0 to <4 x double> + ret <4 x double> %float2double.i +} From rafael.espindola at gmail.com Sun Feb 27 10:51:18 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Sun, 27 Feb 2011 11:51:18 -0500 Subject: [llvm-commits] [patch][lto] Use MC to scan for symbol definitions and uses In-Reply-To: References: <4D692112.5030707@gmail.com> Message-ID: <4D6A8106.9020809@gmail.com> On 11-02-26 6:07 PM, Daniel Dunbar wrote: > Very nice! > > Patch looks quite reasonable to me, my only concern would be whether > it should wait for after 2.9 branch. It's probably safe, but it might > be better to take it afterwards in case it needs to bake. > > Are you aware of situations the current code handles that this one doesn't? No, but it is possible that some users have dependency on the old behavior. For example, we now require that assembly being passed by libLTO be valid. With the git mirrors in place it should not be a big problem to help the patch for 10 days :-) > - Daniel > Cheers, Rafael From rafael.espindola at gmail.com Sun Feb 27 10:55:23 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Sun, 27 Feb 2011 11:55:23 -0500 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: References: <4D65DCFB.90205@gmail.com> <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> <4D67237B.6060306@gmail.com> <3B27AD7C-DE66-4564-BA79-3C958D6D3E72@apple.com> <4D67D60A.9040401@gmail.com> Message-ID: <4D6A81FB.8070207@gmail.com> >> Btw, I have seen the 3.0 planned type changes mentioned some times, >> but I don't know what they are in detail. Is there a doc >> somewhere? > > I wrote them up and sent a link to llvmdev. Thanks! >> Yes, I just need a way to represent MemoryBuffers that are not NULL >> terminated :-) > > I agree that having null termination be optional would be useful. > Clang really wants this (to make its lexer faster) but I don't think > anyone else cares. I'd be fine with eliminating this requirement in > the MemBuffer API and giving MemoryBuffer::getFileOrSTDIN a flags > argument, where one flag would be "RequiresNullTerminatedBuffer" or > something like that. OK, I will give that a try. I would probably still wrap MemoryBuffer in a ZMemoryBuffer that just sets RequiresNullTerminatedBuffer to true so that people don't accidentally pass the wrong type of buffer to the lexer. > -Chris Cheers, Rafael From benny.kra at googlemail.com Sun Feb 27 12:13:53 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sun, 27 Feb 2011 18:13:53 -0000 Subject: [llvm-commits] [llvm] r126578 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Message-ID: <20110227181353.350092A6C12C@llvm.org> Author: d0k Date: Sun Feb 27 12:13:53 2011 New Revision: 126578 URL: http://llvm.org/viewvc/llvm-project?rev=126578&view=rev Log: Silence enum conversion warnings. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=126578&r1=126577&r2=126578&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Sun Feb 27 12:13:53 2011 @@ -749,7 +749,7 @@ insn->sibIndex = SIB_INDEX_NONE; break; default: - insn->sibIndex = (EABase)(sibIndexBase + index); + insn->sibIndex = (SIBIndex)(sibIndexBase + index); if (insn->sibIndex == SIB_INDEX_sib || insn->sibIndex == SIB_INDEX_sib64) insn->sibIndex = SIB_INDEX_NONE; @@ -796,7 +796,7 @@ } break; default: - insn->sibBase = (EABase)(sibBaseBase + base); + insn->sibBase = (SIBBase)(sibBaseBase + base); break; } From clattner at apple.com Sun Feb 27 13:47:02 2011 From: clattner at apple.com (Chris Lattner) Date: Sun, 27 Feb 2011 11:47:02 -0800 Subject: [llvm-commits] [patch] Switch LTO to use MC In-Reply-To: <4D6A81FB.8070207@gmail.com> References: <4D65DCFB.90205@gmail.com> <99D6D76F-3DAD-461D-93DE-F64B2557F0E1@apple.com> <4D67237B.6060306@gmail.com> <3B27AD7C-DE66-4564-BA79-3C958D6D3E72@apple.com> <4D67D60A.9040401@gmail.com> <4D6A81FB.8070207@gmail.com> Message-ID: <4CB06DCC-CD72-4848-A270-4C89BE775D97@apple.com> On Feb 27, 2011, at 8:55 AM, Rafael ?vila de Esp?ndola wrote: >>> >>> Yes, I just need a way to represent MemoryBuffers that are not NULL >>> terminated :-) >> >> I agree that having null termination be optional would be useful. >> Clang really wants this (to make its lexer faster) but I don't think >> anyone else cares. I'd be fine with eliminating this requirement in >> the MemBuffer API and giving MemoryBuffer::getFileOrSTDIN a flags >> argument, where one flag would be "RequiresNullTerminatedBuffer" or >> something like that. > > OK, I will give that a try. I would probably still wrap MemoryBuffer in a ZMemoryBuffer that just sets RequiresNullTerminatedBuffer to true so that people don't accidentally pass the wrong type of buffer to the lexer. I think it would be perfectly fine to just have the lexer assert that it is nul terminated. The reason I mentioned adding a flag to the file open APIs is that MemoryBuffer does an optimization for the mmap case, when the file is not a multiple of a page size: it just knows the OS zero fills the rest of the mapped page. -Chris From rafael.espindola at gmail.com Sun Feb 27 14:15:37 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 27 Feb 2011 20:15:37 -0000 Subject: [llvm-commits] [llvm] r126579 - /llvm/trunk/tools/gold/gold-plugin.cpp Message-ID: <20110227201537.598A82A6C12C@llvm.org> Author: rafael Date: Sun Feb 27 14:15:37 2011 New Revision: 126579 URL: http://llvm.org/viewvc/llvm-project?rev=126579&view=rev Log: bfd was fixed, remove the work around. Modified: llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=126579&r1=126578&r2=126579&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Sun Feb 27 14:15:37 2011 @@ -274,19 +274,8 @@ } free(buf); } else { - // FIXME: We should not need to pass -1 as the file size, but there - // is a bug in BFD that causes it to pass 0 to us. Remove this once - // that is fixed. - off_t size = file->filesize ? file->filesize : -1; - - // FIXME: We should not need to reset the position in the file, but there - // is a bug in BFD. Remove this once that is fixed. - off_t old_pos = lseek(file->fd, 0, SEEK_CUR); - lseek(file->fd, 0, SEEK_SET); - M = lto_module_create_from_fd(file->fd, file->name, size); - - lseek(file->fd, old_pos, SEEK_SET); + M = lto_module_create_from_fd(file->fd, file->name, file->filesize); if (!M) return LDPS_OK; } From rafael.espindola at gmail.com Sun Feb 27 14:30:22 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 27 Feb 2011 20:30:22 -0000 Subject: [llvm-commits] [llvm] r126580 - /llvm/trunk/tools/gold/gold-plugin.cpp Message-ID: <20110227203022.85A042A6C12C@llvm.org> Author: rafael Date: Sun Feb 27 14:30:22 2011 New Revision: 126580 URL: http://llvm.org/viewvc/llvm-project?rev=126580&view=rev Log: Gold now rescans archives as needed, so the pass-through options are not necessary anymore. Modified: llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=126580&r1=126579&r2=126580&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Sun Feb 27 14:30:22 2011 @@ -73,7 +73,6 @@ static generate_bc generate_bc_file = BC_NO; static std::string bc_path; static std::string obj_path; - static std::vector pass_through; static std::string extra_library_path; static std::string triple; static std::string mcpu; @@ -96,9 +95,6 @@ mcpu = opt.substr(strlen("mcpu=")); } else if (opt.startswith("extra-library-path=")) { extra_library_path = opt.substr(strlen("extra_library_path=")); - } else if (opt.startswith("pass-through=")) { - llvm::StringRef item = opt.substr(strlen("pass-through=")); - pass_through.push_back(item.str()); } else if (opt.startswith("mtriple=")) { triple = opt.substr(strlen("mtriple=")); } else if (opt.startswith("obj-path=")) { @@ -489,24 +485,6 @@ return LDPS_ERR; } - for (std::vector::iterator i = options::pass_through.begin(), - e = options::pass_through.end(); - i != e; ++i) { - std::string &item = *i; - const char *item_p = item.c_str(); - if (llvm::StringRef(item).startswith("-l")) { - if (add_input_library(item_p + 2) != LDPS_OK) { - (*message)(LDPL_ERROR, "Unable to add library to the link."); - return LDPS_ERR; - } - } else { - if (add_input_file(item_p) != LDPS_OK) { - (*message)(LDPL_ERROR, "Unable to add .o file to the link."); - return LDPS_ERR; - } - } - } - if (options::obj_path.empty()) Cleanup.push_back(sys::Path(objPath)); From sabre at nondot.org Sun Feb 27 16:51:37 2011 From: sabre at nondot.org (Chris Lattner) Date: Sun, 27 Feb 2011 22:51:37 -0000 Subject: [llvm-commits] [llvm] r126590 - /llvm/trunk/include/llvm/ADT/ArrayRef.h Message-ID: <20110227225137.EE8272A6C12C@llvm.org> Author: lattner Date: Sun Feb 27 16:51:37 2011 New Revision: 126590 URL: http://llvm.org/viewvc/llvm-project?rev=126590&view=rev Log: add a data() method. Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=126590&r1=126589&r2=126590&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ArrayRef.h (original) +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Sun Feb 27 16:51:37 2011 @@ -79,6 +79,8 @@ /// empty - Check if the array is empty. bool empty() const { return Length == 0; } + const T *data() const { return Data; } + /// size - Get the array size. size_t size() const { return Length; } From sabre at nondot.org Sun Feb 27 16:51:57 2011 From: sabre at nondot.org (Chris Lattner) Date: Sun, 27 Feb 2011 22:51:57 -0000 Subject: [llvm-commits] [llvm] r126591 - /llvm/trunk/include/llvm/ADT/ScopedHashTable.h Message-ID: <20110227225158.063CC2A6C12C@llvm.org> Author: lattner Date: Sun Feb 27 16:51:57 2011 New Revision: 126591 URL: http://llvm.org/viewvc/llvm-project?rev=126591&view=rev Log: add the ability to walk the scope tree and insert at not-the-current scope. Modified: llvm/trunk/include/llvm/ADT/ScopedHashTable.h Modified: llvm/trunk/include/llvm/ADT/ScopedHashTable.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ScopedHashTable.h?rev=126591&r1=126590&r2=126591&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ScopedHashTable.h (original) +++ llvm/trunk/include/llvm/ADT/ScopedHashTable.h Sun Feb 27 16:51:57 2011 @@ -96,6 +96,9 @@ ScopedHashTableScope(ScopedHashTable &HT); ~ScopedHashTableScope(); + ScopedHashTableScope *getParentScope() { return PrevScope; } + const ScopedHashTableScope *getParentScope() const { return PrevScope; } + private: friend class ScopedHashTable; ScopedHashTableVal *getLastValInScope() { @@ -141,9 +144,14 @@ template class ScopedHashTable { +public: + /// ScopeTy - This is a helpful typedef that allows clients to get easy access + /// to the name of the scope for this hash table. + typedef ScopedHashTableScope ScopeTy; +private: typedef ScopedHashTableVal ValTy; DenseMap TopLevelMap; - ScopedHashTableScope *CurScope; + ScopeTy *CurScope; AllocatorTy Allocator; @@ -157,9 +165,6 @@ assert(CurScope == 0 && TopLevelMap.empty() && "Scope imbalance!"); } - /// ScopeTy - This is a helpful typedef that allows clients to get easy access - /// to the name of the scope for this hash table. - typedef ScopedHashTableScope ScopeTy; /// Access to the allocator. typedef typename ReferenceAdder::result AllocatorRefTy; @@ -180,13 +185,7 @@ } void insert(const K &Key, const V &Val) { - assert(CurScope && "No scope active!"); - - ScopedHashTableVal *&KeyEntry = TopLevelMap[Key]; - - KeyEntry = ValTy::Create(CurScope->getLastValInScope(), KeyEntry, Key, Val, - Allocator); - CurScope->setLastValInScope(KeyEntry); + insertIntoScope(CurScope, Key, Val); } typedef ScopedHashTableIterator iterator; @@ -199,6 +198,21 @@ if (I == TopLevelMap.end()) return end(); return iterator(I->second); } + + ScopeTy *getCurScope() { return CurScope; } + const ScopeTy *getCurScope() const { return CurScope; } + + /// insertIntoScope - This inserts the specified key/value at the specified + /// (possibly not the current) scope. While it is ok to insert into a scope + /// that isn't the current one, it isn't ok to insert *underneath* an existing + /// value of the specified key. + void insertIntoScope(ScopeTy *S, const K &Key, const V &Val) { + assert(S && "No scope active!"); + ScopedHashTableVal *&KeyEntry = TopLevelMap[Key]; + KeyEntry = ValTy::Create(S->getLastValInScope(), KeyEntry, Key, Val, + Allocator); + S->setLastValInScope(KeyEntry); + } }; /// ScopedHashTableScope ctor - Install this as the current scope for the hash From isanbard at gmail.com Sun Feb 27 19:10:44 2011 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Feb 2011 01:10:44 -0000 Subject: [llvm-commits] [llvm] r126604 - /llvm/trunk/docs/HowToReleaseLLVM.html Message-ID: <20110228011044.E1D5C2A6C12C@llvm.org> Author: void Date: Sun Feb 27 19:10:44 2011 New Revision: 126604 URL: http://llvm.org/viewvc/llvm-project?rev=126604&view=rev Log: Update the documentation on "How to Release LLVM". It lays out a new way of tagging and branching for the release. I will update this more throughout the 2.9 release process. Modified: llvm/trunk/docs/HowToReleaseLLVM.html Modified: llvm/trunk/docs/HowToReleaseLLVM.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/HowToReleaseLLVM.html?rev=126604&r1=126603&r2=126604&view=diff ============================================================================== --- llvm/trunk/docs/HowToReleaseLLVM.html (original) +++ llvm/trunk/docs/HowToReleaseLLVM.html Sun Feb 27 19:10:44 2011 @@ -17,7 +17,8 @@ @@ -26,486 +27,588 @@
-

- This document collects information about successfully releasing LLVM - (including subprojects llvm-gcc and Clang) to the public. - It is the release manager's responsibility to ensure that a high quality - build of LLVM is released. -

+ +

This document contains information about successfully releasing LLVM — + including subprojects: e.g., llvm-gcc and clang — to + the public. It is the Release Manager's responsibility to ensure that a high + quality build of LLVM is released.

+
-

LLVM is released on a time based schedule (currently every 6 months). We - do not have dot releases because of the nature of LLVM incremental - development philosophy. The release schedule is roughly as follows: -

-
    -
  1. Set code freeze and branch creation date for 6 months after last code freeze -date. Announce release schedule to the LLVM community and update the website.
  2. -
  3. Create release branch and begin release process.
  4. -
  5. Send out pre-release for first round of testing. Testing will last 7-10 days. -During the first round of testing, regressions should be found and fixed. Patches -are merged from mainline to the release branch.
  6. -
  7. Generate and send out second pre-release. Bugs found during this time will -not be fixed unless absolutely critical. Bugs introduce by patches merged in -will be fixed and if so, a 3rd round of testing is needed.
  8. -
  9. The release notes should be updated during the first and second round of -pre-release testing.
  10. -
  11. Finally, release!
  12. -
-
+

LLVM is released on a time based schedule — roughly every 6 months. We + do not normally have dot releases because of the nature of LLVM's incremental + development philosophy. That said, the only thing preventing dot releases for + critical bug fixes from happening is a lack of resources — testers, + machines, time, etc. And, because of the high quality we desire for LLVM + releases, we cannot allow for a truncated form of release qualification.

+ +

The release process is roughly as follows:

+ +
    +
  • Set code freeze and branch creation date for 6 months after last code + freeze date. Announce release schedule to the LLVM community and update + the website.

  • + +
  • Create release branch and begin release process.

  • + +
  • Send out release candidate sources for first round of testing. Testing + lasts 7-10 days. During the first round of testing, any regressions found + should be fixed. Patches are merged from mainline into the release + branch. Also, all features need to be completed during this time. Any + features not completed at the end of the first round of testing will be + removed or disabled for the release.

  • + +
  • Generate and send out the second release candidate sources. Only + critial bugs found during this testing phase will be fixed. Any + bugs introduced by merged patches will be fixed. If so a third round of + testing is needed.

  • + +
  • The release notes are updated.

  • + +
  • Finally, release!

  • +
+ + - +
-This section describes a few administrative tasks that need to be done for the -release process to begin. Specifically, it involves creating the release branch, - resetting version numbers, and creating the release tarballs for the release - team to begin testing. + +

This section describes a few administrative tasks that need to be done for + the release process to begin. Specifically, it involves:

+ +
    +
  • Creating the release branch,
  • +
  • Setting version numbers, and
  • +
  • Tagging release candidates for the release team to begin testing
  • +
+
+
-

Branch the Subversion HEAD using the following procedure:

-
    -
  1. -

    Verify that the current Subversion HEAD is in decent shape by examining - nightly tester or buildbot results.

  2. -
  3. -

    Request all developers to refrain from committing. Offenders get commit - rights taken away (temporarily).

  4. -
  5. -

    Create the release branch for llvm, llvm-gcc4.2, - clang, and the test-suite. The branch name will be - release_XX,where XX is the major and minor release numbers. - Clang will have a different release number than llvm/ - llvm-gcc4 since its first release was years later - (still deciding if this will be true or not). These branches - can be created without checking out anything from subversion. -

    + +

    Branch the Subversion trunk using the following procedure:

    + +
      +
    1. Remind developers that the release branching is imminent and to refrain + from committing patches that might break the build. E.g., new features, + large patches for works in progress, an overhaul of the type system, an + exciting new TableGen feature, etc.

    2. + +
    3. Verify that the current Subversion trunk is in decent shape by + examining nightly tester and buildbot results.

    4. + +
    5. Create the release branch for llvm, llvm-gcc-4.2, + clang, and the test-suite from the last known good + revision. The branch's name is release_XY, where X is + the major and Y the minor release numbers. The branches should be + created using the following commands:

      -
      +
      -svn copy https://llvm.org/svn/llvm-project/llvm/trunk \
      -         https://llvm.org/svn/llvm-project/llvm/branches/release_XX
      -svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk \
      -         https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX
      -svn copy https://llvm.org/svn/llvm-project/test-suite/trunk \
      -         https://llvm.org/svn/llvm-project/test-suite/branches/release_XX
      -svn copy https://llvm.org/svn/llvm-project/cfe/trunk \
      -         https://llvm.org/svn/llvm-project/cfe/branches/release_XX
      +$ svn copy https://llvm.org/svn/llvm-project/llvm/trunk \
      +           https://llvm.org/svn/llvm-project/llvm/branches/release_XY
      +
      +$ svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk \
      +           https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XY
      +
      +$ svn copy https://llvm.org/svn/llvm-project/test-suite/trunk \
      +           https://llvm.org/svn/llvm-project/test-suite/branches/release_XY
      +
      +$ svn copy https://llvm.org/svn/llvm-project/cfe/trunk \
      +           https://llvm.org/svn/llvm-project/cfe/branches/release_XY
       
      -
      +
    6. -
    7. -

      Advise developers they can work on Subversion HEAD again.

    8. - -
    9. -

      The Release Manager should switch to the release branch (as all changes - to the release will now be done in the branch). The easiest way to do this - is to grab another working copy using the following commands:

      +
    10. Advise developers that they may now check their patches into the + Subversion tree again.

    11. + +
    12. The Release Manager should switch to the release branch, because all + changes to the release will now be done in the branch. The easiest way to + do this is to grab a working copy using the following commands:

      -svn co https://llvm.org/svn/llvm-project/llvm/branches/release_XX
      -svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX
      -svn co https://llvm.org/svn/llvm-project/test-suite/branches/release_XX
      -svn co https://llvm.org/svn/llvm-project/cfe/branches/release_XX
      +$ svn co https://llvm.org/svn/llvm-project/llvm/branches/release_XY llvm-X.Y
      +
      +$ svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XY llvm-gcc-4.2-X.Y
      +
      +$ svn co https://llvm.org/svn/llvm-project/test-suite/branches/release_XY test-suite-X.Y
      +
      +$ svn co https://llvm.org/svn/llvm-project/cfe/branches/release_XY clang-X.Y
       
    13. +
    -
+
-

- After creating the LLVM release branch, update the release branches' - autoconf/configure.ac version from X.Xsvn to just X.X. Update it on mainline - as well to be the next version (X.X+1svn). Regenerated the configure script - for both. This must be done for both llvm and the - test-suite. -

-

FIXME: Add a note about clang.

-

In addition, the version number of all the Bugzilla components must be - updated for the next release. -

+ +

After creating the LLVM release branch, update the release branches' + autoconf and configure.ac versions from 'X.Ysvn' + to 'X.Y'. Update it on mainline as well to be the next version + ('X.Y+1svn'). Regenerate the configure scripts for both + llvm and the test-suite.

+ +

In addition, the version numbers of all the Bugzilla components must be + updated for the next release.

+
- + +
-

- Create source distributions for LLVM, LLVM-GCC, - clang, and the llvm test-suite by exporting the source from - Subversion and archiving it. This can be done with the following commands: -

+ +

Create release candidates for llvm, llvm-gcc, + clang, and the LLVM test-suite by tagging the branch with + the respective release candidate number. For instance, to create Release + Candidate 1 you would issue the following commands:

-svn export https://llvm.org/svn/llvm-project/llvm/branches/release_XX llvm-X.X
-svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX llvm-gcc4.2-X.X.source
-svn export https://llvm.org/svn/llvm-project/test-suite/branches/release_XX llvm-test-X.X
-svn export https://llvm.org/svn/llvm-project/cfe/branches/release_XX clang-X.X
-tar -czvf - llvm-X.X          | gzip > llvm-X.X.tar.gz
-tar -czvf - llvm-test-X.X     | gzip > llvm-test-X.X.tar.gz
-tar -czvf - llvm-gcc4.2-X.X.source | gzip > llvm-gcc-4.2-X.X.source.tar.gz
-tar -czvf - clang-X.X | gzip > clang-X.X.tar.gz
+$ svn mkdir https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_XY
+$ svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_XY \
+           https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_XY/RC1
+
+$ svn mkdir https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_XY
+$ svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XY \
+           https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_XY/RC1
+
+$ svn mkdir https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_XY
+$ svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XY \
+           https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_XY/RC1
+
+$ svn mkdir https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_XY
+$ svn copy https://llvm.org/svn/llvm-project/cfe/branches/release_XY \
+           https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_XY/RC1
 
+ +

Similarly, Release Candidate 2 would be named RC2 and so + on. This keeps a permanent copy of the release candidate around for people to + export and build as they wish. The final released sources will be tagged in + the RELEASE_XY directory as Final + (c.f. Tag the LLVM Final Release).

+ +

The Release Manager may supply pre-packaged source tarballs for users. This + can be done with the following commands:

+ +
+
+$ svn export https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_XY/RC1 llvm-X.Yrc1
+$ svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_XY/RC1 llvm-gcc4.2-X.Yrc1
+$ svn export https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_XY/RC1 llvm-test-X.Yrc1
+$ svn export https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_XY/RC1 clang-X.Yrc1
+
+$ tar -czvf - llvm-X.Yrc1        | gzip > llvm-X.Yrc1.src.tar.gz
+$ tar -czvf - llvm-test-X.Yrc1   | gzip > llvm-test-X.Yrc1.src.tar.gz
+$ tar -czvf - llvm-gcc4.2-X.Yrc1 | gzip > llvm-gcc-4.2-X.Yrc1.src.tar.gz
+$ tar -czvf - clang-X.Yrc1       | gzip > clang-X.Yrc1.src.tar.gz
+
+
+
- +
-The build of llvm, llvm-gcc, and clang must be free -of errors and warnings in both debug, release+asserts, and release builds. -If all builds are clean, then the release passes build qualification. -
    -
  1. debug: ENABLE_OPTIMIZED=0
  2. -
  3. release+asserts: ENABLE_OPTIMIZED=1
  4. -
  5. release: ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1
  6. -
+

The builds of llvm, llvm-gcc, and clang + must be free of errors and warnings in Debug, Release+Asserts, and + Release builds. If all builds are clean, then the release passes Build + Qualification.

+ +

The make options for building the different modes:

+ + + + + + +
ModeOptions
DebugENABLE_OPTIMIZED=0
Release+AssertsENABLE_OPTIMIZED=1
ReleaseENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1
+
+
-

- Build both debug, release+asserts (optimized), and release versions of - LLVM on all supported platforms. Direction to build llvm are - here. -

+ +

Build Debug, Release+Asserts, and Release versions + of llvm on all supported platforms. Directions to build + llvm are + here.

+
+
-

- Creating the LLVM GCC binary distribution (release/optimized) requires - performing the following steps for each supported platform: -

-
    -
  1. - Build the LLVM GCC front-end by following the directions in the README.LLVM - file. The frontend must be compiled with c, c++, objc (mac only), - objc++ (mac only) and fortran support.
  2. -
  3. Please boostrap as well.
  4. -
  5. Be sure to build with LLVM_VERSION_INFO=X.X, where X is the major and - minor release numbers. -
  6. - -
  7. - Copy the installation directory to a directory named for the specific target. - For example on Red Hat Enterprise Linux, the directory would be named - llvm-gcc4.2-2.6-x86-linux-RHEL4. Archive and compress the new directory. -
  8. -
+

Creating the llvm-gcc binary distribution (Release/Optimized) + requires performing the following steps for each supported platform:

+ +
    +
  1. Build the llvm-gcc front-end by following the directions in + the README.LLVM file. The front-end must be compiled with C, C++, + Objective-C (Mac only), Objective-C++ (Mac only), and Fortran + support.

  2. + +
  3. Boostrapping must be enabled.

  4. + +
  5. Be sure to build with LLVM_VERSION_INFO=X.Y, where X + is the major and Y is the minor release numbers.

  6. + +
  7. Copy the installation directory to a directory named for the specific + target. For example on Red Hat Enterprise Linux, the directory would be + named llvm-gcc4.2-2.6-x86-linux-RHEL4. Archive and compress the + new directory.

  8. +
+
- + +
-

- Creating the Clang binary distribution (debug/release/release) requires - performing the following steps for each supported platform: -

-
    -
  1. - Build clang according to the directions - here. -
  2. - -
  3. Build both a debug and release version of clang, but the binary - will be a release build.
  4. - -
  5. - Package clang (details to follow). -
  6. -
-
+

Creating the clang binary distribution + (Debug/Release+Asserts/Release) requires performing the following steps for + each supported platform:

+ +
    +
  1. Build clang according to the directions + here.
  2. + +
  3. Build both a debug and release version of clang. The binary will be the + release build.
  4. + +
  5. Package clang (details to follow).
  6. +
+ - + +
-

- The table below specifies which compilers are used for each arch/os combination - when qualifying the build of llvm, llvm-gcc, clang. -

- -

- + +

The table below specifies which compilers are used for each Arch/OS + combination when qualifying the build of llvm, llvm-gcc, + and clang.

+ +
- + - -
ArchitectureOScompiler
x86-32Mac OS 10.5gcc 4.0.1
x86-32Linuxgcc 4.2.X, gcc 4.3.X
x86-32FreeBSDgcc 4.2.X
x86-32mingwgcc 3.4.5
x86-32mingwgcc 3.4.5
x86-64Mac OS 10.5gcc 4.0.1
x86-64Linuxgcc 4.2.X, gcc 4.3.X
x86-64FreeBSDgcc 4.2.X
-

+
-
- A release is qualified when it has no regressions from the previous - release (or baseline). Regressions are related to correctness only and not - performance at this time. Regressions are new failures in the set of tests that - are used to qualify each product and only include things on the list. - Ultimately, there is no end to the number of possible bugs in a release. We - need a very concrete and definitive release criteria that ensures we have - monotonically improving quality on some metric. The metric we use is - described below. This doesn't mean that we don't care about other things, - but this are things that must be satisfied before a release can go out -
+

A release is qualified when it has no regressions from the previous release + (or baseline). Regressions are related to correctness first and performance + second. (We may tolerate some minor performance regressions if they are + deemed necessary for the general quality of the compiler.)

+ +

Regressions are new failures in the set of tests that are used to qualify + each product and only include things on the list. Every release will have + some bugs in it. It is the reality of developing a complex piece of + software. We need a very concrete and definitive release criteria that + ensures we have monotonically improving quality on some metric. The metric we + use is described below. This doesn't mean that we don't care about other + criteria, but these are the criteria which we found to be most important and + which must be satisfied before a release can go out

+ + +
-

- LLVM is qualified when it has a clean dejagnu test run without a frontend and - it has no regressions when using either llvm-gcc or clang - with the test-suite from the previous release. -

+ +

LLVM is qualified when it has a clean test run without a front-end. And it + has no regressions when using either llvm-gcc or clang with + the test-suite from the previous release.

+
+
-

- LLVM-GCC is qualified when front-end specific tests in the - llvm dejagnu test suite all pass and there are no regressions in - the test-suite.

-

We do not use the gcc dejagnu test suite as release criteria.

+ +

LLVM-GCC is qualified when front-end specific tests in the + llvm regression test suite all pass and there are no regressions in + the test-suite.

+ +

We do not use the GCC DejaGNU test suite as release criteria.

+
+
- Clang is qualified when front-end specific tests in the - llvm dejagnu test suite all pass, clang's own test suite passes - cleanly, and there are no regressions in the test-suite.

+ +

Clang is qualified when front-end specific tests in the + llvm dejagnu test suite all pass, clang's own test suite passes + cleanly, and there are no regressions in the test-suite.

+
+
-

- + +
ArchitectureOSllvm-gcc baselineclang baseline - tests
+ -
ArchitectureOSllvm-gcc baselineclang baselinetests
x86-32Linuxlast releaselast releasellvm dejagnu, clang tests, test-suite (including spec)
x86-32FreeBSDnonelast releasellvm dejagnu, clang tests, test-suite
x86-32mingwlast releasenoneQT
x86-64Mac OS 10.Xlast releaselast releasellvm dejagnu, clang tests, test-suite (including spec)
x86-64Linuxlast releaselast releasellvm dejagnu, clang tests, test-suite (including spec)
x86-64FreeBSDnonelast releasellvm dejagnu, clang tests, test-suite

+ +
-

- Once all testing has been completed and appropriate bugs filed, the pre-release - tar balls may be put on the website and the LLVM community is notified. Ask that - all LLVM developers test the release in 2 ways:

-
    -
  1. Download llvm-X.X, llvm-test-X.X, and the appropriate llvm-gcc4 - and/or clang binary. Build LLVM. - Run "make check" and the full llvm-test suite (make TEST=nightly report).
  2. -
  3. Download llvm-X.X, llvm-test-X.X, and the llvm-gcc4 and/or clang source. - Compile everything. Run "make check" and the full llvm-test suite (make TEST=nightly - report).
  4. -
-

Ask LLVM developers to submit the report and make check results to the list. - Attempt to verify that there are no regressions from the previous release. - The results are not used to qualify a release, but to spot other potential - problems. For unsupported targets, verify that make check at least is - clean.

+ +

Once all testing has been completed and appropriate bugs filed, the release + candidate tarballs are put on the website and the LLVM community is + notified. Ask that all LLVM developers test the release in 2 ways:

+ +
    +
  1. Download llvm-X.Y, llvm-test-X.Y, and the + appropriate llvm-gcc and/or clang binary. Build + LLVM. Run make check and the full LLVM test suite (make + TEST=nightly report).
  2. + +
  3. Download llvm-X.Y, llvm-test-X.Y, and the + llvm-gcc and/or clang source. Compile everything. Run + make check and the full LLVM test suite (make TEST=nightly + report).
  4. +
+ +

Ask LLVM developers to submit the test suite report and make check + results to the list. Verify that there are no regressions from the previous + release. The results are not used to qualify a release, but to spot other + potential problems. For unsupported targets, verify that make check + is at least clean.

-

During the first round of testing time, - all regressions must be fixed before the second pre-release is created.

+

During the first round of testing, all regressions must be fixed before the + second release candidate is tagged.

-

If this is the second round of testing, this is only to ensure the bug - fixes previously merged in have not created new major problems. This is not - the time to solve additional and unrelated bugs. If no patches are merged in, - the release is determined to be ready and the release manager may move onto - the next step. -

+

If this is the second round of testing, the testing is only to ensure that + bug fixes previously merged in have not created new major problems. This + is not the time to solve additional and unrelated bugs! If no patches are + merged in, the release is determined to be ready and the release manager may + move onto the next stage.

+
- + +
-

- Below are the rules regarding patching the release branch.

-

-

  • Patches applied to the release branch are only applied by the release - manager.
  • -
  • During the first round of testing, patches that fix regressions or that - are small and relatively risk free (verified by the appropriate code owner) - are applied to the branch. Code owners are asked to be very conservative in - approving patches for the branch and we reserve the right to reject any patch - that does not fix a regression as previously defined.
  • -
  • During the remaining rounds of testing, only patches that fix regressions - may be applied.
  • - -

    -
    +

    Below are the rules regarding patching the release branch:

    + +
      +
    1. Patches applied to the release branch may only be applied by the + release manager.

    2. + +
    3. During the first round of testing, patches that fix regressions or that + are small and relatively risk free (verified by the appropriate code + owner) are applied to the branch. Code owners are asked to be very + conservative in approving patches for the branch. We reserve the right to + reject any patch that does not fix a regression as previously + defined.

    4. + +
    5. During the remaining rounds of testing, only patches that fix critical + regressions may be applied.

    6. +
    + + +
    -

    - The final stages of the release process involving tagging the release branch, - updating documentation that refers to the release, and updating the demo - page.

    -

    FIXME: Add a note if anything needs to be done to the clang website. - Eventually the websites will be merged hopefully.

    + +

    The final stages of the release process involves tagging the "final" release + branch, updating documentation that refers to the release, and updating the + demo page.

    +
    +
    -

    - Review the documentation and ensure that it is up to date. The Release Notes - must be updated to reflect bug fixes, new known issues, and changes in the - list of supported platforms. The Getting Started Guide should be updated to - reflect the new release version number tag avaiable from Subversion and - changes in basic system requirements. Merge both changes from mainline into - the release branch. -

    + +

    Review the documentation and ensure that it is up to date. The "Release + Notes" must be updated to reflect new features, bug fixes, new known issues, + and changes in the list of supported platforms. The "Getting Started Guide" + should be updated to reflect the new release version number tag avaiable from + Subversion and changes in basic system requirements. Merge both changes from + mainline into the release branch.

    +
    - + +
    -

    Tag the release branch using the following procedure:

    + +

    Tag the final release sources using the following procedure:

    +
    -svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_XX \
    -         https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_XX
    -svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX \
    -         https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_XX
    -svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XX \
    -         https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_XX
    +$ svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_XY \
    +           https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_XY/Final
    +
    +$ svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XY \
    +           https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_XY/Final
    +
    +$ svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XY \
    +           https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_XY/Final
    +
    +$ svn copy https://llvm.org/svn/llvm-project/cfe/branches/release_XY \
    +           https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_XY/Final
     
    -
    - + +
    -

    - The LLVM demo page must be updated to use the new release. This consists of - using the llvm-gcc binary and building LLVM. Update the website demo page - configuration to use the new release.

    + +

    The LLVM demo page must be updated to use the new release. This consists of + using the new llvm-gcc binary and building LLVM.

    +
    +
    -

    - The website must be updated before the release announcement is sent out. Here is - what to do:

    -
      -
    1. Check out the website module from CVS.
    2. -
    3. Create a new subdirectory X.X in the releases directory.
    4. -
    5. Commit the llvm, test-suite, llvm-gcc source, - clang source, clang binaries, - and llvm-gcc binaries in this new directory.
    6. -
    7. Copy and commit the llvm/docs and LICENSE.txt - files into this new directory. The docs should be built with BUILD_FOR_WEBSITE=1.
    8. -
    9. Commit the index.html to the release/X.X directory to redirect (use from previous - release.
    10. -
    11. Update the releases/download.html file with the new release.
    12. -
    13. Update the releases/index.html with the new release and link to - release documentation.
    14. -
    15. Finally, update the main page (index.html and sidebar) to - point to the new release and release announcement. Make sure this all gets - committed back into Subversion.
    16. -
    + +

    The website must be updated before the release announcement is sent out. Here + is what to do:

    + +
      +
    1. Check out the www module from Subversion.
    2. + +
    3. Create a new subdirectory X.Y in the releases directory.
    4. + +
    5. Commit the llvm, test-suite, llvm-gcc source, + clang source, clang binaries, and llvm-gcc + binaries in this new directory.
    6. + +
    7. Copy and commit the llvm/docs and LICENSE.txt files + into this new directory. The docs should be built with + BUILD_FOR_WEBSITE=1.
    8. + +
    9. Commit the index.html to the release/X.Y directory to + redirect (use from previous release.
    10. + +
    11. Update the releases/download.html file with the new release.
    12. + +
    13. Update the releases/index.html with the new release and link to + release documentation.
    14. + +
    15. Finally, update the main page (index.html and sidebar) to point + to the new release and release announcement. Make sure this all gets + committed back into Subversion.
    16. +
    +
    +
    -

    Have Chris send out the release announcement when everything is finished.

    + +

    Have Chris send out the release announcement when everything is finished.

    +
    From nicholas at mxc.ca Sun Feb 27 21:01:47 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 27 Feb 2011 19:01:47 -0800 Subject: [llvm-commits] PATCH: instcombine switch on select of constants to br In-Reply-To: References: <893CFB3C-832C-4959-AE72-4186FCD61E99@gmail.com> <4D2A730F.2090207@mxc.ca> <130DB463-EF73-40A2-8166-5D3A014D9D12@gmail.com> Message-ID: <4D6B101B.8070703@mxc.ca> Frits van Bommel wrote: > Since there has been no progress here for over six weeks, I updated > this patch myself. > Does anyone mind if I commit this version? I kinda wish it didn't work this way. Here's what I have in mind: 1. fix llvm.org/PR774 (make the default case optional) 2. one optimization which finds switches that have two destinations and turns them into branches 3. one optimization which sees select (and other things) feeding into a switch and removes the impossible cases from the switch, possibly including the default case. That said, if I can't talk you into doing that much work, then this patch looks fine: @@ -2357,10 +2382,10 @@ return true; } - if (SelectInst *SI = dyn_cast(IBI->getAddress())) { + if (SelectInst *SI = dyn_cast(IBI->getAddress())) if (SimplifyIndirectBrOnSelect(IBI, SI)) return SimplifyCFG(BB) | true; - } + return Changed; } You didn't change any behaviour here? Just leave that out of the commit. Nick From geek4civic at gmail.com Sun Feb 27 22:51:57 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Mon, 28 Feb 2011 13:51:57 +0900 Subject: [llvm-commits] [PATCH] Don't install libUnitTestMain.a. It might be useless without gtest headers. Message-ID: --- utils/unittest/UnitTestMain/Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) ...Takumi -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Don-t-install-libUnitTestMain.a.-It-might-be-use.patch.txt Type: text/x-patch Size: 359 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110228/ee874332/attachment.bin From geek4civic at gmail.com Sun Feb 27 22:53:07 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Mon, 28 Feb 2011 13:53:07 +0900 Subject: [llvm-commits] [PATCH] Makefile.rules: [PR9321] "make install" may install include files along explicit pattern. Message-ID: --- Makefile.rules | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) I prefer adding explicit patterns rather than adding exclusive patterns, to suppress installing *.cmake. ...Takumi -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Makefile.rules-PR9321-make-install-may-install-i.patch.txt Type: text/x-patch Size: 1592 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110228/9b415fb5/attachment.bin From geek4civic at gmail.com Sun Feb 27 23:18:07 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Mon, 28 Feb 2011 05:18:07 -0000 Subject: [llvm-commits] [llvm] r126632 - /llvm/trunk/utils/unittest/UnitTestMain/Makefile Message-ID: <20110228051807.2DA8D2A6C12C@llvm.org> Author: chapuni Date: Sun Feb 27 23:18:07 2011 New Revision: 126632 URL: http://llvm.org/viewvc/llvm-project?rev=126632&view=rev Log: Don't install libUnitTestMain.a. It might be useless without gtest headers. Modified: llvm/trunk/utils/unittest/UnitTestMain/Makefile Modified: llvm/trunk/utils/unittest/UnitTestMain/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/UnitTestMain/Makefile?rev=126632&r1=126631&r2=126632&view=diff ============================================================================== --- llvm/trunk/utils/unittest/UnitTestMain/Makefile (original) +++ llvm/trunk/utils/unittest/UnitTestMain/Makefile Sun Feb 27 23:18:07 2011 @@ -27,4 +27,6 @@ CPP.Flags += -DGTEST_HAS_PTHREAD=0 endif +NO_INSTALL = 1 + include $(LEVEL)/Makefile.common From geek4civic at gmail.com Sun Feb 27 23:22:38 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Mon, 28 Feb 2011 14:22:38 +0900 Subject: [llvm-commits] [PATCH] Don't install libUnitTestMain.a. It might be useless without gtest headers. In-Reply-To: References: Message-ID: Committed in r126632, thank you Chandler! ...Takumi