Re: [llvm-commits] [llvm] r47220 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll
On Feb 18, 2008, at 9:35 AM, Duncan Sands wrote: Hi Chris, Nice. Out of curiousity, how does nest do to codegen? 'nest' causes a specific register to be grabbed for the parameter in calls. So removing it doesn't do much :) Ok. if you want me to remove the transform, just ask :) I mostly did it because seeing all those useless nest attributes floating around annoys me when rummaging about in Ada produced .ll's. I have no problem with it. It makes sense to me. You can just do: CallSite User(castInstruction(*UI)); and then handle user generically. Actually you couldn't, but you can now (see the CallSite changes just committed). Ah, strange, I thought that was allowed :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47275 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Author: lattner Date: Mon Feb 18 11:47:29 2008 New Revision: 47275 URL: http://llvm.org/viewvc/llvm-project?rev=47275view=rev Log: minor code simplification, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=47275r1=47274r2=47275view=diff == --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Feb 18 11:47:29 2008 @@ -1117,15 +1117,13 @@ // First, we have to check that the dependency is another memcpy Instruction* dep = MD.getDependency(M); - if (dep == MemoryDependenceAnalysis::None || - dep == MemoryDependenceAnalysis::NonLocal) + if (dep == MemoryDependenceAnalysis::None || + dep == MemoryDependenceAnalysis::NonLocal) +return false; + else if (CallInst* C = dyn_castCallInst(dep)) +return performReturnSlotOptzn(M, C, toErase); + else if (!isaMemCpyInst(dep)) return false; - else if (!isaMemCpyInst(dep)) { -if (CallInst* C = dyn_castCallInst(dep)) - return performReturnSlotOptzn(M, C, toErase); -else - return false; - } // We can only transforms memcpy's where the dest of one is the source of the // other ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47274 - /llvm/trunk/test/Transforms/GVN/sret.ll
Author: lattner Date: Mon Feb 18 11:33:10 2008 New Revision: 47274 URL: http://llvm.org/viewvc/llvm-project?rev=47274view=rev Log: make this just a bit more strict. Modified: llvm/trunk/test/Transforms/GVN/sret.ll Modified: llvm/trunk/test/Transforms/GVN/sret.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/sret.ll?rev=47274r1=47273r2=47274view=diff == --- llvm/trunk/test/Transforms/GVN/sret.ll (original) +++ llvm/trunk/test/Transforms/GVN/sret.ll Mon Feb 18 11:33:10 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as %s | opt -gvn | llvm-dis | grep memcpy | count 1 +; RUN: llvm-as %s | opt -gvn | llvm-dis | not grep {call.*memcpy} 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 = i686-apple-darwin9 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47276 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Author: lattner Date: Mon Feb 18 11:50:16 2008 New Revision: 47276 URL: http://llvm.org/viewvc/llvm-project?rev=47276view=rev Log: Transforming -A + -B -- -(A + B) isn't safe for FP, thanks to Dale for noticing this! Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47276r1=47275r2=47276view=diff == --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 18 11:50:16 2008 @@ -2092,10 +2092,12 @@ // -A + B -- B - A // -A + -B -- -(A + B) if (Value *LHSV = dyn_castNegVal(LHS)) { -if (Value *RHSV = dyn_castNegVal(RHS)) { - Instruction *NewAdd = BinaryOperator::createAdd(LHSV, RHSV, sum); - InsertNewInstBefore(NewAdd, I); - return BinaryOperator::createNeg(NewAdd); +if (LHS-getType()-isIntOrIntVector()) { + if (Value *RHSV = dyn_castNegVal(RHS)) { +Instruction *NewAdd = BinaryOperator::createAdd(LHSV, RHSV, sum); +InsertNewInstBefore(NewAdd, I); +return BinaryOperator::createNeg(NewAdd); + } } return BinaryOperator::createSub(RHS, LHSV); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47272 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Author: lattner Date: Mon Feb 18 11:28:21 2008 New Revision: 47272 URL: http://llvm.org/viewvc/llvm-project?rev=47272view=rev Log: don't bother calling getUnderlyingObject for non-pointers. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=47272r1=47271r2=47272view=diff == --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Feb 18 11:28:21 2008 @@ -262,7 +262,8 @@ bool passedAsArg = false; for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); CI != CE; ++CI) -if (getUnderlyingObject(CI-get()) == P) +if (isaPointerType((*CI)-getType()) +getUnderlyingObject(*CI) == P) passedAsArg = true; if (!passedAsArg) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47278 - /llvm/trunk/lib/Target/X86/README.txt
Author: lattner Date: Mon Feb 18 12:30:13 2008 New Revision: 47278 URL: http://llvm.org/viewvc/llvm-project?rev=47278view=rev Log: Add a note about sext from i1 plus flags use. 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=47278r1=47277r2=47278view=diff == --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Feb 18 12:30:13 2008 @@ -1528,3 +1528,55 @@ See PR2053 for more details. //===-===// + +Consider: +int test(unsigned long a, unsigned long b) { return -(a b); } + +We currently compile this to: + +define i32 @test(i32 %a, i32 %b) nounwind { + %tmp3 = icmp ult i32 %a, %b ; i1 [#uses=1] + %tmp34 = zext i1 %tmp3 to i32 ; i32 [#uses=1] + %tmp5 = sub i32 0, %tmp34 ; i32 [#uses=1] + ret i32 %tmp5 +} + +and + +_test: + movl8(%esp), %eax + cmpl%eax, 4(%esp) + setb%al + movzbl %al, %eax + negl%eax + ret + +Several deficiencies here. First, we should instcombine zext+neg into sext: + +define i32 @test2(i32 %a, i32 %b) nounwind { + %tmp3 = icmp ult i32 %a, %b ; i1 [#uses=1] + %tmp34 = sext i1 %tmp3 to i32 ; i32 [#uses=1] + ret i32 %tmp34 +} + +However, before we can do that, we have to fix the bad codegen that we get for +sext from bool: + +_test2: + movl8(%esp), %eax + cmpl%eax, 4(%esp) + setb%al + movzbl %al, %eax + shll$31, %eax + sarl$31, %eax + ret + +This code should be at least as good as the code above. Once this is fixed, we +can optimize this specific case even more to: + + movl8(%esp), %eax + xorl%ecx, %ecx +cmpl%eax, 4(%esp) +sbbl%ecx, %ecx + +//===-===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47280 - /llvm/trunk/lib/Target/README.txt
Author: lattner Date: Mon Feb 18 12:46:39 2008 New Revision: 47280 URL: http://llvm.org/viewvc/llvm-project?rev=47280view=rev Log: upgrade some tests. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=47280r1=47279r2=47280view=diff == --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Mon Feb 18 12:46:39 2008 @@ -397,32 +397,32 @@ ; This testcase is due to tail-duplication not wanting to copy the return ; instruction into the terminating blocks because there was other code ; optimized out of the function after the taildup happened. -;RUN: llvm-upgrade %s | llvm-as | opt -tailcallelim | llvm-dis | not grep call +; RUN: llvm-as %s | opt -tailcallelim | llvm-dis | not grep call -int %t4(int %a) { +define i32 @t4(i32 %a) { entry: -%tmp.1 = and int %a, 1 -%tmp.2 = cast int %tmp.1 to bool -br bool %tmp.2, label %then.0, label %else.0 - -then.0: -%tmp.5 = add int %a, -1 -%tmp.3 = call int %t4( int %tmp.5 ) -br label %return - -else.0: -%tmp.7 = setne int %a, 0 -br bool %tmp.7, label %then.1, label %return - -then.1: -%tmp.11 = add int %a, -2 -%tmp.9 = call int %t4( int %tmp.11 ) -br label %return + %tmp.1 = and i32 %a, 1 ; i32 [#uses=1] + %tmp.2 = icmp ne i32 %tmp.1, 0 ; i1 [#uses=1] + br i1 %tmp.2, label %then.0, label %else.0 + +then.0:; preds = %entry + %tmp.5 = add i32 %a, -1 ; i32 [#uses=1] + %tmp.3 = call i32 @t4( i32 %tmp.5 ) ; i32 [#uses=1] + br label %return + +else.0:; preds = %entry + %tmp.7 = icmp ne i32 %a, 0 ; i1 [#uses=1] + br i1 %tmp.7, label %then.1, label %return + +then.1:; preds = %else.0 + %tmp.11 = add i32 %a, -2; i32 [#uses=1] + %tmp.9 = call i32 @t4( i32 %tmp.11 ); i32 [#uses=1] + br label %return -return: -%result.0 = phi int [ 0, %else.0 ], [ %tmp.3, %then.0 ], +return:; preds = %then.1, %else.0, %then.0 + %result.0 = phi i32 [ 0, %else.0 ], [ %tmp.3, %then.0 ], [ %tmp.9, %then.1 ] -ret int %result.0 + ret i32 %result.0 } //===-===// @@ -446,21 +446,19 @@ Argument promotion should promote arguments for recursive functions, like this: -; RUN: llvm-upgrade %s | llvm-as | opt -argpromotion | llvm-dis | grep x.val +; RUN: llvm-as %s | opt -argpromotion | llvm-dis | grep x.val -implementation ; Functions: - -internal int %foo(int* %x) { +define internal i32 @foo(i32* %x) { entry: -%tmp = load int* %x -%tmp.foo = call int %foo(int *%x) -ret int %tmp.foo + %tmp = load i32* %x ; i32 [#uses=0] + %tmp.foo = call i32 @foo( i32* %x ) ; i32 [#uses=1] + ret i32 %tmp.foo } -int %bar(int* %x) { +define i32 @bar(i32* %x) { entry: -%tmp3 = call int %foo( int* %x); int[#uses=1] -ret int %tmp3 + %tmp3 = call i32 @foo( i32* %x ); i32 [#uses=1] + ret i32 %tmp3 } //===-===// @@ -529,16 +527,22 @@ corresponding integer operations. On a yonah, this loop: double a[256]; - for (b = 0; b 1000; b++) - for (i = 0; i 256; i++) - a[i] = -a[i]; +void foo() { + int i, b; + for (b = 0; b 1000; b++) + for (i = 0; i 256; i++) +a[i] = -a[i]; +} is twice as slow as this loop: long long a[256]; - for (b = 0; b 1000; b++) - for (i = 0; i 256; i++) - a[i] ^= (1ULL 63); +void foo() { + int i, b; + for (b = 0; b 1000; b++) + for (i = 0; i 256; i++) +a[i] ^= (1ULL 63); +} and I suspect other processors are similar. On X86 in particular this is a big win because doing this with integers allows the use of read/modify/write ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47277 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/mul-remat.ll
On Feb 18, 2008, at 9:55 AM, Dan Gohman wrote: Don't mark scalar integer multiplication as Expand on x86, since x86 has plain one-result scalar integer multiplication instructions. This avoids expanding such instructions into MUL_LOHI sequences that must be special-cased at isel time, and avoids the problem with that code that provented memory operands from being folded. This fixes PR1874, addressesing the most common case. The uncommon cases of optimizing multiply-high operations will require work in DAGCombiner. Very nice! + // 8, 16, and 32-bit plain multiply are legal. And 64-bit multiply + // is also legal on x86-64. + if (!Subtarget-is64Bit()) +setOperationAction(ISD::MUL , MVT::i64 , Expand); Are you sure you need this? if !is64Bit(), i64 won't be legal, so the multiply will be expanded unconditionally. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.pdf
Changes in directory llvm-www/pubs: 2008-02-23-TRANSACT-TangerObjBased.pdf updated: 1.1 - 1.2 --- Log message: updated paper. --- Diffs of the changes: (+0 -0) 2008-02-23-TRANSACT-TangerObjBased.pdf |0 1 files changed Index: llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.pdf ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47247 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
On Feb 18, 2008, at 3:31 PM, Owen Anderson wrote: I can't reproduce on my Mac Pro. Can you file a bug report with a reduce testcase? Did you try building the testcase with -m64? It doesn't happen at -m32. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47220 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll
On Feb 16, 2008, at 6:41 PM, Duncan Sands wrote: Hi Chris, Remove any 'nest' parameter attributes if the function is not passed as an argument to a trampoline intrinsic. Nice. Out of curiousity, how does nest do to codegen? 'nest' causes a specific register to be grabbed for the parameter in calls. So removing it doesn't do much :) Ok. Alternatively, maybe ParamAttrsList should have a 'find attribute' function that returns the first argument that has the specified attribute? I think that would only be useful for attributes that can occur at most once, i.e. sret and nest, and since sret is always on the first parameter it's not useful for sret. I did consider a removeAttrEverywhere method, but again it didn't seem generally useful. Fair enough! +static void RemoveNestAttribute(Function *F) { + F-setParamAttrs(StripNest(F-getParamAttrs())); + for (Value::use_iterator UI = F-use_begin(), E = F-use_end(); UI != E;++UI){ +Instruction *User = castInstruction(*UI); +if (CallInst *CI = dyn_castCallInst(User)) { Please use CallSite to handle CallInst/Invoke uniformly. To create a CallSite don't you first need to get your hands on either a CI or an II? Which means doing the dyn_cast and test anyway, to produce the CallSite (this is annoying, maybe it should be possible to create one from an Instruction*). You can just do: CallSite User(castInstruction(*UI)); and then handle user generically. So I don't see that it gains you much. Also, in ChangeCalleesToFastCall a few lines above I see that a certain lattner didn't consider a CallSite useful for the calling convention case :) Heh, CallSite probably didn't exist when that was written, or my commit wasn't adequately reviewed by my peers ;-) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47237 - /llvm/trunk/lib/Target/X86/README.txt
Author: lattner Date: Sun Feb 17 13:43:57 2008 New Revision: 47237 URL: http://llvm.org/viewvc/llvm-project?rev=47237view=rev Log: move PR2053 to here. 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=47237r1=47236r2=47237view=diff == --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Sun Feb 17 13:43:57 2008 @@ -1516,3 +1516,15 @@ lock ; mov %esp, %esp //===-===// + +The generated code on x86 for checking for signed overflow on a multiply the +obvious way is much longer than it needs to be. + +int x(int a, int b) { + long long prod = (long long)a*b; + return prod 0x7FFF || prod (-0x7FFF-1); +} + +See PR2053 for more details. + +//===-===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-gcc-4.2] r47235 - /llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
Author: lattner Date: Sun Feb 17 13:00:29 2008 New Revision: 47235 URL: http://llvm.org/viewvc/llvm-project?rev=47235view=rev Log: Fix support for -m32 on x86_64-unknown-linux-gnu. This has the effect of always making the target triple (in llvm bc files) be i386-* instead of i586-* etc, but this shouldn't impact anything in LLVM (which is driven by cpu attributes) in theory. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=47235r1=47234r2=47235view=diff == --- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Sun Feb 17 13:00:29 2008 @@ -3748,7 +3748,7 @@ * compiler was configured for i[3456]86-os-blah. */ #define LLVM_OVERRIDE_TARGET_ARCH() \ - (TARGET_64BIT ? x86_64 : ) + (TARGET_64BIT ? x86_64 : i386) /* LLVM_TARGET_INTRINSIC_LOWER - To handle builtins, we want to expand the * invocation into normal LLVM code. If the target can handle the builtin, this ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47239 - /llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
Author: lattner Date: Sun Feb 17 14:44:51 2008 New Revision: 47239 URL: http://llvm.org/viewvc/llvm-project?rev=47239view=rev Log: make the logic for breaking up subtracts more explicit, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=47239r1=47238r2=47239view=diff == --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Sun Feb 17 14:44:51 2008 @@ -391,17 +391,30 @@ return BinaryOperator::createNeg(V, V-getName() + .neg, BI); } +/// ShouldBreakUpSubtract - Return true if we should break up this subtract of +/// X-Y into (X + -Y). +static bool ShouldBreakUpSubtract(Instruction *Sub) { + // If this is a negation, we can't split it up! + if (BinaryOperator::isNeg(Sub)) +return false; + + // Don't bother to break this up unless either the LHS is an associable add or + // if this is only used by one. + if (isReassociableOp(Sub-getOperand(0), Instruction::Add)) +return true; + if (isReassociableOp(Sub-getOperand(1), Instruction::Add)) +return true; + + if (Sub-hasOneUse() isReassociableOp(Sub-use_back(), Instruction::Add)) +return true; + + return false; +} + /// BreakUpSubtract - If we have (X-Y), and if either X is an add, or if this is /// only used by an add, transform this into (X+(0-Y)) to promote better /// reassociation. static Instruction *BreakUpSubtract(Instruction *Sub) { - // Don't bother to break this up unless either the LHS is an associable add or - // if this is only used by one. - if (!isReassociableOp(Sub-getOperand(0), Instruction::Add) - !isReassociableOp(Sub-getOperand(1), Instruction::Add) - !(Sub-hasOneUse() isReassociableOp(Sub-use_back(), Instruction::Add))) -return 0; - // Convert a subtract into an add and a neg instruction... so that sub // instructions can be commuted with other add instructions... // @@ -762,12 +775,12 @@ // If this is a subtract instruction which is not already in negate form, // see if we can convert it to X+-Y. if (BI-getOpcode() == Instruction::Sub) { - if (!BinaryOperator::isNeg(BI)) { + if (ShouldBreakUpSubtract(BI)) { if (Instruction *NI = BreakUpSubtract(BI)) { MadeChange = true; BI = NI; } - } else { + } else if (BinaryOperator::isNeg(BI)) { // Otherwise, this is a negation. See if the operand is a multiply tree // and if this is not an inner node of a multiply tree. if (isReassociableOp(BI-getOperand(1), Instruction::Mul) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47240 - /llvm/trunk/test/Transforms/Reassociate/subtest.ll
Author: lattner Date: Sun Feb 17 14:48:43 2008 New Revision: 47240 URL: http://llvm.org/viewvc/llvm-project?rev=47240view=rev Log: upgrade and simplify this test. Modified: llvm/trunk/test/Transforms/Reassociate/subtest.ll Modified: llvm/trunk/test/Transforms/Reassociate/subtest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/subtest.ll?rev=47240r1=47239r2=47240view=diff == --- llvm/trunk/test/Transforms/Reassociate/subtest.ll (original) +++ llvm/trunk/test/Transforms/Reassociate/subtest.ll Sun Feb 17 14:48:43 2008 @@ -1,10 +1,11 @@ ; With sub reassociation, constant folding can eliminate the 12 and -12 constants. ; -; RUN: llvm-upgrade %s | llvm-as | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 12 +; RUN: llvm-as %s | opt -reassociate -instcombine | llvm-dis | not grep 12 -int test(int %A, int %B) { - %X = add int -12, %A - %Y = sub int %X, %B - %Z = add int %Y, 12 - ret int %Z +define i32 @test(i32 %A, i32 %B) { + %X = add i32 -12, %A; i32 [#uses=1] + %Y = sub i32 %X, %B ; i32 [#uses=1] + %Z = add i32 %Y, 12 ; i32 [#uses=1] + ret i32 %Z } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47242 - /llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
Author: lattner Date: Sun Feb 17 14:54:40 2008 New Revision: 47242 URL: http://llvm.org/viewvc/llvm-project?rev=47242view=rev Log: fix pasto Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=47242r1=47241r2=47242view=diff == --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Sun Feb 17 14:54:40 2008 @@ -404,7 +404,7 @@ isReassociableOp(Sub-getOperand(0), Instruction::Sub)) return true; if (isReassociableOp(Sub-getOperand(1), Instruction::Add) || - isReassociableOp(Sub-getOperand(0), Instruction::Sub)) + isReassociableOp(Sub-getOperand(1), Instruction::Sub)) return true; if (Sub-hasOneUse() (isReassociableOp(Sub-use_back(), Instruction::Add) || ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47244 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/addnegneg.ll
Author: lattner Date: Sun Feb 17 15:03:36 2008 New Revision: 47244 URL: http://llvm.org/viewvc/llvm-project?rev=47244view=rev Log: Fold (-x + -y) - -(x+y) which promotes better association, fixing the second half of PR2047 Added: llvm/trunk/test/Transforms/InstCombine/addnegneg.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47244r1=47243r2=47244view=diff == --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Feb 17 15:03:36 2008 @@ -2090,8 +2090,16 @@ } // -A + B -- B - A - if (Value *V = dyn_castNegVal(LHS)) -return BinaryOperator::createSub(RHS, V); + // -A + -B -- -(A + B) + if (Value *LHSV = dyn_castNegVal(LHS)) { +if (Value *RHSV = dyn_castNegVal(RHS)) { + Instruction *NewAdd = BinaryOperator::createAdd(LHSV, RHSV, sum); + InsertNewInstBefore(NewAdd, I); + return BinaryOperator::createNeg(NewAdd); +} + +return BinaryOperator::createSub(RHS, LHSV); + } // A + -B -- A - B if (!isaConstant(RHS)) Added: llvm/trunk/test/Transforms/InstCombine/addnegneg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/addnegneg.ll?rev=47244view=auto == --- llvm/trunk/test/Transforms/InstCombine/addnegneg.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/addnegneg.ll Sun Feb 17 15:03:36 2008 @@ -0,0 +1,12 @@ +; RUN: llvm-as %s | opt -instcombine | llvm-dis | grep { sub } | count 1 +; PR2047 + +define i32 @l(i32 %a, i32 %b, i32 %c, i32 %d) { +entry: + %b.neg = sub i32 0, %b ; i32 [#uses=1] + %c.neg = sub i32 0, %c ; i32 [#uses=1] + %sub4 = add i32 %c.neg, %b.neg ; i32 [#uses=1] + %sub6 = add i32 %sub4, %d ; i32 [#uses=1] + ret i32 %sub6 +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47241 - in /llvm/trunk: lib/Transforms/Scalar/Reassociate.cpp test/Transforms/Reassociate/subtest2.ll
Author: lattner Date: Sun Feb 17 14:51:26 2008 New Revision: 47241 URL: http://llvm.org/viewvc/llvm-project?rev=47241view=rev Log: Split up subtracts into add+negate if they have a reassociable use or operand that is also a subtract. This implements PR2047 and Transforms/Reassociate/subtest2.ll Added: llvm/trunk/test/Transforms/Reassociate/subtest2.ll Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=47241r1=47240r2=47241view=diff == --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Sun Feb 17 14:51:26 2008 @@ -399,13 +399,16 @@ return false; // Don't bother to break this up unless either the LHS is an associable add or - // if this is only used by one. - if (isReassociableOp(Sub-getOperand(0), Instruction::Add)) + // subtract or if this is only used by one. + if (isReassociableOp(Sub-getOperand(0), Instruction::Add) || + isReassociableOp(Sub-getOperand(0), Instruction::Sub)) return true; - if (isReassociableOp(Sub-getOperand(1), Instruction::Add)) + if (isReassociableOp(Sub-getOperand(1), Instruction::Add) || + isReassociableOp(Sub-getOperand(0), Instruction::Sub)) return true; - - if (Sub-hasOneUse() isReassociableOp(Sub-use_back(), Instruction::Add)) + if (Sub-hasOneUse() + (isReassociableOp(Sub-use_back(), Instruction::Add) || + isReassociableOp(Sub-use_back(), Instruction::Sub))) return true; return false; Added: llvm/trunk/test/Transforms/Reassociate/subtest2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/subtest2.ll?rev=47241view=auto == --- llvm/trunk/test/Transforms/Reassociate/subtest2.ll (added) +++ llvm/trunk/test/Transforms/Reassociate/subtest2.ll Sun Feb 17 14:51:26 2008 @@ -0,0 +1,13 @@ +; With sub reassociation, constant folding can eliminate the uses of %a. +; +; RUN: llvm-as %s | opt -reassociate -instcombine | llvm-dis | grep %a | count 1 +; PR2047 + +define i32 @test(i32 %a, i32 %b, i32 %c) nounwind { +entry: + %tmp3 = sub i32 %a, %b ; i32 [#uses=1] + %tmp5 = sub i32 %tmp3, %c ; i32 [#uses=1] + %tmp7 = sub i32 %tmp5, %a ; i32 [#uses=1] + ret i32 %tmp7 +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47250 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Author: lattner Date: Sun Feb 17 20:11:28 2008 New Revision: 47250 URL: http://llvm.org/viewvc/llvm-project?rev=47250view=rev Log: bitcasts of pointers are always pointers. If we see a memcpy of a pointer, make sure to check later uses of the pointer as well. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=47250r1=47249r2=47250view=diff == --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 20:11:28 2008 @@ -219,8 +219,6 @@ return true; break; // next use. case Instruction::BitCast: - if (!isaPointerType(I-getType())) -return true; if (AddressMightEscape(I)) return true; break; // next use @@ -231,10 +229,9 @@ case Instruction::Call: // If the call is to a few known safe intrinsics, we know that it does // not escape - if (isaMemIntrinsic(I)) -return false; - else + if (!isaMemIntrinsic(I)) return true; + break; // next use default: return true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47247 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
On Feb 17, 2008, at 1:29 PM, Owen Anderson wrote: Author: resistor Date: Sun Feb 17 15:29:08 2008 New Revision: 47247 URL: http://llvm.org/viewvc/llvm-project?rev=47247view=rev Log: Teach getModRefInfo that memcpy, memmove, and memset don't capture memory addresses. Also, noalias arguments are be considered like stack allocated ones for this purpose, because the only way they can be modref'ed is if they escape somewhere in the current function. Very nice owen. +case Instruction::Call: + // If the call is to a few known safe intrinsics, we know that it does + // not escape + if (isaMemIntrinsic(I)) +return false; + else +return true; I fixed one minor problem with this: if you have a memintrinsic, you have to check other uses. @@ -247,8 +254,11 @@ // Allocations and byval arguments are new objects. if (Object (isaAllocationInst(Object) || - (isaArgument(Object) castArgument(Object)- hasByValAttr( { - // Okay, the pointer is to a stack allocated object. If we can prove that + (isaArgument(Object) + (castArgument(Object)- hasByValAttr() || + castArgument(Object)- hasNoAliasAttr() { + // Okay, the pointer is to a stack allocated (or effectively so, for + // for noalias parameters) object. If we can prove that // the pointer never escapes, then we know the call cannot clobber it, // because it simply can't get its address. if (!AddressMightEscape(Object)) Two problems with this code: 1. This will return nomodref for a memcpy that reads or writes a non escaping alloca. I think that if AddressMightEscape returns false, you should loop over operands of the call, and see if getUnderlyingObject returns Object for any of the pointer arguments to the call. If so, the call really could mod/ref the memory. 2. This code: // If this is a tail call and P points to a stack location, we know that // the tail call cannot access or modify the local stack. if (CallInst *CI = dyn_castCallInst(CS.getInstruction())) if (CI-isTailCall() !isaMallocInst(Object)) return NoModRef; is not safe for noalias arguments, only byval and allocas. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47251 - /llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
Author: lattner Date: Sun Feb 17 20:18:25 2008 New Revision: 47251 URL: http://llvm.org/viewvc/llvm-project?rev=47251view=rev Log: simplify some code, BreakUpSubtract always returns nonnull now. Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=47251r1=47250r2=47251view=diff == --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Sun Feb 17 20:18:25 2008 @@ -779,10 +779,8 @@ // see if we can convert it to X+-Y. if (BI-getOpcode() == Instruction::Sub) { if (ShouldBreakUpSubtract(BI)) { -if (Instruction *NI = BreakUpSubtract(BI)) { - MadeChange = true; - BI = NI; -} +BI = BreakUpSubtract(BI); +MadeChange = true; } else if (BinaryOperator::isNeg(BI)) { // Otherwise, this is a negation. See if the operand is a multiply tree // and if this is not an inner node of a multiply tree. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47254 - /llvm/trunk/lib/VMCore/Function.cpp
On Feb 17, 2008, at 8:06 PM, Owen Anderson wrote: Author: resistor Date: Sun Feb 17 22:06:26 2008 New Revision: 47254 URL: http://llvm.org/viewvc/llvm-project?rev=47254view=rev Log: Duncan pointed out that we can fast fail here, because the sret parameter of a function must be the first parameter. getArgNo() is linear time, please compare against F-abegin(). -Chris Modified: llvm/trunk/lib/VMCore/Function.cpp Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=47254r1=47253r2=47254view=diff = = = = = = = = == --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Sun Feb 17 22:06:26 2008 @@ -107,7 +107,8 @@ /// it in its containing function. bool Argument::hasStructRetAttr() const { if (!isaPointerType(getType())) return false; - return getParent()-paramHasAttr(getArgNo()+1, ParamAttr::StructRet); + if (getArgNo()) return false; // StructRet param must be first param + return getParent()-paramHasAttr(1, ParamAttr::StructRet); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47257 - /llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll
Author: lattner Date: Mon Feb 18 00:11:00 2008 New Revision: 47257 URL: http://llvm.org/viewvc/llvm-project?rev=47257view=rev Log: upgrade this test. Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll?rev=47257r1=47256r2=47257view=diff == --- llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Mon Feb 18 00:11:00 2008 @@ -1,19 +1,19 @@ -; RUN: llvm-upgrade %s | llvm-as | opt -instcombine | llvm-dis | not grep {call.*stackrestore} +; RUN: llvm-as %s | opt -instcombine | llvm-dis | not grep {call.*stackrestore} ;; Test that llvm.stackrestore is removed when possible. - -int* %test1(uint %P) { -%tmp = call sbyte* %llvm.stacksave() -call void %llvm.stackrestore(sbyte* %tmp) ;; not restoring anything - %A = alloca int, uint %P -ret int* %A +define i32* @test1(i32 %P) { + %tmp = call i8* @llvm.stacksave( ) + call void @llvm.stackrestore( i8* %tmp ) ;; not restoring anything + %A = alloca i32, i32 %P + ret i32* %A } -void %test2(sbyte* %X) { - call void %llvm.stackrestore(sbyte* %X) ;; no allocas before return. +define void @test2(i8* %X) { + call void @llvm.stackrestore( i8* %X ) ;; no allocas before return. ret void } -declare sbyte* %llvm.stacksave() +declare i8* @llvm.stacksave() + +declare void @llvm.stackrestore(i8*) -declare void %llvm.stackrestore(sbyte*) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47258 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/stacksaverestore.ll
Author: lattner Date: Mon Feb 18 00:12:38 2008 New Revision: 47258 URL: http://llvm.org/viewvc/llvm-project?rev=47258view=rev Log: optimize away stackrestore calls that have no intervening alloca or call. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47258r1=47257r2=47258view=diff == --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 18 00:12:38 2008 @@ -8199,22 +8199,30 @@ } } - // If the stack restore is in a return/unwind block and if there are no - // allocas or calls between the restore and the return, nuke the restore. + // Scan down this block to see if there is another stack restore in the + // same block without an intervening call/alloca. + BasicBlock::iterator BI = II; TerminatorInst *TI = II-getParent()-getTerminator(); - if (isaReturnInst(TI) || isaUnwindInst(TI)) { -BasicBlock::iterator BI = II; -bool CannotRemove = false; -for (++BI; *BI != TI; ++BI) { - if (isaAllocaInst(BI) || - (isaCallInst(BI) !isaIntrinsicInst(BI))) { + bool CannotRemove = false; + for (++BI; *BI != TI; ++BI) { +if (isaAllocaInst(BI)) { + CannotRemove = true; + break; +} +if (isaCallInst(BI)) { + if (!isaIntrinsicInst(BI)) { CannotRemove = true; break; } -} -if (!CannotRemove) + // If there is a stackrestore below this one, remove this one. return EraseInstFromFunction(CI); +} } + + // If the stack restore is in a return/unwind block and if there are no + // allocas or calls between the restore and the return, nuke the restore. + if (!CannotRemove (isaReturnInst(TI) || isaUnwindInst(TI))) +return EraseInstFromFunction(CI); break; } } Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll?rev=47258r1=47257r2=47258view=diff == --- llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Mon Feb 18 00:12:38 2008 @@ -1,4 +1,7 @@ -; RUN: llvm-as %s | opt -instcombine | llvm-dis | not grep {call.*stackrestore} +; RUN: llvm-as %s | opt -instcombine | llvm-dis | grep {call.*stackrestore} | count 1 + +declare i8* @llvm.stacksave() +declare void @llvm.stackrestore(i8*) ;; Test that llvm.stackrestore is removed when possible. define i32* @test1(i32 %P) { @@ -13,7 +16,41 @@ ret void } -declare i8* @llvm.stacksave() +define void @foo(i32 %size) nounwind { +entry: + %tmp118124 = icmp sgt i32 %size, 0 ; i1 [#uses=1] + br i1 %tmp118124, label %bb.preheader, label %return -declare void @llvm.stackrestore(i8*) +bb.preheader: ; preds = %entry + %tmp25 = add i32 %size, -1 ; i32 [#uses=1] + %tmp125 = icmp slt i32 %size, 1 ; i1 [#uses=1] + %smax = select i1 %tmp125, i32 1, i32 %size ; i32 [#uses=1] + br label %bb + +bb:; preds = %bb, %bb.preheader + %i.0.reg2mem.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb ] ; i32 [#uses=2] + %tmp = call i8* @llvm.stacksave( ) ; i8* [#uses=1] + %tmp23 = alloca i8, i32 %size ; i8* [#uses=2] + %tmp27 = getelementptr i8* %tmp23, i32 %tmp25 ; i8* [#uses=1] + store i8 0, i8* %tmp27, align 1 + %tmp28 = call i8* @llvm.stacksave( ); i8* [#uses=1] + %tmp52 = alloca i8, i32 %size ; i8* [#uses=1] + %tmp53 = call i8* @llvm.stacksave( ); i8* [#uses=1] + %tmp77 = alloca i8, i32 %size ; i8* [#uses=1] + %tmp78 = call i8* @llvm.stacksave( ); i8* [#uses=1] + %tmp102 = alloca i8, i32 %size ; i8* [#uses=1] + call void @bar( i32 %i.0.reg2mem.0, i8* %tmp23, i8* %tmp52, i8* %tmp77, i8* %tmp102, i32 %size ) nounwind + call void @llvm.stackrestore( i8* %tmp78 ) + call void @llvm.stackrestore( i8* %tmp53 ) + call void @llvm.stackrestore( i8* %tmp28 ) + call void @llvm.stackrestore( i8* %tmp ) + %indvar.next = add i32 %i.0.reg2mem.0, 1; i32 [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %smax ; i1 [#uses=1] + br i1 %exitcond, label %return, label %bb +
Re: [llvm-commits] [llvm] r47252 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
On Feb 17, 2008, at 10:27 PM, Bill Wendling wrote: What are the bugs? Specifically, it is good to say what you're fixing in the commit log, so that it shows up in svn log. -Chris -bw On Feb 17, 2008, at 6:31 PM, Owen Anderson wrote: Author: resistor Date: Sun Feb 17 20:31:23 2008 New Revision: 47252 URL: http://llvm.org/viewvc/llvm-project?rev=47252view=rev Log: Fix bugs that Chris noticed in my last patch. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ BasicAliasAnalysis.cpp?rev=47252r1=47251r2=47252view=diff = = --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 20:31:23 2008 @@ -250,22 +250,30 @@ const Value *Object = getUnderlyingObject(P); // Allocations and byval arguments are new objects. if (Object -(isaAllocationInst(Object) || - (isaArgument(Object) - (castArgument(Object)- hasByValAttr() || - castArgument(Object)- hasNoAliasAttr() { +(isaAllocationInst(Object) || isaArgument(Object))) { // Okay, the pointer is to a stack allocated (or effectively so, for // for noalias parameters) object. If we can prove that // the pointer never escapes, then we know the call cannot clobber it, // because it simply can't get its address. - if (!AddressMightEscape(Object)) -return NoModRef; + if (isaAllocationInst(Object) || + castArgument(Object)-hasByValAttr() || + castArgument(Object)-hasNoAliasAttr()) +if (!AddressMightEscape(Object)) { + for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); + CI != CE; ++CI) +if (getUnderlyingObject(CI-get()) == P) + return AliasAnalysis::getModRefInfo(CS, P, Size); + + return NoModRef; +} // If this is a tail call and P points to a stack location, we know that // the tail call cannot access or modify the local stack. - if (CallInst *CI = dyn_castCallInst(CS.getInstruction())) -if (CI-isTailCall() !isaMallocInst(Object)) - return NoModRef; + if (isaAllocationInst(Object) || + castArgument(Object)-hasByValAttr()) +if (CallInst *CI = dyn_castCallInst(CS.getInstruction())) + if (CI-isTailCall() !isaMallocInst(Object)) +return NoModRef; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47261 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Author: lattner Date: Mon Feb 18 01:42:56 2008 New Revision: 47261 URL: http://llvm.org/viewvc/llvm-project?rev=47261view=rev Log: switch simplifycfg from using vectors for most things to smallvectors, this speeds it up 2.3% on eon. 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=47261r1=47260r2=47261view=diff == --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 18 01:42:56 2008 @@ -158,7 +158,7 @@ // If there is more than one pred of succ, and there are PHI nodes in // the successor, then we need to add incoming edges for the PHI nodes // -const std::vectorBasicBlock* BBPreds(pred_begin(BB), pred_end(BB)); +const SmallVectorBasicBlock*, 16 BBPreds(pred_begin(BB), pred_end(BB)); // Loop over all of the PHI nodes in the successor of BB. for (BasicBlock::iterator I = Succ-begin(); isaPHINode(I); ++I) { @@ -174,17 +174,15 @@ PN-addIncoming(OldValPN-getIncomingValue(i), OldValPN-getIncomingBlock(i)); } else { -for (std::vectorBasicBlock*::const_iterator PredI = BBPreds.begin(), - End = BBPreds.end(); PredI != End; ++PredI) { - // Add an incoming value for each of the new incoming values... - PN-addIncoming(OldVal, *PredI); -} +// Add an incoming value for each of the new incoming values. +for (unsigned i = 0, e = BBPreds.size(); i != e; ++i) + PN-addIncoming(OldVal, BBPreds[i]); } } } if (isaPHINode(BB-front())) { -std::vectorBasicBlock* +SmallVectorBasicBlock*, 16 OldSuccPreds(pred_begin(Succ), pred_end(Succ)); // Move all PHI nodes in BB to Succ if they are alive, otherwise @@ -464,7 +462,7 @@ static void ErasePossiblyDeadInstructionTree(Instruction *I) { if (!isInstructionTriviallyDead(I)) return; - std::vectorInstruction* InstrsToInspect; + SmallVectorInstruction*, 16 InstrsToInspect; InstrsToInspect.push_back(I); while (!InstrsToInspect.empty()) { @@ -713,7 +711,7 @@ assert(CV Not a comparison?); bool Changed = false; - std::vectorBasicBlock* Preds(pred_begin(BB), pred_end(BB)); + SmallVectorBasicBlock*, 16 Preds(pred_begin(BB), pred_end(BB)); while (!Preds.empty()) { BasicBlock *Pred = Preds.back(); Preds.pop_back(); @@ -733,7 +731,7 @@ // Based on whether the default edge from PTI goes to BB or not, fill in // PredCases and PredDefault with the new switch cases we would like to // build. - std::vectorBasicBlock* NewSuccessors; + SmallVectorBasicBlock*, 8 NewSuccessors; if (PredDefault == BB) { // If this is the default destination from PTI, only the edges in TI @@ -1233,8 +1231,8 @@ BasicBlock::iterator BBI = BB-getTerminator(); if (BBI == BB-begin() || isaPHINode(--BBI)) { // Find predecessors that end with branches. - std::vectorBasicBlock* UncondBranchPreds; - std::vectorBranchInst* CondBranchPreds; + SmallVectorBasicBlock*, 8 UncondBranchPreds; + SmallVectorBranchInst*, 8 CondBranchPreds; for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) { TerminatorInst *PTI = (*PI)-getTerminator(); if (BranchInst *BI = dyn_castBranchInst(PTI)) @@ -1357,7 +1355,7 @@ // destination with call instructions, and any unconditional branch // predecessor with an unwind. // -std::vectorBasicBlock* Preds(pred_begin(BB), pred_end(BB)); +SmallVectorBasicBlock*, 8 Preds(pred_begin(BB), pred_end(BB)); while (!Preds.empty()) { BasicBlock *Pred = Preds.back(); if (BranchInst *BI = dyn_castBranchInst(Pred-getTerminator())) { @@ -1676,7 +1674,7 @@ // If the unreachable instruction is the first in the block, take a gander // at all of the predecessors of this instruction, and simplify them. if (BB-front() == Unreachable) { - std::vectorBasicBlock* Preds(pred_begin(BB), pred_end(BB)); + SmallVectorBasicBlock*, 8 Preds(pred_begin(BB), pred_end(BB)); for (unsigned i = 0, e = Preds.size(); i != e; ++i) { TerminatorInst *TI = Preds[i]-getTerminator(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc-4.2] r47205 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
I am going to temporarily disable this if that's the case. Please take a look. Yes please do. Until ppc has support for memory.barrier, that file won't compile. The builtin was just being ignored before. I'll see about ppc support tomorrow. Please set it to expand by default (in the TargetLowering ctor). Targets that implement it can set it to legal. Expand for this intrinsic should lower it to a libgcc libcall. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-gcc-4.2] r47218 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Author: lattner Date: Sat Feb 16 14:29:46 2008 New Revision: 47218 URL: http://llvm.org/viewvc/llvm-project?rev=47218view=rev Log: Fix missing symbol error, patch by Robert G. Jakabosky, for PR1711 Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=47218r1=47217r2=47218view=diff == --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Sat Feb 16 14:29:46 2008 @@ -30,6 +30,7 @@ #include llvm/Instructions.h #include llvm/Intrinsics.h #include llvm/Module.h +#include llvm-i386-target.h extern C { #include toplev.h ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47220 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll
On Feb 16, 2008, at 12:56 PM, Duncan Sands wrote: Remove any 'nest' parameter attributes if the function is not passed as an argument to a trampoline intrinsic. Nice. Out of curiousity, how does nest do to codegen? +static const ParamAttrsList *StripNest(const ParamAttrsList *Attrs) { + if (Attrs) { +for (unsigned i = 0, e = Attrs-size(); i != e; ++i) { + uint16_t A = Attrs-getParamAttrsAtIndex(i); + if (A ParamAttr::Nest) { How about: if ((A ParamAttr::Nest) == 0) continue; To avoid indentation in the loop. Alternatively, maybe ParamAttrsList should have a 'find attribute' function that returns the first argument that has the specified attribute? +static void RemoveNestAttribute(Function *F) { + F-setParamAttrs(StripNest(F-getParamAttrs())); + for (Value::use_iterator UI = F-use_begin(), E = F-use_end(); UI != E;++UI){ +Instruction *User = castInstruction(*UI); +if (CallInst *CI = dyn_castCallInst(User)) { Please use CallSite to handle CallInst/Invoke uniformly. Thanks Duncan! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47228 - /llvm/trunk/test/Assembler/ConstantExprFold.llx
Author: lattner Date: Sat Feb 16 18:09:08 2008 New Revision: 47228 URL: http://llvm.org/viewvc/llvm-project?rev=47228view=rev Log: this line was commented out. Modified: llvm/trunk/test/Assembler/ConstantExprFold.llx Modified: llvm/trunk/test/Assembler/ConstantExprFold.llx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/ConstantExprFold.llx?rev=47228r1=47227r2=47228view=diff == --- llvm/trunk/test/Assembler/ConstantExprFold.llx (original) +++ llvm/trunk/test/Assembler/ConstantExprFold.llx Sat Feb 16 18:09:08 2008 @@ -22,5 +22,5 @@ global i1 icmp slt (i64* @A, i64* getelementptr (i64* @A, i64 0)); false global i1 icmp slt (i32* getelementptr (%Ty* @B, i64 0, i32 0), i32* getelementptr (%Ty* @B, i64 0, i32 1)); true -global i1 icmp ne (i64* @A, i64* bitcast (%Ty* @B to i64*)) ; true +;global i1 icmp ne (i64* @A, i64* bitcast (%Ty* @B to i64*)) ; true ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47229 - /llvm/trunk/test/Assembler/2004-12-05-LocalGlobalSymtabConflict.ll
Author: lattner Date: Sat Feb 16 18:12:03 2008 New Revision: 47229 URL: http://llvm.org/viewvc/llvm-project?rev=47229view=rev Log: this test isn't useful since we added @ notation for globals. Removed: llvm/trunk/test/Assembler/2004-12-05-LocalGlobalSymtabConflict.ll Removed: llvm/trunk/test/Assembler/2004-12-05-LocalGlobalSymtabConflict.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2004-12-05-LocalGlobalSymtabConflict.ll?rev=47228view=auto == --- llvm/trunk/test/Assembler/2004-12-05-LocalGlobalSymtabConflict.ll (original) +++ llvm/trunk/test/Assembler/2004-12-05-LocalGlobalSymtabConflict.ll (removed) @@ -1,21 +0,0 @@ -; RUN: llvm-as %s | opt -inline | llvm-dis | \ -; RUN: not grep {%G = alloca int} - -; In this testcase, %bar stores to the global G. Make sure that inlining does -; not cause it to store to the G in main instead. [EMAIL PROTECTED] = global i32 7 ; i32* [#uses=1] - -define i32 @main() { -%G = alloca i32 ; i32* [#uses=2] -store i32 0, i32* %G -call void @bar( ) -%RV = load i32* %G ; i32 [#uses=1] -ret i32 %RV -} - -define internal void @bar() { -store i32 123, i32* @G -ret void -} - - ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47232 - /llvm/trunk/test/Bitcode/2006-12-11-Cast-ConstExpr.ll
Author: lattner Date: Sat Feb 16 18:15:25 2008 New Revision: 47232 URL: http://llvm.org/viewvc/llvm-project?rev=47232view=rev Log: fix this test. Modified: llvm/trunk/test/Bitcode/2006-12-11-Cast-ConstExpr.ll Modified: llvm/trunk/test/Bitcode/2006-12-11-Cast-ConstExpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/2006-12-11-Cast-ConstExpr.ll?rev=47232r1=47231r2=47232view=diff == --- llvm/trunk/test/Bitcode/2006-12-11-Cast-ConstExpr.ll (original) +++ llvm/trunk/test/Bitcode/2006-12-11-Cast-ConstExpr.ll Sat Feb 16 18:15:25 2008 @@ -6,5 +6,5 @@ @G = external global i32 define float @tryit(i32 %A) { - ret float sitofp( i32 ptrtoint (i32* @G to i32) to float) + ret float bitcast( i32 ptrtoint (i32* @G to i32) to float) } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47162 - in /llvm/trunk/lib/Target: PowerPC/PPCSubtarget.cpp X86/X86Subtarget.cpp
On Feb 15, 2008, at 10:09 AM, Dale Johannesen wrote: Author: johannes Date: Fri Feb 15 12:09:51 2008 New Revision: 47162 URL: http://llvm.org/viewvc/llvm-project?rev=47162view=rev Log: Remove warning about 64-bit code on processor that doesn't support it. Per Chris. Thanks Dale! How about changing: if (is64Bit) { if (!has64BitSupport()) { Has64BitSupport = true; } ... to: if (is64Bit) { Has64BitSupport = true; ... -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47169 - /llvm/trunk/lib/VMCore/Mangler.cpp
Author: lattner Date: Fri Feb 15 12:54:56 2008 New Revision: 47169 URL: http://llvm.org/viewvc/llvm-project?rev=47169view=rev Log: targets that support quotes for mangled names still need to escape newlines when they occur in the name, just like is escaped. Modified: llvm/trunk/lib/VMCore/Mangler.cpp Modified: llvm/trunk/lib/VMCore/Mangler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=47169r1=47168r2=47169view=diff == --- llvm/trunk/lib/VMCore/Mangler.cpp (original) +++ llvm/trunk/lib/VMCore/Mangler.cpp Fri Feb 15 12:54:56 2008 @@ -96,6 +96,8 @@ for (std::string::const_iterator E = X.end(); I != E; ++I) { if (*I == '') Result += _QQ_; + else if (*I == '\n') +Result += _NL_; else Result += *I; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm-www/releases/download.html
On Feb 15, 2008, at 10:46 AM, Duncan Sands wrote: Thanks Chris! Can you please also update the 2.2 release notes, and where it says (about Ada and Fortran) they need to be built from source, make that a link to GCCFEBuildIntrs. We typically don't change the 2.2 release notes after it ships. Do you mean the mainline release notes in llvm/docs? No, I meant the 2.2 ones, because it is not easy to find your way to GCCFEBuildIntrs from those release notes, that tell you to build from source... ok done -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47171 - in /llvm/trunk/lib/Target: ARM/ARMAsmPrinter.cpp PowerPC/PPCAsmPrinter.cpp X86/X86AsmPrinter.cpp
Author: lattner Date: Fri Feb 15 13:04:54 2008 New Revision: 47171 URL: http://llvm.org/viewvc/llvm-project?rev=47171view=rev Log: Handle \n's in value names for more targets. The asm printers really really really need refactoring :( Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=47171r1=47170r2=47171view=diff == --- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Fri Feb 15 13:04:54 2008 @@ -807,6 +807,15 @@ return Result; } +/// PrintUnmangledNameSafely - Print out the printable characters in the name. +/// Don't print things like \n or \0. +static void PrintUnmangledNameSafely(const Value *V, std::ostream OS) { + for (const char *Name = V-getNameStart(), *E = Name+V-getNameLen(); + Name != E; ++Name) +if (isprint(*Name)) + OS *Name; +} + bool ARMAsmPrinter::doFinalization(Module M) { const TargetData *TD = TM.getTargetData(); @@ -875,7 +884,9 @@ if (TAI-getCOMMDirectiveTakesAlignment()) O , (TAI-getAlignmentIsInBytes() ? (1 Align) : Align); } -O \t\t TAI-getCommentString() I-getName() \n; +O \t\t TAI-getCommentString() ; +PrintUnmangledNameSafely(I, O); +O \n; continue; } } @@ -961,8 +972,9 @@ } EmitAlignment(Align, I); -O name :\t\t\t\t TAI-getCommentString() I-getName() - \n; +O name :\t\t\t\t TAI-getCommentString() ; +PrintUnmangledNameSafely(I, O); +O \n; if (TAI-hasDotTypeDotSizeDirective()) O \t.size name , Size \n; // If the initializer is a extern weak symbol, remember to emit the weak Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=47171r1=47170r2=47171view=diff == --- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri Feb 15 13:04:54 2008 @@ -639,6 +639,15 @@ return Result; } +/// PrintUnmangledNameSafely - Print out the printable characters in the name. +/// Don't print things like \n or \0. +static void PrintUnmangledNameSafely(const Value *V, std::ostream OS) { + for (const char *Name = V-getNameStart(), *E = Name+V-getNameLen(); + Name != E; ++Name) +if (isprint(*Name)) + OS *Name; +} + bool LinuxAsmPrinter::doFinalization(Module M) { const TargetData *TD = TM.getTargetData(); @@ -680,7 +689,9 @@ SwitchToDataSection(\t.data, I); O .comm name , Size; } - O \t\t TAI-getCommentString() ' I-getName() '\n; + O \t\t TAI-getCommentString() '; + PrintUnmangledNameSafely(I, O); + O '\n; } else { switch (I-getLinkage()) { case GlobalValue::LinkOnceLinkage: @@ -727,8 +738,9 @@ } EmitAlignment(Align, I); - O name :\t\t\t\t TAI-getCommentString() ' - I-getName() '\n; + O name :\t\t\t\t TAI-getCommentString() '; + PrintUnmangledNameSafely(I, O); + O '\n; // If the initializer is a extern weak symbol, remember to emit the weak // reference! @@ -942,7 +954,9 @@ if (Subtarget.isDarwin9()) O , Align; } - O \t\t TAI-getCommentString() ' I-getName() '\n; + O \t\t TAI-getCommentString() '; + PrintUnmangledNameSafely(I, O); + O '\n; } else { switch (I-getLinkage()) { case GlobalValue::LinkOnceLinkage: @@ -999,8 +1013,9 @@ } EmitAlignment(Align, I); - O name :\t\t\t\t TAI-getCommentString() ' - I-getName() '\n; + O name :\t\t\t\t TAI-getCommentString() '; + PrintUnmangledNameSafely(I, O); + O '\n; // If the initializer is a extern weak symbol, remember to emit the weak // reference! Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=47171r1=47170r2=47171view=diff == --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Fri Feb 15 13:04:54 2008 @@ -138,9 +138,9 @@ return Result; } -/// PrintUnamedNameSafely - Print out the printable characters in the name. +/// PrintUnmangledNameSafely - Print out the printable characters in the name. /// Don't print things like \n or \0. -static void PrintUnamedNameSafely(const Value *V, std::ostream
Re: [llvm-commits] CVS: llvm-www/releases/download.html
On Feb 14, 2008, at 11:42 PM, Duncan Sands wrote: update the one reference to CFEBuildInstrs.html that I see. Thanks Chris! Can you please also update the 2.2 release notes, and where it says (about Ada and Fortran) they need to be built from source, make that a link to GCCFEBuildIntrs. We typically don't change the 2.2 release notes after it ships. Do you mean the mainline release notes in llvm/docs? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r46827 - memoperands #1
This, and the question of whether to make LSBaseNode store a MemOperand instead of separate fields, are related. Ok, right. What is your opinion on this? Is there any reason not to give MemOperand a VT and then give LSBaseNode a MemOperand? There's a little redundancy; the MemOperand has flags to distinguish between load and store, and LSBaseNode has its opcode which is either LOAD or STORE. But that's not a big problem. True, I don't think that an extra flag of redundancy is a big deal here. Code simplicity is worth it :) Good question. This sort of thing is currently rare enough that it is probably fine to just use a null Value*, and have everything treat it conservatively. Would this be acceptable for now? Yes, using a null Value* is done in many places right now that don't yet provide a proper SourceValue. Ok, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47167 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib
On Feb 15, 2008, at 10:24 AM, Evan Cheng wrote: Author: evancheng Date: Fri Feb 15 12:24:29 2008 New Revision: 47167 URL: http://llvm.org/viewvc/llvm-project?rev=47167view=rev Log: - Removing the infamous r2rMap_ and rep() method. Now the coalescer will update register defs and uses after each successful coalescing. - Also removed a number of hacks and fixed some subtle kill information bugs. Very nice! Is there any compile-time impact of this? Does it speed up coallescing/RA at all? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc-4.2] r47077 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
On Feb 15, 2008, at 11:41 AM, Dale Johannesen wrote: I think this makes isPaddingElement and a bunch of code in llvm- types.cpp dead. Yes, thought I'd see how this patch went first:) Heh ok :) Looks like you were right :) Doesn't this also cause us to regress on PR1278? If that's what you want to call it. Personally I think padding should be deterministic whenever possible, even though the standards don't require it; you get fewer Interesting bugs that way. Ok, but this still doesn't get us that, and I don't see how we reasonably could ever get it in general: struct mystruct x; x.f = 1; x.g = 2; leaves any padding uninitialized. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47170 - /llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
Author: lattner Date: Fri Feb 15 12:56:05 2008 New Revision: 47170 URL: http://llvm.org/viewvc/llvm-project?rev=47170view=rev Log: If the llvm name contains an unprintable character, don't print it in the global comment. This prevents printing things like: .. # foo bar when the name is foo\nbar. Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=47170r1=47169r2=47170view=diff == --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Fri Feb 15 12:56:05 2008 @@ -138,6 +138,15 @@ return Result; } +/// PrintUnamedNameSafely - Print out the printable characters in the name. +/// Don't print things like \n or \0. +static void PrintUnamedNameSafely(const Value *V, std::ostream OS) { + for (const char *Name = V-getNameStart(), *E = Name+V-getNameLen(); + Name != E; ++Name) +if (isprint(*Name)) + OS *Name; +} + bool X86SharedAsmPrinter::doFinalization(Module M) { // Note: this code is not shared by the Intel printer as it is too different // from how MASM does things. When making changes here don't forget to look @@ -218,7 +227,9 @@ if (TAI-getCOMMDirectiveTakesAlignment()) O , (TAI-getAlignmentIsInBytes() ? (1 Align) : Align); } -O \t\t TAI-getCommentString() I-getName() \n; +O \t\t TAI-getCommentString() ; +PrintUnamedNameSafely(I, O); +O \n; continue; } } @@ -319,8 +330,9 @@ } EmitAlignment(Align, I); -O name :\t\t\t\t TAI-getCommentString() I-getName() - \n; +O name :\t\t\t\t TAI-getCommentString() ; +PrintUnamedNameSafely(I, O); +O \n; if (TAI-hasDotTypeDotSizeDirective()) O \t.size\t name , Size \n; // If the initializer is a extern weak symbol, remember to emit the weak ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47167 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib
Excellent! -Chris On Feb 15, 2008, at 11:48 AM, Evan Cheng wrote: It sped up the coalescer considerably. On kimwitu++: before: 0.7527 ( 12.8%) 0.0068 ( 2.7%) 0.7596 ( 12.4%) 0.7591 ( 12.4%) Simple Register Coalescing now: 0.3062 ( 5.6%) 0.0055 ( 2.2%) 0.3117 ( 5.5%) 0.3115 ( 5.5%) Simple Register Coalescing Evan On Feb 15, 2008, at 11:19 AM, Chris Lattner wrote: On Feb 15, 2008, at 10:24 AM, Evan Cheng wrote: Author: evancheng Date: Fri Feb 15 12:24:29 2008 New Revision: 47167 URL: http://llvm.org/viewvc/llvm-project?rev=47167view=rev Log: - Removing the infamous r2rMap_ and rep() method. Now the coalescer will update register defs and uses after each successful coalescing. - Also removed a number of hacks and fixed some subtle kill information bugs. Very nice! Is there any compile-time impact of this? Does it speed up coallescing/RA at all? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/releases/2.2/docs/ReleaseNotes.html
Changes in directory llvm-www/releases/2.2/docs: ReleaseNotes.html updated: 1.2 - 1.3 --- Log message: link to the instructions for building fortran and ada. --- Diffs of the changes: (+4 -3) ReleaseNotes.html |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/releases/2.2/docs/ReleaseNotes.html diff -u llvm-www/releases/2.2/docs/ReleaseNotes.html:1.2 llvm-www/releases/2.2/docs/ReleaseNotes.html:1.3 --- llvm-www/releases/2.2/docs/ReleaseNotes.html:1.2Tue Feb 12 01:02:12 2008 +++ llvm-www/releases/2.2/docs/ReleaseNotes.htmlFri Feb 15 13:06:44 2008 @@ -135,8 +135,9 @@ liAnton and Duncan significantly improved llvm-gcc 4.2 support for the GCC Ada (GNAT) and Fortran (gfortran) front-ends. These front-ends should still be considered experimental however: see the a href=#knownproblemslist of known problems/a. -The release binaries do not contain either front-end: they need to be built from -source (the Ada front-end only builds on x86-32 linux)./li +The release binaries do not contain either front-end: they need to be a +href=http://llvm.org/docs/GCCFEBuildInstrs.html;built from +source/a (the Ada front-end only builds on x86-32 linux)./li liDale contributed full support for long double on x86/x86-64 (where it is 80 bits) and on Darwin PPC/PPC64 (where it is 128 bits). In previous LLVM @@ -755,7 +756,7 @@ src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a a href=http://llvm.org/;LLVM Compiler Infrastructure/abr - Last modified: $Date: 2008/02/12 07:02:12 $ + Last modified: $Date: 2008/02/15 19:06:44 $ /address /body ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc-4.2] r47077 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
On Feb 13, 2008, at 10:36 AM, Dale Johannesen wrote: Author: johannes Date: Wed Feb 13 12:36:09 2008 New Revision: 47077 URL: http://llvm.org/viewvc/llvm-project?rev=47077view=rev Log: Don't omit copying of PaddingElements; this causes wrong code when structs are identical except that one has padding in the same place another has a real field. Look at the right node when looking for MODIFY under RET. I think this makes isPaddingElement and a bunch of code in llvm- types.cpp dead. Doesn't this also cause us to regress on PR1278? I'm fine with temporarily saying we'll take a code pessimization for improved correctness but we need to address this somehow, perhaps by filing another bug. -Chris Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=47077r1=47076r2=47077view=diff = = = = = = = = == --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Feb 13 12:36:09 2008 @@ -1246,8 +1246,6 @@ const StructLayout *SL = getTargetData().getStructLayout(STy); Constant *Zero = ConstantInt::get(Type::Int32Ty, 0); for (unsigned i = 0, e = STy-getNumElements(); i != e; ++i) { - if (isPaddingElement(STy, i)) -continue; Constant *Idx = ConstantInt::get(Type::Int32Ty, i); Value *Idxs[2] = { Zero, Idx }; Value *DElPtr = Builder.CreateGEP(DestLoc.Ptr, Idxs, Idxs + 2, tmp); @@ -1721,7 +1719,8 @@ // operand is an aggregate value, create a temporary to evaluate it into. MemRef DestLoc; const Type *DestTy = ConvertType(TREE_TYPE(TREE_OPERAND(exp, 0))); -if (!DestTy-isFirstClassType() TREE_CODE(exp) != MODIFY_EXPR) +if (!DestTy-isFirstClassType() +TREE_CODE(TREE_OPERAND(exp, 0)) != MODIFY_EXPR) DestLoc = CreateTempLoc(DestTy); Emit(TREE_OPERAND(exp, 0), DestLoc.Ptr ? DestLoc : NULL); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47187 - /llvm/trunk/docs/ProgrammersManual.html
Author: lattner Date: Fri Feb 15 16:57:17 2008 New Revision: 47187 URL: http://llvm.org/viewvc/llvm-project?rev=47187view=rev Log: simplify this. Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=47187r1=47186r2=47187view=diff == --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Fri Feb 15 16:57:17 2008 @@ -1914,9 +1914,7 @@ div class=doc_code pre a href=#InstructionInstruction/a *I = .. ; -a href=#BasicBlockBasicBlock/a *BB = I-gt;getParent(); - -BB-gt;getInstList().erase(I); +I-gt;eraseFromParent(); /pre /div ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47039 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Ta
On Feb 13, 2008, at 3:25 PM, Dan Gohman wrote: ComputeMaskedBits(Op.getOperand(0), InDemandedMask, KnownZero, KnownOne, Depth+1); assert((KnownZero KnownOne) == 0 Bits known to be one AND zero?); + KnownZero = KnownZero.lshr(ShAmt); + KnownOne = KnownOne.lshr(ShAmt); // Handle the sign bits. + APInt SignBit = APInt::getSignBit(BitWidth); + SignBit = SignBit.lshr(ShAmt); // Adjust to where it is now in the mask. It would be better to make an APInt with the bit in the right place instead of starting with a sign bit and shifting it. I don't see a way to do this in a single step with the current APInt API. And this doesn't seem common enough to want a specialized API call. One way to do it would be: APInt SignBit(BitWidth, 0); SignBit.set(position); It's not significantly less code, but it is more efficient :) MVT::ValueType InVT = Op.getOperand(0).getValueType(); +unsigned InBits = MVT::getSizeInBits(InVT); +APInt InMask= APInt::getLowBitsSet(BitWidth, InBits); +APInt InSignBit = APInt::getSignBit(InBits); +APInt NewBits = (~InMask) Mask; // If any of the sign extended bits are demanded, we know that the sign // bit is demanded. +InSignBit.zext(BitWidth); +if (!!(NewBits Mask)) + Mask |= InSignBit; I think this is a bug: NewBits is defined to be ... Mask. This is either a bug or this can be replaced with NewBits != 0 which doesn't seem right. It's actually right, though the code is more involved than it needs to be. I simplified this. Thanks! Incidentally, I think that this method: SDOperand SelectionDAG::getConstant(const APInt Val, MVT::ValueType VT, bool isTarget = false); Can be simplified to: SDOperand SelectionDAG::getConstant(const APInt Val, bool isTarget = false); And have it infer the MVT from the width of the APInt. We can add a new (explicit) method to handle the vector case. In the interest of keeping client code simpler, I'd prefer to avoid having a separate vector version. ok, well, the client code would be even simpler if we had two versions: one that takes an apint, and one that takes an apint + MVT. The first could forward to the second, and be used in cases where the client knows it is only dealing with scalars, which is quite often. More generally though: how many places call SelectionDAG::getConstant with a potentially vector constant? It seems a bit strange to me to have this, because the client would have to be aware that it is doing this and explicitly want it. It seems like a getVectorConstant would be more natural (and easier for the reader to understand), causing these cases to be explicitly separated. What do you think? Thanks Dan! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc-4.2] r47180 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h llvm-types.cpp
On Feb 15, 2008, at 2:02 PM, Dale Johannesen wrote: Author: johannes Date: Fri Feb 15 16:02:22 2008 New Revision: 47180 URL: http://llvm.org/viewvc/llvm-project?rev=47180view=rev Log: Put back fixed version of code to avoid copying padding within structs (sometimes). Nice, thanks Dale! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47188 - in /llvm/trunk: include/llvm/ADT/StringExtras.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp utils/TableGen/CodeGenDAGPatterns.cpp utils/TableGen/DAGISelEmitter.cpp
On Feb 15, 2008, at 3:05 PM, Scott Michel wrote: Author: pingbak Date: Fri Feb 15 17:05:48 2008 New Revision: 47188 URL: http://llvm.org/viewvc/llvm-project?rev=47188view=rev Log: Make tblgen a little smarter about constants smaller than i32. Currently, tblgen will complain if a sign-extended constant does not fit into a data type smaller than i32, e.g., i16. This causes a problem when certain hex constants are used, such as 0xff for byte masks or immediate xor values. Looks good, thanks Scott. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47192 - in /llvm/trunk/test/Assembler: 2004-03-07-FunctionAddressAlignment.ll 2004-03-07-FunctionAddressAlignment.llx
Author: lattner Date: Fri Feb 15 17:51:48 2008 New Revision: 47192 URL: http://llvm.org/viewvc/llvm-project?rev=47192view=rev Log: rename llx - ll Added: llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll - copied unchanged from r47064, llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.llx Removed: llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.llx Removed: llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.llx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.llx?rev=47191view=auto == --- llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.llx (original) +++ llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.llx (removed) @@ -1,15 +0,0 @@ -; RUN: llvm-upgrade %s | llvm-as | llvm-dis | not grep cast -; All of these should be eliminable - - -int %foo() { - ret int and (int cast (int()* %foo to int), int 1) -} - -int %foo2() { - ret int and (int 1, int cast (int()* %foo2 to int)) -} - -bool %foo3() { - ret bool cast (bool()* %foo3 to bool) -} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47194 - /llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll
Author: lattner Date: Fri Feb 15 17:58:25 2008 New Revision: 47194 URL: http://llvm.org/viewvc/llvm-project?rev=47194view=rev Log: upgrade this test, which wasn't testing the right thing since llvm-upgrade came around. Modified: llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll Modified: llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll?rev=47194r1=47193r2=47194view=diff == --- llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll (original) +++ llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll Fri Feb 15 17:58:25 2008 @@ -1,15 +1,15 @@ -; RUN: llvm-upgrade %s | llvm-as | llvm-dis | not grep cast +; RUN: llvm-as %s | llvm-dis | not grep ptrtoint ; All of these should be eliminable -int %foo() { - ret int and (int cast (int()* %foo to int), int 1) +define i32 @foo() { + ret i32 and (i32 ptrtoint (i32()* @foo to i32), i32 1) } -int %foo2() { - ret int and (int 1, int cast (int()* %foo2 to int)) +define i32 @foo2() { + ret i32 and (i32 1, i32 ptrtoint (i32()* @foo2 to i32)) } -bool %foo3() { - ret bool cast (bool()* %foo3 to bool) +define i1 @foo3() { + ret i1 icmp ne (i1()* @foo3, i1()* null) } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc-4.2] r47205 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
nice! On Feb 15, 2008, at 5:27 PM, Andrew Lenharth wrote: Author: alenhar2 Date: Fri Feb 15 19:27:28 2008 New Revision: 47205 URL: http://llvm.org/viewvc/llvm-project?rev=47205view=rev Log: llvm.memory.barrier for __sync_syncronize Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=47205r1=47204r2=47205view=diff = = = = = = = = == --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Feb 15 19:27:28 2008 @@ -4293,6 +4293,18 @@ return true; } + case BUILT_IN_SYNCHRONIZE: { +// We assume like gcc appears to, that this only applies to cached memory. +Value* C[5]; +C[0] = C[1] = C[2] = C[3] = ConstantInt::get(Type::Int1Ty, 1); +C[4] = ConstantInt::get(Type::Int1Ty, 0); + +Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::memory_barrier), + C, C + 5); +return true; + } + #if 1 // FIXME: Should handle these GCC extensions eventually. case BUILT_IN_APPLY_ARGS: case BUILT_IN_APPLY: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/releases/download.html
Changes in directory llvm-www/releases: download.html updated: 1.49 - 1.50 --- Log message: update the one reference to CFEBuildInstrs.html that I see. --- Diffs of the changes: (+2 -2) download.html |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/releases/download.html diff -u llvm-www/releases/download.html:1.49 llvm-www/releases/download.html:1.50 --- llvm-www/releases/download.html:1.49Tue Feb 12 01:01:14 2008 +++ llvm-www/releases/download.html Thu Feb 14 12:58:19 2008 @@ -25,8 +25,8 @@ pNote that if you intend to build the LLVM GCC front-end from source, you must -follow the instructions in the a href=/docs/CFEBuildInstrs.htmlhow to -build the C front-end/a document./p +follow the instructions in the a href=/docs/GCCFEBuildInstrs.htmlhow to +build the llvm-gcc front-end/a document./p /div table class=rel_section ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47128 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/X86/2008-02-14-BitMiscompile.ll
Author: lattner Date: Thu Feb 14 12:48:56 2008 New Revision: 47128 URL: http://llvm.org/viewvc/llvm-project?rev=47128view=rev Log: Fix a miscompilation from Dan's recent apintification. Added: llvm/trunk/test/CodeGen/X86/2008-02-14-BitMiscompile.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=47128r1=47127r2=47128view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 14 12:48:56 2008 @@ -1437,12 +1437,10 @@ // We know that the top bits of C-X are clear if X contains less bits // than C (i.e. no wrap-around can happen). For example, 20-X is // positive if we can prove that X is = 0 and 16. - -// sign bit clear if (CLHS-getAPIntValue().isNonNegative()) { unsigned NLZ = (CLHS-getAPIntValue()+1).countLeadingZeros(); // NLZ can't be BitWidth with no sign bit - APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ); + APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ+1); ComputeMaskedBits(Op.getOperand(1), MaskV, KnownZero, KnownOne, Depth+1); // If all of the MaskV bits are known to be zero, then we know the output Added: llvm/trunk/test/CodeGen/X86/2008-02-14-BitMiscompile.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-02-14-BitMiscompile.ll?rev=47128view=auto == --- llvm/trunk/test/CodeGen/X86/2008-02-14-BitMiscompile.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-02-14-BitMiscompile.ll Thu Feb 14 12:48:56 2008 @@ -0,0 +1,8 @@ +; RUN: llvm-as %s | llc -march=x86 | grep and +define i32 @test(i1 %A) { + %B = zext i1 %A to i32 ; i32 [#uses=1] + %C = sub i32 0, %B ; i32 [#uses=1] + %D = and i32 %C, 255; i32 [#uses=1] + ret i32 %D +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47129 - in /llvm/trunk: lib/Transforms/Utils/LowerInvoke.cpp test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll
Author: lattner Date: Thu Feb 14 13:18:13 2008 New Revision: 47129 URL: http://llvm.org/viewvc/llvm-project?rev=47129view=rev Log: Fix PR2029 Added: llvm/trunk/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=47129r1=47128r2=47129view=diff == --- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Thu Feb 14 13:18:13 2008 @@ -256,6 +256,17 @@ SwitchInst *CatchSwitch) { ConstantInt *InvokeNoC = ConstantInt::get(Type::Int32Ty, InvokeNo); + // If the unwind edge has phi nodes, split the edge. + if (isaPHINode(II-getUnwindDest()-begin())) { +SplitCriticalEdge(II, 1, this); + +// If there are any phi nodes left, they must have a single predecessor. +while (PHINode *PN = dyn_castPHINode(II-getUnwindDest()-begin())) { + PN-replaceAllUsesWith(PN-getIncomingValue(0)); + PN-eraseFromParent(); +} + } + // Insert a store of the invoke num before the invoke and store zero into the // location afterward. new StoreInst(InvokeNoC, InvokeNum, true, II); // volatile Added: llvm/trunk/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll?rev=47129view=auto == --- llvm/trunk/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll (added) +++ llvm/trunk/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll Thu Feb 14 13:18:13 2008 @@ -0,0 +1,14 @@ +; RUN: llvm-as %s | opt -lowerinvoke -enable-correct-eh-support -disable-output +; PR2029 +define i32 @main(i32 %argc, i8** %argv) { +bb470: +invoke i32 @main(i32 0, i8** null) to label %invcont474 unwind label +%lpad902 + +invcont474: ; preds = %bb470 +ret i32 0 + +lpad902:; preds = %bb470 +%tmp471.lcssa = phi i8* [ null, %bb470 ]; i8* +ret i32 0 +} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47148 - /llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
Author: lattner Date: Thu Feb 14 18:57:28 2008 New Revision: 47148 URL: http://llvm.org/viewvc/llvm-project?rev=47148view=rev Log: Support vector constant zeros, thanks to Zack Rusin for the testcase. Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=47148r1=47147r2=47148view=diff == --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Thu Feb 14 18:57:28 2008 @@ -799,13 +799,13 @@ for (unsigned i = 0, e = CP-getNumOperands(); i != e; ++i) InitializeMemory(CP-getOperand(i), (char*)Addr+i*ElementSize); return; + } else if (isaConstantAggregateZero(Init)) { +memset(Addr, 0, (size_t)getTargetData()-getABITypeSize(Init-getType())); +return; } else if (Init-getType()-isFirstClassType()) { GenericValue Val = getConstantValue(Init); StoreValueToMemory(Val, (GenericValue*)Addr, Init-getType()); return; - } else if (isaConstantAggregateZero(Init)) { -memset(Addr, 0, (size_t)getTargetData()-getABITypeSize(Init-getType())); -return; } switch (Init-getType()-getTypeID()) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47143 - in /llvm/trunk: lib/Target/CellSPU/SPUSubtarget.h lib/Target/PowerPC/PPCAsmPrinter.cpp lib/Target/PowerPC/PPCSubtarget.cpp lib/Target/PowerPC/PPCSubtarget.h utils/Ta
On Feb 14, 2008, at 5:23 PM, Dale Johannesen wrote: n Feb 14, 2008, at 3:40 PM, Evan Cheng wrote: Thanks. Since you are hacking on this, can you check something for me? I seem to be getting this annoying warning (something like generating 64-bit code for 32-bit cpu) when I do (for example) -march=x86-64 - mattr=-sse41. Any idea what's causing this bogus warning? Is it when - mattr is used, it does not do auto CPU feature detection? Evan It's simpler than that, the core2 table entry didn't say it has 64- bit support. Fixed. This warning (PPC has it too) also comes out for cross compiles, which I suppose is accurate, but doesn't seem helpful. Anybody for getting rid of it? Please kill it, the code generator shouldn't print to stderr unless aborting. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47121 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/PowerPC/ lib/Target/Sparc/
On Feb 14, 2008, at 3:30 PM, Evan Cheng wrote: This is not a new issue. But I am wondering if this may be a compile time issue if the number of legal FP immediate is sufficiently large? Should we build a hash table for it instead? If a target had a huge number of legal fp immediates, it could use custom lowering instead of 'expand'. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47007 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll
On Feb 13, 2008, at 3:51 AM, Wojciech Matyjewicz wrote: Chris Lattner wrote: Very nice, please add a comment above the code explaining what is going on though :) Done. Very nice, thanks! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47043 - in /llvm/trunk/lib: CodeGen/TargetInstrInfoImpl.cpp Target/PowerPC/PPCInstrInfo.cpp Target/X86/X86InstrInfo.cpp
Bonus points for making tblgen reject instructions marked commutable that don't start with three register operands. That's too restrictive. It's entirely legal for target instruction that don't start with 3 register operands to be commutable. That's why we allow target specific code to commute certain instructions. Ah right, good point! -chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47045 - /llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
I don't know about darwin, but this breaks linux/ppc32 JIT (llc works fine). On a simple test case: define i32 @main(i32 %argc) { entry: %tmp2 = add i32 2, %argc ret i32 %tmp2 } Yep, this was broken on darwin as well. I just committed a fix which makes it work for me, please verify. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47066 - /llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp
Author: lattner Date: Wed Feb 13 11:18:26 2008 New Revision: 47066 URL: http://llvm.org/viewvc/llvm-project?rev=47066view=rev Log: remove some dead code. Modified: llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp Modified: llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp?rev=47066r1=47065r2=47066view=diff == --- llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp Wed Feb 13 11:18:26 2008 @@ -87,10 +87,6 @@ } else if (GV-hasInternalLinkage()) {// Yup, this is a duplicate! // Make all uses of the duplicate constant use the canonical version. Replacements.push_back(std::make_pair(GV, Slot)); -} else if (GV-hasInternalLinkage()) { - // Make all uses of the duplicate constant use the canonical version. - Replacements.push_back(std::make_pair(Slot, GV)); - Slot = GV; } } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47067 - /llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
Author: lattner Date: Wed Feb 13 11:24:14 2008 New Revision: 47067 URL: http://llvm.org/viewvc/llvm-project?rev=47067view=rev Log: Fix the PPC JIT regressions by encoding zeroreg as 0 for BLR. Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=47067r1=47066r2=47067view=diff == --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Wed Feb 13 11:24:14 2008 @@ -46,6 +46,7 @@ unsigned PPCRegisterInfo::getRegisterNumbering(unsigned RegEnum) { using namespace PPC; switch (RegEnum) { + case 0: return 0; case R0 : case X0 : case F0 : case V0 : case CR0: return 0; case R1 : case X1 : case F1 : case V1 : case CR1: return 1; case R2 : case X2 : case F2 : case V2 : case CR2: return 2; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47073 - /llvm/trunk/docs/GettingStarted.html
Author: lattner Date: Wed Feb 13 11:50:24 2008 New Revision: 47073 URL: http://llvm.org/viewvc/llvm-project?rev=47073view=rev Log: gcc 3.2.3 is also bad. Modified: llvm/trunk/docs/GettingStarted.html Modified: llvm/trunk/docs/GettingStarted.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStarted.html?rev=47073r1=47072r2=47073view=diff == --- llvm/trunk/docs/GettingStarted.html (original) +++ llvm/trunk/docs/GettingStarted.html Wed Feb 13 11:50:24 2008 @@ -510,7 +510,8 @@ problems in the STL that effectively prevent it from compiling LLVM. /p -pbGCC 3.2.2/b: This version of GCC fails to compile LLVM./p +pbGCC 3.2.2 and 3.2.3/b: These versions of GCC fails to compile LLVM with +a bogus template error. This was fixed in later GCCs./p pbGCC 3.3.2/b: This version of GCC suffered from a a href=http://gcc.gnu.org/PR13392;serious bug/a which causes it to crash in ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47046 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h
On Feb 13, 2008, at 1:47 AM, Evan Cheng wrote: Very nice, does it also help shootout/fib? bh speedup doesn't seem real. It doesn't help fib. Ok, once things have settled, please take a look at the comments in the bugzilla to see if there are other cases being missed. This idiom happens a lot in the preexisting code. Please use: VNInfo *AValNo = IntA.FindLiveRangeContaining(CopyIdx-1)-valno; ALR is also used below. Ok! + for (unsigned i = 0, e = DefMI-getNumOperands(); i != e; ++i) { This loop needs a comment. What are you trying to find with this loop? Maybe it should be moved out to its own function which just returns idx? This would force you to name it, which would describe what it does :) There is a reason I said initial in the commit message. This is not done. I need a target hook to tell me what is the new destination register after commuting. Right now this is basically assuming x86 commutable instructions: A = A + B Ok. Another random question unrelated to this code: now that we have efficient RAUW, can we eliminate the 'rep' mapping stuff and just RAUW vregs as they are coallesced? Well, actually it's related. I think it's required for correctness. See below. Ah, I see. Well this seems like an independently useful change that will both speed up and simplify coalescing. Are you interested in tackling it as part of this project? Yay for use_iterators :) Except I don't think this is quite right. Iterating through uses of IntA.reg means we end up not updating other uses that have already been coalesced to it. Yeah, that's bad. Where the use iterator could point to the first r2, and incrementing it could point to the next r2. This could be avoided by not zapping instructions in this loop: move the copy zapping to a walk over a smallset or something. Nothing is being zapped in the loop. Copies that would be zapped are put into a set JoinedCopies. In fact, all uses have to be updated to the new register. Ok. It isn't clear to me what this code is doing. It looks like it is looking for the copy that has now becomes an identity copy. Is there some way to factor this with other code that is coallescing copies away? It seems duplicated from somewhere else. It would be nicer to Not really. A number of things are happening here. We are trying to determine which copies are now identity copies and make sure their valno# will be eliminated. We also need to transfer the live ranges defined by the (now dead) copies to the new val# defined by the commuted definition MI. It's also tracking kill information. Ok, please comment it a bit better. Is there any way to avoid this work or factor this out into functions that can be shared with other code? just add all copies to a small vector and then zap them later or something, to keep the logic simple. That's essentially what's happening. This has gone through a number of iterations already. Apart from some cosmetic changes, it's not going to get much simpler than this. ok. Does this need to be an ivar? Can it just be passed by-ref between the methods that need it? This will be cleaned up later as part of RAUW change. Ok. Thanks Evan! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47054 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/arg-cast.ll
On Feb 13, 2008, at 10:16 AM, Dan Gohman wrote: Hi Chris, On Feb 12, 2008, at 11:39 PM, Chris Lattner wrote: URL: http://llvm.org/viewvc/llvm-project?rev=47054view=rev Log: In SDISel, for targets that support FORMAL_ARGUMENTS nodes, lower this node as soon as we create it in SDISel. Previously we would lower it in legalize. The problem with this is that it only exposes the argument loads implied by FORMAL_ARGUMENTs after legalize, so that only dag combine 2 can hack on them. This causes us to miss some optimizations because datatype expansion also happens here. Will this become redundant once LegalizeTypes is finished and DAGCombine can be run between it an legalizing operations? In this case, nope. The issue is that legalizedagtypes would expand the bitconvert on x86-32 because it is f64 - i64, and i64 isn't legal. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47046 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h
On Feb 13, 2008, at 10:58 AM, Evan Cheng wrote: Ah, I see. Well this seems like an independently useful change that will both speed up and simplify coalescing. Are you interested in tackling it as part of this project? That's the plan. Without RAUW change, I can't enable this optimization. Awesome, thanks. It's *shouldn't* take long. *crosses fingers* :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47096 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Ta
On Feb 13, 2008, at 2:28 PM, Dan Gohman wrote: Author: djg Date: Wed Feb 13 16:28:48 2008 New Revision: 47096 URL: http://llvm.org/viewvc/llvm-project?rev=47096view=rev Log: Simplify some logic in ComputeMaskedBits. And change ComputeMaskedBits to pass the mask APInt by value, not by reference. Thanks Dan! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47102 - /llvm/trunk/test/CodeGen/X86/arg-cast.ll
On Feb 13, 2008, at 5:32 PM, Evan Cheng wrote: Author: evancheng Date: Wed Feb 13 19:32:53 2008 New Revision: 47102 URL: http://llvm.org/viewvc/llvm-project?rev=47102view=rev Log: Fix test. Doh, thanks Evan. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47106 - in /llvm/trunk: lib/Target/X86/README-FPStack.txt test/CodeGen/X86/zero-remat.ll
Author: lattner Date: Wed Feb 13 23:39:46 2008 New Revision: 47106 URL: http://llvm.org/viewvc/llvm-project?rev=47106view=rev Log: This readme entry is done, testcase here: CodeGen/X86/zero-remat.ll Modified: llvm/trunk/lib/Target/X86/README-FPStack.txt llvm/trunk/test/CodeGen/X86/zero-remat.ll Modified: llvm/trunk/lib/Target/X86/README-FPStack.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-FPStack.txt?rev=47106r1=47105r2=47106view=diff == --- llvm/trunk/lib/Target/X86/README-FPStack.txt (original) +++ llvm/trunk/lib/Target/X86/README-FPStack.txt Wed Feb 13 23:39:46 2008 @@ -9,20 +9,6 @@ //===-===// -On darwin/x86, we should codegen: - -ret double 0.00e+00 - -as fld0/ret, not as: - -movl $0, 4(%esp) -movl $0, (%esp) -fldl (%esp) - ... -ret - -//===-===// - This should use fiadd on chips where it is profitable: double foo(double P, int *I) { return P+*I; } Modified: llvm/trunk/test/CodeGen/X86/zero-remat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/zero-remat.ll?rev=47106r1=47105r2=47106view=diff == --- llvm/trunk/test/CodeGen/X86/zero-remat.ll (original) +++ llvm/trunk/test/CodeGen/X86/zero-remat.ll Wed Feb 13 23:39:46 2008 @@ -1,5 +1,7 @@ ; RUN: llvm-as %s | llc -march=x86-64 | grep xor | count 4 ; RUN: llvm-as %s | llc -march=x86-64 -stats -info-output-file - | grep asm-printer | grep 12 +; RUN: llvm-as %s | llc -march=x86 | grep fldz +; RUN: llvm-as %s | llc -march=x86 | not grep fldl declare void @bar(double %x) declare void @barf(float %x) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47108 - /llvm/trunk/lib/Target/X86/README-MMX.txt
Author: lattner Date: Wed Feb 13 23:43:18 2008 New Revision: 47108 URL: http://llvm.org/viewvc/llvm-project?rev=47108view=rev Log: the mid-level optimizer removes this stuff. Modified: llvm/trunk/lib/Target/X86/README-MMX.txt Modified: llvm/trunk/lib/Target/X86/README-MMX.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-MMX.txt?rev=47108r1=47107r2=47108view=diff == --- llvm/trunk/lib/Target/X86/README-MMX.txt (original) +++ llvm/trunk/lib/Target/X86/README-MMX.txt Wed Feb 13 23:43:18 2008 @@ -41,29 +41,3 @@ addl$12, %esp ret $4 -//===-===// - -int main() { - __m64 A[1] = { _mm_cvtsi32_si64(1) }; - __m64 B[1] = { _mm_cvtsi32_si64(10) }; - __m64 sum = _mm_cvtsi32_si64(0); - - sum = __builtin_ia32_paddq(__builtin_ia32_paddq(A[0], B[0]), sum); - - printf(Sum = %d\n, _mm_cvtsi64_si32(sum)); - return 0; -} - -Generates: - -movl $11, %eax -### movd %eax, %mm0 -### movq %mm0, 8(%esp) -### movl 8(%esp), %eax -movl %eax, 4(%esp) -movl $_str, (%esp) -call L_printf$stub -xorl %eax, %eax -addl $28, %esp - -These instructions are unnecessary. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47107 - /llvm/trunk/lib/Target/X86/README-FPStack.txt
Author: lattner Date: Wed Feb 13 23:41:38 2008 New Revision: 47107 URL: http://llvm.org/viewvc/llvm-project?rev=47107view=rev Log: this one is easy. Modified: llvm/trunk/lib/Target/X86/README-FPStack.txt Modified: llvm/trunk/lib/Target/X86/README-FPStack.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-FPStack.txt?rev=47107r1=47106r2=47107view=diff == --- llvm/trunk/lib/Target/X86/README-FPStack.txt (original) +++ llvm/trunk/lib/Target/X86/README-FPStack.txt Wed Feb 13 23:41:38 2008 @@ -80,6 +80,6 @@ addl $20, %esp ret -This will be solved when we go to a dynamic programming based isel. +This just requires being smarter when custom expanding fptoui. //===-===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47109 - in /llvm/trunk/lib/Target/X86: README-SSE.txt README.txt
Author: lattner Date: Thu Feb 14 00:19:02 2008 New Revision: 47109 URL: http://llvm.org/viewvc/llvm-project?rev=47109view=rev Log: upgrade some entries, remove stuff that is done. Modified: llvm/trunk/lib/Target/X86/README-SSE.txt llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README-SSE.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=47109r1=47108r2=47109view=diff == --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) +++ llvm/trunk/lib/Target/X86/README-SSE.txt Thu Feb 14 00:19:02 2008 @@ -56,22 +56,23 @@ time, not at spiller time). *Note* however that this can only be done if Y is dead. Here's a testcase: -%.str_3 = external global [15 x sbyte] ; [15 x sbyte]* [#uses=0] -implementation ; Functions: -declare void %printf(int, ...) -void %main() { [EMAIL PROTECTED] = external global [15 x i8] ; [15 x i8]* [#uses=0] +declare void @printf(i32, ...) +define void @main() { build_tree.exit: -br label %no_exit.i7 -no_exit.i7: ; preds = %no_exit.i7, %build_tree.exit -%tmp.0.1.0.i9 = phi double [ 0.00e+00, %build_tree.exit ], [ %tmp.34.i18, %no_exit.i7 ] ; double [#uses=1] -%tmp.0.0.0.i10 = phi double [ 0.00e+00, %build_tree.exit ], [ %tmp.28.i16, %no_exit.i7 ] ; double [#uses=1] -%tmp.28.i16 = add double %tmp.0.0.0.i10, 0.00e+00 -%tmp.34.i18 = add double %tmp.0.1.0.i9, 0.00e+00 -br bool false, label %Compute_Tree.exit23, label %no_exit.i7 -Compute_Tree.exit23:; preds = %no_exit.i7 -tail call void (int, ...)* %printf( int 0 ) -store double %tmp.34.i18, double* null -ret void + br label %no_exit.i7 + +no_exit.i7:; preds = %no_exit.i7, %build_tree.exit + %tmp.0.1.0.i9 = phi double [ 0.00e+00, %build_tree.exit ], [ %tmp.34.i18, %no_exit.i7 ] ; double [#uses=1] + %tmp.0.0.0.i10 = phi double [ 0.00e+00, %build_tree.exit ], [ %tmp.28.i16, %no_exit.i7 ]; double [#uses=1] + %tmp.28.i16 = add double %tmp.0.0.0.i10, 0.00e+00 ; double [#uses=1] + %tmp.34.i18 = add double %tmp.0.1.0.i9, 0.00e+00; double [#uses=2] + br i1 false, label %Compute_Tree.exit23, label %no_exit.i7 + +Compute_Tree.exit23: ; preds = %no_exit.i7 + tail call void (i32, ...)* @printf( i32 0 ) + store double %tmp.34.i18, double* null + ret void } We currently emit: @@ -125,25 +126,6 @@ //===-===// -Currently the x86 codegen isn't very good at mixing SSE and FPStack -code: - -unsigned int foo(double x) { return x; } - -foo: - subl $20, %esp - movsd 24(%esp), %xmm0 - movsd %xmm0, 8(%esp) - fldl 8(%esp) - fisttpll (%esp) - movl (%esp), %eax - addl $20, %esp - ret - -This will be solved when we go to a dynamic programming based isel. - -//===-===// - Lower memcpy / memset to a series of SSE 128 bit move instructions when it's feasible. Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=47109r1=47108r2=47109view=diff == --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Thu Feb 14 00:19:02 2008 @@ -435,44 +435,6 @@ //===-===// -Consider this: - -typedef struct pair { float A, B; } pair; -void pairtest(pair P, float *FP) { -*FP = P.A+P.B; -} - -We currently generate this code with llvmgcc4: - -_pairtest: -movl 8(%esp), %eax -movl 4(%esp), %ecx -movd %eax, %xmm0 -movd %ecx, %xmm1 -addss %xmm0, %xmm1 -movl 12(%esp), %eax -movss %xmm1, (%eax) -ret - -we should be able to generate: -_pairtest: -movss 4(%esp), %xmm0 -movl 12(%esp), %eax -addss 8(%esp), %xmm0 -movss %xmm0, (%eax) -ret - -The issue is that llvmgcc4 is forcing the struct to memory, then passing it as -integer chunks. It does this so that structs like {short,short} are passed in -a single 32-bit integer stack slot. We should handle the safe cases above much -nicer, while still handling the hard cases. - -While true in general, in this specific case we could do better by promoting -load int + bitcast to float - load fload. This basically needs alignment info, -the code is already implemented (but disabled) in dag combine). - -//===-===// - Another instruction selector deficiency: void %bar() { @@ -551,25 +513,24
[llvm-commits] [llvm] r47116 - /llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp
Author: lattner Date: Thu Feb 14 01:39:01 2008 New Revision: 47116 URL: http://llvm.org/viewvc/llvm-project?rev=47116view=rev Log: simplify code, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp?rev=47116r1=47115r2=47116view=diff == --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp Thu Feb 14 01:39:01 2008 @@ -162,13 +162,15 @@ // Loop over all of the basic blocks that are not reachable, dropping all of // their internal references... - for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB) -if (!Reachable.count(BB)) { - for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI!=SE; ++SI) -if (Reachable.count(*SI)) - (*SI)-removePredecessor(BB); - BB-dropAllReferences(); -} + for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB) { +if (Reachable.count(BB)) + continue; + +for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI) + if (Reachable.count(*SI)) +(*SI)-removePredecessor(BB); +BB-dropAllReferences(); + } for (Function::iterator I = ++F.begin(); I != F.end();) if (!Reachable.count(I)) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r46827 - memoperands #1
On Feb 12, 2008, at 11:27 AM, Dan Gohman wrote: Hi Chris, Thanks for the careful review! I've responded to parts of it already, and I'll be responding to more soon. Thanks Dan! On Feb 10, 2008, at 11:56 AM, Chris Lattner wrote: Instead of Size here, would it make sense to store an MVT? That would seem to capture strictly more information, thought I'm not sure if it's directly useful right now. This, and the question of whether to make LSBaseNode store a MemOperand instead of separate fields, are related. Ok, right. What is your opinion on this? Is there any reason not to give MemOperand a VT and then give LSBaseNode a MemOperand? Also related is the question is what to do about the lowering of something like insert vector element where the element index isn't a constant and the target doesn't have an instruction to handle it. Legalize emits a store with a computed offset; what should the MemOperand for this look like? One way is to give it a larger size, to cover the known area over which the store might occur. This would mean it would use a different VT from the actual store, which could be confusing. Maybe it should have both a size and a VT. Good question. This sort of thing is currently rare enough that it is probably fine to just use a null Value*, and have everything treat it conservatively. Would this be acceptable for now? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47027 - /llvm/trunk/docs/CFEBuildInstrs.html
On Feb 12, 2008, at 1:23 PM, Duncan Sands wrote: Author: baldrick Date: Tue Feb 12 15:22:58 2008 New Revision: 47027 URL: http://llvm.org/viewvc/llvm-project?rev=47027view=rev Log: Add instructions for building Ada and Fortran. Adjust mentions of gcc4 to be 4.0/4.2 agnostic. This file should probably be renamed tor GCCFEBuildInstrs.html... Thanks Duncan! Please go ahead and rename it (updating any references to it), but please put a stub page in place that links to the new one. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47042 - in /llvm/trunk: include/llvm/CodeGen/MachineRegisterInfo.h lib/CodeGen/MachineRegisterInfo.cpp
On Feb 12, 2008, at 6:45 PM, Evan Cheng wrote: URL: http://llvm.org/viewvc/llvm-project?rev=47042view=rev Log: Added debugging routine dumpUses. Nice. +++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Tue Feb 12 20:45:38 2008 +#ifndef NDEBUG + void dumpUses(unsigned RegNo) const; +#endif I wouldn't bother ifdefing this. This is a recipe for getting compile errors later if someone forgets to #ifdef all uses. +#ifndef NDEBUG +void MachineRegisterInfo::dumpUses(unsigned Reg) const { + for (use_iterator I = use_begin(Reg), E = use_end(); I != E; ++I) +I.getOperand().getParent()-dump(); +} +#endif This can be simplified to: I-dump(); -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/pubs/index.html
Changes in directory llvm-www/pubs: index.html updated: 1.63 - 1.64 --- Log message: add to index page --- Diffs of the changes: (+3 -0) index.html |3 +++ 1 files changed, 3 insertions(+) Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.63 llvm-www/pubs/index.html:1.64 --- llvm-www/pubs/index.html:1.63 Thu Jan 24 16:53:51 2008 +++ llvm-www/pubs/index.htmlTue Feb 12 13:36:35 2008 @@ -2,6 +2,9 @@ div class=www_sectiontitleLLVM Related Publications/div ol +lia href=2008-02-23-TRANSACT-TangerObjBased.htmlMaking Object-Based STM Practical in Unmanaged Environments/abr +Torvald Riegel and Diogo Becker de Brumbr +iACM SIGPLAN Workshop on Transactional Computing (TRANSACT 2008)/i, Salt Lake City, Utah, 2008/li lia href=2008-CGO-DagISel.htmlNear-Optimal Instruction Selection on DAGs/abr David Ryan Koes and Seth Copen Goldsteinbr ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.html 2008-02-23-TRANSACT-TangerObjBased.pdf
Changes in directory llvm-www/pubs: 2008-02-23-TRANSACT-TangerObjBased.html added (r1.1) 2008-02-23-TRANSACT-TangerObjBased.pdf added (r1.1) --- Log message: new paper from Torvald Riegel --- Diffs of the changes: (+49 -0) 2008-02-23-TRANSACT-TangerObjBased.html | 49 2008-02-23-TRANSACT-TangerObjBased.pdf |0 2 files changed, 49 insertions(+) Index: llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.html diff -c /dev/null llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.html:1.1 *** /dev/null Tue Feb 12 13:34:26 2008 --- llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.html Tue Feb 12 13:34:15 2008 *** *** 0 --- 1,49 + !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN + html + head + meta http-equiv=Content-Type content=text/html; charset=UTF-8 / + link rel=stylesheet href=../llvm.css type=text/css media=screen / + titleTransactifying Applications Using an Open Compiler Framework/title + /head + body + + div class=pub_title + Making Object-Based STM Practical in Unmanaged Environments + /div + div class=pub_author + Torvald Riegel and Diogo Becker de Brum + /div + + h2Abstract:/h2 + blockquote + Current transactifying compilers for unmanaged environments (e.g., systems software written + in C/C++) target only word-based software transactional memories (STMs) because the + compiler cannot easily infer whether it is safe to transform a transactional access to a + certain memory location in an object-based way. To use object-based STMs in these + environments, programmers must use explicit calls to the STM or use a restricted language + dialect, both of which are not practical. In this paper, we show how an existing pointer + analysis can be used to let a transactifying compiler for C/C++ use object-based accesses + whenever this is possible and safe, while falling back to word-based accesses otherwise. + Programmers do not need to provide any annotations and do not have to use a restricted + language. Our evaluation also shows that an object-based STM can be significantly faster + than a word-based STM with an otherwise identical design and implementation, even if the + parameters of the latter have been tuned. + /blockquote + + h2Bibtex:/h2 + pre + @inproceedings{Riegel2008objbased, + author = {{T}orvald {R}iegel and {B}ecker de {B}rum, {D}iogo}, + title = {{M}aking {O}bject-{B}ased {STM} {P}ractical in {U}nmanaged {E}nvironments}, + booktitle = {{TRANSACT} 2008}, + year = {2008}, + } + /pre + + h2Download:/h2 + ul + lia href=2008-02-23-TRANSACT-TangerObjBased.pdfMaking Object-Based STM Practical in Unmanaged Environments/a (PDF)/li + /ul + + /body + /html Index: llvm-www/pubs/2008-02-23-TRANSACT-TangerObjBased.pdf ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47046 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h
On Feb 12, 2008, at 7:01 PM, Evan Cheng wrote: Author: evancheng Date: Tue Feb 12 21:01:43 2008 New Revision: 47046 URL: http://llvm.org/viewvc/llvm-project?rev=47046view=rev Log: Initial support for copy elimination by commuting its definition MI. Yay, thanks for tackling this Evan! This speeds up FreeBench/neural by 29%, Olden/bh by 12%, oopack_v1p8 by 53%. Very nice, does it also help shootout/fib? +/// ReplaceMachineInstrInMaps - Replacing a machine instr with a new one in +/// maps used by register allocator. +void ReplaceMachineInstrInMaps(MachineInstr *MI, MachineInstr *NewMI) { + Mi2IndexMap::iterator mi2i = mi2iMap_.find(MI); + if (mi2i != mi2iMap_.end()) { Please change this to: if (mi2i == mi2iMap_.end()) return; ... Just to avoid indentation. +i2miMap_[mi2i-second/InstrSlots::NUM] = NewMI; +Mi2IndexMap::const_iterator it = mi2iMap_.find(MI); +assert(it != mi2iMap_.end() Invalid instruction!); +unsigned Index = it-second; +mi2iMap_.erase(MI); This would avoid another lookup if you used .erase(it); +bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval IntA, + LiveInterval IntB, + MachineInstr *CopyMI) { ... + // Get the location that B is defined at. Two options: either this value has + // an unknown definition point or it is defined at CopyIdx. If unknown, we + // can't process it. + if (!BValNo-reg) return false; + assert(BValNo-def == CopyIdx Copy doesn't define the value?); + + // AValNo is the value number in A that defines the copy, A3 in the example. + LiveInterval::iterator ALR = IntA.FindLiveRangeContaining(CopyIdx-1); + VNInfo *AValNo = ALR-valno; This idiom happens a lot in the preexisting code. Please use: VNInfo *AValNo = IntA.FindLiveRangeContaining(CopyIdx-1)-valno; Or better yet, add a new method that returns valno directly. + int Idx = -1; Idx is too generic of a name for a variable with this long of lifetime, please name it something more descriptive. What type of idx is it? + for (unsigned i = 0, e = DefMI-getNumOperands(); i != e; ++i) { This loop needs a comment. What are you trying to find with this loop? Maybe it should be moved out to its own function which just returns idx? This would force you to name it, which would describe what it does :) +MachineOperand MO = DefMI-getOperand(i); +if (!MO.isRegister()) continue; +unsigned Reg = MO.getReg(); +if (Reg TargetRegisterInfo::isVirtualRegister(Reg)) { How about: if (Reg == 0 || !isvreg) continue; + if (rep(Reg) == IntA.reg) { +// If the dest register comes from an interval other than IntA, we +// can't handle this. +if (Reg != IntA.reg) + return false; I must be missing something here, how do you know this is a def operand? Another random question unrelated to this code: now that we have efficient RAUW, can we eliminate the 'rep' mapping stuff and just RAUW vregs as they are coallesced? +continue; + } + if (Idx != -1) +// FIXME: Being overly careful here. We just need to figure out the +// which register operand will become the new def. +return false; + Idx = i; +} + } + if (Idx == -1) +// Something like %reg1024 = add %reg1024, %reg1024 +return false; + + MachineOperand MO = DefMI-getOperand(Idx); + unsigned NewReg = MO.getReg(); + if (rep(NewReg) != IntB.reg || !MO.isKill()) +return false; This logic would make more sense if I knew what Idx indicates and why you're rejecting these cases :). Also, MO has a long lifetime, please name it DefMO or something else more descriptive. + // Make sure there are no other definitions of IntB that would reach the + // uses which the new definition can reach. + for (LiveInterval::iterator AI = IntA.begin(), AE = IntA.end(); + AI != AE; ++AI) { +if (AI-valno != AValNo) continue; +LiveInterval::Ranges::iterator BI = + std::upper_bound(IntB.ranges.begin(), IntB.ranges.end(), AI- start); +if (BI != IntB.ranges.begin()) + --BI; +for (; BI != IntB.ranges.end() AI-end = BI-start; ++BI) { + if (BI-valno == BLR-valno) +continue; + if (BI-start = AI-start BI-end AI-start) +return false; + if (BI-start AI-start BI-start AI-end) +return false; +} Please split this out into a static function or a method on liveinterval. + } + + // Commute def machine instr. How about: at this point we have decided that it is legal to do this transformation. Start by commuting the instruction. + MachineBasicBlock *MBB = DefMI-getParent(); + MachineInstr *NewMI = tii_-commuteInstruction(DefMI); + if (NewMI
Re: [llvm-commits] [llvm] r47007 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll
On Feb 12, 2008, at 7:09 AM, Wojciech Matyjewicz wrote: Author: wmat Date: Tue Feb 12 09:09:36 2008 New Revision: 47007 URL: http://llvm.org/viewvc/llvm-project?rev=47007view=rev Log: Fix PR2002. Suppose n is the initial value for the induction variable (with step 1) and m is its final value. Then, the correct trip count is SMAX(m,n)-n. Previously, we used SMAX(0,m-n), but m-n may overflow and can't in general be interpreted as signed. Very nice, please add a comment above the code explaining what is going on though :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r47039 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Ta
On Feb 12, 2008, at 4:35 PM, Dan Gohman wrote: Convert SelectionDAG::ComputeMaskedBits to use APInt instead of uint64_t. Add an overload that supports the uint64_t interface for use by clients that haven't been updated yet. Great! Thanks for tackling this Dan! +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Tue Feb 12 18:35:47 2008 @@ -556,6 +556,12 @@ /// bitsets. This code only analyzes bits in Mask, in order to short-circuit /// processing. Targets can implement the computeMaskedBitsForTargetNode /// method in the TargetLowering class to allow target nodes to be understood. + void ComputeMaskedBits(SDOperand Op, APInt Mask, APInt KnownZero, Please pass Mask by const reference (likewise to the virtual method). APInts are somewhat cheap to copy in the common case (no malloc) but they aren't free, and it would be better to make the copies explicit so they are only done when needed. case ISD::SRL: // (ushr X, C1) C2 == 0 iff (-1 C1) C2 == 0 .. + APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt); KnownZero |= HighBits; // High bits known zero. How about: KnownZero |= APInt::getHighBitsSet(BitWidth, ShAmt); case ISD::SRA: if (ConstantSDNode *SA = dyn_castConstantSDNode(Op.getOperand(1))) { unsigned ShAmt = SA-getValue(); + APInt InDemandedMask = (Mask ShAmt); // If any of the demanded bits are produced by the sign extension, we also // demand the input sign bit. + APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt); + if (!!(HighBits Mask)) +InDemandedMask |= APInt::getSignBit(BitWidth); Heh, this is clever, but non-obvious. How about: if ((HighBits Mask) != 0) or: if ((HighBits Mask).getBoolValue()) which is less tricky but more obvious. There are a couple instances of similar !! things. In fact, this occurs often enough that it might be worthwhile to avoid the construction of the temporary APInt. How about defining a new method: X.intersect(Y) to be true if any bits in X are also set in Y? Aka (XY)!=0 ComputeMaskedBits(Op.getOperand(0), InDemandedMask, KnownZero, KnownOne, Depth+1); assert((KnownZero KnownOne) == 0 Bits known to be one AND zero?); + KnownZero = KnownZero.lshr(ShAmt); + KnownOne = KnownOne.lshr(ShAmt); // Handle the sign bits. + APInt SignBit = APInt::getSignBit(BitWidth); + SignBit = SignBit.lshr(ShAmt); // Adjust to where it is now in the mask. It would be better to make an APInt with the bit in the right place instead of starting with a sign bit and shifting it. @@ -1283,14 +1274,18 @@ // Sign extension. Compute the demanded bits in the result that are not // present in the input. -uint64_t NewBits = ~MVT::getIntVTBitMask(EVT) Mask; +APInt NewBits = ~APInt::getLowBitsSet(BitWidth, + MVT::getSizeInBits(EVT)) Mask; instead of using ~lowbits, how about using getHighBitsSet? // If the sign extended bits are demanded, we know that the sign // bit is demanded. +InSignBit.zext(BitWidth); This is another create sign and extend. It would be better to just make the apint with the bit set in the right place. case ISD::LOAD: { if (ISD::isZEXTLoad(Op.Val)) { LoadSDNode *LD = castLoadSDNode(Op); MVT::ValueType VT = LD-getMemoryVT(); - KnownZero |= ~MVT::getIntVTBitMask(VT) Mask; + KnownZero |= ~APInt::getLowBitsSet(BitWidth, MVT::getSizeInBits(VT)) Mask; Instead of ~lowbits, how about using highbits? likewise in a couple other places. case ISD::SIGN_EXTEND: { MVT::ValueType InVT = Op.getOperand(0).getValueType(); +unsigned InBits = MVT::getSizeInBits(InVT); +APInt InMask= APInt::getLowBitsSet(BitWidth, InBits); +APInt InSignBit = APInt::getSignBit(InBits); +APInt NewBits = (~InMask) Mask; // If any of the sign extended bits are demanded, we know that the sign // bit is demanded. +InSignBit.zext(BitWidth); +if (!!(NewBits Mask)) + Mask |= InSignBit; I think this is a bug: NewBits is defined to be ... Mask. This is either a bug or this can be replaced with NewBits != 0 which doesn't seem right. @@ -1402,11 +1415,11 @@ // Output known-0 bits are known if clear or set in both the low clear bits // common to both LHS RHS. For example, 8+(X3) is known to have the // low 3 bits clear. -uint64_t KnownZeroOut = std::min(CountTrailingZeros_64(~KnownZero), - CountTrailingZeros_64(~KnownZero2)); +unsigned KnownZeroOut = std::min((~KnownZero).countTrailingZeros(), + (~KnownZero2).countTrailingZeros()); Huh, apint has a countLeadingOnes() but no countTrailingOnes(). If it did, you could use it instead of ~'ing
[llvm-commits] [llvm] r47052 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Author: lattner Date: Wed Feb 13 01:25:05 2008 New Revision: 47052 URL: http://llvm.org/viewvc/llvm-project?rev=47052view=rev Log: teach dag combiner how to eliminate MERGE_VALUES nodes. 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=47052r1=47051r2=47052view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 13 01:25:05 2008 @@ -137,6 +137,7 @@ // otherwise- N should be replaced by the returned Operand. // SDOperand visitTokenFactor(SDNode *N); +SDOperand visitMERGE_VALUES(SDNode *N); SDOperand visitADD(SDNode *N); SDOperand visitSUB(SDNode *N); SDOperand visitADDC(SDNode *N); @@ -662,6 +663,7 @@ switch(N-getOpcode()) { default: break; case ISD::TokenFactor:return visitTokenFactor(N); + case ISD::MERGE_VALUES: return visitMERGE_VALUES(N); case ISD::ADD:return visitADD(N); case ISD::SUB:return visitSUB(N); case ISD::ADDC: return visitADDC(N); @@ -837,6 +839,18 @@ return Result; } +/// MERGE_VALUES can always be eliminated. +SDOperand DAGCombiner::visitMERGE_VALUES(SDNode *N) { + WorkListRemover DeadNodes(*this); + for (unsigned i = 0, e = N-getNumOperands(); i != e; ++i) +DAG.ReplaceAllUsesOfValueWith(SDOperand(N, i), N-getOperand(i), + DeadNodes); + removeFromWorkList(N); + DAG.DeleteNode(N); + return SDOperand(N, 0); // Return N so it doesn't get rechecked! +} + + static SDOperand combineShlAddConstant(SDOperand N0, SDOperand N1, SelectionDAG DAG) { MVT::ValueType VT = N0.getValueType(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r47053 - in /llvm/trunk/lib/Target: ARM/ARMISelLowering.cpp CellSPU/SPUISelLowering.cpp PowerPC/PPCISelLowering.cpp
Author: lattner Date: Wed Feb 13 01:35:30 2008 New Revision: 47053 URL: http://llvm.org/viewvc/llvm-project?rev=47053view=rev Log: don't try to avoid inserting loads when lowering FORMAL_ARGUMENTS. DAGCombine is now quite good at zapifying them. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=47053r1=47052r2=47053view=diff == --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Feb 13 01:35:30 2008 @@ -954,22 +954,15 @@ NumGPRs += ObjGPRs; if (ObjSize) { -// If the argument is actually used, emit a load from the right stack -// slot. -if (!Op.Val-hasNUsesOfValue(0, ArgNo)) { - MachineFrameInfo *MFI = MF.getFrameInfo(); - int FI = MFI-CreateFixedObject(ObjSize, ArgOffset); - SDOperand FIN = DAG.getFrameIndex(FI, MVT::i32); - if (ObjGPRs == 0) -ArgValue = DAG.getLoad(ObjectVT, Root, FIN, NULL, 0); - else { -SDOperand ArgValue2 = DAG.getLoad(MVT::i32, Root, FIN, NULL, 0); -assert(ObjectVT != MVT::i64 i64 should already be lowered); -ArgValue = DAG.getNode(ARMISD::FMDRR, MVT::f64, ArgValue, ArgValue2); - } -} else { - // Don't emit a dead load. - ArgValue = DAG.getNode(ISD::UNDEF, ObjectVT); +MachineFrameInfo *MFI = MF.getFrameInfo(); +int FI = MFI-CreateFixedObject(ObjSize, ArgOffset); +SDOperand FIN = DAG.getFrameIndex(FI, MVT::i32); +if (ObjGPRs == 0) + ArgValue = DAG.getLoad(ObjectVT, Root, FIN, NULL, 0); +else { + SDOperand ArgValue2 = DAG.getLoad(MVT::i32, Root, FIN, NULL, 0); + assert(ObjectVT != MVT::i64 i64 should already be lowered); + ArgValue = DAG.getNode(ARMISD::FMDRR, MVT::f64, ArgValue, ArgValue2); } ArgOffset += ObjSize; // Move on to the next argument. Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=47053r1=47052r2=47053view=diff == --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Feb 13 01:35:30 2008 @@ -1008,17 +1008,9 @@ // We need to load the argument to a virtual register if we determined above // that we ran out of physical registers of the appropriate type if (needsLoad) { - // If the argument is actually used, emit a load from the right stack - // slot. - if (!Op.Val-hasNUsesOfValue(0, ArgNo)) { -int FI = MFI-CreateFixedObject(ObjSize, ArgOffset); -SDOperand FIN = DAG.getFrameIndex(FI, PtrVT); -ArgVal = DAG.getLoad(ObjectVT, Root, FIN, NULL, 0); - } else { -// Don't emit a dead load. -ArgVal = DAG.getNode(ISD::UNDEF, ObjectVT); - } - + int FI = MFI-CreateFixedObject(ObjSize, ArgOffset); + SDOperand FIN = DAG.getFrameIndex(FI, PtrVT); + ArgVal = DAG.getLoad(ObjectVT, Root, FIN, NULL, 0); ArgOffset += StackSlotSize; } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=47053r1=47052r2=47053view=diff == --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Feb 13 01:35:30 2008 @@ -1420,19 +1420,12 @@ } // We need to load the argument to a virtual register if we determined above -// that we ran out of physical registers of the appropriate type +// that we ran out of physical registers of the appropriate type. if (needsLoad) { - // If the argument is actually used, emit a load from the right stack - // slot. - if (!Op.Val-hasNUsesOfValue(0, ArgNo)) { -int FI = MFI-CreateFixedObject(ObjSize, -CurArgOffset + (ArgSize - ObjSize)); -SDOperand FIN = DAG.getFrameIndex(FI, PtrVT); -ArgVal = DAG.getLoad(ObjectVT, Root, FIN, NULL, 0); - } else { -// Don't emit a dead load. -ArgVal = DAG.getNode(ISD::UNDEF, ObjectVT); - } + int FI = MFI-CreateFixedObject(ObjSize, + CurArgOffset + (ArgSize - ObjSize)); + SDOperand FIN = DAG.getFrameIndex(FI, PtrVT); + ArgVal = DAG.getLoad(ObjectVT, Root, FIN, NULL, 0); } ArgValues.push_back(ArgVal); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu
[llvm-commits] [llvm] r47054 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/arg-cast.ll
Author: lattner Date: Wed Feb 13 01:39:09 2008 New Revision: 47054 URL: http://llvm.org/viewvc/llvm-project?rev=47054view=rev Log: In SDISel, for targets that support FORMAL_ARGUMENTS nodes, lower this node as soon as we create it in SDISel. Previously we would lower it in legalize. The problem with this is that it only exposes the argument loads implied by FORMAL_ARGUMENTs after legalize, so that only dag combine 2 can hack on them. This causes us to miss some optimizations because datatype expansion also happens here. Exposing the loads early allows us to do optimizations on them. For example we now compile arg-cast.ll to: _foo: movl$2147483647, %eax andl8(%esp), %eax ret where we previously produced: _foo: subl$12, %esp movsd 16(%esp), %xmm0 movsd %xmm0, (%esp) movl$2147483647, %eax andl4(%esp), %eax addl$12, %esp ret It might also make sense to do this for ISD::CALL nodes, which have implicit stores on many targets. Added: llvm/trunk/test/CodeGen/X86/arg-cast.ll 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=47054r1=47053r2=47054view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb 13 01:39:09 2008 @@ -4074,8 +4074,22 @@ // Create the node. SDNode *Result = DAG.getNode(ISD::FORMAL_ARGUMENTS, - DAG.getNodeValueTypes(RetVals), RetVals.size(), + DAG.getVTList(RetVals[0], RetVals.size()), Ops[0], Ops.size()).Val; + + // Prelower FORMAL_ARGUMENTS. This isn't required for functionality, but + // allows exposing the loads that may be part of the argument access to the + // first DAGCombiner pass. + SDOperand TmpRes = LowerOperation(SDOperand(Result, 0), DAG); + + // The number of results should match up, except that the lowered one may have + // an extra flag result. + assert((Result-getNumValues() == TmpRes.Val-getNumValues() || + (Result-getNumValues()+1 == TmpRes.Val-getNumValues() + TmpRes.getValue(Result-getNumValues()).getValueType() == MVT::Flag)) + Lowering produced unexpected number of results!); + Result = TmpRes.Val; + unsigned NumArgRegs = Result-getNumValues() - 1; DAG.setRoot(SDOperand(Result, NumArgRegs)); Added: llvm/trunk/test/CodeGen/X86/arg-cast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/arg-cast.ll?rev=47054view=auto == --- llvm/trunk/test/CodeGen/X86/arg-cast.ll (added) +++ llvm/trunk/test/CodeGen/X86/arg-cast.ll Wed Feb 13 01:39:09 2008 @@ -0,0 +1,18 @@ +; This should compile to movl $2147483647, %eax + andl only. +; RUN: llvm-as %s | llc | grep andl +; RUN: llvm-as %s | llc | not grep movsd +; RUN: llvm-as %s | llc | not grep esp +; rdar://5736574 + +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 = i686-apple-darwin8 + +define i32 @foo(double %x) nounwind { +entry: + %x15 = bitcast double %x to i64 ; i64 [#uses=1] + %tmp713 = lshr i64 %x15, 32 ; i64 [#uses=1] + %tmp714 = trunc i64 %tmp713 to i32 ; i32 [#uses=1] + %tmp8 = and i32 %tmp714, 2147483647 ; i32 [#uses=1] + ret i32 %tmp8 +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r46993 - /llvm/trunk/docs/ReleaseNotes.html
Author: lattner Date: Tue Feb 12 00:29:45 2008 New Revision: 46993 URL: http://llvm.org/viewvc/llvm-project?rev=46993view=rev Log: rip out llvm 2.2 stuff in preparation for llvm 2.3 Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=46993r1=46992r2=46993view=diff == --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Tue Feb 12 00:29:45 2008 @@ -4,11 +4,11 @@ head meta http-equiv=Content-Type content=text/html; charset=utf-8 link rel=stylesheet href=llvm.css type=text/css - titleLLVM 2.2 Release Notes/title + titleLLVM 2.3 Release Notes/title /head body -div class=doc_titleLLVM 2.2 Release Notes/div +div class=doc_titleLLVM 2.3 Release Notes/div ol lia href=#introIntroduction/a/li @@ -23,6 +23,8 @@ pWritten by the a href=http://llvm.org;LLVM Team/ap /div +h1font color=redTHIS IS A WORK IN PROGRESS FOR LLVM 2.3 (currently in +progress on SVN HEAD)/font/h1 !-- *** -- div class=doc_section @@ -33,7 +35,7 @@ div class=doc_text pThis document contains the release notes for the LLVM compiler -infrastructure, release 2.2. Here we describe the status of LLVM, including +infrastructure, release 2.3. Here we describe the status of LLVM, including major improvements from the previous release and any known problems. All LLVM releases may be downloaded from the a href=http://llvm.org/releases/;LLVM releases web site/a./p @@ -59,12 +61,12 @@ div class=doc_text -pThis is the thirteenth public release of the LLVM Compiler Infrastructure. -It includes many features and refinements from LLVM 2.1./p +pThis is the fourteenth public release of the LLVM Compiler Infrastructure. +It includes many features and refinements from LLVM 2.2./p /div -!-- Unfinished features in 2.2: +!-- Unfinished features in 2.3: Index Set Splitting not enabled by default Machine LICM Machine Sinking @@ -73,35 +75,26 @@ !--=-- div class=doc_subsection -a name=deprecationDeprecated features in LLVM 2.2/a +a name=deprecationRemoved features in LLVM 2.3/a /div div class=doc_text -pThis is the last LLVM release to support llvm-gcc 4.0, llvm-upgrade, and -llvmc in its current form. llvm-gcc 4.0 has been replaced with llvm-gcc 4.2. -llvm-upgrade is useful for upgrading llvm 1.9 files to llvm 2.x syntax, but you -can always use an old release to do this. llvmc is currently mostly useless in -llvm 2.2, and will be redesigned or removed in llvm 2.3./p +pLLVM 2.2 was the last LLVM release to support llvm-gcc 4.0 and llvm-upgrade. +llvm-gcc 4.0 has been replaced with llvm-gcc 4.2. llvm-upgrade was useful for +upgrading llvm 1.9 files to llvm 2.x syntax, but you can always use a previous +llvm release to do this./p /div !--=-- div class=doc_subsection -a name=frontendsllvm-gcc 4.0, llvm-gcc 4.2, and clang/a +a name=frontendsllvm-gcc 4.2 and clang/a /div div class=doc_text -pLLVM 2.2 fully supports both the llvm-gcc 4.0 and llvm-gcc 4.2 front-ends (in -LLVM 2.1, llvm-gcc 4.2 was beta). Since LLVM 2.1, the llvm-gcc 4.2 front-end -has made leaps and bounds and is now at least as good as 4.0 in virtually every -area, and is better in several areas (for example, exception handling -correctness, support for Ada and Fortran, better ABI compatibility, etc). We -strongly recommend that you -migrate from llvm-gcc 4.0 to llvm-gcc 4.2 in this release cycle because -bLLVM 2.2 is the last release that will support llvm-gcc 4.0/b: LLVM 2.3 -will only support the llvm-gcc 4.2 front-end./p +pLLVM 2.3 fully supports llvm-gcc 4.2 front-end. /p pThe a href=http://clang.llvm.org/;clang project/a is an effort to build a set of new 'llvm native' front-end technologies for the LLVM optimizer @@ -109,7 +102,7 @@ nicely, and it has advanced source-to-source analysis and transformation capabilities. If you are interested in building source-level tools for C and Objective-C (and eventually C++), you should take a look. However, note that -clang is not an official part of the LLVM 2.2 release. If you are interested in +clang is not an official part of the LLVM 2.3 release. If you are interested in this project, please see its a href=http://clang.llvm.org/;web site/a./p /div @@ -121,41 +114,9 @@ div class=doc_text -pLLVM 2.2 includes several major new capabilities:/p +pLLVM 2.3 includes several major new capabilities:/p ul -liA research team led by Scott Michel in the Computer Systems Research -Department at The Aerospace Corporation contributed the CellSPU backend, which -generates code for the vector coprocessors on the
[llvm-commits] [llvm] r46991 - /llvm/trunk/docs/CommandGuide/Makefile
Author: lattner Date: Tue Feb 12 00:07:47 2008 New Revision: 46991 URL: http://llvm.org/viewvc/llvm-project?rev=46991view=rev Log: heavily refactor this to have less duplication between BUILD_FOR_WEBSITE mode and not. Modified: llvm/trunk/docs/CommandGuide/Makefile Modified: llvm/trunk/docs/CommandGuide/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/Makefile?rev=46991r1=46990r2=46991view=diff == --- llvm/trunk/docs/CommandGuide/Makefile (original) +++ llvm/trunk/docs/CommandGuide/Makefile Tue Feb 12 00:07:47 2008 @@ -8,67 +8,59 @@ ##===--===## ifdef BUILD_FOR_WEBSITE - # This special case is for keeping the CommandGuide on the LLVM web site # up to date automatically as the documents are checked in. It must build # the POD files to HTML only and keep them in the src directories. It must also # build in an unconfigured tree, hence the ifdef. To use this, run # make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script. +SRC_DOC_DIR= +DST_HTML_DIR=html/ +DST_MAN_DIR=man/man1/ +DST_PS_DIR=ps/ -POD := $(wildcard *.pod) -HTML := $(patsubst %.pod, html/%.html, $(POD)) -MAN := $(patsubst %.pod, man/man1/%.1, $(POD)) -PS := $(patsubst %.pod, ps/%.ps, $(POD)) - -all: $(HTML) $(MAN) $(PS) - -.SUFFIXES: -.SUFFIXES: .html .pod .1 .ps - -html/%.html: %.pod - pod2html --css=manpage.css --htmlroot=. \ - --podpath=. --noindex --infile=$ --outfile=$@ --title=$* - -man/man1/%.1: %.pod - pod2man --release=CVS --center=LLVM Command Guide $ $@ - -ps/%.ps: man/man1/%.1 - groff -Tps -man $ $@ +# If we are in BUILD_FOR_WEBSITE mode, default to the all target. +all:: html man ps clean: rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) +else -else - +# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info. LEVEL := ../.. - include $(LEVEL)/Makefile.common -POD := $(wildcard $(PROJ_SRC_DIR)/*.pod) +SRC_DOC_DIR=$(PROJ_SRC_DIR)/ +DST_HTML_DIR=$(PROJ_OBJ_DIR)/ +DST_MAN_DIR=$(PROJ_OBJ_DIR)/ +DST_PS_DIR=$(PROJ_OBJ_DIR)/ -EXTRA_DIST := $(POD) index.html +endif -HTML = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.html, $(POD)) -MAN = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.1, $(POD)) -PS = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.ps, $(POD)) + +POD := $(wildcard $(SRC_DOC_DIR)*.pod) +HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD)) +MAN := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD)) +PS := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD)) .SUFFIXES: .SUFFIXES: .html .pod .1 .ps -$(HTML) : html/.dir man/.dir man/man1/.dir ps/.dir +$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir + pod2html --css=manpage.css --htmlroot=. \ + --podpath=. --noindex --infile=$ --outfile=$@ --title=$* -html: $(HTML) +$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir + pod2man --release=CVS --center=LLVM Command Guide $ $@ + +$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir + groff -Tps -man $ $@ -$(PROJ_OBJ_DIR)/%.html: %.pod - $(POD2HTML) --css=manpage.css --htmlroot=. --podpath=. \ - --noindex --infile=$ --outfile=$@ --title=$* - -$(PROJ_OBJ_DIR)/%.1: %.pod - $(POD2MAN) --release=$(LLVMVersion) \ - --center=LLVM Command Guide $ $@ -$(PROJ_OBJ_DIR)/%.ps: $(PROJ_OBJ_DIR)/%.1 - $(GROFF) -Tps -man $ $@ +html: $(HTML) +man: $(MAN) +ps: $(PS) + +EXTRA_DIST := $(POD) index.html clean-local:: $(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) @@ -97,5 +89,3 @@ printvars:: $(Echo) POD: '$(POD)' $(Echo) HTML : '$(HTML)' - -endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r46923 - /llvm/trunk/docs/ReleaseNotes.html
Author: lattner Date: Sun Feb 10 02:17:19 2008 New Revision: 46923 URL: http://llvm.org/viewvc/llvm-project?rev=46923view=rev Log: final set of major updates Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=46923r1=46922r2=46923view=diff == --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Feb 10 02:17:19 2008 @@ -138,10 +138,15 @@ bits) and on Darwin PPC/PPC64 (where it is 128 bits). In previous LLVM releases, llvm-gcc silently mapped long double to double./li -liGordon rewrote most of the a href=GarbageCollection.htmlAccurate Garbage -Collection/a code in the code generator, making the generated code more -efficient and adding support for the Ocaml garbage collector metadata -format./li +liGordon Henriksen rewrote most of the a href=GarbageCollection.html +Accurate Garbage Collection/a code in the code generator, making the +generated code more efficient and adding support for the Ocaml garbage collector +metadata format./li + +liChristopher Lamb contributed support for multiple address spaces in LLVM +IR. This is useful for supporting targets that have 'near' vs 'far' pointers, +'RAM' vs 'ROM' pointers, or that have non-local memory that can be accessed with +special instructions./li liLLVM now includes a new set of detailed a href=tutorial/index.htmltutorials/a, which explain how to implement a @@ -151,6 +156,44 @@ !--=-- div class=doc_subsection +a name=coreimprovementsLLVM Core Improvements/a +/div + +div class=doc_text +pNew features include: +/p + +ul +liGordon contributed support for C and Ocaml Bindings for the basic LLVM IR +construction routines as well as several other auxiliary APIs./li + +liAnton added readnone/readonly attributes for modeling function side effects. +Duncan hooked up GCC's pure/const attributes to use them and enhanced mod/ref +analysis to use them./li + +liDevang added LLVMFoldingBuilder, a version of LLVMBuilder that implicitly +simplifies the code as it is constructed./li + +liTed Kremenek added a framework for generic object serialization to bitcode +files. This support is only used by clang right now for ASTs but is extensible +and could be used for serializing arbitrary other data into bitcode files./li + +liDuncan improved TargetData to distinguish between the size/alignment of a +type in a register, in memory according to the platform ABI, and in memory when +we have a choice./li + +liDuncan moved parameter attributes off of FunctionType and onto functions +and calls. This makes it much easier to add attributes to a function in a +transformation pass./li + +liDan Gohman added support for vector sin, cos, and pow intrinsics./li + +/ul + +/div + +!--=-- +div class=doc_subsection a name=codegenCode Generator Improvements/a /div @@ -211,15 +254,15 @@ div class=doc_text -pIn addition to a huge array of bug fixes and minor performance tweaks, LLVM -2.2 supports a few major enhancements:/p +pIn addition to a huge array of bug fixes and minor performance tweaks, the +LLVM 2.2 optimizers support a few major enhancements:/p ul liDaniel Berlin and Curtis Dunham rewrote Andersen's alias analysis to be -several orders of magnitude faster, implemented Offline Variable Substitution -and Lazy Cycle Detection. Note that Andersen's is not enabled in llvm-gcc by -default./li +several orders of magnitude faster, and implemented Offline Variable +Substitution and Lazy Cycle Detection. Note that Andersen's is not enabled in +llvm-gcc by default, but can be accessed through 'opt'./li liDan Gohman contributed several enhancements to Loop Strength Reduction (LSR) to make it more aggressive with SSE intrinsics./li @@ -240,48 +283,23 @@ /div div class=doc_text -pNew features include: +pNew target-specific features include: /p ul -liEvan X86 now models EFLAGS in instructions./li -liEvan: If conversion on by default for ARM./li -liBruno: MIPS PIC support./li -liArnold Schwaighofer: X86 tail call support./li -liDale darwin/x86-64 and darwin/ppc eh/li -liEvan: darwin/x86 debug info, improvements at -O0?/li -/ul - -/div - -!--=-- -div class=doc_subsection -a name=coreimprovementsLLVM Core Improvements/a -/div - -div class=doc_text -pNew features include: -/p - -ul -liDevang added LLVMFoldingBuilder./li -liDan added support for vector sin, cos, and pow intrinsics./li -liTed added a framework for generic object serialization to bitcode files, -only used by clang right now for ASTs but could be used for other -stuff./li -liDuncan fixed TargetData to distinguish between the
[llvm-commits] [llvm] r46924 - /llvm/trunk/docs/ReleaseNotes.html
Author: lattner Date: Sun Feb 10 02:18:42 2008 New Revision: 46924 URL: http://llvm.org/viewvc/llvm-project?rev=46924view=rev Log: validation fixes Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=46924r1=46923r2=46924view=diff == --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Feb 10 02:18:42 2008 @@ -152,6 +152,8 @@ href=tutorial/index.htmltutorials/a, which explain how to implement a language with LLVM and shows how to use several important APIs./li +/ul + /div !--=-- @@ -697,7 +699,7 @@ a href=http://jigsaw.w3.org/css-validator/check/referer;img src=http://jigsaw.w3.org/css-validator/images/vcss; alt=Valid CSS!/a a href=http://validator.w3.org/check/referer;img - src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01! //a + src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a a href=http://llvm.org/;LLVM Compiler Infrastructure/abr Last modified: $Date$ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r46929 - /llvm/trunk/docs/ReleaseNotes.html
Author: lattner Date: Sun Feb 10 11:52:05 2008 New Revision: 46929 URL: http://llvm.org/viewvc/llvm-project?rev=46929view=rev Log: close an li tag Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=46929r1=46928r2=46929view=diff == --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Feb 10 11:52:05 2008 @@ -130,7 +130,7 @@ (GNAT) and Fortran (gfortran) front-ends. These front-ends should still be considered experimental however: see the a href=#knownproblemslist of known problems/a. The release binaries do not contain either front-end: they need to be built from -source (the Ada front-end only builds on x86-32 linux). +source (the Ada front-end only builds on x86-32 linux)./li liDale contributed full support for long double on x86/x86-64 (where it is 80 bits) and on Darwin PPC/PPC64 (where it is 128 bits). In previous LLVM ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/www-index.html
Changes in directory llvm-www: www-index.html updated: 1.151 - 1.152 --- Log message: link to all the tutorials. --- Diffs of the changes: (+2 -2) www-index.html |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.151 llvm-www/www-index.html:1.152 --- llvm-www/www-index.html:1.151 Thu Jan 24 02:12:47 2008 +++ llvm-www/www-index.html Sun Feb 10 12:10:42 2008 @@ -79,8 +79,8 @@ div class=www_sectiontitleWant to learn more?/div -pIf you'd like to learn more about LLVM, take a look at a -href=pubs/2004-09-22-LCPCLLVMTutorial.htmlLLVM Tutorial/a and the extensive +pIf you'd like to learn more about LLVM, take a look at the a +href=docs/tutorial/LLVM Tutorials/a and the extensive a href=docs/documentation/a for LLVM. In particular, all of the tools distributed with LLVM are described in the a href=docs/CommandGuide/LLVM Command Guide/a. If you're interested in what ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] patches for the JIT and Kaleidoscope tutorials
On Jan 30, 2008, at 12:51 PM, Sam Bishop wrote: I have been working my way through the JIT and Kaleidoscope tutorials in my (minuscule) spare time. Thanks again for writing them! I have attached a patch containing some minor changes, ranging from spelling and grammar fixes to adding a Next: next tutorial section hyperlink to the bottom of each page. Every page has been given the next link treatment, but otherwise I'm only half way through the Kaleidoscope tutorial. I will send a follow-on patch if time permits. Applied, thanks Sam! http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080204/058073.html -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r46108 - in /llvm/trunk: lib/Transforms/IPO/ArgumentPromotion.cpp test/Transforms/ArgumentPromotion/attrs.ll
On Jan 17, 2008, at 1:45 AM, Duncan Sands wrote: Hi Chris, Fix arg promotion to propagate the correct attrs on the calls to promoted functions. This is important for varargs calls in particular. Thanks to duncan for providing a great testcase. you forgot about attributes on the function return value. Hi Duncan, I've lost the context for this, do you remember what this was about? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r46930 - in /llvm/trunk: Xcode/LLVM.xcodeproj/ docs/ include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/ARM/ lib/Target/
On Feb 10, 2008, at 10:45 AM, Dan Gohman wrote: Author: djg Date: Sun Feb 10 12:45:23 2008 New Revision: 46930 URL: http://llvm.org/viewvc/llvm-project?rev=46930view=rev Log: Rename MRegisterInfo to TargetRegisterInfo. Whoa, excellent! We've needed this for a long time, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r46932 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Author: lattner Date: Sun Feb 10 13:05:37 2008 New Revision: 46932 URL: http://llvm.org/viewvc/llvm-project?rev=46932view=rev Log: Fix scalarrepl to not 'miscompile' undefined code, part #2. This fixes the store case, my previous patch just fixed the load case. rdar://5707076. Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=46932r1=46931r2=46932view=diff == --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sun Feb 10 13:05:37 2008 @@ -1150,7 +1150,7 @@ // then 'or' into place. Value *SV = SI-getOperand(0); const Type *AllocaType = NewAI-getType()-getElementType(); - if (SV-getType() == AllocaType) { + if (SV-getType() == AllocaType Offset == 0) { // All is well. } else if (const VectorType *PTy = dyn_castVectorType(AllocaType)) { Value *Old = new LoadInst(NewAI, NewAI-getName()+.in, SI); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r46933 - in /llvm/trunk/docs/tutorial: JITTutorial1.html JITTutorial2.html LangImpl1.html LangImpl2.html LangImpl3.html LangImpl4.html LangImpl5.html LangImpl6.html LangImpl7.htm
Author: lattner Date: Sun Feb 10 13:11:04 2008 New Revision: 46933 URL: http://llvm.org/viewvc/llvm-project?rev=46933view=rev Log: Various updates from Sam Bishop: I have been working my way through the JIT and Kaleidoscope tutorials in my (minuscule) spare time. Thanks again for writing them! I have attached a patch containing some minor changes, ranging from spelling and grammar fixes to adding a Next: next tutorial section hyperlink to the bottom of each page. Every page has been given the next link treatment, but otherwise I'm only half way through the Kaleidoscope tutorial. I will send a follow-on patch if time permits. Modified: llvm/trunk/docs/tutorial/JITTutorial1.html llvm/trunk/docs/tutorial/JITTutorial2.html llvm/trunk/docs/tutorial/LangImpl1.html llvm/trunk/docs/tutorial/LangImpl2.html llvm/trunk/docs/tutorial/LangImpl3.html llvm/trunk/docs/tutorial/LangImpl4.html llvm/trunk/docs/tutorial/LangImpl5.html llvm/trunk/docs/tutorial/LangImpl6.html llvm/trunk/docs/tutorial/LangImpl7.html Modified: llvm/trunk/docs/tutorial/JITTutorial1.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/JITTutorial1.html?rev=46933r1=46932r2=46933view=diff == --- llvm/trunk/docs/tutorial/JITTutorial1.html (original) +++ llvm/trunk/docs/tutorial/JITTutorial1.html Sun Feb 10 13:11:04 2008 @@ -25,7 +25,7 @@ div class=doc_text -pFor starters, lets consider a relatively straightforward function that takes three integer parameters and returns an arithmetic combination of them. This is nice and simple, especially since it involves no control flow:/p +pFor starters, let's consider a relatively straightforward function that takes three integer parameters and returns an arithmetic combination of them. This is nice and simple, especially since it involves no control flow:/p div class=doc_code pre @@ -86,7 +86,7 @@ /pre /div -pThe first segment is pretty simple: it creates an LLVM âmodule.â In LLVM, a module represents a single unit of code that is to be processed together. A module contains things like global variables and function declarations and implementations. Here, weâve declared a codemakeLLVMModule()/code function to do the real work of creating the module. Donât worry, weâll be looking at that one next!/p +pThe first segment is pretty simple: it creates an LLVM âmodule.â In LLVM, a module represents a single unit of code that is to be processed together. A module contains things like global variables, function declarations, and implementations. Here weâve declared a codemakeLLVMModule()/code function to do the real work of creating the module. Donât worry, weâll be looking at that one next!/p pThe second segment runs the LLVM module verifier on our newly created module. While this probably isnât really necessary for a simple module like this one, itâs always a good idea, especially if youâre generating LLVM IR based on some input. The verifier will print an error message if your LLVM module is malformed in any way./p @@ -106,7 +106,7 @@ div class=doc_code pre - Constant* c = mod-getOrInsertFunction(mul_add, + Constant* c = mod-gt;getOrInsertFunction(mul_add, /*ret type*/ IntegerType::get(32), /*args*/ IntegerType::get(32), IntegerType::get(32), @@ -114,31 +114,31 @@ /*varargs terminated with null*/ NULL); Function* mul_add = castlt;Functiongt;(c); - mul_add-setCallingConv(CallingConv::C); + mul_add-gt;setCallingConv(CallingConv::C); /pre /div -pWe construct our codeFunction/code by calling codegetOrInsertFunction()/code on our module, passing in the name, return type, and argument types of the function. In the case of our codemul_add/code function, that means one 32-bit integer for the return value, and three 32-bit integers for the arguments./p +pWe construct our codeFunction/code by calling codegetOrInsertFunction()/code on our module, passing in the name, return type, and argument types of the function. In the case of our codemul_add/code function, that means one 32-bit integer for the return value and three 32-bit integers for the arguments./p -pYou'll notice that codegetOrInsertFunction/code doesn't actually return a codeFunction*/code. This is because, if the function already existed, but with a different prototype, codegetOrInsertFunction/code will return a cast of the existing function to the desired prototype. Since we know that there's not already a codemul_add/code function, we can safely just cast codec/code to a codeFunction*/code. +pYou'll notice that codegetOrInsertFunction()/code doesn't actually return a codeFunction*/code. This is because codegetOrInsertFunction()/code will return a cast of the existing function if the function already
Re: [llvm-commits] [llvm] r46827 - memoperands #1
On Feb 6, 2008, at 2:27 PM, Dan Gohman wrote: URL: http://llvm.org/viewvc/llvm-project?rev=46827view=rev Log: Create a new class, MemOperand, for describing memory references in the backend. Introduce a new SDNode type, MemOperandSDNode, for holding a MemOperand in the SelectionDAG IR, and add a MemOperand list to MachineInstr, and code to manage them. Remove the offset field from SrcValueSDNode; uses of SrcValueSDNode that were using it are all all using MemOperandSDNode now. Also, begin updating some getLoad and getStore calls to use the PseudoSourceValue objects. Most of this was written by Florian Brander, some reorganization and updating to TOT by me. Re-apply the memory operand changes, with a fix for the static initializer problem, a minor tweak to the way the DAGISelEmitter finds load/store nodes, and a renaming of the new PseudoSourceValue objects. This is very nice work guys. Some thoughts: class MemOperand { Should this be named MachineMemOperand, or something like that, for consistency? unsigned int Flags; int Offset; int Size; unsigned int Alignment; Is 32 bits sufficient for offset information? Are there any targets that can do reg+largeoffset? If you store Alignment in power-of-two form, you can make it be a short, and then pack flags+alignment into the same word. Instead of Size here, would it make sense to store an MVT? That would seem to capture strictly more information, thought I'm not sure if it's directly useful right now. Is the Value* always required to have llvm::PointerType if nonnull? If so, it would be useful to add a comment stating that. When we have more support for alternate address spaces in the backend, this could be a useful invariant to have. In MachineInstr, is there any semantics associated with the ordering of memoperands? Are there any current targets that have instructions with multiple memoperands? Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=46585r1=46584r2=46585view=diff = = = = = = = = == --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jan 30 18:25:39 2008 @@ -381,8 +381,12 @@ SDOperand getIndexedStore(SDOperand OrigStoe, SDOperand Base, SDOperand Offset, ISD::MemIndexedMode AM); + // getSrcValue - Construct a node to track a Value* through the backend. + SDOperand getSrcValue(const Value *v); + + // getMemOperand - Construct a node to track a memory reference + // through the backend. + SDOperand getMemOperand(const MemOperand MO); What is the difference between a SrcValueSDNode and a MemOperandSDNode now? Is the former a special case of the later? +/// MemOperandSDNode - An SDNode that holds a MemOperand. This is +/// used to represent a reference to memory after ISD::LOAD +/// and ISD::STORE have been lowered. +/// +class MemOperandSDNode : public SDNode { + virtual void ANCHOR(); // Out-of-line virtual method to give class a home. +protected: + friend class SelectionDAG; + /// Create a MemOperand node + explicit MemOperandSDNode(MemOperand mo) This should probably take 'mo' by const reference to avoid a copy. @@ -1546,6 +1573,10 @@ /// isUnindexed - Return true if this is NOT a pre/post inc/dec load/store. bool isUnindexed() const { return AddrMode == ISD::UNINDEXED; } + /// getMemOperand - Return a MemOperand object describing the memory + /// reference performed by this load or store. + MemOperand getMemOperand() const; Would it make sense to merge all the fields in LSBaseSDNode into a MemOperand ivar? = = = = = = = = == --- llvm/trunk/lib/CodeGen/PseudoSourceValue.cpp (original) +++ llvm/trunk/lib/CodeGen/PseudoSourceValue.cpp Wed Feb 6 16:27:42 2008 @@ -0,0 +1,41 @@ ... +namespace llvm { + static ManagedStaticPseudoSourceValue[5] PSVs; + + const PseudoSourceValue PseudoSourceValue::getFixedStack() { return (*PSVs)[0]; } + const PseudoSourceValue PseudoSourceValue::getStack() { return (*PSVs)[1]; } + const PseudoSourceValue PseudoSourceValue::getGOT() { return (*PSVs)[2]; } + const PseudoSourceValue PseudoSourceValue::getConstantPool() { return (*PSVs)[3]; } + const PseudoSourceValue PseudoSourceValue::getJumpTable() { return (*PSVs)[4]; } + 80 col violations, but otherwise looks nice. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=46827r1=46826r2=46827view=diff = = = = = = = = == ---
Re: [llvm-commits] [llvm] r46108 - in /llvm/trunk: lib/Transforms/IPO/ArgumentPromotion.cpp test/Transforms/ArgumentPromotion/attrs.ll
On Feb 10, 2008, at 11:56 AM, Duncan Sands wrote: you forgot about attributes on the function return value. I've lost the context for this, do you remember what this was about? I fixed it for you already :) Ahh, thanks :) :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r46827 - MemOperands #2/2
On Feb 6, 2008, at 2:27 PM, Dan Gohman wrote: URL: http://llvm.org/viewvc/llvm-project?rev=46827view=rev Log: Re-apply the memory operand changes, with a fix for the static initializer problem, a minor tweak to the way the DAGISelEmitter finds load/store nodes, and a renaming of the new PseudoSourceValue objects. Continuing the review: = = = = = = = = == --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Wed Feb 6 16:27:42 2008 @@ -277,15 +277,27 @@ return N; } +/// CountOperands - The inputs to target nodes have any actual inputs first, +/// followed by optional memory operands chain operand, then flag operands. Strictly speaking, a node can have at most one flag operand. This comment isn't your bug, but it would be nice to fix it :) +/// Compute the number of actual operands that will go into the machine istr. istr - instr or instruction? Also, double space before 'will'. unsigned ScheduleDAG::CountOperands(SDNode *Node) { unsigned N = Node-getNumOperands(); while (N Node-getOperand(N - 1).getValueType() == MVT::Flag) --N; if (N Node-getOperand(N - 1).getValueType() == MVT::Other) --N; // Ignore chain if it exists. + while (N MemOperandSDNode::classof(Node-getOperand(N - 1).Val)) Instead of calling classof, please use: N isaMemOperandSDNode(...) +--N; // Ignore MemOperand nodes + return N; +} + +/// CountMemOperands - Find the index of the last MemOperandSDNode operand +unsigned ScheduleDAG::CountMemOperands(SDNode *Node) { Please rename this method. The name implies that it returns the number of mem operands, not the index of the last one. = = = = = = = = == --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Feb 6 16:27:42 2008 @@ -3503,6 +3535,26 @@ TheGlobal = const_castGlobalValue*(GA); } +/// getMemOperand - Return a MemOperand object describing the memory +/// reference performed by this load or store. +MemOperand LSBaseSDNode::getMemOperand() const { + int Size = (MVT::getSizeInBits(getMemoryVT()) + 7) 3; + int Flags = +getOpcode() == ISD::LOAD ? MemOperand::MOLoad : MemOperand::MOStore; + if (IsVolatile) Flags |= MemOperand::MOVolatile; + + // Check if the load references a frame index, and does not have + // an SV attached. + const FrameIndexSDNode *FI = +dyn_castconst FrameIndexSDNode(getBasePtr().Val); + if (!getSrcValue() FI) +return MemOperand(PseudoSourceValue::getFixedStack(), Flags, + FI-getIndex(), Size, Alignment); + else +return MemOperand(getSrcValue(), Flags, + getSrcValueOffset(), Size, Alignment); This logic seems correct, but would be more clear (at least to me) if written as: if (getSrcValue() || !FI) +return MemOperand(getSrcValue(), Flags, + getSrcValueOffset(), Size, Alignment); else + if (!getSrcValue() FI) +return MemOperand(PseudoSourceValue::getFixedStack(), Flags, + FI-getIndex(), Size, Alignment); It would be even easier if LSBaseSDNode just contained a memoperand to return by const reference though :) = = = = = = = = == --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Feb 6 16:27:42 2008 @@ -2199,9 +2203,11 @@ Op.getOperand(0)); // STD the extended value into the stack slot. + MemOperand MO(PseudoSourceValue::getFixedStack(), +MemOperand::MOStore, FrameIdx, 8, 8); Ah, this is interesting. I had to go look at the header file to make sure this is correct: wouldn't it make sense for the offset/index to be passed after the Value*? I would expect to see something like: + MemOperand MO(PseudoSourceValue::getFixedStack(), FrameIdx, +MemOperand::MOStore, 8, 8); instead of splitting the two. If MemOperand stored an MVT instead of a size, it would make it a bit more clear what was going on, because the magic constants would be reduced: + MemOperand MO(PseudoSourceValue::getFixedStack(), FrameIdx, +MemOperand::MOStore, MVT::i64, 8); etc. = = = = = = = = == --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Wed Feb 6 16:27:42 2008 @@ -313,6 +313,12 @@ std::vectorstd::pairstd::string, std::string OrigChains; std::setstd::string Duplicates; + /// LSI - Load/Store information. + /// Save
Re: [llvm-commits] Fix for PR1798 (ScalarEvolution)
On Feb 9, 2008, at 9:26 AM, Wojciech Matyjewicz wrote: Hi, I've attached an updated version of the patch. It is ready for using support for APInts in the code generator, but currently it doesn't rely on this feature. I've added a hack that rounds up the computation bitwidth to power of 2 (only these bitwidths are allowed: 1, 2, ..., 64). Hack is visible and very easy to remove in future. Is it safe to commit it now? The patch looks good to me. Nicholas, can you please review it also? If Nicholas likes it, please commit, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r46952 - /llvm/trunk/docs/ReleaseNotes.html
Author: lattner Date: Mon Feb 11 01:27:21 2008 New Revision: 46952 URL: http://llvm.org/viewvc/llvm-project?rev=46952view=rev Log: tweaks from dale. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=46952r1=46951r2=46952view=diff == --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Mon Feb 11 01:27:21 2008 @@ -292,8 +292,8 @@ liEvan contributed support to the X86 backend to model the mod/ref behavior of the EFLAGS register explicitly in all instructions. This gives more freedom to the scheduler, and is a more explicit way to model the instructions./li -liDale contributed support for exception handling on Darwin/x86-64 and -Darwin/PPC./li +liDale contributed support for exception handling on Darwin/PPC and he and +Anton got x86-64 working./li liEvan turned on if-conversion by default for ARM, allowing LLVM to take advantage of its predication features./li liBruno added PIC support to the MIPS backend, fixed many bugs and improved ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits