From sabre at nondot.org Mon Dec 21 00:03:06 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 06:03:06 -0000 Subject: [llvm-commits] [llvm] r91814 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/select.ll Message-ID: <200912210603.nBL636Zw010031@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 00:03:05 2009 New Revision: 91814 URL: http://llvm.org/viewvc/llvm-project?rev=91814&view=rev Log: give instcombine some helper functions for matching MIN and MAX, and implement some optimizations for MIN(MIN()) and MAX(MAX()) and MIN(MAX()) etc. This substantially improves the code in PR5822 but doesn't kick in much elsewhere. 2 max's were optimized in pairlocalalign and one in smg2000. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/select.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=91814&r1=91813&r2=91814&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Dec 21 00:03:05 2009 @@ -75,6 +75,15 @@ STATISTIC(NumDeadStore, "Number of dead stores eliminated"); STATISTIC(NumSunkInst , "Number of instructions sunk"); +/// SelectPatternFlavor - We can match a variety of different patterns for +/// select operations. +enum SelectPatternFlavor { + SPF_UNKNOWN = 0, + SPF_SMIN, SPF_UMIN, + SPF_SMAX, SPF_UMAX + //SPF_ABS - TODO. +}; + namespace { /// InstCombineWorklist - This is the worklist management logic for /// InstCombine. @@ -281,6 +290,9 @@ Instruction *FoldSelectOpOp(SelectInst &SI, Instruction *TI, Instruction *FI); Instruction *FoldSelectIntoOp(SelectInst &SI, Value*, Value*); + Instruction *FoldSPFofSPF(Instruction *Inner, SelectPatternFlavor SPF1, + Value *A, Value *B, Instruction &Outer, + SelectPatternFlavor SPF2, Value *C); Instruction *visitSelectInst(SelectInst &SI); Instruction *visitSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI); Instruction *visitCallInst(CallInst &CI); @@ -649,6 +661,57 @@ return 0; } +/// MatchSelectPattern - Pattern match integer [SU]MIN, [SU]MAX, and ABS idioms, +/// returning the kind and providing the out parameter results if we +/// successfully match. +static SelectPatternFlavor +MatchSelectPattern(Value *V, Value *&LHS, Value *&RHS) { + SelectInst *SI = dyn_cast(V); + if (SI == 0) return SPF_UNKNOWN; + + ICmpInst *ICI = dyn_cast(SI->getCondition()); + if (ICI == 0) return SPF_UNKNOWN; + + LHS = ICI->getOperand(0); + RHS = ICI->getOperand(1); + + // (icmp X, Y) ? X : Y + if (SI->getTrueValue() == ICI->getOperand(0) && + SI->getFalseValue() == ICI->getOperand(1)) { + switch (ICI->getPredicate()) { + default: return SPF_UNKNOWN; // Equality. + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_UGE: return SPF_UMAX; + case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_SGE: return SPF_SMAX; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_ULE: return SPF_UMIN; + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_SLE: return SPF_SMIN; + } + } + + // (icmp X, Y) ? Y : X + if (SI->getTrueValue() == ICI->getOperand(1) && + SI->getFalseValue() == ICI->getOperand(0)) { + switch (ICI->getPredicate()) { + default: return SPF_UNKNOWN; // Equality. + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_UGE: return SPF_UMIN; + case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_SGE: return SPF_SMIN; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_ULE: return SPF_UMAX; + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_SLE: return SPF_SMAX; + } + } + + // TODO: (X > 4) ? X : 5 --> (X >= 5) ? X : 5 --> MAX(X, 5) + + return SPF_UNKNOWN; +} + /// isFreeToInvert - Return true if the specified value is free to invert (apply /// ~ to). This happens in cases where the ~ can be eliminated. static inline bool isFreeToInvert(Value *V) { @@ -733,12 +796,12 @@ APInt MulExt = LHSExt * RHSExt; - if (sign) { - APInt Min = APInt::getSignedMinValue(W).sext(W * 2); - APInt Max = APInt::getSignedMaxValue(W).sext(W * 2); - return MulExt.slt(Min) || MulExt.sgt(Max); - } else + if (!sign) return MulExt.ugt(APInt::getLowBitsSet(W * 2, W)); + + APInt Min = APInt::getSignedMinValue(W).sext(W * 2); + APInt Max = APInt::getSignedMaxValue(W).sext(W * 2); + return MulExt.slt(Min) || MulExt.sgt(Max); } @@ -9479,9 +9542,6 @@ return ReplaceInstUsesWith(SI, TrueVal); /// NOTE: if we wanted to, this is where to detect integer MIN/MAX } - - /// NOTE: if we wanted to, this is where to detect integer ABS - return Changed ? &SI : 0; } @@ -9523,6 +9583,35 @@ return false; } +/// FoldSPFofSPF - We have an SPF (e.g. a min or max) of an SPF of the form: +/// SPF2(SPF1(A, B), C) +Instruction *InstCombiner::FoldSPFofSPF(Instruction *Inner, + SelectPatternFlavor SPF1, + Value *A, Value *B, + Instruction &Outer, + SelectPatternFlavor SPF2, Value *C) { + if (C == A || C == B) { + // MAX(MAX(A, B), B) -> MAX(A, B) + // MIN(MIN(a, b), a) -> MIN(a, b) + if (SPF1 == SPF2) + return ReplaceInstUsesWith(Outer, Inner); + + // MAX(MIN(a, b), a) -> a + // MIN(MAX(a, b), a) -> a + if (SPF1 == SPF_SMIN && SPF2 == SPF_SMAX || + SPF1 == SPF_SMAX && SPF2 == SPF_SMIN || + SPF1 == SPF_UMIN && SPF2 == SPF_UMAX || + SPF1 == SPF_UMAX && SPF2 == SPF_UMIN) + return ReplaceInstUsesWith(Outer, C); + } + + // TODO: MIN(MIN(A, 23), 97) + return 0; +} + + + + Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { Value *CondVal = SI.getCondition(); Value *TrueVal = SI.getTrueValue(); @@ -9729,9 +9818,28 @@ // See if we can fold the select into one of our operands. if (SI.getType()->isInteger()) { - Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal); - if (FoldI) + if (Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal)) return FoldI; + + // MAX(MAX(a, b), a) -> MAX(a, b) + // MIN(MIN(a, b), a) -> MIN(a, b) + // MAX(MIN(a, b), a) -> a + // MIN(MAX(a, b), a) -> a + Value *LHS, *RHS, *LHS2, *RHS2; + if (SelectPatternFlavor SPF = MatchSelectPattern(&SI, LHS, RHS)) { + if (SelectPatternFlavor SPF2 = MatchSelectPattern(LHS, LHS2, RHS2)) + if (Instruction *R = FoldSPFofSPF(cast(LHS),SPF2,LHS2,RHS2, + SI, SPF, RHS)) + return R; + if (SelectPatternFlavor SPF2 = MatchSelectPattern(RHS, LHS2, RHS2)) + if (Instruction *R = FoldSPFofSPF(cast(RHS),SPF2,LHS2,RHS2, + SI, SPF, LHS)) + return R; + } + + // TODO. + // ABS(-X) -> ABS(X) + // ABS(ABS(X)) -> ABS(X) } // See if we can fold the select into a phi node if the condition is a select. Modified: llvm/trunk/test/Transforms/InstCombine/select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select.ll?rev=91814&r1=91813&r2=91814&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/select.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/select.ll Mon Dec 21 00:03:05 2009 @@ -382,3 +382,43 @@ ; CHECK-NEXT: ret i32 %a } + +define i32 @test30(i32 %x, i32 %y) { + %cmp = icmp sgt i32 %x, %y + %cond = select i1 %cmp, i32 %x, i32 %y + %cmp5 = icmp sgt i32 %cond, %x + %retval = select i1 %cmp5, i32 %cond, i32 %x + ret i32 %retval +} + +define i32 @test31(i32 %x, i32 %y) { + %cmp = icmp ugt i32 %x, %y + %cond = select i1 %cmp, i32 %x, i32 %y + %cmp5 = icmp ugt i32 %cond, %x + %retval = select i1 %cmp5, i32 %cond, i32 %x + ret i32 %retval +} + +define i32 @test32(i32 %x, i32 %y) { + %cmp = icmp sgt i32 %x, %y + %cond = select i1 %cmp, i32 %y, i32 %x + %cmp5 = icmp sgt i32 %cond, %x + %retval = select i1 %cmp5, i32 %x, i32 %cond + ret i32 %retval +} + +define i32 @test33(i32 %x, i32 %y) { + %cmp = icmp sgt i32 %x, %y + %cond = select i1 %cmp, i32 %y, i32 %x + %cmp5 = icmp sgt i32 %cond, %x + %retval = select i1 %cmp5, i32 %cond, i32 %x + ret i32 %retval +} + +define i32 @test34(i32 %x, i32 %y) { + %cmp = icmp sgt i32 %x, %y + %cond = select i1 %cmp, i32 %x, i32 %y + %cmp5 = icmp sgt i32 %cond, %x + %retval = select i1 %cmp5, i32 %x, i32 %cond + ret i32 %retval +} From sabre at nondot.org Mon Dec 21 00:06:10 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 06:06:10 -0000 Subject: [llvm-commits] [llvm] r91815 - /llvm/trunk/test/Transforms/InstCombine/select.ll Message-ID: <200912210606.nBL66AZk010132@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 00:06:10 2009 New Revision: 91815 URL: http://llvm.org/viewvc/llvm-project?rev=91815&view=rev Log: really convert this to filecheck. Modified: llvm/trunk/test/Transforms/InstCombine/select.ll Modified: llvm/trunk/test/Transforms/InstCombine/select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select.ll?rev=91815&r1=91814&r2=91815&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/select.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/select.ll Mon Dec 21 00:06:10 2009 @@ -1,7 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; PR1822 -; RUN: opt < %s -instcombine -S | not grep select +; RUN: opt < %s -instcombine -S | FileCheck %s define i32 @test1(i32 %A, i32 %B) { %C = select i1 false, i32 %A, i32 %B @@ -97,7 +97,7 @@ ; CHECK: @test11 ; CHECK: icmp ne i32 %a, 0 ; CHECK: %R = zext i1 -; CHECK: ret i1 %R +; CHECK: ret i32 %R } define i32 @test12(i1 %cond, i32 %a) { @@ -284,7 +284,7 @@ %tmp = icmp slt i32 %x, 0 %retval = select i1 %tmp, i16 -1, i16 0 ret i16 %retval -; CHECK: @test21 +; CHECK: @test22 ; CHECK-NEXT: ashr i32 %x, 31 ; CHECK-NEXT: trunc i32 ; CHECK-NEXT: ret i16 @@ -377,9 +377,9 @@ next: %b = select i1 %a, i32 %A, i32 %c ret i32 %b -; CHECK: @test25 +; CHECK: @test29 ; CHECK: %a = phi i32 [ %A, %jump ], [ %B, %entry ] -; CHECK-NEXT: ret i32 %a +; CHECK: ret i32 %a } From sabre at nondot.org Mon Dec 21 00:08:50 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 06:08:50 -0000 Subject: [llvm-commits] [llvm] r91816 - /llvm/trunk/test/Transforms/InstCombine/select.ll Message-ID: <200912210608.nBL68ogD010219@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 00:08:50 2009 New Revision: 91816 URL: http://llvm.org/viewvc/llvm-project?rev=91816&view=rev Log: add check lines for min/max tests. Modified: llvm/trunk/test/Transforms/InstCombine/select.ll Modified: llvm/trunk/test/Transforms/InstCombine/select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select.ll?rev=91816&r1=91815&r2=91816&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/select.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/select.ll Mon Dec 21 00:08:50 2009 @@ -383,42 +383,58 @@ } +; SMAX(SMAX(x, y), x) -> SMAX(x, y) define i32 @test30(i32 %x, i32 %y) { %cmp = icmp sgt i32 %x, %y %cond = select i1 %cmp, i32 %x, i32 %y + %cmp5 = icmp sgt i32 %cond, %x %retval = select i1 %cmp5, i32 %cond, i32 %x ret i32 %retval +; CHECK: @test30 +; CHECK: ret i32 %cond } +; UMAX(UMAX(x, y), x) -> UMAX(x, y) define i32 @test31(i32 %x, i32 %y) { %cmp = icmp ugt i32 %x, %y %cond = select i1 %cmp, i32 %x, i32 %y %cmp5 = icmp ugt i32 %cond, %x %retval = select i1 %cmp5, i32 %cond, i32 %x ret i32 %retval +; CHECK: @test31 +; CHECK: ret i32 %cond } +; SMIN(SMIN(x, y), x) -> SMIN(x, y) define i32 @test32(i32 %x, i32 %y) { %cmp = icmp sgt i32 %x, %y %cond = select i1 %cmp, i32 %y, i32 %x %cmp5 = icmp sgt i32 %cond, %x %retval = select i1 %cmp5, i32 %x, i32 %cond ret i32 %retval +; CHECK: @test32 +; CHECK: ret i32 %cond } +; MAX(MIN(x, y), x) -> x define i32 @test33(i32 %x, i32 %y) { %cmp = icmp sgt i32 %x, %y %cond = select i1 %cmp, i32 %y, i32 %x %cmp5 = icmp sgt i32 %cond, %x %retval = select i1 %cmp5, i32 %cond, i32 %x ret i32 %retval +; CHECK: @test33 +; CHECK: ret i32 %x } +; MIN(MAX(x, y), x) -> x define i32 @test34(i32 %x, i32 %y) { %cmp = icmp sgt i32 %x, %y %cond = select i1 %cmp, i32 %x, i32 %y %cmp5 = icmp sgt i32 %cond, %x %retval = select i1 %cmp5, i32 %x, i32 %cond ret i32 %retval +; CHECK: @test34 +; CHECK: ret i32 %x } From sabre at nondot.org Mon Dec 21 00:08:58 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 20 Dec 2009 22:08:58 -0800 Subject: [llvm-commits] [llvm] r91813 - /llvm/trunk/test/Transforms/InstCombine/select.ll In-Reply-To: <4B2F0DF0.4060002@mxc.ca> References: <200912210553.nBL5rDsO009658@zion.cs.uiuc.edu> <4B2F0DF0.4060002@mxc.ca> Message-ID: <7B36B82B-4910-4000-9CB9-AE4B4E09188A@nondot.org> doh, thanks! On Dec 20, 2009, at 9:56 PM, Nick Lewycky wrote: > Chris Lattner wrote: >> Author: lattner >> Date: Sun Dec 20 23:53:13 2009 >> New Revision: 91813 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=91813&view=rev >> Log: >> filecheckize >> >> Modified: >> llvm/trunk/test/Transforms/InstCombine/select.ll >> >> Modified: llvm/trunk/test/Transforms/InstCombine/select.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select.ll?rev=91813&r1=91812&r2=91813&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/Transforms/InstCombine/select.ll (original) >> +++ llvm/trunk/test/Transforms/InstCombine/select.ll Sun Dec 20 23:53:13 2009 >> @@ -4,202 +4,306 @@ >> ; RUN: opt < %s -instcombine -S | not grep select >> >> > Chris, I think you forgot the important part ;-) > > Nick >> define i32 @test1(i32 %A, i32 %B) { >> - %C = select i1 false, i32 %A, i32 %B ; [#uses=1] >> + %C = select i1 false, i32 %A, i32 %B >> ret i32 %C >> +; CHECK: @test1 >> +; CHECK: ret i32 %B >> } >> >> define i32 @test2(i32 %A, i32 %B) { >> - %C = select i1 true, i32 %A, i32 %B ; [#uses=1] >> + %C = select i1 true, i32 %A, i32 %B >> ret i32 %C >> +; CHECK: @test2 >> +; CHECK: ret i32 %A >> } >> >> >> define i32 @test3(i1 %C, i32 %I) { >> ; V = I >> - %V = select i1 %C, i32 %I, i32 %I ; [#uses=1] >> + %V = select i1 %C, i32 %I, i32 %I >> ret i32 %V >> +; CHECK: @test3 >> +; CHECK: ret i32 %I >> } >> >> define i1 @test4(i1 %C) { >> ; V = C >> - %V = select i1 %C, i1 true, i1 false ; [#uses=1] >> + %V = select i1 %C, i1 true, i1 false >> ret i1 %V >> +; CHECK: @test4 >> +; CHECK: ret i1 %C >> } >> >> define i1 @test5(i1 %C) { >> ; V = !C >> - %V = select i1 %C, i1 false, i1 true ; [#uses=1] >> + %V = select i1 %C, i1 false, i1 true >> ret i1 %V >> +; CHECK: @test5 >> +; CHECK: xor i1 %C, true >> +; CHECK: ret i1 >> } >> >> define i32 @test6(i1 %C) { >> ; V = cast C to int >> - %V = select i1 %C, i32 1, i32 0 ; [#uses=1] >> + %V = select i1 %C, i32 1, i32 0 >> ret i32 %V >> +; CHECK: @test6 >> +; CHECK: %V = zext i1 %C to i32 >> +; CHECK: ret i32 %V >> } >> >> define i1 @test7(i1 %C, i1 %X) { >> ; R = or C, X >> - %R = select i1 %C, i1 true, i1 %X ; [#uses=1] >> + %R = select i1 %C, i1 true, i1 %X >> ret i1 %R >> +; CHECK: @test7 >> +; CHECK: %R = or i1 %C, %X >> +; CHECK: ret i1 %R >> } >> >> define i1 @test8(i1 %C, i1 %X) { >> ; R = and C, X >> - %R = select i1 %C, i1 %X, i1 false ; [#uses=1] >> + %R = select i1 %C, i1 %X, i1 false >> ret i1 %R >> +; CHECK: @test8 >> +; CHECK: %R = and i1 %C, %X >> +; CHECK: ret i1 %R >> } >> >> define i1 @test9(i1 %C, i1 %X) { >> ; R = and !C, X >> - %R = select i1 %C, i1 false, i1 %X ; [#uses=1] >> + %R = select i1 %C, i1 false, i1 %X >> ret i1 %R >> +; CHECK: @test9 >> +; CHECK: xor i1 %C, true >> +; CHECK: %R = and i1 >> +; CHECK: ret i1 %R >> } >> >> define i1 @test10(i1 %C, i1 %X) { >> ; R = or !C, X >> - %R = select i1 %C, i1 %X, i1 true ; [#uses=1] >> + %R = select i1 %C, i1 %X, i1 true >> ret i1 %R >> +; CHECK: @test10 >> +; CHECK: xor i1 %C, true >> +; CHECK: %R = or i1 >> +; CHECK: ret i1 %R >> } >> >> define i32 @test11(i32 %a) { >> - %C = icmp eq i32 %a, 0 ; [#uses=1] >> - %R = select i1 %C, i32 0, i32 1 ; [#uses=1] >> + %C = icmp eq i32 %a, 0 >> + %R = select i1 %C, i32 0, i32 1 >> ret i32 %R >> +; CHECK: @test11 >> +; CHECK: icmp ne i32 %a, 0 >> +; CHECK: %R = zext i1 >> +; CHECK: ret i1 %R >> } >> >> define i32 @test12(i1 %cond, i32 %a) { >> - %b = or i32 %a, 1 ; [#uses=1] >> - %c = select i1 %cond, i32 %b, i32 %a ; [#uses=1] >> + %b = or i32 %a, 1 >> + %c = select i1 %cond, i32 %b, i32 %a >> ret i32 %c >> +; CHECK: @test12 >> +; CHECK: %b = zext i1 %cond to i32 >> +; CHECK: %c = or i32 %b, %a >> +; CHECK: ret i32 %c >> } >> >> define i32 @test12a(i1 %cond, i32 %a) { >> - %b = ashr i32 %a, 1 ; [#uses=1] >> - %c = select i1 %cond, i32 %b, i32 %a ; [#uses=1] >> + %b = ashr i32 %a, 1 >> + %c = select i1 %cond, i32 %b, i32 %a >> ret i32 %c >> +; CHECK: @test12a >> +; CHECK: %b = zext i1 %cond to i32 >> +; CHECK: %c = ashr i32 %a, %b >> +; CHECK: ret i32 %c >> } >> >> define i32 @test12b(i1 %cond, i32 %a) { >> - %b = ashr i32 %a, 1 ; [#uses=1] >> - %c = select i1 %cond, i32 %a, i32 %b ; [#uses=1] >> + %b = ashr i32 %a, 1 >> + %c = select i1 %cond, i32 %a, i32 %b >> ret i32 %c >> +; CHECK: @test12b >> +; CHECK: zext i1 %cond to i32 >> +; CHECK: %b = xor i32 >> +; CHECK: %c = ashr i32 %a, %b >> +; CHECK: ret i32 %c >> } >> >> define i32 @test13(i32 %a, i32 %b) { >> - %C = icmp eq i32 %a, %b ; [#uses=1] >> - %V = select i1 %C, i32 %a, i32 %b ; [#uses=1] >> + %C = icmp eq i32 %a, %b >> + %V = select i1 %C, i32 %a, i32 %b >> ret i32 %V >> +; CHECK: @test13 >> +; CHECK: ret i32 %b >> } >> >> define i32 @test13a(i32 %a, i32 %b) { >> - %C = icmp ne i32 %a, %b ; [#uses=1] >> - %V = select i1 %C, i32 %a, i32 %b ; [#uses=1] >> + %C = icmp ne i32 %a, %b >> + %V = select i1 %C, i32 %a, i32 %b >> ret i32 %V >> +; CHECK: @test13a >> +; CHECK: ret i32 %a >> } >> >> define i32 @test13b(i32 %a, i32 %b) { >> - %C = icmp eq i32 %a, %b ; [#uses=1] >> - %V = select i1 %C, i32 %b, i32 %a ; [#uses=1] >> + %C = icmp eq i32 %a, %b >> + %V = select i1 %C, i32 %b, i32 %a >> ret i32 %V >> +; CHECK: @test13b >> +; CHECK: ret i32 %a >> } >> >> define i1 @test14a(i1 %C, i32 %X) { >> - %V = select i1 %C, i32 %X, i32 0 ; [#uses=1] >> + %V = select i1 %C, i32 %X, i32 0 >> ; (X < 1) | !C >> - %R = icmp slt i32 %V, 1 ; [#uses=1] >> + %R = icmp slt i32 %V, 1 >> ret i1 %R >> +; CHECK: @test14a >> +; CHECK: icmp slt i32 %X, 1 >> +; CHECK: xor i1 %C, true >> +; CHECK: or i1 >> +; CHECK: ret i1 %R >> } >> >> define i1 @test14b(i1 %C, i32 %X) { >> - %V = select i1 %C, i32 0, i32 %X ; [#uses=1] >> + %V = select i1 %C, i32 0, i32 %X >> ; (X < 1) | C >> - %R = icmp slt i32 %V, 1 ; [#uses=1] >> + %R = icmp slt i32 %V, 1 >> ret i1 %R >> +; CHECK: @test14b >> +; CHECK: icmp slt i32 %X, 1 >> +; CHECK: or i1 >> +; CHECK: ret i1 %R >> } >> >> ;; Code sequence for (X & 16) ? 16 : 0 >> define i32 @test15a(i32 %X) { >> - %t1 = and i32 %X, 16 ; [#uses=1] >> - %t2 = icmp eq i32 %t1, 0 ; [#uses=1] >> - %t3 = select i1 %t2, i32 0, i32 16 ; [#uses=1] >> + %t1 = and i32 %X, 16 >> + %t2 = icmp eq i32 %t1, 0 >> + %t3 = select i1 %t2, i32 0, i32 16 >> ret i32 %t3 >> +; CHECK: @test15a >> +; CHECK: %t1 = and i32 %X, 16 >> +; CHECK: ret i32 %t1 >> } >> >> ;; Code sequence for (X & 32) ? 0 : 24 >> define i32 @test15b(i32 %X) { >> - %t1 = and i32 %X, 32 ; [#uses=1] >> - %t2 = icmp eq i32 %t1, 0 ; [#uses=1] >> - %t3 = select i1 %t2, i32 32, i32 0 ; [#uses=1] >> + %t1 = and i32 %X, 32 >> + %t2 = icmp eq i32 %t1, 0 >> + %t3 = select i1 %t2, i32 32, i32 0 >> ret i32 %t3 >> +; CHECK: @test15b >> +; CHECK: %t1 = and i32 %X, 32 >> +; CHECK: xor i32 %t1, 32 >> +; CHECK: ret i32 >> } >> >> ;; Alternate code sequence for (X & 16) ? 16 : 0 >> define i32 @test15c(i32 %X) { >> - %t1 = and i32 %X, 16 ; [#uses=1] >> - %t2 = icmp eq i32 %t1, 16 ; [#uses=1] >> - %t3 = select i1 %t2, i32 16, i32 0 ; [#uses=1] >> + %t1 = and i32 %X, 16 >> + %t2 = icmp eq i32 %t1, 16 >> + %t3 = select i1 %t2, i32 16, i32 0 >> ret i32 %t3 >> +; CHECK: @test15c >> +; CHECK: %t1 = and i32 %X, 16 >> +; CHECK: ret i32 %t1 >> } >> >> ;; Alternate code sequence for (X & 16) ? 16 : 0 >> define i32 @test15d(i32 %X) { >> - %t1 = and i32 %X, 16 ; [#uses=1] >> - %t2 = icmp ne i32 %t1, 0 ; [#uses=1] >> - %t3 = select i1 %t2, i32 16, i32 0 ; [#uses=1] >> + %t1 = and i32 %X, 16 >> + %t2 = icmp ne i32 %t1, 0 >> + %t3 = select i1 %t2, i32 16, i32 0 >> ret i32 %t3 >> +; CHECK: @test15d >> +; CHECK: %t1 = and i32 %X, 16 >> +; CHECK: ret i32 %t1 >> } >> >> define i32 @test16(i1 %C, i32* %P) { >> - %P2 = select i1 %C, i32* %P, i32* null ; [#uses=1] >> - %V = load i32* %P2 ; [#uses=1] >> + %P2 = select i1 %C, i32* %P, i32* null >> + %V = load i32* %P2 >> ret i32 %V >> +; CHECK: @test16 >> +; CHECK-NEXT: %V = load i32* %P >> +; CHECK: ret i32 %V >> } >> >> define i1 @test17(i32* %X, i1 %C) { >> - %R = select i1 %C, i32* %X, i32* null ; [#uses=1] >> - %RV = icmp eq i32* %R, null ; [#uses=1] >> + %R = select i1 %C, i32* %X, i32* null >> + %RV = icmp eq i32* %R, null >> ret i1 %RV >> +; CHECK: @test17 >> +; CHECK: icmp eq i32* %X, null >> +; CHECK: xor i1 %C, true >> +; CHECK: %RV = or i1 >> +; CHECK: ret i1 %RV >> } >> >> define i32 @test18(i32 %X, i32 %Y, i1 %C) { >> - %R = select i1 %C, i32 %X, i32 0 ; [#uses=1] >> - %V = sdiv i32 %Y, %R ; [#uses=1] >> + %R = select i1 %C, i32 %X, i32 0 >> + %V = sdiv i32 %Y, %R >> ret i32 %V >> +; CHECK: @test18 >> +; CHECK: %V = sdiv i32 %Y, %X >> +; CHECK: ret i32 %V >> } >> >> define i32 @test19(i32 %x) { >> - %tmp = icmp ugt i32 %x, 2147483647 ; [#uses=1] >> - %retval = select i1 %tmp, i32 -1, i32 0 ; [#uses=1] >> + %tmp = icmp ugt i32 %x, 2147483647 >> + %retval = select i1 %tmp, i32 -1, i32 0 >> ret i32 %retval >> +; CHECK: @test19 >> +; CHECK-NEXT: ashr i32 %x, 31 >> +; CHECK-NEXT: ret i32 >> } >> >> define i32 @test20(i32 %x) { >> - %tmp = icmp slt i32 %x, 0 ; [#uses=1] >> - %retval = select i1 %tmp, i32 -1, i32 0 ; [#uses=1] >> + %tmp = icmp slt i32 %x, 0 >> + %retval = select i1 %tmp, i32 -1, i32 0 >> ret i32 %retval >> +; CHECK: @test20 >> +; CHECK-NEXT: ashr i32 %x, 31 >> +; CHECK-NEXT: ret i32 >> } >> >> define i64 @test21(i32 %x) { >> - %tmp = icmp slt i32 %x, 0 ; [#uses=1] >> - %retval = select i1 %tmp, i64 -1, i64 0 ; [#uses=1] >> + %tmp = icmp slt i32 %x, 0 >> + %retval = select i1 %tmp, i64 -1, i64 0 >> ret i64 %retval >> +; CHECK: @test21 >> +; CHECK-NEXT: ashr i32 %x, 31 >> +; CHECK-NEXT: sext i32 >> +; CHECK-NEXT: ret i64 >> } >> >> define i16 @test22(i32 %x) { >> - %tmp = icmp slt i32 %x, 0 ; [#uses=1] >> - %retval = select i1 %tmp, i16 -1, i16 0 ; [#uses=1] >> + %tmp = icmp slt i32 %x, 0 >> + %retval = select i1 %tmp, i16 -1, i16 0 >> ret i16 %retval >> +; CHECK: @test21 >> +; CHECK-NEXT: ashr i32 %x, 31 >> +; CHECK-NEXT: trunc i32 >> +; CHECK-NEXT: ret i16 >> } >> >> define i1 @test23(i1 %a, i1 %b) { >> - %c = select i1 %a, i1 %b, i1 %a ; [#uses=1] >> + %c = select i1 %a, i1 %b, i1 %a >> ret i1 %c >> +; CHECK: @test23 >> +; CHECK-NEXT: %c = and i1 %a, %b >> +; CHECK-NEXT: ret i1 %c >> } >> >> define i1 @test24(i1 %a, i1 %b) { >> - %c = select i1 %a, i1 %a, i1 %b ; [#uses=1] >> + %c = select i1 %a, i1 %a, i1 %b >> ret i1 %c >> +; CHECK: @test24 >> +; CHECK-NEXT: %c = or i1 %a, %b >> +; CHECK-NEXT: ret i1 %c >> } >> >> define i32 @test25(i1 %c) { >> @@ -211,6 +315,9 @@ >> %a = phi i1 [true, %jump], [false, %entry] >> %b = select i1 %a, i32 10, i32 20 >> ret i32 %b >> +; CHECK: @test25 >> +; CHECK: %a = phi i32 [ 10, %jump ], [ 20, %entry ] >> +; CHECK-NEXT: ret i32 %a >> } >> >> define i32 @test26(i1 %cond) { >> @@ -223,6 +330,9 @@ >> %a = phi i1 [true, %jump], [%c, %entry] >> %b = select i1 %a, i32 10, i32 20 >> ret i32 %b >> +; CHECK: @test26 >> +; CHECK: %a = phi i32 [ 10, %jump ], [ 20, %entry ] >> +; CHECK-NEXT: ret i32 %a >> } >> >> define i32 @test27(i1 %c, i32 %A, i32 %B) { >> @@ -234,6 +344,9 @@ >> %a = phi i1 [true, %jump], [false, %entry] >> %b = select i1 %a, i32 %A, i32 %B >> ret i32 %b >> +; CHECK: @test27 >> +; CHECK: %a = phi i32 [ %A, %jump ], [ %B, %entry ] >> +; CHECK-NEXT: ret i32 %a >> } >> >> define i32 @test28(i1 %cond, i32 %A, i32 %B) { >> @@ -246,6 +359,9 @@ >> %a = phi i1 [true, %jump], [false, %entry] >> %b = select i1 %a, i32 %A, i32 %c >> ret i32 %b >> +; CHECK: @test28 >> +; CHECK: %a = phi i32 [ %A, %jump ], [ %B, %entry ] >> +; CHECK-NEXT: ret i32 %a >> } >> >> define i32 @test29(i1 %cond, i32 %A, i32 %B) { >> @@ -261,5 +377,8 @@ >> next: >> %b = select i1 %a, i32 %A, i32 %c >> ret i32 %b >> +; CHECK: @test25 >> +; CHECK: %a = phi i32 [ %A, %jump ], [ %B, %entry ] >> +; CHECK-NEXT: ret i32 %a >> } >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From eli.friedman at gmail.com Mon Dec 21 00:49:24 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 21 Dec 2009 06:49:24 -0000 Subject: [llvm-commits] [llvm] r91817 - in /llvm/trunk: include/llvm/ADT/StringRef.h unittests/ADT/StringRefTest.cpp Message-ID: <200912210649.nBL6nOVM011568@zion.cs.uiuc.edu> Author: efriedma Date: Mon Dec 21 00:49:24 2009 New Revision: 91817 URL: http://llvm.org/viewvc/llvm-project?rev=91817&view=rev Log: Change StringRef::startswith and StringRef::endswith to versions which are a bit more verbose, but optimize to much shorter code. Modified: llvm/trunk/include/llvm/ADT/StringRef.h llvm/trunk/unittests/ADT/StringRefTest.cpp Modified: llvm/trunk/include/llvm/ADT/StringRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=91817&r1=91816&r2=91817&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h (original) +++ llvm/trunk/include/llvm/ADT/StringRef.h Mon Dec 21 00:49:24 2009 @@ -159,12 +159,14 @@ /// startswith - Check if this string starts with the given \arg Prefix. bool startswith(StringRef Prefix) const { - return substr(0, Prefix.Length).equals(Prefix); + return Length >= Prefix.Length && + memcmp(Data, Prefix.Data, Prefix.Length) == 0; } /// endswith - Check if this string ends with the given \arg Suffix. bool endswith(StringRef Suffix) const { - return slice(size() - Suffix.Length, size()).equals(Suffix); + return Length >= Suffix.Length && + memcmp(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0; } /// @} Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=91817&r1=91816&r2=91817&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/StringRefTest.cpp (original) +++ llvm/trunk/unittests/ADT/StringRefTest.cpp Mon Dec 21 00:49:24 2009 @@ -198,6 +198,14 @@ EXPECT_FALSE(Str.startswith("hi")); } +TEST(StringRefTest, EndsWith) { + StringRef Str("hello"); + EXPECT_TRUE(Str.endswith("lo")); + EXPECT_FALSE(Str.endswith("helloworld")); + EXPECT_FALSE(Str.endswith("worldhello")); + EXPECT_FALSE(Str.endswith("so")); +} + TEST(StringRefTest, Find) { StringRef Str("hello"); EXPECT_EQ(2U, Str.find('l')); From sabre at nondot.org Mon Dec 21 01:15:15 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 07:15:15 -0000 Subject: [llvm-commits] [llvm] r91819 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200912210715.nBL7FFA9012460@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 01:15:15 2009 New Revision: 91819 URL: http://llvm.org/viewvc/llvm-project?rev=91819&view=rev Log: add a helper ctor. Modified: llvm/trunk/include/llvm/ADT/DenseMap.h Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=91819&r1=91818&r2=91819&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Mon Dec 21 01:15:15 2009 @@ -46,7 +46,7 @@ typedef ValueT mapped_type; typedef BucketT value_type; - DenseMap(const DenseMap& other) { + DenseMap(const DenseMap &other) { NumBuckets = 0; CopyFrom(other); } @@ -55,6 +55,12 @@ init(NumInitBuckets); } + template + DenseMap(const InputIt &I, const InputIt &E) { + init(64); + insert(I, E); + } + ~DenseMap() { const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey(); for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) { From sabre at nondot.org Mon Dec 21 01:16:11 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 07:16:11 -0000 Subject: [llvm-commits] [llvm] r91820 - in /llvm/trunk: lib/Transforms/Utils/SSAUpdater.cpp test/Transforms/LoopRotate/phi-duplicate.ll Message-ID: <200912210716.nBL7GCk2012508@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 01:16:11 2009 New Revision: 91820 URL: http://llvm.org/viewvc/llvm-project?rev=91820&view=rev Log: fix PR5837 by having SSAUpdate reuse phi nodes for the 'GetValueInMiddleOfBlock' case, instead of inserting duplicates. A similar fix is almost certainly needed by the machine-level SSAUpdate implementation. Added: llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=91820&r1=91819&r2=91820&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Mon Dec 21 01:16:11 2009 @@ -149,7 +149,29 @@ if (SingularValue != 0) return SingularValue; - // Otherwise, we do need a PHI: insert one now. + // Otherwise, we do need a PHI: check to see if we already have one available + // in this block that produces the right value. + if (isa(BB->begin())) { + DenseMap ValueMapping(PredValues.begin(), + PredValues.end()); + PHINode *SomePHI; + for (BasicBlock::iterator It = BB->begin(); + (SomePHI = dyn_cast(It)); ++It) { + // Scan this phi to see if it is what we need. + bool Equal = true; + for (unsigned i = 0, e = SomePHI->getNumIncomingValues(); i != e; ++i) + if (ValueMapping[SomePHI->getIncomingBlock(i)] != + SomePHI->getIncomingValue(i)) { + Equal = false; + break; + } + + if (Equal) + return SomePHI; + } + } + + // Ok, we have no way out, insert a new one now. PHINode *InsertedPHI = PHINode::Create(PrototypeValue->getType(), PrototypeValue->getName(), &BB->front()); Added: llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll?rev=91820&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll (added) +++ llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll Mon Dec 21 01:16:11 2009 @@ -0,0 +1,35 @@ +; RUN: opt -S %s -loop-rotate | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0" + +; PR5837 +define void @test(i32 %N, double* %G) nounwind ssp { +entry: + br label %for.cond + +for.cond: ; preds = %for.body, %entry + %j.0 = phi i64 [ 1, %entry ], [ %inc, %for.body ] ; [#uses=5] + %cmp = icmp slt i64 %j.0, 1000 ; [#uses=1] + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %arrayidx = getelementptr inbounds double* %G, i64 %j.0 ; [#uses=1] + %tmp3 = load double* %arrayidx ; [#uses=1] + %sub = sub i64 %j.0, 1 ; [#uses=1] + %arrayidx6 = getelementptr inbounds double* %G, i64 %sub ; [#uses=1] + %tmp7 = load double* %arrayidx6 ; [#uses=1] + %add = fadd double %tmp3, %tmp7 ; [#uses=1] + %arrayidx10 = getelementptr inbounds double* %G, i64 %j.0 ; [#uses=1] + store double %add, double* %arrayidx10 + %inc = add nsw i64 %j.0, 1 ; [#uses=1] + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} +; Should only end up with one phi. +; CHECK: for.body: +; CHECK-NEXT: %j.02 = phi i64 +; CHECK-NOT phi +; CHECK: ret void + From clattner at apple.com Mon Dec 21 01:38:19 2009 From: clattner at apple.com (Chris Lattner) Date: Sun, 20 Dec 2009 23:38:19 -0800 Subject: [llvm-commits] [llvm] r85016 - /llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp In-Reply-To: <7064681D-2A98-432F-A88E-53E851C2FFF4@apple.com> References: <200910242319.n9ONJrei025407@zion.cs.uiuc.edu> <6FE2703A-1167-451D-B151-E84B042B2378@apple.com> <7064681D-2A98-432F-A88E-53E851C2FFF4@apple.com> Message-ID: <45E320E2-244A-4C08-982E-2CFE14B1AB14@apple.com> On Oct 26, 2009, at 8:58 AM, Dan Gohman wrote: >>> Author: djg >>> Date: Sat Oct 24 18:19:52 2009 >>> New Revision: 85016 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=85016&view=rev >>> Log: >>> Rewrite LoopRotation's SSA updating code using SSAUpdater. >> >> Awesome, I didn't remember loop rotate had its own ssa update code. >> >> If, in your travels, you run into any cases where SSAUpdate is a significant compile time issue, please give me a testcase. I have many less-than-crazy ideas for speeding it up. > > One problem I'm seeing is redundant PHIs. Sphereflake for example > now gets code like this: > > %p.013.i = phi %struct.node_t* [ %p.0.be.i, %bb5.backedge.i ], [ %78, %bb9.i ] ; <%struct.node_t*> [#uses=1] > %p.012.i = phi %struct.node_t* [ %p.0.be.i, %bb5.backedge.i ], [ %78, %bb9.i ] ; <%struct.node_t*> [#uses=1] > %p.011.i = phi %struct.node_t* [ %p.0.be.i, %bb5.backedge.i ], [ %78, %bb9.i ] ; <%struct.node_t*> [#uses=1] > %p.010.i = phi %struct.node_t* [ %p.0.be.i, %bb5.backedge.i ], [ %78, %bb9.i ] ; <%struct.node_t*> [#uses=1] > %p.09.i = phi %struct.node_t* [ %p.0.be.i, %bb5.backedge.i ], [ %78, %bb9.i ] ; <%struct.node_t*> [#uses=7] > > Indvars can't eliminate these because they aren't a function of the > canonical induction variable. These PHIs stick around and end up > being allocated registers, which is suboptimal. I finally found a good example that demonstrated this, PR5837, which is now fixed. I recall that you added phi merging code to simplifycfg or instcombine somewhere, do you think it makes sense to remove this (potentially really expensive) optimization now? -Chris From sabre at nondot.org Mon Dec 21 01:45:57 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 07:45:57 -0000 Subject: [llvm-commits] [llvm] r91821 - /llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <200912210745.nBL7jvCW013586@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 01:45:57 2009 New Revision: 91821 URL: http://llvm.org/viewvc/llvm-project?rev=91821&view=rev Log: revert r89298, which was committed without a testcase. I think the underlying PHI node insertion issue in SSAUpdate is fixed. Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=91821&r1=91820&r2=91821&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Mon Dec 21 01:45:57 2009 @@ -305,12 +305,6 @@ } } - // If there are duplicate phi nodes (for example, from loop rotation), - // get rid of them. - for (Loop::block_iterator BB = L->block_begin(), E = L->block_end(); - BB != E; ++BB) - EliminateDuplicatePHINodes(*BB); - return Changed; } From sabre at nondot.org Mon Dec 21 01:52:40 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 07:52:40 -0000 Subject: [llvm-commits] [llvm] r91822 - /llvm/trunk/include/llvm-c/Target.h Message-ID: <200912210752.nBL7qeL1013815@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 01:52:40 2009 New Revision: 91822 URL: http://llvm.org/viewvc/llvm-project?rev=91822&view=rev Log: improve compatibility with SWIG, patch by James Knight! Modified: llvm/trunk/include/llvm-c/Target.h Modified: llvm/trunk/include/llvm-c/Target.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=91822&r1=91821&r2=91822&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Target.h (original) +++ llvm/trunk/include/llvm-c/Target.h Mon Dec 21 01:52:40 2009 @@ -35,9 +35,11 @@ /* Declare all of the target-initialization functions that are available. */ #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##TargetInfo(); #include "llvm/Config/Targets.def" - +#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ + #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(); #include "llvm/Config/Targets.def" +#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ /** LLVMInitializeAllTargetInfos - The main program should call this function if it wants access to all available targets that LLVM is configured to @@ -45,6 +47,7 @@ static inline void LLVMInitializeAllTargetInfos() { #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo(); #include "llvm/Config/Targets.def" +#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ } /** LLVMInitializeAllTargets - The main program should call this function if it @@ -53,6 +56,7 @@ static inline void LLVMInitializeAllTargets() { #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target(); #include "llvm/Config/Targets.def" +#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ } /** LLVMInitializeNativeTarget - The main program should call this function to From clattner at apple.com Mon Dec 21 01:53:04 2009 From: clattner at apple.com (Chris Lattner) Date: Sun, 20 Dec 2009 23:53:04 -0800 Subject: [llvm-commits] llvm-c/Target.h SWIG friendliness In-Reply-To: <5713ED16-A811-45D9-94A5-B6FF6B994B7C@fuhm.net> References: <5713ED16-A811-45D9-94A5-B6FF6B994B7C@fuhm.net> Message-ID: On Dec 17, 2009, at 3:05 PM, James Y Knight wrote: > Without this patch, SWIG chokes on llvm-c/Target.h, as, if you don't use #include files, it appears to have duplicate #defines. (SWIG doesn't follow #include when looking for functions/enums/etc to wrap). Since LLVM-C's main purpose is to generate bindings, it seems like a good idea to have it not cause SWIG to barf. > > Of course, even with this patch, SWIG won't notice the LLVMInitialize*Target and LLVMInitialize*TargetInfo functions, but at least it's not completely failing. Perhaps it would be a better idea to pre-expand all these definitions, rather than using fancy #include tricks with llvm/Config/Targets.def at all, but this works well enough for me. Applied in r91822, thanks! In the future, please include patches as attachments. I applied this one manually since it is small and obvious. -Chris > > --- Target.h~ 2009-11-17 13:58:45.000000000 -0500 > +++ Target.h 2009-12-17 17:36:55.675913000 -0500 > @@ -35,9 +35,11 @@ > /* Declare all of the target-initialization functions that are available. */ > #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##TargetInfo(); > #include "llvm/Config/Targets.def" > +#undef LLVM_TARGET > > #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(); > #include "llvm/Config/Targets.def" > +#undef LLVM_TARGET > > /** LLVMInitializeAllTargetInfos - The main program should call this function if > it wants access to all available targets that LLVM is configured to > @@ -45,6 +47,7 @@ > static inline void LLVMInitializeAllTargetInfos() { > #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo(); > #include "llvm/Config/Targets.def" > +#undef LLVM_TARGET > } > > /** LLVMInitializeAllTargets - The main program should call this function if it > @@ -53,6 +56,7 @@ > static inline void LLVMInitializeAllTargets() { > #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target(); > #include "llvm/Config/Targets.def" > +#undef LLVM_TARGET > } > > /** LLVMInitializeNativeTarget - The main program should call this function to > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Dec 21 01:54:26 2009 From: clattner at apple.com (Chris Lattner) Date: Sun, 20 Dec 2009 23:54:26 -0800 Subject: [llvm-commits] [llvm] r91672 - in /llvm/trunk: lib/Target/X86/X86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/break-sse-dep.ll In-Reply-To: <200912180740.nBI7eUQG026117@zion.cs.uiuc.edu> References: <200912180740.nBI7eUQG026117@zion.cs.uiuc.edu> Message-ID: <1705660A-2565-4C04-943A-D8032B676037@apple.com> On Dec 17, 2009, at 11:40 PM, Evan Cheng wrote: > Author: evancheng > Date: Fri Dec 18 01:40:29 2009 > New Revision: 91672 > > URL: http://llvm.org/viewvc/llvm-project?rev=91672&view=rev > Log: > On recent Intel u-arch's, folding loads into some unary SSE instructions can > be non-optimal. To be precise, we should avoid folding loads if the instructions > only update part of the destination register, and the non-updated part is not > needed. e.g. cvtss2sd, sqrtss. Unfolding the load from these instructions breaks > the partial register dependency and it can improve performance. e.g. Very nice Evan, > +def FeatureBreakSSEDep : SubtargetFeature<"break-sse-dep", "BreakSSEDep","true", > + "Should break SSE partial update dep with load / xorps">; Do we really need a feature for this? Is this actually good for any SSE chip? -Chris From eli.friedman at gmail.com Mon Dec 21 02:03:17 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 21 Dec 2009 08:03:17 -0000 Subject: [llvm-commits] [llvm] r91823 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200912210803.nBL83HN1014193@zion.cs.uiuc.edu> Author: efriedma Date: Mon Dec 21 02:03:16 2009 New Revision: 91823 URL: http://llvm.org/viewvc/llvm-project?rev=91823&view=rev Log: A couple minor README updates. 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=91823&r1=91822&r2=91823&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Dec 21 02:03:16 2009 @@ -123,20 +123,6 @@ //===---------------------------------------------------------------------===// -How about intrinsics? An example is: - *res = _mm_mulhi_epu16(*A, _mm_mul_epu32(*B, *C)); - -compiles to - pmuludq (%eax), %xmm0 - movl 8(%esp), %eax - movdqa (%eax), %xmm1 - pmulhuw %xmm0, %xmm1 - -The transformation probably requires a X86 specific pass or a DAG combiner -target specific hook. - -//===---------------------------------------------------------------------===// - In many cases, LLVM generates code like this: _test: @@ -1762,6 +1748,11 @@ cmpl $150, %edi jne LBB1_1 ## bb1 +The issue is that we hoist the cast of "scaler" to long long outside of the +loop, the value comes into the loop as two values, and +RegsForValue::getCopyFromRegs doesn't know how to put an AssertSext on the +constructed BUILD_PAIR which represents the cast value. + //===---------------------------------------------------------------------===// Test instructions can be eliminated by using EFLAGS values from arithmetic From echristo at apple.com Mon Dec 21 02:15:29 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 21 Dec 2009 08:15:29 -0000 Subject: [llvm-commits] [llvm] r91824 - in /llvm/trunk: include/llvm/Target/TargetMachine.h lib/CodeGen/LLVMTargetMachine.cpp lib/Target/Mips/MipsTargetMachine.cpp lib/Target/X86/X86TargetMachine.cpp lib/Target/X86/X86TargetMachine.h Message-ID: <200912210815.nBL8FT37014588@zion.cs.uiuc.edu> Author: echristo Date: Mon Dec 21 02:15:29 2009 New Revision: 91824 URL: http://llvm.org/viewvc/llvm-project?rev=91824&view=rev Log: Fix setting and default setting of code model for jit. Do this by allowing backends to override routines that will default the JIT and Static code generation to an appropriate code model for the architecture. Should fix PR 5773. Modified: llvm/trunk/include/llvm/Target/TargetMachine.h llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.h Modified: llvm/trunk/include/llvm/Target/TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=91824&r1=91823&r2=91824&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) +++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Dec 21 02:15:29 2009 @@ -292,6 +292,13 @@ /// bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level); +private: + // These routines are used by addPassesToEmitFileFinish and + // addPassesToEmitMachineCode to set the CodeModel if it's still marked + // as default. + virtual void setCodeModelForJIT(); + virtual void setCodeModelForStatic(); + public: /// addPassesToEmitFile - Add passes to the specified pass manager to get the Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=91824&r1=91823&r2=91824&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Dec 21 02:15:29 2009 @@ -83,7 +83,18 @@ AsmInfo = T.createAsmInfo(TargetTriple); } +// Set the default code model for the JIT for a generic target. +// FIXME: Is small right here? or .is64Bit() ? Large : Small? +void +LLVMTargetMachine::setCodeModelForJIT() { + setCodeModel(CodeModel::Small); +} +// Set the default code model for static compilation for a generic target. +void +LLVMTargetMachine::setCodeModelForStatic() { + setCodeModel(CodeModel::Small); +} FileModel::Model LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, @@ -130,6 +141,9 @@ bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM, MachineCodeEmitter *MCE, CodeGenOpt::Level OptLevel) { + // Make sure the code model is set. + setCodeModelForStatic(); + if (MCE) addSimpleCodeEmitter(PM, OptLevel, *MCE); if (PrintEmittedAsm) @@ -146,6 +160,9 @@ bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM, JITCodeEmitter *JCE, CodeGenOpt::Level OptLevel) { + // Make sure the code model is set. + setCodeModelForJIT(); + if (JCE) addSimpleCodeEmitter(PM, OptLevel, *JCE); if (PrintEmittedAsm) @@ -162,6 +179,9 @@ bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM, ObjectCodeEmitter *OCE, CodeGenOpt::Level OptLevel) { + // Make sure the code model is set. + setCodeModelForStatic(); + if (OCE) addSimpleCodeEmitter(PM, OptLevel, *OCE); if (PrintEmittedAsm) @@ -181,6 +201,9 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM, MachineCodeEmitter &MCE, CodeGenOpt::Level OptLevel) { + // Make sure the code model is set. + setCodeModelForJIT(); + // Add common CodeGen passes. if (addCommonCodeGenPasses(PM, OptLevel)) return true; @@ -203,6 +226,9 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM, JITCodeEmitter &JCE, CodeGenOpt::Level OptLevel) { + // Make sure the code model is set. + setCodeModelForJIT(); + // Add common CodeGen passes. if (addCommonCodeGenPasses(PM, OptLevel)) return true; Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=91824&r1=91823&r2=91824&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Mon Dec 21 02:15:29 2009 @@ -50,11 +50,6 @@ else setRelocationModel(Reloc::Static); } - - // TODO: create an option to enable long calls, like -mlong-calls, - // that would be our CodeModel::Large. It must not work with Abicall. - if (getCodeModel() == CodeModel::Default) - setCodeModel(CodeModel::Small); } MipselTargetMachine:: Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=91824&r1=91823&r2=91824&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Dec 21 02:15:29 2009 @@ -95,10 +95,6 @@ assert(getRelocationModel() != Reloc::Default && "Relocation mode not picked"); - // If no code model is picked, default to small. - if (getCodeModel() == CodeModel::Default) - setCodeModel(CodeModel::Small); - // ELF and X86-64 don't have a distinct DynamicNoPIC model. DynamicNoPIC // is defined as a model for code which may be used in static or dynamic // executables but not necessarily a shared library. On X86-32 we just @@ -188,10 +184,6 @@ Subtarget.setPICStyle(PICStyles::None); } - // 64-bit JIT places everything in the same buffer except external functions. - if (Subtarget.is64Bit()) - setCodeModel(CodeModel::Large); - PM.add(createX86CodeEmitterPass(*this, MCE)); return false; @@ -208,9 +200,6 @@ Subtarget.setPICStyle(PICStyles::None); } - // 64-bit JIT places everything in the same buffer except external functions. - if (Subtarget.is64Bit()) - setCodeModel(CodeModel::Large); PM.add(createX86JITCodeEmitterPass(*this, JCE)); @@ -244,3 +233,23 @@ PM.add(createX86ObjectCodeEmitterPass(*this, OCE)); return false; } + +void X86TargetMachine::setCodeModelForStatic() { + + if (getCodeModel() != CodeModel::Default) return; + + // For static codegen, if we're not already set, use Small codegen. + setCodeModel(CodeModel::Small); +} + + +void X86TargetMachine::setCodeModelForJIT() { + + if (getCodeModel() != CodeModel::Default) return; + + // 64-bit JIT places everything in the same buffer except external functions. + if (Subtarget.is64Bit()) + setCodeModel(CodeModel::Large); + else + setCodeModel(CodeModel::Small); +} Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=91824&r1=91823&r2=91824&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Mon Dec 21 02:15:29 2009 @@ -38,6 +38,11 @@ X86ELFWriterInfo ELFWriterInfo; Reloc::Model DefRelocModel; // Reloc model before it's overridden. +private: + // We have specific defaults for X86. + virtual void setCodeModelForJIT(); + virtual void setCodeModelForStatic(); + public: X86TargetMachine(const Target &T, const std::string &TT, const std::string &FS, bool is64Bit); From sabre at nondot.org Mon Dec 21 02:23:12 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 02:23:12 -0600 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200912210823.nBL8NCsE014877@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.87 -> 1.88 --- Log message: add a link to the blog, remove a link to the wiki. The wiki isn't being updated (other than spam) and most of the content should be in the docs if it ever exists. I'm completely willing to be convinced that it has value if someone really cares... --- Diffs of the changes: (+1 -1) header.incl | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.87 llvm-www/header.incl:1.88 --- llvm-www/header.incl:1.87 Fri Oct 23 23:43:57 2009 +++ llvm-www/header.incl Mon Dec 21 02:22:05 2009 @@ -34,7 +34,7 @@ LLVM Developers
Bug Database
LLVM Logo
-Wiki
+Blog

From daniel at zuster.org Mon Dec 21 11:32:00 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 21 Dec 2009 17:32:00 -0000 Subject: [llvm-commits] [llvm] r91826 - in /llvm/trunk/test: FrontendC++/m64-ptr.cpp LLVMC/MultiplePluginPriorities.td Message-ID: <200912211732.nBLHW0Gw016894@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Dec 21 11:31:59 2009 New Revision: 91826 URL: http://llvm.org/viewvc/llvm-project?rev=91826&view=rev Log: XFAIL these tests on powerpc, under the assumption that no one cares. If you care, feel free to fix. Modified: llvm/trunk/test/FrontendC++/m64-ptr.cpp llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Modified: llvm/trunk/test/FrontendC++/m64-ptr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/m64-ptr.cpp?rev=91826&r1=91825&r2=91826&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/m64-ptr.cpp (original) +++ llvm/trunk/test/FrontendC++/m64-ptr.cpp Mon Dec 21 11:31:59 2009 @@ -1,4 +1,5 @@ // RUN: %llvmgxx %s -S -o - | FileCheck %s +// XFAIL: powerpc-apple-darwin // Make sure pointers are passed as pointers, not converted to int. // The first load should be of type i8** in either 32 or 64 bit mode. Modified: llvm/trunk/test/LLVMC/MultiplePluginPriorities.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/MultiplePluginPriorities.td?rev=91826&r1=91825&r2=91826&view=diff ============================================================================== --- llvm/trunk/test/LLVMC/MultiplePluginPriorities.td (original) +++ llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Mon Dec 21 11:31:59 2009 @@ -1,5 +1,6 @@ // Check that multiple plugin priorities are not allowed. // RUN: ignore tblgen -I %p/../../include --gen-llvmc %s |& grep "More than one 'PluginPriority' instance found" +// XFAIL: powerpc-apple-darwin include "llvm/CompilerDriver/Common.td" From bob.wilson at apple.com Mon Dec 21 12:39:47 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 21 Dec 2009 18:39:47 -0000 Subject: [llvm-commits] [llvm] r91828 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200912211839.nBLIdlXl019351@zion.cs.uiuc.edu> Author: bwilson Date: Mon Dec 21 12:39:47 2009 New Revision: 91828 URL: http://llvm.org/viewvc/llvm-project?rev=91828&view=rev Log: Remove special-case SROA optimization of variable indexes to one-element and two-element arrays. After restructuring the SROA code, it was not safe to do this without adding more checking. It is not clear that this special-case has really been useful, and removing this simplifies the code quite a bit. 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=91828&r1=91827&r2=91828&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Dec 21 12:39:47 2009 @@ -107,12 +107,11 @@ int isSafeAllocaToScalarRepl(AllocaInst *AI); void isSafeForScalarRepl(Instruction *I, AllocaInst *AI, uint64_t Offset, - uint64_t ArrayOffset, AllocaInfo &Info); + AllocaInfo &Info); void isSafeGEP(GetElementPtrInst *GEPI, AllocaInst *AI, uint64_t &Offset, - uint64_t &ArrayOffset, AllocaInfo &Info); - void isSafeMemAccess(AllocaInst *AI, uint64_t Offset, uint64_t ArrayOffset, - uint64_t MemSize, const Type *MemOpType, bool isStore, - AllocaInfo &Info); + AllocaInfo &Info); + void isSafeMemAccess(AllocaInst *AI, uint64_t Offset, uint64_t MemSize, + const Type *MemOpType, bool isStore, AllocaInfo &Info); bool TypeHasComponent(const Type *T, uint64_t Offset, uint64_t Size); uint64_t FindElementAndOffset(const Type *&T, uint64_t &Offset, const Type *&IdxTy); @@ -120,7 +119,6 @@ void DoScalarReplacement(AllocaInst *AI, std::vector &WorkList); void DeleteDeadInstructions(); - void CleanupGEP(GetElementPtrInst *GEP); void CleanupAllocaUsers(Value *V); AllocaInst *AddNewAlloca(Function &F, const Type *Ty, AllocaInst *Base); @@ -401,43 +399,33 @@ } } -/// AllUsersAreLoads - Return true if all users of this value are loads. -static bool AllUsersAreLoads(Value *Ptr) { - for (Value::use_iterator I = Ptr->use_begin(), E = Ptr->use_end(); - I != E; ++I) - if (cast(*I)->getOpcode() != Instruction::Load) - return false; - return true; -} - /// isSafeForScalarRepl - Check if instruction I is a safe use with regard to /// performing scalar replacement of alloca AI. The results are flagged in -/// the Info parameter. Offset and ArrayOffset indicate the position within -/// AI that is referenced by this instruction. +/// the Info parameter. Offset indicates the position within AI that is +/// referenced by this instruction. void SROA::isSafeForScalarRepl(Instruction *I, AllocaInst *AI, uint64_t Offset, - uint64_t ArrayOffset, AllocaInfo &Info) { + AllocaInfo &Info) { for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI!=E; ++UI) { Instruction *User = cast(*UI); if (BitCastInst *BC = dyn_cast(User)) { - isSafeForScalarRepl(BC, AI, Offset, ArrayOffset, Info); + isSafeForScalarRepl(BC, AI, Offset, Info); } else if (GetElementPtrInst *GEPI = dyn_cast(User)) { - uint64_t GEPArrayOffset = ArrayOffset; uint64_t GEPOffset = Offset; - isSafeGEP(GEPI, AI, GEPOffset, GEPArrayOffset, Info); + isSafeGEP(GEPI, AI, GEPOffset, Info); if (!Info.isUnsafe) - isSafeForScalarRepl(GEPI, AI, GEPOffset, GEPArrayOffset, Info); + isSafeForScalarRepl(GEPI, AI, GEPOffset, Info); } else if (MemIntrinsic *MI = dyn_cast(UI)) { ConstantInt *Length = dyn_cast(MI->getLength()); if (Length) - isSafeMemAccess(AI, Offset, ArrayOffset, Length->getZExtValue(), 0, + isSafeMemAccess(AI, Offset, Length->getZExtValue(), 0, UI.getOperandNo() == 1, Info); else MarkUnsafe(Info); } else if (LoadInst *LI = dyn_cast(User)) { if (!LI->isVolatile()) { const Type *LIType = LI->getType(); - isSafeMemAccess(AI, Offset, ArrayOffset, TD->getTypeAllocSize(LIType), + isSafeMemAccess(AI, Offset, TD->getTypeAllocSize(LIType), LIType, false, Info); } else MarkUnsafe(Info); @@ -445,7 +433,7 @@ // Store is ok if storing INTO the pointer, not storing the pointer if (!SI->isVolatile() && SI->getOperand(0) != I) { const Type *SIType = SI->getOperand(0)->getType(); - isSafeMemAccess(AI, Offset, ArrayOffset, TD->getTypeAllocSize(SIType), + isSafeMemAccess(AI, Offset, TD->getTypeAllocSize(SIType), SIType, true, Info); } else MarkUnsafe(Info); @@ -469,12 +457,9 @@ /// replacement. It is safe when all the indices are constant, in-bounds /// references, and when the resulting offset corresponds to an element within /// the alloca type. The results are flagged in the Info parameter. Upon -/// return, Offset is adjusted as specified by the GEP indices. For the -/// special case of a variable index to a 2-element array, ArrayOffset is set -/// to the array element size. +/// return, Offset is adjusted as specified by the GEP indices. void SROA::isSafeGEP(GetElementPtrInst *GEPI, AllocaInst *AI, - uint64_t &Offset, uint64_t &ArrayOffset, - AllocaInfo &Info) { + uint64_t &Offset, AllocaInfo &Info) { gep_type_iterator GEPIt = gep_type_begin(GEPI), E = gep_type_end(GEPI); if (GEPIt == E) return; @@ -486,27 +471,6 @@ if (++GEPIt == E) return; - // If the first index is a non-constant index into an array, see if we can - // handle it as a special case. - const Type *ArrayEltTy = 0; - if (!isa(GEPIt.getOperand()) && - ArrayOffset == 0 && Offset == 0) { - if (const ArrayType *AT = dyn_cast(*GEPIt)) { - uint64_t NumElements = AT->getNumElements(); - - // If this is an array index and the index is not constant, we cannot - // promote... that is unless the array has exactly one or two elements - // in it, in which case we CAN promote it, but we have to canonicalize - // this out if this is the only problem. - if ((NumElements != 1 && NumElements != 2) || !AllUsersAreLoads(GEPI)) - return MarkUnsafe(Info); - Info.needsCleanup = true; - ArrayOffset = TD->getTypeAllocSizeInBits(AT->getElementType()); - ArrayEltTy = AT->getElementType(); - ++GEPIt; - } - } - // Walk through the GEP type indices, checking the types that this indexes // into. for (; GEPIt != E; ++GEPIt) { @@ -535,19 +499,9 @@ // All the indices are safe. Now compute the offset due to this GEP and // check if the alloca has a component element at that offset. - if (ArrayOffset == 0) { - SmallVector Indices(GEPI->op_begin() + 1, GEPI->op_end()); - Offset += TD->getIndexedOffset(GEPI->getPointerOperandType(), - &Indices[0], Indices.size()); - } else { - // Both array elements have the same type, so it suffices to check one of - // them. Copy the GEP indices starting from the array index, but replace - // that variable index with a constant zero. - SmallVector Indices(GEPI->op_begin() + 2, GEPI->op_end()); - Indices[0] = Constant::getNullValue(Type::getInt32Ty(GEPI->getContext())); - const Type *ArrayEltPtr = PointerType::getUnqual(ArrayEltTy); - Offset += TD->getIndexedOffset(ArrayEltPtr, &Indices[0], Indices.size()); - } + SmallVector Indices(GEPI->op_begin() + 1, GEPI->op_end()); + Offset += TD->getIndexedOffset(GEPI->getPointerOperandType(), + &Indices[0], Indices.size()); if (!TypeHasComponent(AI->getAllocatedType(), Offset, 0)) MarkUnsafe(Info); } @@ -556,13 +510,11 @@ /// alloca or has an offset and size that corresponds to a component element /// within it. The offset checked here may have been formed from a GEP with a /// pointer bitcasted to a different type. -void SROA::isSafeMemAccess(AllocaInst *AI, uint64_t Offset, - uint64_t ArrayOffset, uint64_t MemSize, +void SROA::isSafeMemAccess(AllocaInst *AI, uint64_t Offset, uint64_t MemSize, const Type *MemOpType, bool isStore, AllocaInfo &Info) { // Check if this is a load/store of the entire alloca. - if (Offset == 0 && ArrayOffset == 0 && - MemSize == TD->getTypeAllocSize(AI->getAllocatedType())) { + if (Offset == 0 && MemSize == TD->getTypeAllocSize(AI->getAllocatedType())) { bool UsesAggregateType = (MemOpType == AI->getAllocatedType()); // This is safe for MemIntrinsics (where MemOpType is 0), integer types // (which are essentially the same as the MemIntrinsics, especially with @@ -580,8 +532,7 @@ } // Check if the offset/size correspond to a component within the alloca type. const Type *T = AI->getAllocatedType(); - if (TypeHasComponent(T, Offset, MemSize) && - (ArrayOffset == 0 || TypeHasComponent(T, Offset + ArrayOffset, MemSize))) + if (TypeHasComponent(T, Offset, MemSize)) return; return MarkUnsafe(Info); @@ -1219,7 +1170,7 @@ // the users are safe to transform. AllocaInfo Info; - isSafeForScalarRepl(AI, AI, 0, 0, Info); + isSafeForScalarRepl(AI, AI, 0, Info); if (Info.isUnsafe) { DEBUG(errs() << "Cannot transform: " << *AI << '\n'); return 0; @@ -1238,83 +1189,21 @@ return Info.needsCleanup ? 1 : 3; } -/// CleanupGEP - GEP is used by an Alloca, which can be promoted after the GEP -/// is canonicalized here. -void SROA::CleanupGEP(GetElementPtrInst *GEPI) { - gep_type_iterator I = gep_type_begin(GEPI); - ++I; - - const ArrayType *AT = dyn_cast(*I); - if (!AT) - return; - - uint64_t NumElements = AT->getNumElements(); - - if (isa(I.getOperand())) - return; - - if (NumElements == 1) { - GEPI->setOperand(2, - Constant::getNullValue(Type::getInt32Ty(GEPI->getContext()))); - return; - } - - assert(NumElements == 2 && "Unhandled case!"); - // All users of the GEP must be loads. At each use of the GEP, insert - // two loads of the appropriate indexed GEP and select between them. - Value *IsOne = new ICmpInst(GEPI, ICmpInst::ICMP_NE, I.getOperand(), - Constant::getNullValue(I.getOperand()->getType()), - "isone"); - // Insert the new GEP instructions, which are properly indexed. - SmallVector Indices(GEPI->op_begin()+1, GEPI->op_end()); - Indices[1] = Constant::getNullValue(Type::getInt32Ty(GEPI->getContext())); - Value *ZeroIdx = GetElementPtrInst::CreateInBounds(GEPI->getOperand(0), - Indices.begin(), - Indices.end(), - GEPI->getName()+".0",GEPI); - Indices[1] = ConstantInt::get(Type::getInt32Ty(GEPI->getContext()), 1); - Value *OneIdx = GetElementPtrInst::CreateInBounds(GEPI->getOperand(0), - Indices.begin(), - Indices.end(), - GEPI->getName()+".1", GEPI); - // Replace all loads of the variable index GEP with loads from both - // indexes and a select. - while (!GEPI->use_empty()) { - LoadInst *LI = cast(GEPI->use_back()); - Value *Zero = new LoadInst(ZeroIdx, LI->getName()+".0", LI); - Value *One = new LoadInst(OneIdx , LI->getName()+".1", LI); - Value *R = SelectInst::Create(IsOne, One, Zero, LI->getName(), LI); - LI->replaceAllUsesWith(R); - LI->eraseFromParent(); - } -} - /// CleanupAllocaUsers - If SROA reported that it can promote the specified /// allocation, but only if cleaned up, perform the cleanups required. void SROA::CleanupAllocaUsers(Value *V) { - // At this point, we know that the end result will be SROA'd and promoted, so - // we can insert ugly code if required so long as sroa+mem2reg will clean it - // up. for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ) { User *U = *UI++; - if (isa(U)) { - CleanupAllocaUsers(U); - } else if (GetElementPtrInst *GEPI = dyn_cast(U)) { - CleanupGEP(GEPI); - CleanupAllocaUsers(GEPI); - if (GEPI->use_empty()) GEPI->eraseFromParent(); - } else { - Instruction *I = cast(U); - SmallVector DbgInUses; - if (!isa(I) && OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) { - // Safe to remove debug info uses. - while (!DbgInUses.empty()) { - DbgInfoIntrinsic *DI = DbgInUses.back(); DbgInUses.pop_back(); - DI->eraseFromParent(); - } - I->eraseFromParent(); + Instruction *I = cast(U); + SmallVector DbgInUses; + if (!isa(I) && OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) { + // Safe to remove debug info uses. + while (!DbgInUses.empty()) { + DbgInfoIntrinsic *DI = DbgInUses.back(); DbgInUses.pop_back(); + DI->eraseFromParent(); } + I->eraseFromParent(); } } } From evan.cheng at apple.com Mon Dec 21 12:44:30 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Dec 2009 10:44:30 -0800 Subject: [llvm-commits] [llvm] r91820 - in /llvm/trunk: lib/Transforms/Utils/SSAUpdater.cpp test/Transforms/LoopRotate/phi-duplicate.ll In-Reply-To: <200912210716.nBL7GCk2012508@zion.cs.uiuc.edu> References: <200912210716.nBL7GCk2012508@zion.cs.uiuc.edu> Message-ID: <47347F9E-EA54-43F2-954F-8CAF4BF9EAEC@apple.com> Machine SSAUpdate already checks for duplicate phi's. Evan On Dec 20, 2009, at 11:16 PM, Chris Lattner wrote: > Author: lattner > Date: Mon Dec 21 01:16:11 2009 > New Revision: 91820 > > URL: http://llvm.org/viewvc/llvm-project?rev=91820&view=rev > Log: > fix PR5837 by having SSAUpdate reuse phi nodes for the > 'GetValueInMiddleOfBlock' case, instead of inserting > duplicates. > > A similar fix is almost certainly needed by the machine-level > SSAUpdate implementation. > > Added: > llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll > Modified: > llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=91820&r1=91819&r2=91820&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Mon Dec 21 01:16:11 2009 > @@ -149,7 +149,29 @@ > if (SingularValue != 0) > return SingularValue; > > - // Otherwise, we do need a PHI: insert one now. > + // Otherwise, we do need a PHI: check to see if we already have one available > + // in this block that produces the right value. > + if (isa(BB->begin())) { > + DenseMap ValueMapping(PredValues.begin(), > + PredValues.end()); > + PHINode *SomePHI; > + for (BasicBlock::iterator It = BB->begin(); > + (SomePHI = dyn_cast(It)); ++It) { > + // Scan this phi to see if it is what we need. > + bool Equal = true; > + for (unsigned i = 0, e = SomePHI->getNumIncomingValues(); i != e; ++i) > + if (ValueMapping[SomePHI->getIncomingBlock(i)] != > + SomePHI->getIncomingValue(i)) { > + Equal = false; > + break; > + } > + > + if (Equal) > + return SomePHI; > + } > + } > + > + // Ok, we have no way out, insert a new one now. > PHINode *InsertedPHI = PHINode::Create(PrototypeValue->getType(), > PrototypeValue->getName(), > &BB->front()); > > Added: llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll?rev=91820&view=auto > > ============================================================================== > --- llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll (added) > +++ llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll Mon Dec 21 01:16:11 2009 > @@ -0,0 +1,35 @@ > +; RUN: opt -S %s -loop-rotate | FileCheck %s > +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" > +target triple = "x86_64-apple-darwin10.0" > + > +; PR5837 > +define void @test(i32 %N, double* %G) nounwind ssp { > +entry: > + br label %for.cond > + > +for.cond: ; preds = %for.body, %entry > + %j.0 = phi i64 [ 1, %entry ], [ %inc, %for.body ] ; [#uses=5] > + %cmp = icmp slt i64 %j.0, 1000 ; [#uses=1] > + br i1 %cmp, label %for.body, label %for.end > + > +for.body: ; preds = %for.cond > + %arrayidx = getelementptr inbounds double* %G, i64 %j.0 ; [#uses=1] > + %tmp3 = load double* %arrayidx ; [#uses=1] > + %sub = sub i64 %j.0, 1 ; [#uses=1] > + %arrayidx6 = getelementptr inbounds double* %G, i64 %sub ; [#uses=1] > + %tmp7 = load double* %arrayidx6 ; [#uses=1] > + %add = fadd double %tmp3, %tmp7 ; [#uses=1] > + %arrayidx10 = getelementptr inbounds double* %G, i64 %j.0 ; [#uses=1] > + store double %add, double* %arrayidx10 > + %inc = add nsw i64 %j.0, 1 ; [#uses=1] > + br label %for.cond > + > +for.end: ; preds = %for.cond > + ret void > +} > +; Should only end up with one phi. > +; CHECK: for.body: > +; CHECK-NEXT: %j.02 = phi i64 > +; CHECK-NOT phi > +; CHECK: ret void > + > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Mon Dec 21 12:45:35 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Dec 2009 10:45:35 -0800 Subject: [llvm-commits] [llvm] r91672 - in /llvm/trunk: lib/Target/X86/X86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/break-sse-dep.ll In-Reply-To: <1705660A-2565-4C04-943A-D8032B676037@apple.com> References: <200912180740.nBI7eUQG026117@zion.cs.uiuc.edu> <1705660A-2565-4C04-943A-D8032B676037@apple.com> Message-ID: <7F1FB4E1-A63C-48CC-AB24-D1BDCC3BC1BF@apple.com> On Dec 20, 2009, at 11:54 PM, Chris Lattner wrote: > > On Dec 17, 2009, at 11:40 PM, Evan Cheng wrote: > >> Author: evancheng >> Date: Fri Dec 18 01:40:29 2009 >> New Revision: 91672 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=91672&view=rev >> Log: >> On recent Intel u-arch's, folding loads into some unary SSE instructions can >> be non-optimal. To be precise, we should avoid folding loads if the instructions >> only update part of the destination register, and the non-updated part is not >> needed. e.g. cvtss2sd, sqrtss. Unfolding the load from these instructions breaks >> the partial register dependency and it can improve performance. e.g. > > Very nice Evan, > >> +def FeatureBreakSSEDep : SubtargetFeature<"break-sse-dep", "BreakSSEDep","true", >> + "Should break SSE partial update dep with load / xorps">; > > Do we really need a feature for this? Is this actually good for any SSE chip? It's not clear. It's known to be an issue since CoreDuo. It's possible it will change for future u-arch so I'd leave it as a subtarget feature for now. Evan > > -Chris From sabre at nondot.org Mon Dec 21 12:46:30 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 10:46:30 -0800 Subject: [llvm-commits] [llvm] r91820 - in /llvm/trunk: lib/Transforms/Utils/SSAUpdater.cpp test/Transforms/LoopRotate/phi-duplicate.ll In-Reply-To: <47347F9E-EA54-43F2-954F-8CAF4BF9EAEC@apple.com> References: <200912210716.nBL7GCk2012508@zion.cs.uiuc.edu> <47347F9E-EA54-43F2-954F-8CAF4BF9EAEC@apple.com> Message-ID: <3CCE22A5-9B87-47F1-9017-006072DE2E78@nondot.org> On Dec 21, 2009, at 10:44 AM, Evan Cheng wrote: > Machine SSAUpdate already checks for duplicate phi's. Ah, thanks! -Chris > Evan > > On Dec 20, 2009, at 11:16 PM, Chris Lattner wrote: > >> Author: lattner >> Date: Mon Dec 21 01:16:11 2009 >> New Revision: 91820 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=91820&view=rev >> Log: >> fix PR5837 by having SSAUpdate reuse phi nodes for the >> 'GetValueInMiddleOfBlock' case, instead of inserting >> duplicates. >> >> A similar fix is almost certainly needed by the machine-level >> SSAUpdate implementation. >> >> Added: >> llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll >> Modified: >> llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp >> >> Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=91820&r1=91819&r2=91820&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original) >> +++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Mon Dec 21 01:16:11 2009 >> @@ -149,7 +149,29 @@ >> if (SingularValue != 0) >> return SingularValue; >> >> - // Otherwise, we do need a PHI: insert one now. >> + // Otherwise, we do need a PHI: check to see if we already have one available >> + // in this block that produces the right value. >> + if (isa(BB->begin())) { >> + DenseMap ValueMapping(PredValues.begin(), >> + PredValues.end()); >> + PHINode *SomePHI; >> + for (BasicBlock::iterator It = BB->begin(); >> + (SomePHI = dyn_cast(It)); ++It) { >> + // Scan this phi to see if it is what we need. >> + bool Equal = true; >> + for (unsigned i = 0, e = SomePHI->getNumIncomingValues(); i != e; ++i) >> + if (ValueMapping[SomePHI->getIncomingBlock(i)] != >> + SomePHI->getIncomingValue(i)) { >> + Equal = false; >> + break; >> + } >> + >> + if (Equal) >> + return SomePHI; >> + } >> + } >> + >> + // Ok, we have no way out, insert a new one now. >> PHINode *InsertedPHI = PHINode::Create(PrototypeValue->getType(), >> PrototypeValue->getName(), >> &BB->front()); >> >> Added: llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll?rev=91820&view=auto >> >> ============================================================================== >> --- llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll (added) >> +++ llvm/trunk/test/Transforms/LoopRotate/phi-duplicate.ll Mon Dec 21 01:16:11 2009 >> @@ -0,0 +1,35 @@ >> +; RUN: opt -S %s -loop-rotate | FileCheck %s >> +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" >> +target triple = "x86_64-apple-darwin10.0" >> + >> +; PR5837 >> +define void @test(i32 %N, double* %G) nounwind ssp { >> +entry: >> + br label %for.cond >> + >> +for.cond: ; preds = %for.body, %entry >> + %j.0 = phi i64 [ 1, %entry ], [ %inc, %for.body ] ; [#uses=5] >> + %cmp = icmp slt i64 %j.0, 1000 ; [#uses=1] >> + br i1 %cmp, label %for.body, label %for.end >> + >> +for.body: ; preds = %for.cond >> + %arrayidx = getelementptr inbounds double* %G, i64 %j.0 ; [#uses=1] >> + %tmp3 = load double* %arrayidx ; [#uses=1] >> + %sub = sub i64 %j.0, 1 ; [#uses=1] >> + %arrayidx6 = getelementptr inbounds double* %G, i64 %sub ; [#uses=1] >> + %tmp7 = load double* %arrayidx6 ; [#uses=1] >> + %add = fadd double %tmp3, %tmp7 ; [#uses=1] >> + %arrayidx10 = getelementptr inbounds double* %G, i64 %j.0 ; [#uses=1] >> + store double %add, double* %arrayidx10 >> + %inc = add nsw i64 %j.0, 1 ; [#uses=1] >> + br label %for.cond >> + >> +for.end: ; preds = %for.cond >> + ret void >> +} >> +; Should only end up with one phi. >> +; CHECK: for.body: >> +; CHECK-NEXT: %j.02 = phi i64 >> +; CHECK-NOT phi >> +; CHECK: ret void >> + >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Dec 21 12:47:50 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Dec 2009 10:47:50 -0800 Subject: [llvm-commits] [llvm] r91672 - in /llvm/trunk: lib/Target/X86/X86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/break-sse-dep.ll In-Reply-To: <7F1FB4E1-A63C-48CC-AB24-D1BDCC3BC1BF@apple.com> References: <200912180740.nBI7eUQG026117@zion.cs.uiuc.edu> <1705660A-2565-4C04-943A-D8032B676037@apple.com> <7F1FB4E1-A63C-48CC-AB24-D1BDCC3BC1BF@apple.com> Message-ID: <0D89AF38-18FC-4407-9274-C843B83652D4@apple.com> On Dec 21, 2009, at 10:45 AM, Evan Cheng wrote: >>> >>> +def FeatureBreakSSEDep : SubtargetFeature<"break-sse-dep", "BreakSSEDep","true", >>> + "Should break SSE partial update dep with load / xorps">; >> >> Do we really need a feature for this? Is this actually good for any SSE chip? > > It's not clear. It's known to be an issue since CoreDuo. It's possible it will change for future u-arch so I'd leave it as a subtarget feature for now. Unless there is a reason to have this, I'd prefer to not have it clutter up the td files. I can't imagine a reasonable (non-scalarizing) implementation of SSE that wouldn't have this issue. For example, you didn't add this flag to any of the AMD chips. -Chris From evan.cheng at apple.com Mon Dec 21 13:05:55 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Dec 2009 11:05:55 -0800 Subject: [llvm-commits] [llvm] r91672 - in /llvm/trunk: lib/Target/X86/X86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/break-sse-dep.ll In-Reply-To: <0D89AF38-18FC-4407-9274-C843B83652D4@apple.com> References: <200912180740.nBI7eUQG026117@zion.cs.uiuc.edu> <1705660A-2565-4C04-943A-D8032B676037@apple.com> <7F1FB4E1-A63C-48CC-AB24-D1BDCC3BC1BF@apple.com> <0D89AF38-18FC-4407-9274-C843B83652D4@apple.com> Message-ID: On Dec 21, 2009, at 10:47 AM, Chris Lattner wrote: > > On Dec 21, 2009, at 10:45 AM, Evan Cheng wrote: > >>>> >>>> +def FeatureBreakSSEDep : SubtargetFeature<"break-sse-dep", "BreakSSEDep","true", >>>> + "Should break SSE partial update dep with load / xorps">; >>> >>> Do we really need a feature for this? Is this actually good for any SSE chip? >> >> It's not clear. It's known to be an issue since CoreDuo. It's possible it will change for future u-arch so I'd leave it as a subtarget feature for now. > > Unless there is a reason to have this, I'd prefer to not have it clutter up the td files. I can't imagine a reasonable (non-scalarizing) implementation of SSE that wouldn't have this issue. Really? It's a big surprise to Dan and I (and the engineer who noticed this) that unfolding the load actually breaks the register dependency. It's not documented anywhere in the public Intel manual. > > For example, you didn't add this flag to any of the AMD chips. That's intentional. I don't have a AMD machine to try it on and I did not want to introduce a regression. I don't really care that much whether it's a subtarget feature. If no one pipes up soon, I'll remove it. Evan > > -Chris From evan.cheng at apple.com Mon Dec 21 13:08:49 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Dec 2009 11:08:49 -0800 Subject: [llvm-commits] [llvm] r91821 - /llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp In-Reply-To: <200912210745.nBL7jvCW013586@zion.cs.uiuc.edu> References: <200912210745.nBL7jvCW013586@zion.cs.uiuc.edu> Message-ID: <4407291D-4494-422C-832A-36AB6DC6D7F1@apple.com> I think 90260 is the test case. Evan On Dec 20, 2009, at 11:45 PM, Chris Lattner wrote: > Author: lattner > Date: Mon Dec 21 01:45:57 2009 > New Revision: 91821 > > URL: http://llvm.org/viewvc/llvm-project?rev=91821&view=rev > Log: > revert r89298, which was committed without a testcase. I think > the underlying PHI node insertion issue in SSAUpdate is fixed. > > Modified: > llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=91821&r1=91820&r2=91821&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Mon Dec 21 01:45:57 2009 > @@ -305,12 +305,6 @@ > } > } > > - // If there are duplicate phi nodes (for example, from loop rotation), > - // get rid of them. > - for (Loop::block_iterator BB = L->block_begin(), E = L->block_end(); > - BB != E; ++BB) > - EliminateDuplicatePHINodes(*BB); > - > return Changed; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Dec 21 13:13:24 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Dec 2009 11:13:24 -0800 Subject: [llvm-commits] [llvm] r91672 - in /llvm/trunk: lib/Target/X86/X86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/break-sse-dep.ll In-Reply-To: References: <200912180740.nBI7eUQG026117@zion.cs.uiuc.edu> <1705660A-2565-4C04-943A-D8032B676037@apple.com> <7F1FB4E1-A63C-48CC-AB24-D1BDCC3BC1BF@apple.com> <0D89AF38-18FC-4407-9274-C843B83652D4@apple.com> Message-ID: <99F7166D-548B-4DCC-AA22-FAD6616EC1D1@apple.com> On Dec 21, 2009, at 11:05 AM, Evan Cheng wrote: >> Unless there is a reason to have this, I'd prefer to not have it clutter up the td files. I can't imagine a reasonable (non-scalarizing) implementation of SSE that wouldn't have this issue. > > Really? It's a big surprise to Dan and I (and the engineer who noticed this) that unfolding the load actually breaks the register dependency. It's not documented anywhere in the public Intel manual. It was also surprising to me, but it makes perfect sense in retrospect. If a scalar load zeros the top of the register, it "obviously" has no dependence on the top bits coming in. >> For example, you didn't add this flag to any of the AMD chips. > > That's intentional. I don't have a AMD machine to try it on and I did not want to introduce a regression. I'm almost certain they have the same issue. > > I don't really care that much whether it's a subtarget feature. If no one pipes up soon, I'll remove it. Thanks! -Chris From sabre at nondot.org Mon Dec 21 13:13:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 11:13:53 -0800 Subject: [llvm-commits] [llvm] r91821 - /llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp In-Reply-To: <4407291D-4494-422C-832A-36AB6DC6D7F1@apple.com> References: <200912210745.nBL7jvCW013586@zion.cs.uiuc.edu> <4407291D-4494-422C-832A-36AB6DC6D7F1@apple.com> Message-ID: <4B9A0B4F-1E06-4C9A-91DD-C7A20CF42C23@nondot.org> On Dec 21, 2009, at 11:08 AM, Evan Cheng wrote: > I think 90260 is the test case. Ok, if it's in the regression test suite, it is still passing :) -Chris From isanbard at gmail.com Mon Dec 21 13:35:00 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Dec 2009 19:35:00 -0000 Subject: [llvm-commits] [llvm] r91834 - in /llvm/trunk: include/llvm/CodeGen/SDNodeOrdering.h lib/CodeGen/SelectionDAG/SDNodeOrdering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200912211935.nBLJZ0Bc021497@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 13:34:59 2009 New Revision: 91834 URL: http://llvm.org/viewvc/llvm-project?rev=91834&view=rev Log: Place SDNodeOrdering.h in the directory it's used. Added: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h - copied unchanged from r91830, llvm/trunk/include/llvm/CodeGen/SDNodeOrdering.h Removed: llvm/trunk/include/llvm/CodeGen/SDNodeOrdering.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Removed: llvm/trunk/include/llvm/CodeGen/SDNodeOrdering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SDNodeOrdering.h?rev=91833&view=auto ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SDNodeOrdering.h (original) +++ llvm/trunk/include/llvm/CodeGen/SDNodeOrdering.h (removed) @@ -1,57 +0,0 @@ -//===-- llvm/CodeGen/SDNodeOrdering.h - SDNode Ordering ---------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file declares the SDNodeOrdering class. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CODEGEN_SDNODEORDERING_H -#define LLVM_CODEGEN_SDNODEORDERING_H - -#include "llvm/ADT/DenseMap.h" - -namespace llvm { - -class SDNode; - -/// SDNodeOrdering - Maps a unique (monotonically increasing) value to each -/// SDNode that roughly corresponds to the ordering of the original LLVM -/// instruction. This is used for turning off scheduling, because we'll forgo -/// the normal scheduling algorithms and output the instructions according to -/// this ordering. -class SDNodeOrdering { - DenseMap OrderMap; - - void operator=(const SDNodeOrdering&); // Do not implement. - SDNodeOrdering(const SDNodeOrdering&); // Do not implement. -public: - SDNodeOrdering() {} - - void add(const SDNode *Node, unsigned O) { - assert(O && "Invalid ordering!"); - OrderMap[Node] = O; - } - void remove(const SDNode *Node) { - DenseMap::iterator Itr = OrderMap.find(Node); - if (Itr != OrderMap.end()) - OrderMap.erase(Itr); - } - void clear() { - OrderMap.clear(); - } - unsigned getOrder(const SDNode *Node) { - unsigned Order = OrderMap[Node]; - assert(Order && "Node isn't in ordering map!"); - return Order; - } -}; - -} // end llvm namespace - -#endif Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=91834&r1=91833&r2=91834&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Dec 21 13:34:59 2009 @@ -10,7 +10,9 @@ // This implements the SelectionDAG class. // //===----------------------------------------------------------------------===// + #include "llvm/CodeGen/SelectionDAG.h" +#include "SDNodeOrdering.h" #include "llvm/Constants.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Function.h" @@ -25,7 +27,6 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" -#include "llvm/CodeGen/SDNodeOrdering.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" From stoklund at 2pi.dk Mon Dec 21 13:35:36 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 21 Dec 2009 19:35:36 -0000 Subject: [llvm-commits] [test-suite] r91835 - /test-suite/trunk/Makefile.rules Message-ID: <200912211935.nBLJZaON021529@zion.cs.uiuc.edu> Author: stoklund Date: Mon Dec 21 13:35:36 2009 New Revision: 91835 URL: http://llvm.org/viewvc/llvm-project?rev=91835&view=rev Log: The -disable-opt option implies -disable-inlining for both opt and llvm-ld. When -disable-inlining also appears in $LLVMLD_FLAGS, llvm-ld fails because the option is given twice. Modified: test-suite/trunk/Makefile.rules Modified: test-suite/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=91835&r1=91834&r2=91835&view=diff ============================================================================== --- test-suite/trunk/Makefile.rules (original) +++ test-suite/trunk/Makefile.rules Mon Dec 21 13:35:36 2009 @@ -379,8 +379,8 @@ endif ifdef DISABLE_LTO -EXTRA_LOPT_OPTIONS += -disable-opt -disable-inlining -EXTRA_LINKTIME_OPT_FLAGS += -disable-opt -disable-inlining +EXTRA_LOPT_OPTIONS += -disable-opt +EXTRA_LINKTIME_OPT_FLAGS += -disable-opt endif # From evan.cheng at apple.com Mon Dec 21 13:53:39 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Dec 2009 19:53:39 -0000 Subject: [llvm-commits] [llvm] r91836 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200912211953.nBLJrdpu022216@zion.cs.uiuc.edu> Author: evancheng Date: Mon Dec 21 13:53:39 2009 New Revision: 91836 URL: http://llvm.org/viewvc/llvm-project?rev=91836&view=rev Log: Delete the instruction just before the function terminates for consistency sake. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=91836&r1=91835&r2=91836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Dec 21 13:53:39 2009 @@ -3148,8 +3148,6 @@ unsigned incr = MI->getOperand(2).getReg(); DebugLoc dl = MI->getDebugLoc(); - F->DeleteMachineInstr(MI); // The instruction is gone now. - bool isThumb2 = Subtarget->isThumb2(); unsigned ldrOpc, strOpc; switch (Size) { @@ -3216,6 +3214,9 @@ // exitMBB: // ... BB = exitMBB; + + F->DeleteMachineInstr(MI); // The instruction is gone now. + return BB; } From isanbard at gmail.com Mon Dec 21 13:59:38 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Dec 2009 19:59:38 -0000 Subject: [llvm-commits] [llvm] r91838 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912211959.nBLJxc35022440@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 13:59:38 2009 New Revision: 91838 URL: http://llvm.org/viewvc/llvm-project?rev=91838&view=rev Log: First wave of plumbing for assigning an ordering to SDNodes. This takes care of a lot of the branching instructions. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91838&r1=91837&r2=91838&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 13:59:38 2009 @@ -586,20 +586,15 @@ // We're processing a new instruction. ++SDNodeOrder; - SDNode *PrevNode = DAG.getRoot().getNode(); - // Note: this doesn't use InstVisitor, because it has to work with // ConstantExpr's in addition to instructions. switch (Opcode) { default: llvm_unreachable("Unknown instruction type encountered!"); // Build the switch statement using the Instruction.def file. #define HANDLE_INST(NUM, OPCODE, CLASS) \ - case Instruction::OPCODE: visit##OPCODE((CLASS&)I); break; + case Instruction::OPCODE: return visit##OPCODE((CLASS&)I); #include "llvm/Instruction.def" } - - if (DisableScheduling && DAG.getRoot().getNode() != PrevNode) - DAG.AssignOrdering(DAG.getRoot().getNode(), SDNodeOrder); } SDValue SelectionDAGBuilder::getValue(const Value *V) { @@ -1115,10 +1110,16 @@ CurMBB->addSuccessor(Succ0MBB); // If this is not a fall-through branch, emit the branch. - if (Succ0MBB != NextBlock) - DAG.setRoot(DAG.getNode(ISD::BR, getCurDebugLoc(), + if (Succ0MBB != NextBlock) { + SDValue V = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, getControlRoot(), - DAG.getBasicBlock(Succ0MBB))); + DAG.getBasicBlock(Succ0MBB)); + DAG.setRoot(V); + + if (DisableScheduling) + DAG.AssignOrdering(V.getNode(), SDNodeOrder); + } + return; } @@ -1177,6 +1178,7 @@ // Create a CaseBlock record representing this branch. CaseBlock CB(ISD::SETEQ, CondVal, ConstantInt::getTrue(*DAG.getContext()), NULL, Succ0MBB, Succ1MBB, CurMBB); + // Use visitSwitchCase to actually insert the fast branch sequence for this // cond branch. visitSwitchCase(CB); @@ -1240,6 +1242,7 @@ SDValue True = DAG.getConstant(1, Cond.getValueType()); Cond = DAG.getNode(ISD::XOR, dl, Cond.getValueType(), Cond, True); } + SDValue BrCond = DAG.getNode(ISD::BRCOND, dl, MVT::Other, getControlRoot(), Cond, DAG.getBasicBlock(CB.TrueBB)); @@ -1247,18 +1250,20 @@ // If the branch was constant folded, fix up the CFG. if (BrCond.getOpcode() == ISD::BR) { CurMBB->removeSuccessor(CB.FalseBB); - DAG.setRoot(BrCond); } else { // Otherwise, go ahead and insert the false branch. if (BrCond == getControlRoot()) CurMBB->removeSuccessor(CB.TrueBB); - if (CB.FalseBB == NextBlock) - DAG.setRoot(BrCond); - else - DAG.setRoot(DAG.getNode(ISD::BR, dl, MVT::Other, BrCond, - DAG.getBasicBlock(CB.FalseBB))); + if (CB.FalseBB != NextBlock) + BrCond = DAG.getNode(ISD::BR, dl, MVT::Other, BrCond, + DAG.getBasicBlock(CB.FalseBB)); } + + DAG.setRoot(BrCond); + + if (DisableScheduling) + DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); } /// visitJumpTable - Emit JumpTable node in the current MBB @@ -1269,9 +1274,13 @@ SDValue Index = DAG.getCopyFromReg(getControlRoot(), getCurDebugLoc(), JT.Reg, PTy); SDValue Table = DAG.getJumpTable(JT.JTI, PTy); - DAG.setRoot(DAG.getNode(ISD::BR_JT, getCurDebugLoc(), - MVT::Other, Index.getValue(1), - Table, Index)); + SDValue BrJumpTable = DAG.getNode(ISD::BR_JT, getCurDebugLoc(), + MVT::Other, Index.getValue(1), + Table, Index); + DAG.setRoot(BrJumpTable); + + if (DisableScheduling) + DAG.AssignOrdering(BrJumpTable.getNode(), SDNodeOrder); } /// visitJumpTableHeader - This function emits necessary code to produce index @@ -1317,11 +1326,14 @@ MVT::Other, CopyTo, CMP, DAG.getBasicBlock(JT.Default)); - if (JT.MBB == NextBlock) - DAG.setRoot(BrCond); - else - DAG.setRoot(DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, BrCond, - DAG.getBasicBlock(JT.MBB))); + if (JT.MBB != NextBlock) + BrCond = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, BrCond, + DAG.getBasicBlock(JT.MBB)); + + DAG.setRoot(BrCond); + + if (DisableScheduling) + DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); } /// visitBitTestHeader - This function emits necessary code to produce value @@ -1361,11 +1373,14 @@ MVT::Other, CopyTo, RangeCmp, DAG.getBasicBlock(B.Default)); - if (MBB == NextBlock) - DAG.setRoot(BrRange); - else - DAG.setRoot(DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, CopyTo, - DAG.getBasicBlock(MBB))); + if (MBB != NextBlock) + BrRange = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, CopyTo, + DAG.getBasicBlock(MBB)); + + DAG.setRoot(BrRange); + + if (DisableScheduling) + DAG.AssignOrdering(BrRange.getNode(), SDNodeOrder); } /// visitBitTestCase - this function produces one "bit test" From asl at math.spbu.ru Mon Dec 21 14:18:49 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 21 Dec 2009 20:18:49 -0000 Subject: [llvm-commits] [llvm] r91841 - /llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp Message-ID: <200912212018.nBLKIn8v023047@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 21 14:18:49 2009 New Revision: 91841 URL: http://llvm.org/viewvc/llvm-project?rev=91841&view=rev Log: Mark FPW as allocable when frame address is taken. Modified: llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp Modified: llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp?rev=91841&r1=91840&r2=91841&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp Mon Dec 21 14:18:49 2009 @@ -44,15 +44,31 @@ MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, 0 }; + static const unsigned CalleeSavedRegsFP[] = { + MSP430::R5W, MSP430::R6W, MSP430::R7W, + MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, + 0 + }; static const unsigned CalleeSavedRegsIntr[] = { MSP430::FPW, MSP430::R5W, MSP430::R6W, MSP430::R7W, MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, MSP430::R12W, MSP430::R13W, MSP430::R14W, MSP430::R15W, 0 }; + static const unsigned CalleeSavedRegsIntrFP[] = { + MSP430::R5W, MSP430::R6W, MSP430::R7W, + MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, + MSP430::R12W, MSP430::R13W, MSP430::R14W, MSP430::R15W, + 0 + }; + + if (hasFP(*MF)) + return (F->getCallingConv() == CallingConv::MSP430_INTR ? + CalleeSavedRegsIntrFP : CalleeSavedRegsFP); + else + return (F->getCallingConv() == CallingConv::MSP430_INTR ? + CalleeSavedRegsIntr : CalleeSavedRegs); - return (F->getCallingConv() == CallingConv::MSP430_INTR ? - CalleeSavedRegsIntr : CalleeSavedRegs); } const TargetRegisterClass *const * @@ -65,6 +81,12 @@ &MSP430::GR16RegClass, &MSP430::GR16RegClass, 0 }; + static const TargetRegisterClass * const CalleeSavedRegClassesFP[] = { + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, 0 + }; static const TargetRegisterClass * const CalleeSavedRegClassesIntr[] = { &MSP430::GR16RegClass, &MSP430::GR16RegClass, &MSP430::GR16RegClass, &MSP430::GR16RegClass, @@ -74,9 +96,21 @@ &MSP430::GR16RegClass, &MSP430::GR16RegClass, 0 }; + static const TargetRegisterClass * const CalleeSavedRegClassesIntrFP[] = { + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, &MSP430::GR16RegClass, + &MSP430::GR16RegClass, 0 + }; - return (F->getCallingConv() == CallingConv::MSP430_INTR ? - CalleeSavedRegClassesIntr : CalleeSavedRegClasses); + if (hasFP(*MF)) + return (F->getCallingConv() == CallingConv::MSP430_INTR ? + CalleeSavedRegClassesIntrFP : CalleeSavedRegClassesFP); + else + return (F->getCallingConv() == CallingConv::MSP430_INTR ? + CalleeSavedRegClassesIntr : CalleeSavedRegClasses); } BitVector MSP430RegisterInfo::getReservedRegs(const MachineFunction &MF) const { @@ -102,7 +136,11 @@ bool MSP430RegisterInfo::hasFP(const MachineFunction &MF) const { - return NoFramePointerElim || MF.getFrameInfo()->hasVarSizedObjects(); + const MachineFrameInfo *MFI = MF.getFrameInfo(); + + return (NoFramePointerElim || + MF.getFrameInfo()->hasVarSizedObjects() || + MFI->isFrameAddressTaken()); } bool MSP430RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { From asl at math.spbu.ru Mon Dec 21 14:19:37 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 21 Dec 2009 20:19:37 -0000 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h Message-ID: <200912212019.nBLKJbgb023078@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 21 14:19:37 2009 New Revision: 91842 URL: http://llvm.org/viewvc/llvm-project?rev=91842&view=rev Log: Remove uber-gross hack. The define _snprintf to snprintf is invalid due to two reasons: 1. Accroding to C++ standard snprintf should be available in std namespace (and __gnu_cxx in case of GCC to). Such ifdef will change all snprintf's to _snprintf's, but won't bring snprintf to all necessary namespaces. Thus e.g. any locale-using code on mingw will yield an error (include this file + string to see the result) 2. MSVCRT's _snprintf does not comply with C99 standard. Standard one is snprintf. Modified: llvm/trunk/include/llvm/Support/Format.h Modified: llvm/trunk/include/llvm/Support/Format.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Format.h?rev=91842&r1=91841&r2=91842&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Format.h (original) +++ llvm/trunk/include/llvm/Support/Format.h Mon Dec 21 14:19:37 2009 @@ -25,9 +25,6 @@ #include #include -#ifdef WIN32 -#define snprintf _snprintf -#endif namespace llvm { From ofv at wanadoo.es Mon Dec 21 14:33:14 2009 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Mon, 21 Dec 2009 21:33:14 +0100 Subject: [llvm-commits] [PATCH] Fix build depedencies with CMake References: <4B2E0CE4.8050506@laposte.net> Message-ID: <87y6kwqd85.fsf@telefonica.net> C?dric Venet writes: > diff --git a/examples/wpa/CMakeLists.txt b/examples/wpa/CMakeLists.txt Maybe the right place to propose the patch is the clang cvs ml? -- ?scar From dag at cray.com Mon Dec 21 15:20:31 2009 From: dag at cray.com (David Greene) Date: Mon, 21 Dec 2009 15:20:31 -0600 Subject: [llvm-commits] [llvm] r91672 - in /llvm/trunk: lib/Target/X86/X86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/break-sse-dep.ll In-Reply-To: <99F7166D-548B-4DCC-AA22-FAD6616EC1D1@apple.com> References: <200912180740.nBI7eUQG026117@zion.cs.uiuc.edu> <99F7166D-548B-4DCC-AA22-FAD6616EC1D1@apple.com> Message-ID: <200912211520.31954.dag@cray.com> On Monday 21 December 2009 13:13, Chris Lattner wrote: > > That's intentional. I don't have a AMD machine to try it on and I did not > > want to introduce a regression. > > I'm almost certain they have the same issue. Yes, they do. -Dave From greened at obbligato.org Mon Dec 21 15:21:35 2009 From: greened at obbligato.org (David Greene) Date: Mon, 21 Dec 2009 21:21:35 -0000 Subject: [llvm-commits] [llvm] r91843 - in /llvm/trunk: test/TableGen/subst2.td utils/TableGen/Record.cpp Message-ID: <200912212121.nBLLLZCW025263@zion.cs.uiuc.edu> Author: greened Date: Mon Dec 21 15:21:34 2009 New Revision: 91843 URL: http://llvm.org/viewvc/llvm-project?rev=91843&view=rev Log: Fix a bug in !subst where TableGen would go and resubstitute text it had just substituted. This could cause infinite looping in certain pathological cases. Added: llvm/trunk/test/TableGen/subst2.td Modified: llvm/trunk/utils/TableGen/Record.cpp Added: llvm/trunk/test/TableGen/subst2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/subst2.td?rev=91843&view=auto ============================================================================== --- llvm/trunk/test/TableGen/subst2.td (added) +++ llvm/trunk/test/TableGen/subst2.td Mon Dec 21 15:21:34 2009 @@ -0,0 +1,15 @@ +// RUN: tblgen %s | FileCheck %s +// CHECK: No subst +// CHECK: No foo +// CHECK: RECURSE foo + +class Recurse { + string Text = t; +} + +class Text : + Recurse; + +def Ok1 : Text<"No subst">; +def Ok2 : Text<"No NORECURSE">; +def Trouble : Text<"RECURSE NORECURSE">; Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=91843&r1=91842&r2=91843&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Mon Dec 21 15:21:34 2009 @@ -945,11 +945,13 @@ std::string Val = RHSs->getValue(); std::string::size_type found; + std::string::size_type idx = 0; do { - found = Val.find(LHSs->getValue()); + found = Val.find(LHSs->getValue(), idx); if (found != std::string::npos) { Val.replace(found, LHSs->getValue().size(), MHSs->getValue()); } + idx = found + MHSs->getValue().size(); } while (found != std::string::npos); return new StringInit(Val); From jyasskin at google.com Mon Dec 21 15:47:52 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Mon, 21 Dec 2009 13:47:52 -0800 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: On Sun, Dec 20, 2009 at 4:07 AM, nicolas geoffray wrote: > Hi Jeffrey, > >> >> >> ============================================================================== >> --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) >> +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Dec 17 15:35:29 >> 2009 >> @@ -517,9 +517,15 @@ >> ? void *Actual = TheJIT->isCompilingLazily() >> ? ? ? (void *)(intptr_t)LazyResolverFn : (void *)0; >> >> + ?// TODO: Delete this when PR5737 is fixed. >> + ?std::string ErrorMsg; >> + ?if (TheJIT->materializeFunction(F, &ErrorMsg)) { >> + ? ?llvm_report_error("Error reading function '" + F->getName()+ >> + ? ? ? ? ? ? ? ? ? ? ?"' from bitcode file: " + ErrorMsg); >> + ?} > > This should be guarded by a lazy compilation enabled check. What's the actual failure you see? As far as I understand, it's lazy bitcode loading that causes functions to have ghost linkage, not lazy compilation. Until http://llvm.org/bugs/show_bug.cgi?id=5737 is fixed, there's no way to tell whether a ghost function is available_externally without materializing it, so I'd expect not having this to break all users of lazy bitcode loading, not just users who also compile lazily. >> ? // If this is an external declaration, attempt to resolve the address >> now >> ? // to place in the stub. >> - ?if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) { >> + ?if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) { > > Why remove the hasNotBeenReadFromBitcode? The hasNotBeenReadFromBitcode > function verifies that the linkage of the function is GhostLinkage, which is > used by lazy compilation. So users that use lazy compilation require the > call to hasNotBeenReadFromBitcode. Given the above call to materializeFunction(F), hasNotBeenReadFromBitcode should always be false, so testing it is redundant. I could add an assert() if you want. >> ? ? Actual = TheJIT->getPointerToFunction(F); >> >> ? ? // If we resolved the symbol to a null address (eg. a weak external) >> @@ -552,7 +558,7 @@ >> ? // exist yet, add it to the JIT's work list so that we can fill in the >> stub >> ? // address later. >> ? if (!Actual && !TheJIT->isCompilingLazily()) >> - ? ?if (!F->isDeclaration() || F->hasNotBeenReadFromBitcode()) >> + ? ?if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage()) >> ? ? ? TheJIT->addPendingFunction(F); > > Likewise. > >> >> ? return Stub; >> @@ -755,9 +761,16 @@ >> ? ? void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F); >> ? ? if (ResultPtr) return ResultPtr; >> >> + ? ?// TODO: Delete this when PR5737 is fixed. >> + ? ?std::string ErrorMsg; >> + ? ?if (TheJIT->materializeFunction(F, &ErrorMsg)) { >> + ? ? ?llvm_report_error("Error reading function '" + F->getName()+ >> + ? ? ? ? ? ? ? ? ? ? ? ?"' from bitcode file: " + ErrorMsg); >> + ? ?} >> + > > Add the guard for enabled lazy compilation. > >> >> ? ? // If this is an external function pointer, we can force the JIT to >> ? ? // 'compile' it, which really just adds it to the map. >> - ? ?if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) >> + ? ?if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) >> ? ? ? return TheJIT->getPointerToFunction(F); >> ? } > > Don't remove the hasNotBeenReadFromBitcode. > > Hope that still fixes the PR! > Cheers, > Nicolas > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From isanbard at gmail.com Mon Dec 21 15:59:52 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Dec 2009 21:59:52 -0000 Subject: [llvm-commits] [llvm] r91845 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912212159.nBLLxqQa026660@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 15:59:52 2009 New Revision: 91845 URL: http://llvm.org/viewvc/llvm-project?rev=91845&view=rev Log: - Add a bit more plumbing assigning an order to SDNodes. - Modify the "dump" method to emit the order of an SDNode. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=91845&r1=91844&r2=91845&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Dec 21 15:59:52 2009 @@ -834,6 +834,9 @@ /// AssignOrdering - Assign an order to the SDNode. void AssignOrdering(SDNode *SD, unsigned Order); + /// GetOrdering - Get the order for the SDNode. + unsigned GetOrdering(const SDNode *SD) const; + void dump() const; /// CreateStackTemporary - Create a stack temporary, suitable for holding the Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=91845&r1=91844&r2=91845&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Dec 21 15:59:52 2009 @@ -5218,6 +5218,12 @@ Ordering->add(SD, Order); } +/// GetOrdering - Get the order for the SDNode. +unsigned SelectionDAG::GetOrdering(const SDNode *SD) const { + assert(SD && "Trying to get the order of a null node!"); + return Ordering ? Ordering->getOrder(SD) : 0; +} + //===----------------------------------------------------------------------===// // SDNode Class @@ -5857,6 +5863,10 @@ if (unsigned int TF = BA->getTargetFlags()) OS << " [TF=" << TF << ']'; } + + if (G) + if (unsigned Order = G->GetOrdering(this)) + OS << " [ORD=" << Order << ']'; } void SDNode::print(raw_ostream &OS, const SelectionDAG *G) const { @@ -6062,25 +6072,31 @@ const SelectionDAG *G, VisitedSDNodeSet &once) { if (!once.insert(N)) // If we've been here before, return now. return; + // Dump the current SDNode, but don't end the line yet. OS << std::string(indent, ' '); N->printr(OS, G); + // Having printed this SDNode, walk the children: for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { const SDNode *child = N->getOperand(i).getNode(); + if (i) OS << ","; OS << " "; + if (child->getNumOperands() == 0) { // This child has no grandchildren; print it inline right here. child->printr(OS, G); once.insert(child); - } else { // Just the address. FIXME: also print the child's opcode + } else { // Just the address. FIXME: also print the child's opcode. OS << (void*)child; if (unsigned RN = N->getOperand(i).getResNo()) OS << ":" << RN; } } + OS << "\n"; + // Dump children that have grandchildren on their own line(s). for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { const SDNode *child = N->getOperand(i).getNode(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91845&r1=91844&r2=91845&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 15:59:52 2009 @@ -1418,11 +1418,14 @@ if (++BBI != FuncInfo.MF->end()) NextBlock = BBI; - if (NextMBB == NextBlock) - DAG.setRoot(BrAnd); - else - DAG.setRoot(DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, BrAnd, - DAG.getBasicBlock(NextMBB))); + if (NextMBB != NextBlock) + BrAnd = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, BrAnd, + DAG.getBasicBlock(NextMBB)); + + DAG.setRoot(BrAnd); + + if (DisableScheduling) + DAG.AssignOrdering(BrAnd.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitInvoke(InvokeInst &I) { @@ -1445,9 +1448,13 @@ CurMBB->addSuccessor(LandingPad); // Drop into normal successor. - DAG.setRoot(DAG.getNode(ISD::BR, getCurDebugLoc(), - MVT::Other, getControlRoot(), - DAG.getBasicBlock(Return))); + SDValue Branch = DAG.getNode(ISD::BR, getCurDebugLoc(), + MVT::Other, getControlRoot(), + DAG.getBasicBlock(Return)); + DAG.setRoot(Branch); + + if (DisableScheduling) + DAG.AssignOrdering(Branch.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitUnwind(UnwindInst &I) { From nicolas.geoffray at gmail.com Mon Dec 21 16:00:20 2009 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Mon, 21 Dec 2009 23:00:20 +0100 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: Hi Jeffrey, > > This should be guarded by a lazy compilation enabled check. > > What's the actual failure you see? As far as I understand, it's lazy > bitcode loading that causes functions to have ghost linkage, not lazy > compilation. > Yes, sorry, that was lazy bitcode loading. This should not be triggered here. > > Until http://llvm.org/bugs/show_bug.cgi?id=5737 is fixed, there's no > way to tell whether a ghost function is available_externally without > materializing it, so I'd expect not having this to break all users of > lazy bitcode loading, not just users who also compile lazily. > > Ah, that's unfortunate. Two things incompatible with each other.... Still, the behavior was OK before your change, so I guess both ways do not fix PR5737. I'd really like to see the old behavior coming back again until a proper fix to PR5737 is submitted. Declaration() || F->hasAvailableExternallyLinkage()) { > > > > Why remove the hasNotBeenReadFromBitcode? The hasNotBeenReadFromBitcode > > function verifies that the linkage of the function is GhostLinkage, which > is > > used by lazy compilation. So users that use lazy compilation require the > > call to hasNotBeenReadFromBitcode. > > Given the above call to materializeFunction(F), > hasNotBeenReadFromBitcode should always be false, so testing it is > redundant. I could add an assert() if you want. > > No, the matierialize function should not be there in the first place. Nicolas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091221/9e7590f8/attachment.html From isanbard at gmail.com Mon Dec 21 16:30:11 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Dec 2009 22:30:11 -0000 Subject: [llvm-commits] [llvm] r91846 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912212230.nBLMUBB4027715@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 16:30:11 2009 New Revision: 91846 URL: http://llvm.org/viewvc/llvm-project?rev=91846&view=rev Log: Assign ordering to more instructions. Incremental check-in. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91846&r1=91845&r2=91846&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 16:30:11 2009 @@ -1967,10 +1967,16 @@ // If this is not a fall-through branch, emit the branch. CurMBB->addSuccessor(Default); - if (Default != NextBlock) - DAG.setRoot(DAG.getNode(ISD::BR, getCurDebugLoc(), - MVT::Other, getControlRoot(), - DAG.getBasicBlock(Default))); + if (Default != NextBlock) { + SDValue Val = DAG.getNode(ISD::BR, getCurDebugLoc(), + MVT::Other, getControlRoot(), + DAG.getBasicBlock(Default)); + DAG.setRoot(Val); + + if (DisableScheduling) + DAG.AssignOrdering(Val.getNode(), SDNodeOrder); + } + return; } @@ -2022,11 +2028,14 @@ for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i) CurMBB->addSuccessor(FuncInfo.MBBMap[I.getSuccessor(i)]); - DAG.setRoot(DAG.getNode(ISD::BRIND, getCurDebugLoc(), - MVT::Other, getControlRoot(), - getValue(I.getAddress()))); -} + SDValue Res = DAG.getNode(ISD::BRIND, getCurDebugLoc(), + MVT::Other, getControlRoot(), + getValue(I.getAddress())); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); +} void SelectionDAGBuilder::visitFSub(User &I) { // -0.0 - X --> fneg @@ -2040,17 +2049,28 @@ Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size()); if (CV == CNZ) { SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); + SDValue Res = DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return; } } } + if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) if (CFP->isExactlyValue(ConstantFP::getNegativeZero(Ty)->getValueAPF())) { SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); + SDValue Res = DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return; } @@ -2060,9 +2080,12 @@ void SelectionDAGBuilder::visitBinary(User &I, unsigned OpCode) { SDValue Op1 = getValue(I.getOperand(0)); SDValue Op2 = getValue(I.getOperand(1)); + SDValue Res = DAG.getNode(OpCode, getCurDebugLoc(), + Op1.getValueType(), Op1, Op2); + setValue(&I, Res); - setValue(&I, DAG.getNode(OpCode, getCurDebugLoc(), - Op1.getValueType(), Op1, Op2)); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitShift(User &I, unsigned Opcode) { @@ -2095,8 +2118,12 @@ TLI.getPointerTy(), Op2); } - setValue(&I, DAG.getNode(Opcode, getCurDebugLoc(), - Op1.getValueType(), Op1, Op2)); + SDValue Res = DAG.getNode(Opcode, getCurDebugLoc(), + Op1.getValueType(), Op1, Op2); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitICmp(User &I) { @@ -2110,7 +2137,11 @@ ISD::CondCode Opcode = getICmpCondCode(predicate); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getSetCC(getCurDebugLoc(), DestVT, Op1, Op2, Opcode)); + SDValue Res = DAG.getSetCC(getCurDebugLoc(), DestVT, Op1, Op2, Opcode); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitFCmp(User &I) { @@ -2123,37 +2154,54 @@ SDValue Op2 = getValue(I.getOperand(1)); ISD::CondCode Condition = getFCmpCondCode(predicate); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getSetCC(getCurDebugLoc(), DestVT, Op1, Op2, Condition)); + SDValue Res = DAG.getSetCC(getCurDebugLoc(), DestVT, Op1, Op2, Condition); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitSelect(User &I) { SmallVector ValueVTs; ComputeValueVTs(TLI, I.getType(), ValueVTs); unsigned NumValues = ValueVTs.size(); - if (NumValues != 0) { - SmallVector Values(NumValues); - SDValue Cond = getValue(I.getOperand(0)); - SDValue TrueVal = getValue(I.getOperand(1)); - SDValue FalseVal = getValue(I.getOperand(2)); - - for (unsigned i = 0; i != NumValues; ++i) - Values[i] = DAG.getNode(ISD::SELECT, getCurDebugLoc(), - TrueVal.getNode()->getValueType(i), Cond, - SDValue(TrueVal.getNode(), TrueVal.getResNo() + i), - SDValue(FalseVal.getNode(), FalseVal.getResNo() + i)); - - setValue(&I, DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), - DAG.getVTList(&ValueVTs[0], NumValues), - &Values[0], NumValues)); - } -} + if (NumValues == 0) return; + + SmallVector Values(NumValues); + SDValue Cond = getValue(I.getOperand(0)); + SDValue TrueVal = getValue(I.getOperand(1)); + SDValue FalseVal = getValue(I.getOperand(2)); + + for (unsigned i = 0; i != NumValues; ++i) { + Values[i] = DAG.getNode(ISD::SELECT, getCurDebugLoc(), + TrueVal.getNode()->getValueType(i), Cond, + SDValue(TrueVal.getNode(), + TrueVal.getResNo() + i), + SDValue(FalseVal.getNode(), + FalseVal.getResNo() + i)); + + if (DisableScheduling) + DAG.AssignOrdering(Values[i].getNode(), SDNodeOrder); + } + + SDValue Res = DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), + DAG.getVTList(&ValueVTs[0], NumValues), + &Values[0], NumValues); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); +} void SelectionDAGBuilder::visitTrunc(User &I) { // TruncInst cannot be a no-op cast because sizeof(src) > sizeof(dest). SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitZExt(User &I) { @@ -2161,7 +2209,11 @@ // ZExt also can't be a cast to bool for same reason. So, nothing much to do SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::ZERO_EXTEND, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::ZERO_EXTEND, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitSExt(User &I) { @@ -2169,50 +2221,78 @@ // SExt also can't be a cast to bool for same reason. So, nothing much to do SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::SIGN_EXTEND, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::SIGN_EXTEND, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitFPTrunc(User &I) { // FPTrunc is never a no-op cast, no need to check SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::FP_ROUND, getCurDebugLoc(), - DestVT, N, DAG.getIntPtrConstant(0))); + SDValue Res = DAG.getNode(ISD::FP_ROUND, getCurDebugLoc(), + DestVT, N, DAG.getIntPtrConstant(0)); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitFPExt(User &I){ // FPTrunc is never a no-op cast, no need to check SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::FP_EXTEND, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::FP_EXTEND, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitFPToUI(User &I) { // FPToUI is never a no-op cast, no need to check SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::FP_TO_UINT, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::FP_TO_UINT, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitFPToSI(User &I) { // FPToSI is never a no-op cast, no need to check SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::FP_TO_SINT, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::FP_TO_SINT, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitUIToFP(User &I) { // UIToFP is never a no-op cast, no need to check SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::UINT_TO_FP, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::UINT_TO_FP, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitSIToFP(User &I){ // SIToFP is never a no-op cast, no need to check SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getNode(ISD::SINT_TO_FP, getCurDebugLoc(), DestVT, N)); + SDValue Res = DAG.getNode(ISD::SINT_TO_FP, getCurDebugLoc(), DestVT, N); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitPtrToInt(User &I) { @@ -2221,8 +2301,11 @@ SDValue N = getValue(I.getOperand(0)); EVT SrcVT = N.getValueType(); EVT DestVT = TLI.getValueType(I.getType()); - SDValue Result = DAG.getZExtOrTrunc(N, getCurDebugLoc(), DestVT); - setValue(&I, Result); + SDValue Res = DAG.getZExtOrTrunc(N, getCurDebugLoc(), DestVT); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitIntToPtr(User &I) { @@ -2231,20 +2314,29 @@ SDValue N = getValue(I.getOperand(0)); EVT SrcVT = N.getValueType(); EVT DestVT = TLI.getValueType(I.getType()); - setValue(&I, DAG.getZExtOrTrunc(N, getCurDebugLoc(), DestVT)); + SDValue Res = DAG.getZExtOrTrunc(N, getCurDebugLoc(), DestVT); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitBitCast(User &I) { SDValue N = getValue(I.getOperand(0)); EVT DestVT = TLI.getValueType(I.getType()); - // BitCast assures us that source and destination are the same size so this - // is either a BIT_CONVERT or a no-op. - if (DestVT != N.getValueType()) - setValue(&I, DAG.getNode(ISD::BIT_CONVERT, getCurDebugLoc(), - DestVT, N)); // convert types - else - setValue(&I, N); // noop cast. + // BitCast assures us that source and destination are the same size so this is + // either a BIT_CONVERT or a no-op. + if (DestVT != N.getValueType()) { + SDValue Res = DAG.getNode(ISD::BIT_CONVERT, getCurDebugLoc(), + DestVT, N); // convert types. + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + } else { + setValue(&I, N); // noop cast. + } } void SelectionDAGBuilder::visitInsertElement(User &I) { @@ -2253,10 +2345,13 @@ SDValue InIdx = DAG.getNode(ISD::ZERO_EXTEND, getCurDebugLoc(), TLI.getPointerTy(), getValue(I.getOperand(2))); + SDValue Res = DAG.getNode(ISD::INSERT_VECTOR_ELT, getCurDebugLoc(), + TLI.getValueType(I.getType()), + InVec, InVal, InIdx); + setValue(&I, Res); - setValue(&I, DAG.getNode(ISD::INSERT_VECTOR_ELT, getCurDebugLoc(), - TLI.getValueType(I.getType()), - InVec, InVal, InIdx)); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitExtractElement(User &I) { @@ -2264,8 +2359,12 @@ SDValue InIdx = DAG.getNode(ISD::ZERO_EXTEND, getCurDebugLoc(), TLI.getPointerTy(), getValue(I.getOperand(1))); - setValue(&I, DAG.getNode(ISD::EXTRACT_VECTOR_ELT, getCurDebugLoc(), - TLI.getValueType(I.getType()), InVec, InIdx)); + SDValue Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, getCurDebugLoc(), + TLI.getValueType(I.getType()), InVec, InIdx); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } From sabre at nondot.org Mon Dec 21 16:43:03 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 22:43:03 -0000 Subject: [llvm-commits] [llvm] r91848 - /llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Message-ID: <200912212243.nBLMh3Th028134@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 16:43:03 2009 New Revision: 91848 URL: http://llvm.org/viewvc/llvm-project?rev=91848&view=rev Log: improve indentation avoid a pointless conversion from weakvh to trackingvh, no functionality change. Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=91848&r1=91847&r2=91848&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Mon Dec 21 16:43:03 2009 @@ -220,7 +220,7 @@ // Query AvailableVals by doing an insertion of null. std::pair InsertRes = - AvailableVals.insert(std::make_pair(BB, WeakVH())); + AvailableVals.insert(std::make_pair(BB, TrackingVH())); // Handle the case when the insertion fails because we have already seen BB. if (!InsertRes.second) { @@ -236,8 +236,8 @@ // it. When we get back to the first instance of the recursion we will fill // in the PHI node. return InsertRes.first->second = - PHINode::Create(PrototypeValue->getType(), PrototypeValue->getName(), - &BB->front()); + PHINode::Create(PrototypeValue->getType(), PrototypeValue->getName(), + &BB->front()); } // Okay, the value isn't in the map and we just inserted a null in the entry From isanbard at gmail.com Mon Dec 21 16:42:14 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Dec 2009 22:42:14 -0000 Subject: [llvm-commits] [llvm] r91847 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912212242.nBLMgEPu028097@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 16:42:14 2009 New Revision: 91847 URL: http://llvm.org/viewvc/llvm-project?rev=91847&view=rev Log: Another incremental check-in for assigning ordering to SDNodes. This time for shuffle and insert vector. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91847&r1=91846&r2=91847&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 16:42:14 2009 @@ -2401,8 +2401,13 @@ unsigned SrcNumElts = SrcVT.getVectorNumElements(); if (SrcNumElts == MaskNumElts) { - setValue(&I, DAG.getVectorShuffle(VT, getCurDebugLoc(), Src1, Src2, - &Mask[0])); + SDValue Res = DAG.getVectorShuffle(VT, getCurDebugLoc(), Src1, Src2, + &Mask[0]); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return; } @@ -2413,8 +2418,13 @@ // lengths match. if (SrcNumElts*2 == MaskNumElts && SequentialMask(Mask, 0)) { // The shuffle is concatenating two vectors together. - setValue(&I, DAG.getNode(ISD::CONCAT_VECTORS, getCurDebugLoc(), - VT, Src1, Src2)); + SDValue Res = DAG.getNode(ISD::CONCAT_VECTORS, getCurDebugLoc(), + VT, Src1, Src2); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return; } @@ -2445,8 +2455,14 @@ else MappedOps.push_back(Idx + MaskNumElts - SrcNumElts); } - setValue(&I, DAG.getVectorShuffle(VT, getCurDebugLoc(), Src1, Src2, - &MappedOps[0])); + + SDValue Res = DAG.getVectorShuffle(VT, getCurDebugLoc(), Src1, Src2, + &MappedOps[0]); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return; } @@ -2497,20 +2513,28 @@ } if (RangeUse[0] == 0 && RangeUse[1] == 0) { - setValue(&I, DAG.getUNDEF(VT)); // Vectors are not used. + SDValue Res = DAG.getUNDEF(VT); + setValue(&I, Res); // Vectors are not used. + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return; } else if (RangeUse[0] < 2 && RangeUse[1] < 2) { // Extract appropriate subvector and generate a vector shuffle for (int Input=0; Input < 2; ++Input) { SDValue& Src = Input == 0 ? Src1 : Src2; - if (RangeUse[Input] == 0) { + if (RangeUse[Input] == 0) Src = DAG.getUNDEF(VT); - } else { + else Src = DAG.getNode(ISD::EXTRACT_SUBVECTOR, getCurDebugLoc(), VT, Src, DAG.getIntPtrConstant(StartIdx[Input])); - } + + if (DisableScheduling) + DAG.AssignOrdering(Src.getNode(), SDNodeOrder); } + // Calculate new mask. SmallVector MappedOps; for (unsigned i = 0; i != MaskNumElts; ++i) { @@ -2522,8 +2546,14 @@ else MappedOps.push_back(Idx - SrcNumElts - StartIdx[1] + MaskNumElts); } - setValue(&I, DAG.getVectorShuffle(VT, getCurDebugLoc(), Src1, Src2, - &MappedOps[0])); + + SDValue Res = DAG.getVectorShuffle(VT, getCurDebugLoc(), Src1, Src2, + &MappedOps[0]); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return; } } @@ -2539,17 +2569,29 @@ Ops.push_back(DAG.getUNDEF(EltVT)); } else { int Idx = Mask[i]; + SDValue Res; + if (Idx < (int)SrcNumElts) - Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, getCurDebugLoc(), - EltVT, Src1, DAG.getConstant(Idx, PtrVT))); + Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, getCurDebugLoc(), + EltVT, Src1, DAG.getConstant(Idx, PtrVT)); else - Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, getCurDebugLoc(), - EltVT, Src2, - DAG.getConstant(Idx - SrcNumElts, PtrVT))); + Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, getCurDebugLoc(), + EltVT, Src2, + DAG.getConstant(Idx - SrcNumElts, PtrVT)); + + Ops.push_back(Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } } - setValue(&I, DAG.getNode(ISD::BUILD_VECTOR, getCurDebugLoc(), - VT, &Ops[0], Ops.size())); + + SDValue Res = DAG.getNode(ISD::BUILD_VECTOR, getCurDebugLoc(), + VT, &Ops[0], Ops.size()); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitInsertValue(InsertValueInst &I) { @@ -2588,9 +2630,13 @@ Values[i] = IntoUndef ? DAG.getUNDEF(AggValueVTs[i]) : SDValue(Agg.getNode(), Agg.getResNo() + i); - setValue(&I, DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), - DAG.getVTList(&AggValueVTs[0], NumAggValues), - &Values[0], NumAggValues)); + SDValue Res = DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), + DAG.getVTList(&AggValueVTs[0], NumAggValues), + &Values[0], NumAggValues); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitExtractValue(ExtractValueInst &I) { @@ -2616,9 +2662,13 @@ DAG.getUNDEF(Agg.getNode()->getValueType(Agg.getResNo() + i)) : SDValue(Agg.getNode(), Agg.getResNo() + i); - setValue(&I, DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), - DAG.getVTList(&ValValueVTs[0], NumValValues), - &Values[0], NumValValues)); + SDValue Res = DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), + DAG.getVTList(&ValValueVTs[0], NumValValues), + &Values[0], NumValValues); + setValue(&I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } From jyasskin at google.com Mon Dec 21 16:50:25 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Mon, 21 Dec 2009 14:50:25 -0800 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: On Mon, Dec 21, 2009 at 2:00 PM, nicolas geoffray wrote: > Hi Jeffrey, > >> >> > This should be guarded by a lazy compilation enabled check. >> >> What's the actual failure you see? As far as I understand, it's lazy >> bitcode loading that causes functions to have ghost linkage, not lazy >> compilation. > > Yes, sorry, that was lazy bitcode loading. This should not be triggered > here. >> >> Until http://llvm.org/bugs/show_bug.cgi?id=5737 is fixed, there's no >> way to tell whether a ghost function is available_externally without >> materializing it, so I'd expect not having this to break all users of >> lazy bitcode loading, not just users who also compile lazily. >> > > Ah, that's unfortunate. Two things incompatible with each other.... ?Still, > the behavior was OK before your change, so I guess both ways do not fix > PR5737. I'd really like to see the old behavior coming back again until a > proper fix to PR5737 is submitted. The behavior was not ok before my change: available_externally functions loaded lazily from bitcode would infinite-loop if you ever actually called them. This change avoided that infinite loop at the cost of loading one extra layer of functions from bitcode. It doesn't load the whole transitive call graph, just one layer down from the function you actually need to compile, and unless I did something wrong it doesn't compile that extra layer. Nick and I intend to fix PR5737 before 2.7 comes out, but trading some extra memory and time to get rid of an infinite loop seemed like a decent short-term option. Now, if it's costing vmkit more memory or time than I expected, I'm certainly willing to reconsider the order of these two fixes. What did this actually break for you? How much extra time or memory is it costing? >> Declaration() || F->hasAvailableExternallyLinkage()) { >> > >> > Why remove the hasNotBeenReadFromBitcode? The hasNotBeenReadFromBitcode >> > function verifies that the linkage of the function is GhostLinkage, >> > which is >> > used by lazy compilation. So users that use lazy compilation require the >> > call to hasNotBeenReadFromBitcode. >> >> Given the above call to materializeFunction(F), >> hasNotBeenReadFromBitcode should always be false, so testing it is >> redundant. I could add an assert() if you want. >> > > No, the matierialize function should not be there in the first place. When I delete it, I'll put back the hasNotBeenRead check. (I expect the tests will force me to.) From nicolas.geoffray at gmail.com Mon Dec 21 17:03:13 2009 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Tue, 22 Dec 2009 00:03:13 +0100 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: > > The behavior was not ok before my change: available_externally > functions loaded lazily from bitcode would infinite-loop if you ever > actually called them. This change avoided that infinite loop at the > cost of loading one extra layer of functions from bitcode. It doesn't > load the whole transitive call graph, just one layer down from the > function you actually need to compile, and unless I did something > wrong it doesn't compile that extra layer. Nick and I intend to fix > PR5737 before 2.7 comes out, but trading some extra memory and time to > get rid of an infinite loop seemed like a decent short-term option. > > It's not just about memory and time. See my comment below. > Now, if it's costing vmkit more memory or time than I expected, I'm > certainly willing to reconsider the order of these two fixes. What did > this actually break for you? How much extra time or memory is it > costing? > > The problem is not memory nor time. It's just that materializeFunction in Java includes calling applicative code to actually load the class that will be transformed to llvm instructions. However, in Java/vmkit everything must be done lazily, especially loading a class :) Nicolas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091222/0c52dbe1/attachment.html From sabre at nondot.org Mon Dec 21 17:04:33 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 23:04:33 -0000 Subject: [llvm-commits] [llvm] r91849 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200912212304.nBLN4X0Q029283@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 17:04:33 2009 New Revision: 91849 URL: http://llvm.org/viewvc/llvm-project?rev=91849&view=rev Log: refactor some code out to a new helper method. 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=91849&r1=91848&r2=91849&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Dec 21 17:04:33 2009 @@ -1277,6 +1277,32 @@ assert(!isSimpleValue() && "Wrong accessor"); return cast(Val.getPointer()); } + + /// MaterializeAdjustedValue - Emit code into this block to adjust the value + /// defined here to the specified type. This handles various coercion cases. + Value *MaterializeAdjustedValue(const Type *LoadTy, + const TargetData *TD) const { + Value *Res; + if (isSimpleValue()) { + Res = getSimpleValue(); + if (Res->getType() != LoadTy) { + assert(TD && "Need target data to handle type mismatch case"); + Res = GetStoreValueForLoad(Res, Offset, LoadTy, BB->getTerminator(), + *TD); + + DEBUG(errs() << "GVN COERCED NONLOCAL VAL:\nOffset: " << Offset << " " + << *getSimpleValue() << '\n' + << *Res << '\n' << "\n\n\n"); + } + } else { + Res = GetMemInstValueForLoad(getMemIntrinValue(), Offset, + LoadTy, BB->getTerminator(), *TD); + DEBUG(errs() << "GVN COERCED NONLOCAL MEM INTRIN:\nOffset: " << Offset + << " " << *getMemIntrinValue() << '\n' + << *Res << '\n' << "\n\n\n"); + } + return Res; + } }; /// ConstructSSAForLoadSet - Given a set of loads specified by ValuesPerBlock, @@ -1299,28 +1325,7 @@ if (SSAUpdate.HasValueForBlock(BB)) continue; - unsigned Offset = AV.Offset; - - Value *AvailableVal; - if (AV.isSimpleValue()) { - AvailableVal = AV.getSimpleValue(); - if (AvailableVal->getType() != LoadTy) { - assert(TD && "Need target data to handle type mismatch case"); - AvailableVal = GetStoreValueForLoad(AvailableVal, Offset, LoadTy, - BB->getTerminator(), *TD); - - DEBUG(errs() << "GVN COERCED NONLOCAL VAL:\nOffset: " << Offset << " " - << *AV.getSimpleValue() << '\n' - << *AvailableVal << '\n' << "\n\n\n"); - } - } else { - AvailableVal = GetMemInstValueForLoad(AV.getMemIntrinValue(), Offset, - LoadTy, BB->getTerminator(), *TD); - DEBUG(errs() << "GVN COERCED NONLOCAL MEM INTRIN:\nOffset: " << Offset - << " " << *AV.getMemIntrinValue() << '\n' - << *AvailableVal << '\n' << "\n\n\n"); - } - SSAUpdate.AddAvailableValue(BB, AvailableVal); + SSAUpdate.AddAvailableValue(BB, AV.MaterializeAdjustedValue(LoadTy, TD)); } // Perform PHI construction. From isanbard at gmail.com Mon Dec 21 17:10:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Dec 2009 23:10:20 -0000 Subject: [llvm-commits] [llvm] r91850 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912212310.nBLNAK89029496@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 17:10:19 2009 New Revision: 91850 URL: http://llvm.org/viewvc/llvm-project?rev=91850&view=rev Log: More ordering plumbing. This time for GEP. I need to remember to assign orderings to values returned by getValue(). Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91850&r1=91849&r2=91850&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 17:10:19 2009 @@ -2383,6 +2383,11 @@ SDValue Src1 = getValue(I.getOperand(0)); SDValue Src2 = getValue(I.getOperand(1)); + if (DisableScheduling) { + DAG.AssignOrdering(Src1.getNode(), SDNodeOrder); + DAG.AssignOrdering(Src2.getNode(), SDNodeOrder); + } + // Convert the ConstantVector mask operand into an array of ints, with -1 // representing undef values. SmallVector MaskElts; @@ -2460,8 +2465,11 @@ &MappedOps[0]); setValue(&I, Res); - if (DisableScheduling) + if (DisableScheduling) { + DAG.AssignOrdering(Src1.getNode(), SDNodeOrder); + DAG.AssignOrdering(Src2.getNode(), SDNodeOrder); DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + } return; } @@ -2671,11 +2679,13 @@ DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } - void SelectionDAGBuilder::visitGetElementPtr(User &I) { SDValue N = getValue(I.getOperand(0)); const Type *Ty = I.getOperand(0)->getType(); + if (DisableScheduling) + DAG.AssignOrdering(N.getNode(), SDNodeOrder); + for (GetElementPtrInst::op_iterator OI = I.op_begin()+1, E = I.op_end(); OI != E; ++OI) { Value *Idx = *OI; @@ -2686,7 +2696,11 @@ uint64_t Offset = TD->getStructLayout(StTy)->getElementOffset(Field); N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N, DAG.getIntPtrConstant(Offset)); + + if (DisableScheduling) + DAG.AssignOrdering(N.getNode(), SDNodeOrder); } + Ty = StTy->getElementType(Field); } else { Ty = cast(Ty)->getElementType(); @@ -2699,14 +2713,21 @@ SDValue OffsVal; EVT PTy = TLI.getPointerTy(); unsigned PtrBits = PTy.getSizeInBits(); - if (PtrBits < 64) { + if (PtrBits < 64) OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(), TLI.getPointerTy(), DAG.getConstant(Offs, MVT::i64)); - } else + else OffsVal = DAG.getIntPtrConstant(Offs); + N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N, OffsVal); + + if (DisableScheduling) { + DAG.AssignOrdering(OffsVal.getNode(), SDNodeOrder); + DAG.AssignOrdering(N.getNode(), SDNodeOrder); + } + continue; } @@ -2732,12 +2753,19 @@ IdxN = DAG.getNode(ISD::MUL, getCurDebugLoc(), N.getValueType(), IdxN, Scale); } + + if (DisableScheduling) + DAG.AssignOrdering(IdxN.getNode(), SDNodeOrder); } N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N, IdxN); + + if (DisableScheduling) + DAG.AssignOrdering(N.getNode(), SDNodeOrder); } } + setValue(&I, N); } From sabre at nondot.org Mon Dec 21 17:15:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Dec 2009 23:15:49 -0000 Subject: [llvm-commits] [llvm] r91851 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200912212315.nBLNFndv029694@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 17:15:48 2009 New Revision: 91851 URL: http://llvm.org/viewvc/llvm-project?rev=91851&view=rev Log: Add a fastpath to Load GVN to special case when we have exactly one dominating load to avoid even messing around with SSAUpdate at all. In this case (which is very common, we can just use the input value directly). This speeds up GVN time on gcc.c-torture/20001226-1.c from 36.4s to 16.3s, which still isn't great, but substantially better and this is a simple speedup that applies to lots of different cases. 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=91851&r1=91850&r2=91851&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Dec 21 17:15:48 2009 @@ -1311,7 +1311,15 @@ static Value *ConstructSSAForLoadSet(LoadInst *LI, SmallVectorImpl &ValuesPerBlock, const TargetData *TD, + const DominatorTree &DT, AliasAnalysis *AA) { + // Check for the fully redundant, dominating load case. In this case, we can + // just use the dominating value directly. + if (ValuesPerBlock.size() == 1 && + DT.properlyDominates(ValuesPerBlock[0].BB, LI->getParent())) + return ValuesPerBlock[0].MaterializeAdjustedValue(LI->getType(), TD); + + // Otherwise, we have to construct SSA form. SmallVector NewPHIs; SSAUpdater SSAUpdate(&NewPHIs); SSAUpdate.Initialize(LI); @@ -1494,7 +1502,7 @@ DEBUG(errs() << "GVN REMOVING NONLOCAL LOAD: " << *LI << '\n'); // Perform PHI construction. - Value *V = ConstructSSAForLoadSet(LI, ValuesPerBlock, TD, + Value *V = ConstructSSAForLoadSet(LI, ValuesPerBlock, TD, *DT, VN.getAliasAnalysis()); LI->replaceAllUsesWith(V); @@ -1683,7 +1691,7 @@ ValuesPerBlock.push_back(AvailableValueInBlock::get(UnavailablePred,NewLoad)); // Perform PHI construction. - Value *V = ConstructSSAForLoadSet(LI, ValuesPerBlock, TD, + Value *V = ConstructSSAForLoadSet(LI, ValuesPerBlock, TD, *DT, VN.getAliasAnalysis()); LI->replaceAllUsesWith(V); if (isa(V)) From jyasskin at google.com Mon Dec 21 17:27:49 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Mon, 21 Dec 2009 15:27:49 -0800 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: On Mon, Dec 21, 2009 at 3:03 PM, nicolas geoffray wrote: >> The behavior was not ok before my change: available_externally >> functions loaded lazily from bitcode would infinite-loop if you ever >> actually called them. This change avoided that infinite loop at the >> cost of loading one extra layer of functions from bitcode. It doesn't >> load the whole transitive call graph, just one layer down from the >> function you actually need to compile, and unless I did something >> wrong it doesn't compile that extra layer. Nick and I intend to fix >> PR5737 before 2.7 comes out, but trading some extra memory and time to >> get rid of an infinite loop seemed like a decent short-term option. >> > > It's not just about memory and time. See my comment below. > >> >> Now, if it's costing vmkit more memory or time than I expected, I'm >> certainly willing to reconsider the order of these two fixes. What did >> this actually break for you? How much extra time or memory is it >> costing? >> > > The problem is not memory nor time. It's just that materializeFunction in > Java includes calling applicative code to actually load the class that will > be transformed to llvm instructions. However, in Java/vmkit everything must > be done lazily, especially loading a class :) Ah, I see now. You have your own ModuleProvider, and it needs to know precisely when the function is actually needed, right? Yeah, it sounds like I need to roll back that part of this fix until PR5737 is fixed. Could you please write some tests for the ways you're using ModuleProviders and the other interfaces in LLVM? I keep breaking or nearly breaking you, and I'd be much more likely to get this right if a test broke when I got it wrong. From daniel at zuster.org Mon Dec 21 17:27:58 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 21 Dec 2009 23:27:58 -0000 Subject: [llvm-commits] [llvm] r91853 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200912212327.nBLNRxmt030165@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Dec 21 17:27:57 2009 New Revision: 91853 URL: http://llvm.org/viewvc/llvm-project?rev=91853&view=rev Log: Add suggested parentheses. 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=91853&r1=91852&r2=91853&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Dec 21 17:27:57 2009 @@ -9598,10 +9598,10 @@ // MAX(MIN(a, b), a) -> a // MIN(MAX(a, b), a) -> a - if (SPF1 == SPF_SMIN && SPF2 == SPF_SMAX || - SPF1 == SPF_SMAX && SPF2 == SPF_SMIN || - SPF1 == SPF_UMIN && SPF2 == SPF_UMAX || - SPF1 == SPF_UMAX && SPF2 == SPF_UMIN) + if ((SPF1 == SPF_SMIN && SPF2 == SPF_SMAX) || + (SPF1 == SPF_SMAX && SPF2 == SPF_SMIN) || + (SPF1 == SPF_UMIN && SPF2 == SPF_UMAX) || + (SPF1 == SPF_UMAX && SPF2 == SPF_UMIN)) return ReplaceInstUsesWith(Outer, C); } From isanbard at gmail.com Mon Dec 21 17:47:40 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Dec 2009 23:47:40 -0000 Subject: [llvm-commits] [llvm] r91857 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912212347.nBLNlfiT030808@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 17:47:40 2009 New Revision: 91857 URL: http://llvm.org/viewvc/llvm-project?rev=91857&view=rev Log: Add more plumbing to assign ordering to SDNodes. Have the "getValue" method assign the ordering when called. Combine some of the ordering assignments to keep things simple. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91857&r1=91856&r2=91857&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 17:47:40 2009 @@ -638,8 +638,12 @@ for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i) Constants.push_back(SDValue(Val, i)); } - return DAG.getMergeValues(&Constants[0], Constants.size(), - getCurDebugLoc()); + + SDValue Res = DAG.getMergeValues(&Constants[0], Constants.size(), + getCurDebugLoc()); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return Res; } if (isa(C->getType()) || isa(C->getType())) { @@ -661,7 +665,12 @@ else Constants[i] = DAG.getConstant(0, EltVT); } - return DAG.getMergeValues(&Constants[0], NumElts, getCurDebugLoc()); + + SDValue Res = DAG.getMergeValues(&Constants[0], NumElts, + getCurDebugLoc()); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return Res; } if (BlockAddress *BA = dyn_cast(C)) @@ -689,8 +698,12 @@ } // Create a BUILD_VECTOR node. - return NodeMap[V] = DAG.getNode(ISD::BUILD_VECTOR, getCurDebugLoc(), - VT, &Ops[0], Ops.size()); + SDValue Res = DAG.getNode(ISD::BUILD_VECTOR, getCurDebugLoc(), + VT, &Ops[0], Ops.size()); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + + return NodeMap[V] = Res; } // If this is a static alloca, generate it as the frameindex instead of @@ -707,7 +720,10 @@ RegsForValue RFV(*DAG.getContext(), TLI, InReg, V->getType()); SDValue Chain = DAG.getEntryNode(); - return RFV.getCopyFromRegs(DAG, getCurDebugLoc(), Chain, NULL); + SDValue Res = RFV.getCopyFromRegs(DAG, getCurDebugLoc(), Chain, NULL); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return Res; } /// Get the EVTs and ArgFlags collections that represent the return type @@ -788,16 +804,26 @@ SmallVector Chains(NumValues); EVT PtrVT = PtrValueVTs[0]; - for (unsigned i = 0; i != NumValues; ++i) - Chains[i] = DAG.getStore(Chain, getCurDebugLoc(), - SDValue(RetOp.getNode(), RetOp.getResNo() + i), - DAG.getNode(ISD::ADD, getCurDebugLoc(), PtrVT, RetPtr, - DAG.getConstant(Offsets[i], PtrVT)), - NULL, Offsets[i], false, 0); + for (unsigned i = 0; i != NumValues; ++i) { + SDValue Add = DAG.getNode(ISD::ADD, getCurDebugLoc(), PtrVT, RetPtr, + DAG.getConstant(Offsets[i], PtrVT)); + Chains[i] = + DAG.getStore(Chain, getCurDebugLoc(), + SDValue(RetOp.getNode(), RetOp.getResNo() + i), + Add, NULL, Offsets[i], false, 0); + + if (DisableScheduling) { + DAG.AssignOrdering(Add.getNode(), SDNodeOrder); + DAG.AssignOrdering(Chains[i].getNode(), SDNodeOrder); + } + } + Chain = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), MVT::Other, &Chains[0], NumValues); - } - else { + + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); + } else { for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { SmallVector ValueVTs; ComputeValueVTs(TLI, I.getOperand(i)->getType(), ValueVTs); @@ -862,6 +888,9 @@ // Update the DAG with the new chain value resulting from return lowering. DAG.setRoot(Chain); + + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); } /// CopyToExportRegsIfNeeded - If the given value has virtual registers @@ -1224,6 +1253,9 @@ } } + if (DisableScheduling) + DAG.AssignOrdering(Cond.getNode(), SDNodeOrder); + // Update successor info CurMBB->addSuccessor(CB.TrueBB); CurMBB->addSuccessor(CB.FalseBB); @@ -1241,12 +1273,18 @@ std::swap(CB.TrueBB, CB.FalseBB); SDValue True = DAG.getConstant(1, Cond.getValueType()); Cond = DAG.getNode(ISD::XOR, dl, Cond.getValueType(), Cond, True); + + if (DisableScheduling) + DAG.AssignOrdering(Cond.getNode(), SDNodeOrder); } SDValue BrCond = DAG.getNode(ISD::BRCOND, dl, MVT::Other, getControlRoot(), Cond, DAG.getBasicBlock(CB.TrueBB)); + if (DisableScheduling) + DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); + // If the branch was constant folded, fix up the CFG. if (BrCond.getOpcode() == ISD::BR) { CurMBB->removeSuccessor(CB.FalseBB); @@ -1255,15 +1293,16 @@ if (BrCond == getControlRoot()) CurMBB->removeSuccessor(CB.TrueBB); - if (CB.FalseBB != NextBlock) + if (CB.FalseBB != NextBlock) { BrCond = DAG.getNode(ISD::BR, dl, MVT::Other, BrCond, DAG.getBasicBlock(CB.FalseBB)); + + if (DisableScheduling) + DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); + } } DAG.setRoot(BrCond); - - if (DisableScheduling) - DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); } /// visitJumpTable - Emit JumpTable node in the current MBB @@ -1279,8 +1318,11 @@ Table, Index); DAG.setRoot(BrJumpTable); - if (DisableScheduling) + if (DisableScheduling) { + DAG.AssignOrdering(Index.getNode(), SDNodeOrder); + DAG.AssignOrdering(Table.getNode(), SDNodeOrder); DAG.AssignOrdering(BrJumpTable.getNode(), SDNodeOrder); + } } /// visitJumpTableHeader - This function emits necessary code to produce index @@ -1292,7 +1334,7 @@ // difference between smallest and largest cases. SDValue SwitchOp = getValue(JTH.SValue); EVT VT = SwitchOp.getValueType(); - SDValue SUB = DAG.getNode(ISD::SUB, getCurDebugLoc(), VT, SwitchOp, + SDValue Sub = DAG.getNode(ISD::SUB, getCurDebugLoc(), VT, SwitchOp, DAG.getConstant(JTH.First, VT)); // The SDNode we just created, which holds the value being switched on minus @@ -1300,7 +1342,7 @@ // can be used as an index into the jump table in a subsequent basic block. // This value may be smaller or larger than the target's pointer type, and // therefore require extension or truncating. - SwitchOp = DAG.getZExtOrTrunc(SUB, getCurDebugLoc(), TLI.getPointerTy()); + SwitchOp = DAG.getZExtOrTrunc(Sub, getCurDebugLoc(), TLI.getPointerTy()); unsigned JumpTableReg = FuncInfo.MakeReg(TLI.getPointerTy()); SDValue CopyTo = DAG.getCopyToReg(getControlRoot(), getCurDebugLoc(), @@ -1311,14 +1353,22 @@ // for the switch statement if the value being switched on exceeds the largest // case in the switch. SDValue CMP = DAG.getSetCC(getCurDebugLoc(), - TLI.getSetCCResultType(SUB.getValueType()), SUB, + TLI.getSetCCResultType(Sub.getValueType()), Sub, DAG.getConstant(JTH.Last-JTH.First,VT), ISD::SETUGT); + if (DisableScheduling) { + DAG.AssignOrdering(Sub.getNode(), SDNodeOrder); + DAG.AssignOrdering(SwitchOp.getNode(), SDNodeOrder); + DAG.AssignOrdering(CopyTo.getNode(), SDNodeOrder); + DAG.AssignOrdering(CMP.getNode(), SDNodeOrder); + } + // Set NextBlock to be the MBB immediately after the current one, if any. // This is used to avoid emitting unnecessary branches to the next block. MachineBasicBlock *NextBlock = 0; MachineFunction::iterator BBI = CurMBB; + if (++BBI != FuncInfo.MF->end()) NextBlock = BBI; @@ -1326,14 +1376,18 @@ MVT::Other, CopyTo, CMP, DAG.getBasicBlock(JT.Default)); - if (JT.MBB != NextBlock) + if (DisableScheduling) + DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); + + if (JT.MBB != NextBlock) { BrCond = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, BrCond, DAG.getBasicBlock(JT.MBB)); - DAG.setRoot(BrCond); + if (DisableScheduling) + DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); + } - if (DisableScheduling) - DAG.AssignOrdering(BrCond.getNode(), SDNodeOrder); + DAG.setRoot(BrCond); } /// visitBitTestHeader - This function emits necessary code to produce value @@ -1342,21 +1396,29 @@ // Subtract the minimum value SDValue SwitchOp = getValue(B.SValue); EVT VT = SwitchOp.getValueType(); - SDValue SUB = DAG.getNode(ISD::SUB, getCurDebugLoc(), VT, SwitchOp, + SDValue Sub = DAG.getNode(ISD::SUB, getCurDebugLoc(), VT, SwitchOp, DAG.getConstant(B.First, VT)); // Check range SDValue RangeCmp = DAG.getSetCC(getCurDebugLoc(), - TLI.getSetCCResultType(SUB.getValueType()), - SUB, DAG.getConstant(B.Range, VT), + TLI.getSetCCResultType(Sub.getValueType()), + Sub, DAG.getConstant(B.Range, VT), ISD::SETUGT); - SDValue ShiftOp = DAG.getZExtOrTrunc(SUB, getCurDebugLoc(), TLI.getPointerTy()); + SDValue ShiftOp = DAG.getZExtOrTrunc(Sub, getCurDebugLoc(), + TLI.getPointerTy()); B.Reg = FuncInfo.MakeReg(TLI.getPointerTy()); SDValue CopyTo = DAG.getCopyToReg(getControlRoot(), getCurDebugLoc(), B.Reg, ShiftOp); + if (DisableScheduling) { + DAG.AssignOrdering(Sub.getNode(), SDNodeOrder); + DAG.AssignOrdering(RangeCmp.getNode(), SDNodeOrder); + DAG.AssignOrdering(ShiftOp.getNode(), SDNodeOrder); + DAG.AssignOrdering(CopyTo.getNode(), SDNodeOrder); + } + // Set NextBlock to be the MBB immediately after the current one, if any. // This is used to avoid emitting unnecessary branches to the next block. MachineBasicBlock *NextBlock = 0; @@ -1373,14 +1435,18 @@ MVT::Other, CopyTo, RangeCmp, DAG.getBasicBlock(B.Default)); - if (MBB != NextBlock) + if (DisableScheduling) + DAG.AssignOrdering(BrRange.getNode(), SDNodeOrder); + + if (MBB != NextBlock) { BrRange = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, CopyTo, DAG.getBasicBlock(MBB)); - DAG.setRoot(BrRange); + if (DisableScheduling) + DAG.AssignOrdering(BrRange.getNode(), SDNodeOrder); + } - if (DisableScheduling) - DAG.AssignOrdering(BrRange.getNode(), SDNodeOrder); + DAG.setRoot(BrRange); } /// visitBitTestCase - this function produces one "bit test" @@ -1404,6 +1470,13 @@ AndOp, DAG.getConstant(0, TLI.getPointerTy()), ISD::SETNE); + if (DisableScheduling) { + DAG.AssignOrdering(ShiftOp.getNode(), SDNodeOrder); + DAG.AssignOrdering(SwitchVal.getNode(), SDNodeOrder); + DAG.AssignOrdering(AndOp.getNode(), SDNodeOrder); + DAG.AssignOrdering(AndCmp.getNode(), SDNodeOrder); + } + CurMBB->addSuccessor(B.TargetBB); CurMBB->addSuccessor(NextMBB); @@ -1411,6 +1484,9 @@ MVT::Other, getControlRoot(), AndCmp, DAG.getBasicBlock(B.TargetBB)); + if (DisableScheduling) + DAG.AssignOrdering(BrAnd.getNode(), SDNodeOrder); + // Set NextBlock to be the MBB immediately after the current one, if any. // This is used to avoid emitting unnecessary branches to the next block. MachineBasicBlock *NextBlock = 0; @@ -1418,14 +1494,15 @@ if (++BBI != FuncInfo.MF->end()) NextBlock = BBI; - if (NextMBB != NextBlock) + if (NextMBB != NextBlock) { BrAnd = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, BrAnd, DAG.getBasicBlock(NextMBB)); - DAG.setRoot(BrAnd); + if (DisableScheduling) + DAG.AssignOrdering(BrAnd.getNode(), SDNodeOrder); + } - if (DisableScheduling) - DAG.AssignOrdering(BrAnd.getNode(), SDNodeOrder); + DAG.setRoot(BrAnd); } void SelectionDAGBuilder::visitInvoke(InvokeInst &I) { @@ -1910,7 +1987,6 @@ return true; } - /// Clusterify - Transform simple list of Cases into list of CaseRange's size_t SelectionDAGBuilder::Clusterify(CaseVector& Cases, const SwitchInst& SI) { @@ -1957,7 +2033,6 @@ void SelectionDAGBuilder::visitSwitch(SwitchInst &SI) { // Figure out which block is immediately after the current one. MachineBasicBlock *NextBlock = 0; - MachineBasicBlock *Default = FuncInfo.MBBMap[SI.getDefaultDest()]; // If there is only the default destination, branch to it if it is not the @@ -1968,13 +2043,13 @@ // If this is not a fall-through branch, emit the branch. CurMBB->addSuccessor(Default); if (Default != NextBlock) { - SDValue Val = DAG.getNode(ISD::BR, getCurDebugLoc(), + SDValue Res = DAG.getNode(ISD::BR, getCurDebugLoc(), MVT::Other, getControlRoot(), DAG.getBasicBlock(Default)); - DAG.setRoot(Val); + DAG.setRoot(Res); if (DisableScheduling) - DAG.AssignOrdering(Val.getNode(), SDNodeOrder); + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } return; @@ -2122,8 +2197,11 @@ Op1.getValueType(), Op1, Op2); setValue(&I, Res); - if (DisableScheduling) + if (DisableScheduling) { + DAG.AssignOrdering(Op1.getNode(), SDNodeOrder); + DAG.AssignOrdering(Op2.getNode(), SDNodeOrder); DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + } } void SelectionDAGBuilder::visitICmp(User &I) { @@ -2343,28 +2421,32 @@ SDValue InVec = getValue(I.getOperand(0)); SDValue InVal = getValue(I.getOperand(1)); SDValue InIdx = DAG.getNode(ISD::ZERO_EXTEND, getCurDebugLoc(), - TLI.getPointerTy(), - getValue(I.getOperand(2))); + TLI.getPointerTy(), + getValue(I.getOperand(2))); SDValue Res = DAG.getNode(ISD::INSERT_VECTOR_ELT, getCurDebugLoc(), TLI.getValueType(I.getType()), InVec, InVal, InIdx); setValue(&I, Res); - if (DisableScheduling) + if (DisableScheduling) { + DAG.AssignOrdering(InIdx.getNode(), SDNodeOrder); DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + } } void SelectionDAGBuilder::visitExtractElement(User &I) { SDValue InVec = getValue(I.getOperand(0)); SDValue InIdx = DAG.getNode(ISD::ZERO_EXTEND, getCurDebugLoc(), - TLI.getPointerTy(), - getValue(I.getOperand(1))); + TLI.getPointerTy(), + getValue(I.getOperand(1))); SDValue Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, getCurDebugLoc(), TLI.getValueType(I.getType()), InVec, InIdx); setValue(&I, Res); - if (DisableScheduling) + if (DisableScheduling) { + DAG.AssignOrdering(InIdx.getNode(), SDNodeOrder); DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + } } @@ -2383,11 +2465,6 @@ SDValue Src1 = getValue(I.getOperand(0)); SDValue Src2 = getValue(I.getOperand(1)); - if (DisableScheduling) { - DAG.AssignOrdering(Src1.getNode(), SDNodeOrder); - DAG.AssignOrdering(Src2.getNode(), SDNodeOrder); - } - // Convert the ConstantVector mask operand into an array of ints, with -1 // representing undef values. SmallVector MaskElts; @@ -2532,7 +2609,7 @@ else if (RangeUse[0] < 2 && RangeUse[1] < 2) { // Extract appropriate subvector and generate a vector shuffle for (int Input=0; Input < 2; ++Input) { - SDValue& Src = Input == 0 ? Src1 : Src2; + SDValue &Src = Input == 0 ? Src1 : Src2; if (RangeUse[Input] == 0) Src = DAG.getUNDEF(VT); else @@ -2683,9 +2760,6 @@ SDValue N = getValue(I.getOperand(0)); const Type *Ty = I.getOperand(0)->getType(); - if (DisableScheduling) - DAG.AssignOrdering(N.getNode(), SDNodeOrder); - for (GetElementPtrInst::op_iterator OI = I.op_begin()+1, E = I.op_end(); OI != E; ++OI) { Value *Idx = *OI; From foom at fuhm.net Mon Dec 21 17:54:11 2009 From: foom at fuhm.net (James Y Knight) Date: Mon, 21 Dec 2009 18:54:11 -0500 Subject: [llvm-commits] Use "LLVMBool" instead of "int" for booleans in llvm-c API Message-ID: <9440D18F-527C-46F7-B39D-1CAF9FDA673B@fuhm.net> In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for. This should have no impact, but it allows me to put the following: %typemap(cin) LLVMBool ":boolean"; %typemap(cout) LLVMBool ":boolean"; in my swig .i file, and have it map LLVMBool to a boolean type in the bindings, instead of treating it as an integer. The attached patch also includes the following two tangentially related changes: 1) The following change seems trivially correct, but I'm not sure why it was not originally done like this. It makes the autogenerated wrapper nicer. -enum { LLVMBigEndian, LLVMLittleEndian }; -typedef int LLVMByteOrdering; +enum LLVMByteOrdering { LLVMBigEndian, LLVMLittleEndian }; ...Although, I don't know why this API uses an enum in any case. The obvious wrapper would have been: LLVMBool LLVMIsLittleEndian(LLVMTargetDataRef TD) { return unwrap(TD)->isLittleEndian(); } ...I suppose someone had a reason to not do that? *shrug* 2) While making these changes, I noticed that the function declaration for LLVMConstInlineAsm didn't match the function definition, and fixed it: -LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, +LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, - int HasSideEffects); + LLVMBool HasSideEffects, LLVMBool IsAlignStack); But i'm not sure if was correct procedure to fix the prototype, or if the function body should be adjusted to match the prototype instead... -------------- next part -------------- A non-text attachment was scrubbed... Name: LLVM-Bool.patch Type: application/octet-stream Size: 34682 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091221/7139d1c1/attachment.obj -------------- next part -------------- PS: The bindings I'm creating are for Common-Lisp, and are available here: http://repo.or.cz/w/cl-llvm.git/ James From lhames at gmail.com Mon Dec 21 18:11:50 2009 From: lhames at gmail.com (Lang Hames) Date: Tue, 22 Dec 2009 00:11:50 -0000 Subject: [llvm-commits] [llvm] r91859 - in /llvm/trunk: include/llvm/CodeGen/SlotIndexes.h lib/CodeGen/CalcSpillWeights.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/PreAllocSplitting.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SlotIndexes.cpp lib/CodeGen/Spiller.cpp Message-ID: <200912220011.nBM0BpLK031691@zion.cs.uiuc.edu> Author: lhames Date: Mon Dec 21 18:11:50 2009 New Revision: 91859 URL: http://llvm.org/viewvc/llvm-project?rev=91859&view=rev Log: Changed slot index ranges for MachineBasicBlocks to be exclusive of endpoint. This fixes an in-place update bug where code inserted at the end of basic blocks may not be covered by existing intervals which were live across the entire block. It is also consistent with the way ranges are specified for live intervals. Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/SlotIndexes.cpp llvm/trunk/lib/CodeGen/Spiller.cpp Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=91859&r1=91858&r2=91859&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Mon Dec 21 18:11:50 2009 @@ -579,7 +579,7 @@ (I == idx2MBBMap.end() && idx2MBBMap.size()>0)) ? (I-1): I; assert(J != idx2MBBMap.end() && J->first <= index && - index <= getMBBEndIdx(J->second) && + index < getMBBEndIdx(J->second) && "index does not correspond to an MBB"); return J->second; } Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=91859&r1=91858&r2=91859&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Mon Dec 21 18:11:50 2009 @@ -95,7 +95,7 @@ SlotIndex defIdx = lis->getInstructionIndex(mi).getDefIndex(); const LiveRange *dlr = lis->getInterval(reg).getLiveRangeContaining(defIdx); - if (dlr->end > mbbEnd) + if (dlr->end >= mbbEnd) weight *= 3.0F; } regInt.weight += weight; Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=91859&r1=91858&r2=91859&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Dec 21 18:11:50 2009 @@ -324,8 +324,7 @@ // of the defining block, potentially live across some blocks, then is // live into some number of blocks, but gets killed. Start by adding a // range that goes from this definition to the end of the defining block. - LiveRange NewLR(defIndex, getMBBEndIdx(mbb).getNextIndex().getLoadIndex(), - ValNo); + LiveRange NewLR(defIndex, getMBBEndIdx(mbb), ValNo); DEBUG(errs() << " +" << NewLR); interval.addRange(NewLR); @@ -334,10 +333,8 @@ // live interval. for (SparseBitVector<>::iterator I = vi.AliveBlocks.begin(), E = vi.AliveBlocks.end(); I != E; ++I) { - LiveRange LR( - getMBBStartIdx(mf_->getBlockNumbered(*I)), - getMBBEndIdx(mf_->getBlockNumbered(*I)).getNextIndex().getLoadIndex(), - ValNo); + MachineBasicBlock *aliveBlock = mf_->getBlockNumbered(*I); + LiveRange LR(getMBBStartIdx(aliveBlock), getMBBEndIdx(aliveBlock), ValNo); interval.addRange(LR); DEBUG(errs() << " +" << LR); } @@ -467,7 +464,7 @@ CopyMI = mi; ValNo = interval.getNextValue(defIndex, CopyMI, true, VNInfoAllocator); - SlotIndex killIndex = getMBBEndIdx(mbb).getNextIndex().getLoadIndex(); + SlotIndex killIndex = getMBBEndIdx(mbb); LiveRange LR(defIndex, killIndex, ValNo); interval.addRange(LR); ValNo->addKill(indexes_->getTerminatorGap(mbb)); @@ -1247,7 +1244,7 @@ continue; SlotIndex KillIdx = VNI->kills[j]; - if (KillIdx > Idx && KillIdx < End) + if (KillIdx > Idx && KillIdx <= End) return true; } return false; @@ -2085,7 +2082,7 @@ VN->kills.push_back(indexes_->getTerminatorGap(startInst->getParent())); LiveRange LR( SlotIndex(getInstructionIndex(startInst).getDefIndex()), - getMBBEndIdx(startInst->getParent()).getNextIndex().getBaseIndex(), VN); + getMBBEndIdx(startInst->getParent()), VN); Interval.addRange(LR); return LR; Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=91859&r1=91858&r2=91859&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Mon Dec 21 18:11:50 2009 @@ -378,7 +378,7 @@ SmallPtrSet Processed; SlotIndex EndIdx = LIs->getMBBEndIdx(MBB); - LiveRange SLR(SpillIndex, EndIdx.getNextSlot(), CurrSValNo); + LiveRange SLR(SpillIndex, EndIdx, CurrSValNo); CurrSLI->addRange(SLR); Processed.insert(MBB); @@ -475,7 +475,7 @@ SlotIndex EndIndex = LIs->getMBBEndIdx(MBB); RetVNI = NewVNs[Walker]; - LI->addRange(LiveRange(DefIndex, EndIndex.getNextSlot(), RetVNI)); + LI->addRange(LiveRange(DefIndex, EndIndex, RetVNI)); } else if (!ContainsDefs && ContainsUses) { SmallPtrSet& BlockUses = Uses[MBB]; @@ -511,8 +511,7 @@ UseIndex = UseIndex.getUseIndex(); SlotIndex EndIndex; if (IsIntraBlock) { - EndIndex = LIs->getInstructionIndex(UseI); - EndIndex = EndIndex.getUseIndex(); + EndIndex = LIs->getInstructionIndex(UseI).getDefIndex(); } else EndIndex = LIs->getMBBEndIdx(MBB); @@ -521,7 +520,7 @@ RetVNI = PerformPHIConstruction(Walker, MBB, LI, Visited, Defs, Uses, NewVNs, LiveOut, Phis, false, true); - LI->addRange(LiveRange(UseIndex, EndIndex.getNextSlot(), RetVNI)); + LI->addRange(LiveRange(UseIndex, EndIndex, RetVNI)); // FIXME: Need to set kills properly for inter-block stuff. if (RetVNI->isKill(UseIndex)) RetVNI->removeKill(UseIndex); @@ -571,8 +570,7 @@ StartIndex = foundDef ? StartIndex.getDefIndex() : StartIndex.getUseIndex(); SlotIndex EndIndex; if (IsIntraBlock) { - EndIndex = LIs->getInstructionIndex(UseI); - EndIndex = EndIndex.getUseIndex(); + EndIndex = LIs->getInstructionIndex(UseI).getDefIndex(); } else EndIndex = LIs->getMBBEndIdx(MBB); @@ -582,7 +580,7 @@ RetVNI = PerformPHIConstruction(Walker, MBB, LI, Visited, Defs, Uses, NewVNs, LiveOut, Phis, false, true); - LI->addRange(LiveRange(StartIndex, EndIndex.getNextSlot(), RetVNI)); + LI->addRange(LiveRange(StartIndex, EndIndex, RetVNI)); if (foundUse && RetVNI->isKill(StartIndex)) RetVNI->removeKill(StartIndex); @@ -663,7 +661,7 @@ for (DenseMap::iterator I = IncomingVNs.begin(), E = IncomingVNs.end(); I != E; ++I) { I->second->setHasPHIKill(true); - SlotIndex KillIndex = LIs->getMBBEndIdx(I->first); + SlotIndex KillIndex(LIs->getMBBEndIdx(I->first), true); if (!I->second->isKill(KillIndex)) I->second->addKill(KillIndex); } @@ -671,11 +669,10 @@ SlotIndex EndIndex; if (IsIntraBlock) { - EndIndex = LIs->getInstructionIndex(UseI); - EndIndex = EndIndex.getUseIndex(); + EndIndex = LIs->getInstructionIndex(UseI).getDefIndex(); } else EndIndex = LIs->getMBBEndIdx(MBB); - LI->addRange(LiveRange(StartIndex, EndIndex.getNextSlot(), RetVNI)); + LI->addRange(LiveRange(StartIndex, EndIndex, RetVNI)); if (IsIntraBlock) RetVNI->addKill(EndIndex); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=91859&r1=91858&r2=91859&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Dec 21 18:11:50 2009 @@ -1065,7 +1065,7 @@ if (SuccMBB == CopyMBB) continue; if (DstInt.overlaps(li_->getMBBStartIdx(SuccMBB), - li_->getMBBEndIdx(SuccMBB).getNextIndex().getBaseIndex())) + li_->getMBBEndIdx(SuccMBB))) return false; } } @@ -1121,7 +1121,7 @@ if (PredMBB == SMBB) continue; if (SrcInt.overlaps(li_->getMBBStartIdx(PredMBB), - li_->getMBBEndIdx(PredMBB).getNextIndex().getBaseIndex())) + li_->getMBBEndIdx(PredMBB))) return false; } } Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=91859&r1=91858&r2=91859&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original) +++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Mon Dec 21 18:11:50 2009 @@ -92,13 +92,14 @@ functionSize = 0; unsigned index = 0; + push_back(createEntry(0, index)); + // Iterate over the the function. for (MachineFunction::iterator mbbItr = mf->begin(), mbbEnd = mf->end(); mbbItr != mbbEnd; ++mbbItr) { MachineBasicBlock *mbb = &*mbbItr; // Insert an index for the MBB start. - push_back(createEntry(0, index)); SlotIndex blockStartIndex(back(), SlotIndex::LOAD); index += SlotIndex::NUM; @@ -137,16 +138,16 @@ index += SlotIndex::NUM; } - SlotIndex blockEndIndex(back(), SlotIndex::STORE); + // One blank instruction at the end. + push_back(createEntry(0, index)); + + SlotIndex blockEndIndex(back(), SlotIndex::LOAD); mbb2IdxMap.insert( std::make_pair(mbb, std::make_pair(blockStartIndex, blockEndIndex))); idx2MBBMap.push_back(IdxMBBPair(blockStartIndex, mbb)); } - // One blank instruction at the end. - push_back(createEntry(0, index)); - // Sort the Idx2MBBMap std::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare()); Modified: llvm/trunk/lib/CodeGen/Spiller.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Spiller.cpp?rev=91859&r1=91858&r2=91859&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/Spiller.cpp (original) +++ llvm/trunk/lib/CodeGen/Spiller.cpp Mon Dec 21 18:11:50 2009 @@ -486,10 +486,10 @@ SlotIndex newKillRangeEnd = oldKillRange->end; oldKillRange->end = copyIdx.getDefIndex(); - if (newKillRangeEnd != lis->getMBBEndIdx(killMBB).getNextSlot()) { - assert(newKillRangeEnd > lis->getMBBEndIdx(killMBB).getNextSlot() && + if (newKillRangeEnd != lis->getMBBEndIdx(killMBB)) { + assert(newKillRangeEnd > lis->getMBBEndIdx(killMBB) && "PHI kill range doesn't reach kill-block end. Not sane."); - newLI->addRange(LiveRange(lis->getMBBEndIdx(killMBB).getNextSlot(), + newLI->addRange(LiveRange(lis->getMBBEndIdx(killMBB), newKillRangeEnd, newVNI)); } @@ -500,7 +500,7 @@ newKillVNI->addKill(lis->getMBBTerminatorGap(killMBB)); newKillVNI->setHasPHIKill(true); li->addRange(LiveRange(copyIdx.getDefIndex(), - lis->getMBBEndIdx(killMBB).getNextSlot(), + lis->getMBBEndIdx(killMBB), newKillVNI)); } From isanbard at gmail.com Mon Dec 21 18:12:37 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 00:12:37 -0000 Subject: [llvm-commits] [llvm] r91860 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912220012.nBM0CbIs031729@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 18:12:37 2009 New Revision: 91860 URL: http://llvm.org/viewvc/llvm-project?rev=91860&view=rev Log: To make things interesting, I added MORE code to set the ordering of SDNodes. This time in the load/store and limited-precision code. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91860&r1=91859&r2=91860&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 18:12:37 2009 @@ -2861,11 +2861,15 @@ AllocSize, DAG.getConstant(TySize, AllocSize.getValueType())); - + if (DisableScheduling) + DAG.AssignOrdering(AllocSize.getNode(), SDNodeOrder); EVT IntPtr = TLI.getPointerTy(); AllocSize = DAG.getZExtOrTrunc(AllocSize, getCurDebugLoc(), IntPtr); + if (DisableScheduling) + DAG.AssignOrdering(AllocSize.getNode(), SDNodeOrder); + // Handle alignment. If the requested alignment is less than or equal to // the stack alignment, ignore it. If the size is greater than or equal to // the stack alignment, we note this in the DYNAMIC_STACKALLOC node. @@ -2879,10 +2883,15 @@ AllocSize = DAG.getNode(ISD::ADD, getCurDebugLoc(), AllocSize.getValueType(), AllocSize, DAG.getIntPtrConstant(StackAlign-1)); + if (DisableScheduling) + DAG.AssignOrdering(AllocSize.getNode(), SDNodeOrder); + // Mask out the low bits for alignment purposes. AllocSize = DAG.getNode(ISD::AND, getCurDebugLoc(), AllocSize.getValueType(), AllocSize, DAG.getIntPtrConstant(~(uint64_t)(StackAlign-1))); + if (DisableScheduling) + DAG.AssignOrdering(AllocSize.getNode(), SDNodeOrder); SDValue Ops[] = { getRoot(), AllocSize, DAG.getIntPtrConstant(Align) }; SDVTList VTs = DAG.getVTList(AllocSize.getValueType(), MVT::Other); @@ -2891,6 +2900,9 @@ setValue(&I, DSA); DAG.setRoot(DSA.getValue(1)); + if (DisableScheduling) + DAG.AssignOrdering(DSA.getNode(), SDNodeOrder); + // Inform the Frame Information that we have just allocated a variable-sized // object. FuncInfo.MF->getFrameInfo()->CreateVariableSizedObject(); @@ -2929,30 +2941,41 @@ SmallVector Chains(NumValues); EVT PtrVT = Ptr.getValueType(); for (unsigned i = 0; i != NumValues; ++i) { + SDValue A = DAG.getNode(ISD::ADD, getCurDebugLoc(), + PtrVT, Ptr, + DAG.getConstant(Offsets[i], PtrVT)); SDValue L = DAG.getLoad(ValueVTs[i], getCurDebugLoc(), Root, - DAG.getNode(ISD::ADD, getCurDebugLoc(), - PtrVT, Ptr, - DAG.getConstant(Offsets[i], PtrVT)), - SV, Offsets[i], isVolatile, Alignment); + A, SV, Offsets[i], isVolatile, Alignment); + Values[i] = L; Chains[i] = L.getValue(1); + + if (DisableScheduling) { + DAG.AssignOrdering(A.getNode(), SDNodeOrder); + DAG.AssignOrdering(L.getNode(), SDNodeOrder); + } } if (!ConstantMemory) { SDValue Chain = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), - MVT::Other, - &Chains[0], NumValues); + MVT::Other, &Chains[0], NumValues); if (isVolatile) DAG.setRoot(Chain); else PendingLoads.push_back(Chain); + + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); } - setValue(&I, DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), - DAG.getVTList(&ValueVTs[0], NumValues), - &Values[0], NumValues)); -} + SDValue Res = DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(), + DAG.getVTList(&ValueVTs[0], NumValues), + &Values[0], NumValues); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); +} void SelectionDAGBuilder::visitStore(StoreInst &I) { Value *SrcV = I.getOperand(0); @@ -2976,16 +2999,26 @@ EVT PtrVT = Ptr.getValueType(); bool isVolatile = I.isVolatile(); unsigned Alignment = I.getAlignment(); - for (unsigned i = 0; i != NumValues; ++i) + + for (unsigned i = 0; i != NumValues; ++i) { + SDValue Add = DAG.getNode(ISD::ADD, getCurDebugLoc(), PtrVT, Ptr, + DAG.getConstant(Offsets[i], PtrVT)); Chains[i] = DAG.getStore(Root, getCurDebugLoc(), SDValue(Src.getNode(), Src.getResNo() + i), - DAG.getNode(ISD::ADD, getCurDebugLoc(), - PtrVT, Ptr, - DAG.getConstant(Offsets[i], PtrVT)), - PtrV, Offsets[i], isVolatile, Alignment); + Add, PtrV, Offsets[i], isVolatile, Alignment); + + if (DisableScheduling) { + DAG.AssignOrdering(Add.getNode(), SDNodeOrder); + DAG.AssignOrdering(Chains[i].getNode(), SDNodeOrder); + } + } + + SDValue Res = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), + MVT::Other, &Chains[0], NumValues); + DAG.setRoot(Res); - DAG.setRoot(DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), - MVT::Other, &Chains[0], NumValues)); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } /// visitTargetIntrinsic - Lower a call of a target intrinsic to an INTRINSIC @@ -3030,6 +3063,7 @@ "Intrinsic uses a non-legal type?"); } #endif // NDEBUG + if (HasChain) ValueVTs.push_back(MVT::Other); @@ -3044,16 +3078,19 @@ Info.memVT, Info.ptrVal, Info.offset, Info.align, Info.vol, Info.readMem, Info.writeMem); - } - else if (!HasChain) + } else if (!HasChain) { Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, getCurDebugLoc(), VTs, &Ops[0], Ops.size()); - else if (I.getType() != Type::getVoidTy(*DAG.getContext())) + } else if (I.getType() != Type::getVoidTy(*DAG.getContext())) { Result = DAG.getNode(ISD::INTRINSIC_W_CHAIN, getCurDebugLoc(), VTs, &Ops[0], Ops.size()); - else + } else { Result = DAG.getNode(ISD::INTRINSIC_VOID, getCurDebugLoc(), VTs, &Ops[0], Ops.size()); + } + + if (DisableScheduling) + DAG.AssignOrdering(Result.getNode(), SDNodeOrder); if (HasChain) { SDValue Chain = Result.getValue(Result.getNode()->getNumValues()-1); @@ -3062,11 +3099,16 @@ else DAG.setRoot(Chain); } + if (I.getType() != Type::getVoidTy(*DAG.getContext())) { if (const VectorType *PTy = dyn_cast(I.getType())) { EVT VT = TLI.getValueType(PTy); Result = DAG.getNode(ISD::BIT_CONVERT, getCurDebugLoc(), VT, Result); + + if (DisableScheduling) + DAG.AssignOrdering(Result.getNode(), SDNodeOrder); } + setValue(&I, Result); } } @@ -3078,12 +3120,20 @@ /// /// where Op is the hexidecimal representation of floating point value. static SDValue -GetSignificand(SelectionDAG &DAG, SDValue Op, DebugLoc dl) { +GetSignificand(SelectionDAG &DAG, SDValue Op, DebugLoc dl, unsigned Order) { SDValue t1 = DAG.getNode(ISD::AND, dl, MVT::i32, Op, DAG.getConstant(0x007fffff, MVT::i32)); SDValue t2 = DAG.getNode(ISD::OR, dl, MVT::i32, t1, DAG.getConstant(0x3f800000, MVT::i32)); - return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, t2); + SDValue Res = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, t2); + + if (DisableScheduling) { + DAG.AssignOrdering(t1.getNode(), Order); + DAG.AssignOrdering(t2.getNode(), Order); + DAG.AssignOrdering(Res.getNode(), Order); + } + + return Res; } /// GetExponent - Get the exponent: @@ -3093,14 +3143,23 @@ /// where Op is the hexidecimal representation of floating point value. static SDValue GetExponent(SelectionDAG &DAG, SDValue Op, const TargetLowering &TLI, - DebugLoc dl) { + DebugLoc dl, unsigned Order) { SDValue t0 = DAG.getNode(ISD::AND, dl, MVT::i32, Op, DAG.getConstant(0x7f800000, MVT::i32)); SDValue t1 = DAG.getNode(ISD::SRL, dl, MVT::i32, t0, DAG.getConstant(23, TLI.getPointerTy())); SDValue t2 = DAG.getNode(ISD::SUB, dl, MVT::i32, t1, DAG.getConstant(127, MVT::i32)); - return DAG.getNode(ISD::SINT_TO_FP, dl, MVT::f32, t2); + SDValue Res = DAG.getNode(ISD::SINT_TO_FP, dl, MVT::f32, t2); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), Order); + DAG.AssignOrdering(t1.getNode(), Order); + DAG.AssignOrdering(t2.getNode(), Order); + DAG.AssignOrdering(Res.getNode(), Order); + } + + return Res; } /// getF32Constant - Get 32-bit floating point constant. @@ -3124,6 +3183,10 @@ I.getOperand(1)); setValue(&I, L); DAG.setRoot(L.getValue(1)); + + if (DisableScheduling) + DAG.AssignOrdering(L.getNode(), SDNodeOrder); + return 0; } @@ -3137,6 +3200,10 @@ SDValue Result = DAG.getNode(Op, getCurDebugLoc(), VTs, Op1, Op2); setValue(&I, Result); + + if (DisableScheduling) + DAG.AssignOrdering(Result.getNode(), SDNodeOrder); + return 0; } @@ -3164,10 +3231,20 @@ SDValue t1 = DAG.getNode(ISD::SINT_TO_FP, dl, MVT::f32, IntegerPartOfX); SDValue X = DAG.getNode(ISD::FSUB, dl, MVT::f32, t0, t1); + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(IntegerPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(X.getNode(), SDNodeOrder); + } + // IntegerPartOfX <<= 23; IntegerPartOfX = DAG.getNode(ISD::SHL, dl, MVT::i32, IntegerPartOfX, DAG.getConstant(23, TLI.getPointerTy())); + if (DisableScheduling) + DAG.AssignOrdering(IntegerPartOfX.getNode(), SDNodeOrder); + if (LimitFloatPrecision <= 6) { // For floating-point precision of 6: // @@ -3190,6 +3267,16 @@ TwoToFracPartOfX, IntegerPartOfX); result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, t6); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFracPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { // For floating-point precision of 12: // @@ -3216,6 +3303,18 @@ TwoToFracPartOfX, IntegerPartOfX); result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, t8); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFracPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 // For floating-point precision of 18: // @@ -3255,12 +3354,32 @@ TwoToFracPartOfX, IntegerPartOfX); result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, t14); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(t9.getNode(), SDNodeOrder); + DAG.AssignOrdering(t10.getNode(), SDNodeOrder); + DAG.AssignOrdering(t11.getNode(), SDNodeOrder); + DAG.AssignOrdering(t12.getNode(), SDNodeOrder); + DAG.AssignOrdering(t13.getNode(), SDNodeOrder); + DAG.AssignOrdering(t14.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFracPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } } else { // No special expansion. result = DAG.getNode(ISD::FEXP, dl, getValue(I.getOperand(1)).getValueType(), getValue(I.getOperand(1))); + if (DisableScheduling) + DAG.AssignOrdering(result.getNode(), SDNodeOrder); } setValue(&I, result); @@ -3278,14 +3397,20 @@ SDValue Op = getValue(I.getOperand(1)); SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i32, Op); + if (DisableScheduling) + DAG.AssignOrdering(Op1.getNode(), SDNodeOrder); + // Scale the exponent by log(2) [0.69314718f]. - SDValue Exp = GetExponent(DAG, Op1, TLI, dl); + SDValue Exp = GetExponent(DAG, Op1, TLI, dl, SDNodeOrder); SDValue LogOfExponent = DAG.getNode(ISD::FMUL, dl, MVT::f32, Exp, getF32Constant(DAG, 0x3f317218)); + if (DisableScheduling) + DAG.AssignOrdering(LogOfExponent.getNode(), SDNodeOrder); + // Get the significand and build it into a floating-point number with // exponent of 1. - SDValue X = GetSignificand(DAG, Op1, dl); + SDValue X = GetSignificand(DAG, Op1, dl, SDNodeOrder); if (LimitFloatPrecision <= 6) { // For floating-point precision of 6: @@ -3305,6 +3430,14 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, LogOfMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(LogOfMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { // For floating-point precision of 12: // @@ -3331,6 +3464,18 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, LogOfMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(LogOfMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 // For floating-point precision of 18: // @@ -3365,12 +3510,31 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, LogOfMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(t9.getNode(), SDNodeOrder); + DAG.AssignOrdering(t10.getNode(), SDNodeOrder); + DAG.AssignOrdering(LogOfMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } } else { // No special expansion. result = DAG.getNode(ISD::FLOG, dl, getValue(I.getOperand(1)).getValueType(), getValue(I.getOperand(1))); + + if (DisableScheduling) + DAG.AssignOrdering(result.getNode(), SDNodeOrder); } setValue(&I, result); @@ -3388,12 +3552,18 @@ SDValue Op = getValue(I.getOperand(1)); SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i32, Op); + if (DisableScheduling) + DAG.AssignOrdering(Op1.getNode(), SDNodeOrder); + // Get the exponent. - SDValue LogOfExponent = GetExponent(DAG, Op1, TLI, dl); + SDValue LogOfExponent = GetExponent(DAG, Op1, TLI, dl, SDNodeOrder); + + if (DisableScheduling) + DAG.AssignOrdering(LogOfExponent.getNode(), SDNodeOrder); // Get the significand and build it into a floating-point number with // exponent of 1. - SDValue X = GetSignificand(DAG, Op1, dl); + SDValue X = GetSignificand(DAG, Op1, dl, SDNodeOrder); // Different possible minimax approximations of significand in // floating-point for various degrees of accuracy over [1,2]. @@ -3413,6 +3583,14 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, Log2ofMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(Log2ofMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { // For floating-point precision of 12: // @@ -3439,6 +3617,18 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, Log2ofMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(Log2ofMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 // For floating-point precision of 18: // @@ -3474,12 +3664,31 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, Log2ofMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(t9.getNode(), SDNodeOrder); + DAG.AssignOrdering(t10.getNode(), SDNodeOrder); + DAG.AssignOrdering(Log2ofMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } } else { // No special expansion. result = DAG.getNode(ISD::FLOG2, dl, getValue(I.getOperand(1)).getValueType(), getValue(I.getOperand(1))); + + if (DisableScheduling) + DAG.AssignOrdering(result.getNode(), SDNodeOrder); } setValue(&I, result); @@ -3497,14 +3706,20 @@ SDValue Op = getValue(I.getOperand(1)); SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i32, Op); + if (DisableScheduling) + DAG.AssignOrdering(Op1.getNode(), SDNodeOrder); + // Scale the exponent by log10(2) [0.30102999f]. - SDValue Exp = GetExponent(DAG, Op1, TLI, dl); + SDValue Exp = GetExponent(DAG, Op1, TLI, dl, SDNodeOrder); SDValue LogOfExponent = DAG.getNode(ISD::FMUL, dl, MVT::f32, Exp, getF32Constant(DAG, 0x3e9a209a)); + if (DisableScheduling) + DAG.AssignOrdering(LogOfExponent.getNode(), SDNodeOrder); + // Get the significand and build it into a floating-point number with // exponent of 1. - SDValue X = GetSignificand(DAG, Op1, dl); + SDValue X = GetSignificand(DAG, Op1, dl, SDNodeOrder); if (LimitFloatPrecision <= 6) { // For floating-point precision of 6: @@ -3524,6 +3739,14 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, Log10ofMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(Log10ofMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { // For floating-point precision of 12: // @@ -3546,6 +3769,16 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, Log10ofMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(Log10ofMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 // For floating-point precision of 18: // @@ -3576,12 +3809,29 @@ result = DAG.getNode(ISD::FADD, dl, MVT::f32, LogOfExponent, Log10ofMantissa); + + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(Log10ofMantissa.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } } else { // No special expansion. result = DAG.getNode(ISD::FLOG10, dl, getValue(I.getOperand(1)).getValueType(), getValue(I.getOperand(1))); + + if (DisableScheduling) + DAG.AssignOrdering(result.getNode(), SDNodeOrder); } setValue(&I, result); @@ -3600,6 +3850,9 @@ SDValue IntegerPartOfX = DAG.getNode(ISD::FP_TO_SINT, dl, MVT::i32, Op); + if (DisableScheduling) + DAG.AssignOrdering(IntegerPartOfX.getNode(), SDNodeOrder); + // FractionalPartOfX = x - (float)IntegerPartOfX; SDValue t1 = DAG.getNode(ISD::SINT_TO_FP, dl, MVT::f32, IntegerPartOfX); SDValue X = DAG.getNode(ISD::FSUB, dl, MVT::f32, Op, t1); @@ -3608,6 +3861,12 @@ IntegerPartOfX = DAG.getNode(ISD::SHL, dl, MVT::i32, IntegerPartOfX, DAG.getConstant(23, TLI.getPointerTy())); + if (DisableScheduling) { + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(X.getNode(), SDNodeOrder); + DAG.AssignOrdering(IntegerPartOfX.getNode(), SDNodeOrder); + } + if (LimitFloatPrecision <= 6) { // For floating-point precision of 6: // @@ -3629,6 +3888,16 @@ result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, TwoToFractionalPartOfX); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFractionalPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { // For floating-point precision of 12: // @@ -3654,6 +3923,18 @@ result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, TwoToFractionalPartOfX); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFractionalPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 // For floating-point precision of 18: // @@ -3690,12 +3971,33 @@ result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, TwoToFractionalPartOfX); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(t9.getNode(), SDNodeOrder); + DAG.AssignOrdering(t10.getNode(), SDNodeOrder); + DAG.AssignOrdering(t11.getNode(), SDNodeOrder); + DAG.AssignOrdering(t12.getNode(), SDNodeOrder); + DAG.AssignOrdering(t13.getNode(), SDNodeOrder); + DAG.AssignOrdering(t14.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFractionalPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } } else { // No special expansion. result = DAG.getNode(ISD::FEXP2, dl, getValue(I.getOperand(1)).getValueType(), getValue(I.getOperand(1))); + + if (DisableScheduling) + DAG.AssignOrdering(result.getNode(), SDNodeOrder); } setValue(&I, result); @@ -3737,10 +4039,20 @@ SDValue t1 = DAG.getNode(ISD::SINT_TO_FP, dl, MVT::f32, IntegerPartOfX); SDValue X = DAG.getNode(ISD::FSUB, dl, MVT::f32, t0, t1); + if (DisableScheduling) { + DAG.AssignOrdering(t0.getNode(), SDNodeOrder); + DAG.AssignOrdering(t1.getNode(), SDNodeOrder); + DAG.AssignOrdering(IntegerPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(X.getNode(), SDNodeOrder); + } + // IntegerPartOfX <<= 23; IntegerPartOfX = DAG.getNode(ISD::SHL, dl, MVT::i32, IntegerPartOfX, DAG.getConstant(23, TLI.getPointerTy())); + if (DisableScheduling) + DAG.AssignOrdering(IntegerPartOfX.getNode(), SDNodeOrder); + if (LimitFloatPrecision <= 6) { // For floating-point precision of 6: // @@ -3762,6 +4074,16 @@ result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, TwoToFractionalPartOfX); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFractionalPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { // For floating-point precision of 12: // @@ -3787,6 +4109,18 @@ result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, TwoToFractionalPartOfX); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFractionalPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 // For floating-point precision of 18: // @@ -3823,6 +4157,24 @@ result = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f32, TwoToFractionalPartOfX); + + if (DisableScheduling) { + DAG.AssignOrdering(t2.getNode(), SDNodeOrder); + DAG.AssignOrdering(t3.getNode(), SDNodeOrder); + DAG.AssignOrdering(t4.getNode(), SDNodeOrder); + DAG.AssignOrdering(t5.getNode(), SDNodeOrder); + DAG.AssignOrdering(t6.getNode(), SDNodeOrder); + DAG.AssignOrdering(t7.getNode(), SDNodeOrder); + DAG.AssignOrdering(t8.getNode(), SDNodeOrder); + DAG.AssignOrdering(t9.getNode(), SDNodeOrder); + DAG.AssignOrdering(t10.getNode(), SDNodeOrder); + DAG.AssignOrdering(t11.getNode(), SDNodeOrder); + DAG.AssignOrdering(t12.getNode(), SDNodeOrder); + DAG.AssignOrdering(t13.getNode(), SDNodeOrder); + DAG.AssignOrdering(t14.getNode(), SDNodeOrder); + DAG.AssignOrdering(TwoToFractionalPartOfX.getNode(), SDNodeOrder); + DAG.AssignOrdering(result.getNode(), SDNodeOrder); + } } } else { // No special expansion. @@ -3830,6 +4182,9 @@ getValue(I.getOperand(1)).getValueType(), getValue(I.getOperand(1)), getValue(I.getOperand(2))); + + if (DisableScheduling) + DAG.AssignOrdering(result.getNode(), SDNodeOrder); } setValue(&I, result); From isanbard at gmail.com Mon Dec 21 18:40:51 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 00:40:51 -0000 Subject: [llvm-commits] [llvm] r91863 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912220040.nBM0epA6032715@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 18:40:51 2009 New Revision: 91863 URL: http://llvm.org/viewvc/llvm-project?rev=91863&view=rev Log: Now add ordering to SDNodes created by the massive intrinsic lowering function. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91863&r1=91862&r2=91863&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 18:40:51 2009 @@ -4196,6 +4196,8 @@ const char * SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { DebugLoc dl = getCurDebugLoc(); + SDValue Res; + switch (Intrinsic) { default: // By default, turn this into a target intrinsic node. @@ -4205,26 +4207,33 @@ case Intrinsic::vaend: visitVAEnd(I); return 0; case Intrinsic::vacopy: visitVACopy(I); return 0; case Intrinsic::returnaddress: - setValue(&I, DAG.getNode(ISD::RETURNADDR, dl, TLI.getPointerTy(), - getValue(I.getOperand(1)))); + Res = DAG.getNode(ISD::RETURNADDR, dl, TLI.getPointerTy(), + getValue(I.getOperand(1))); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::frameaddress: - setValue(&I, DAG.getNode(ISD::FRAMEADDR, dl, TLI.getPointerTy(), - getValue(I.getOperand(1)))); + Res = DAG.getNode(ISD::FRAMEADDR, dl, TLI.getPointerTy(), + getValue(I.getOperand(1))); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::setjmp: return "_setjmp"+!TLI.usesUnderscoreSetJmp(); - break; case Intrinsic::longjmp: return "_longjmp"+!TLI.usesUnderscoreLongJmp(); - break; case Intrinsic::memcpy: { SDValue Op1 = getValue(I.getOperand(1)); SDValue Op2 = getValue(I.getOperand(2)); SDValue Op3 = getValue(I.getOperand(3)); unsigned Align = cast(I.getOperand(4))->getZExtValue(); - DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, false, - I.getOperand(1), 0, I.getOperand(2), 0)); + Res = DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, false, + I.getOperand(1), 0, I.getOperand(2), 0); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::memset: { @@ -4232,8 +4241,11 @@ SDValue Op2 = getValue(I.getOperand(2)); SDValue Op3 = getValue(I.getOperand(3)); unsigned Align = cast(I.getOperand(4))->getZExtValue(); - DAG.setRoot(DAG.getMemset(getRoot(), dl, Op1, Op2, Op3, Align, - I.getOperand(1), 0)); + Res = DAG.getMemset(getRoot(), dl, Op1, Op2, Op3, Align, + I.getOperand(1), 0); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::memmove: { @@ -4249,13 +4261,19 @@ Size = C->getZExtValue(); if (AA->alias(I.getOperand(1), Size, I.getOperand(2), Size) == AliasAnalysis::NoAlias) { - DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, false, - I.getOperand(1), 0, I.getOperand(2), 0)); + Res = DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, false, + I.getOperand(1), 0, I.getOperand(2), 0); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } - DAG.setRoot(DAG.getMemmove(getRoot(), dl, Op1, Op2, Op3, Align, - I.getOperand(1), 0, I.getOperand(2), 0)); + Res = DAG.getMemmove(getRoot(), dl, Op1, Op2, Op3, Align, + I.getOperand(1), 0, I.getOperand(2), 0); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::dbg_stoppoint: @@ -4308,6 +4326,8 @@ SDValue Op = DAG.getNode(ISD::EXCEPTIONADDR, dl, VTs, Ops, 1); setValue(&I, Op); DAG.setRoot(Op.getValue(1)); + if (DisableScheduling) + DAG.AssignOrdering(Op.getNode(), SDNodeOrder); return 0; } @@ -4334,7 +4354,12 @@ DAG.setRoot(Op.getValue(1)); - setValue(&I, DAG.getSExtOrTrunc(Op, dl, MVT::i32)); + Res = DAG.getSExtOrTrunc(Op, dl, MVT::i32); + setValue(&I, Res); + if (DisableScheduling) { + DAG.AssignOrdering(Op.getNode(), SDNodeOrder); + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + } return 0; } @@ -4344,14 +4369,16 @@ if (MMI) { // Find the type id for the given typeinfo. GlobalVariable *GV = ExtractTypeInfo(I.getOperand(1)); - unsigned TypeID = MMI->getTypeIDFor(GV); - setValue(&I, DAG.getConstant(TypeID, MVT::i32)); + Res = DAG.getConstant(TypeID, MVT::i32); } else { // Return something different to eh_selector. - setValue(&I, DAG.getConstant(1, MVT::i32)); + Res = DAG.getConstant(1, MVT::i32); } + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } @@ -4359,11 +4386,14 @@ case Intrinsic::eh_return_i64: if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo()) { MMI->setCallsEHReturn(true); - DAG.setRoot(DAG.getNode(ISD::EH_RETURN, dl, - MVT::Other, - getControlRoot(), - getValue(I.getOperand(1)), - getValue(I.getOperand(2)))); + Res = DAG.getNode(ISD::EH_RETURN, dl, + MVT::Other, + getControlRoot(), + getValue(I.getOperand(1)), + getValue(I.getOperand(2))); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } else { setValue(&I, DAG.getConstant(0, TLI.getPointerTy())); } @@ -4373,26 +4403,28 @@ if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo()) { MMI->setCallsUnwindInit(true); } - return 0; - case Intrinsic::eh_dwarf_cfa: { EVT VT = getValue(I.getOperand(1)).getValueType(); SDValue CfaArg = DAG.getSExtOrTrunc(getValue(I.getOperand(1)), dl, TLI.getPointerTy()); - SDValue Offset = DAG.getNode(ISD::ADD, dl, TLI.getPointerTy(), DAG.getNode(ISD::FRAME_TO_ARGS_OFFSET, dl, TLI.getPointerTy()), CfaArg); - setValue(&I, DAG.getNode(ISD::ADD, dl, + SDValue FA = DAG.getNode(ISD::FRAMEADDR, dl, TLI.getPointerTy(), - DAG.getNode(ISD::FRAMEADDR, dl, - TLI.getPointerTy(), - DAG.getConstant(0, - TLI.getPointerTy())), - Offset)); + DAG.getConstant(0, TLI.getPointerTy())); + Res = DAG.getNode(ISD::ADD, dl, TLI.getPointerTy(), + FA, Offset); + setValue(&I, Res); + if (DisableScheduling) { + DAG.AssignOrdering(CfaArg.getNode(), SDNodeOrder); + DAG.AssignOrdering(Offset.getNode(), SDNodeOrder); + DAG.AssignOrdering(FA.getNode(), SDNodeOrder); + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + } return 0; } case Intrinsic::convertff: @@ -4417,36 +4449,50 @@ case Intrinsic::convertuu: Code = ISD::CVT_UU; break; } EVT DestVT = TLI.getValueType(I.getType()); - Value* Op1 = I.getOperand(1); - setValue(&I, DAG.getConvertRndSat(DestVT, getCurDebugLoc(), getValue(Op1), - DAG.getValueType(DestVT), - DAG.getValueType(getValue(Op1).getValueType()), - getValue(I.getOperand(2)), - getValue(I.getOperand(3)), - Code)); + Value *Op1 = I.getOperand(1); + Res = DAG.getConvertRndSat(DestVT, getCurDebugLoc(), getValue(Op1), + DAG.getValueType(DestVT), + DAG.getValueType(getValue(Op1).getValueType()), + getValue(I.getOperand(2)), + getValue(I.getOperand(3)), + Code); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } - case Intrinsic::sqrt: - setValue(&I, DAG.getNode(ISD::FSQRT, dl, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + Res = DAG.getNode(ISD::FSQRT, dl, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::powi: - setValue(&I, DAG.getNode(ISD::FPOWI, dl, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)), - getValue(I.getOperand(2)))); + Res = DAG.getNode(ISD::FPOWI, dl, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1)), + getValue(I.getOperand(2))); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::sin: - setValue(&I, DAG.getNode(ISD::FSIN, dl, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + Res = DAG.getNode(ISD::FSIN, dl, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::cos: - setValue(&I, DAG.getNode(ISD::FCOS, dl, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + Res = DAG.getNode(ISD::FCOS, dl, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::log: visitLog(I); @@ -4468,55 +4514,74 @@ return 0; case Intrinsic::pcmarker: { SDValue Tmp = getValue(I.getOperand(1)); - DAG.setRoot(DAG.getNode(ISD::PCMARKER, dl, MVT::Other, getRoot(), Tmp)); + Res = DAG.getNode(ISD::PCMARKER, dl, MVT::Other, getRoot(), Tmp); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::readcyclecounter: { SDValue Op = getRoot(); - SDValue Tmp = DAG.getNode(ISD::READCYCLECOUNTER, dl, - DAG.getVTList(MVT::i64, MVT::Other), - &Op, 1); - setValue(&I, Tmp); - DAG.setRoot(Tmp.getValue(1)); + Res = DAG.getNode(ISD::READCYCLECOUNTER, dl, + DAG.getVTList(MVT::i64, MVT::Other), + &Op, 1); + setValue(&I, Res); + DAG.setRoot(Res.getValue(1)); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::bswap: - setValue(&I, DAG.getNode(ISD::BSWAP, dl, - getValue(I.getOperand(1)).getValueType(), - getValue(I.getOperand(1)))); + Res = DAG.getNode(ISD::BSWAP, dl, + getValue(I.getOperand(1)).getValueType(), + getValue(I.getOperand(1))); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::cttz: { SDValue Arg = getValue(I.getOperand(1)); EVT Ty = Arg.getValueType(); - SDValue result = DAG.getNode(ISD::CTTZ, dl, Ty, Arg); - setValue(&I, result); + Res = DAG.getNode(ISD::CTTZ, dl, Ty, Arg); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::ctlz: { SDValue Arg = getValue(I.getOperand(1)); EVT Ty = Arg.getValueType(); - SDValue result = DAG.getNode(ISD::CTLZ, dl, Ty, Arg); - setValue(&I, result); + Res = DAG.getNode(ISD::CTLZ, dl, Ty, Arg); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::ctpop: { SDValue Arg = getValue(I.getOperand(1)); EVT Ty = Arg.getValueType(); - SDValue result = DAG.getNode(ISD::CTPOP, dl, Ty, Arg); - setValue(&I, result); + Res = DAG.getNode(ISD::CTPOP, dl, Ty, Arg); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::stacksave: { SDValue Op = getRoot(); - SDValue Tmp = DAG.getNode(ISD::STACKSAVE, dl, - DAG.getVTList(TLI.getPointerTy(), MVT::Other), &Op, 1); - setValue(&I, Tmp); - DAG.setRoot(Tmp.getValue(1)); + Res = DAG.getNode(ISD::STACKSAVE, dl, + DAG.getVTList(TLI.getPointerTy(), MVT::Other), &Op, 1); + setValue(&I, Res); + DAG.setRoot(Res.getValue(1)); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::stackrestore: { - SDValue Tmp = getValue(I.getOperand(1)); - DAG.setRoot(DAG.getNode(ISD::STACKRESTORE, dl, MVT::Other, getRoot(), Tmp)); + Res = getValue(I.getOperand(1)); + Res = DAG.getNode(ISD::STACKRESTORE, dl, MVT::Other, getRoot(), Res); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::stackprotector: { @@ -4534,11 +4599,13 @@ SDValue FIN = DAG.getFrameIndex(FI, PtrTy); // Store the stack protector onto the stack. - SDValue Result = DAG.getStore(getRoot(), getCurDebugLoc(), Src, FIN, - PseudoSourceValue::getFixedStack(FI), - 0, true); - setValue(&I, Result); - DAG.setRoot(Result); + Res = DAG.getStore(getRoot(), getCurDebugLoc(), Src, FIN, + PseudoSourceValue::getFixedStack(FI), + 0, true); + setValue(&I, Res); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::objectsize: { @@ -4551,9 +4618,13 @@ EVT Ty = Arg.getValueType(); if (CI->getZExtValue() < 2) - setValue(&I, DAG.getConstant(-1ULL, Ty)); + Res = DAG.getConstant(-1ULL, Ty); else - setValue(&I, DAG.getConstant(0, Ty)); + Res = DAG.getConstant(0, Ty); + + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::var_annotation: @@ -4571,15 +4642,16 @@ Ops[4] = DAG.getSrcValue(I.getOperand(1)); Ops[5] = DAG.getSrcValue(F); - SDValue Tmp = DAG.getNode(ISD::TRAMPOLINE, dl, - DAG.getVTList(TLI.getPointerTy(), MVT::Other), - Ops, 6); - - setValue(&I, Tmp); - DAG.setRoot(Tmp.getValue(1)); + Res = DAG.getNode(ISD::TRAMPOLINE, dl, + DAG.getVTList(TLI.getPointerTy(), MVT::Other), + Ops, 6); + + setValue(&I, Res); + DAG.setRoot(Res.getValue(1)); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } - case Intrinsic::gcroot: if (GFI) { Value *Alloca = I.getOperand(1); @@ -4589,22 +4661,22 @@ GFI->addStackRoot(FI->getIndex(), TypeMap); } return 0; - case Intrinsic::gcread: case Intrinsic::gcwrite: llvm_unreachable("GC failed to lower gcread/gcwrite intrinsics!"); return 0; - - case Intrinsic::flt_rounds: { - setValue(&I, DAG.getNode(ISD::FLT_ROUNDS_, dl, MVT::i32)); - return 0; - } - - case Intrinsic::trap: { - DAG.setRoot(DAG.getNode(ISD::TRAP, dl,MVT::Other, getRoot())); + case Intrinsic::flt_rounds: + Res = DAG.getNode(ISD::FLT_ROUNDS_, dl, MVT::i32); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + return 0; + case Intrinsic::trap: + Res = DAG.getNode(ISD::TRAP, dl,MVT::Other, getRoot()); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; - } - case Intrinsic::uadd_with_overflow: return implVisitAluOverflow(I, ISD::UADDO); case Intrinsic::sadd_with_overflow: @@ -4624,7 +4696,10 @@ Ops[1] = getValue(I.getOperand(1)); Ops[2] = getValue(I.getOperand(2)); Ops[3] = getValue(I.getOperand(3)); - DAG.setRoot(DAG.getNode(ISD::PREFETCH, dl, MVT::Other, &Ops[0], 4)); + Res = DAG.getNode(ISD::PREFETCH, dl, MVT::Other, &Ops[0], 4); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } @@ -4634,7 +4709,10 @@ for (int x = 1; x < 6; ++x) Ops[x] = getValue(I.getOperand(x)); - DAG.setRoot(DAG.getNode(ISD::MEMBARRIER, dl, MVT::Other, &Ops[0], 6)); + Res = DAG.getNode(ISD::MEMBARRIER, dl, MVT::Other, &Ops[0], 6); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; } case Intrinsic::atomic_cmp_swap: { @@ -4649,6 +4727,8 @@ I.getOperand(1)); setValue(&I, L); DAG.setRoot(L.getValue(1)); + if (DisableScheduling) + DAG.AssignOrdering(L.getNode(), SDNodeOrder); return 0; } case Intrinsic::atomic_load_add: @@ -4677,7 +4757,10 @@ case Intrinsic::invariant_start: case Intrinsic::lifetime_start: // Discard region information. - setValue(&I, DAG.getUNDEF(TLI.getPointerTy())); + Res = DAG.getUNDEF(TLI.getPointerTy()); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return 0; case Intrinsic::invariant_end: case Intrinsic::lifetime_end: From sabre at nondot.org Mon Dec 21 18:44:05 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 00:44:05 -0000 Subject: [llvm-commits] [llvm] r91864 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Message-ID: <200912220044.nBM0i5tc000386@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 18:44:05 2009 New Revision: 91864 URL: http://llvm.org/viewvc/llvm-project?rev=91864&view=rev Log: print pcrel immediates as signed values instead of unsigned so that we get things like this out of the disassembler: 0x100000ecb: callq -96 instead of: 0x100000ecb: callq 4294967200 rdar://7491123 Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp?rev=91864&r1=91863&r2=91864&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Mon Dec 21 18:44:05 2009 @@ -45,12 +45,14 @@ } /// print_pcrel_imm - This is used to print an immediate value that ends up -/// being encoded as a pc-relative value. These print slightly differently, for -/// example, a $ is not emitted. +/// being encoded as a pc-relative value (e.g. for jumps and calls). These +/// print slightly differently than normal immediates. For example, a $ is not +/// emitted. void X86ATTInstPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) { const MCOperand &Op = MI->getOperand(OpNo); if (Op.isImm()) - O << Op.getImm(); + // Print this as a signed 32-bit value. + O << (int)Op.getImm(); else { assert(Op.isExpr() && "unknown pcrel immediate operand"); Op.getExpr()->print(O, &MAI); From isanbard at gmail.com Mon Dec 21 18:50:33 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 00:50:33 -0000 Subject: [llvm-commits] [llvm] r91866 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912220050.nBM0oXWp000573@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 18:50:32 2009 New Revision: 91866 URL: http://llvm.org/viewvc/llvm-project?rev=91866&view=rev Log: Add ordering of SDNodes to LowerCallTo. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91866&r1=91865&r2=91866&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 18:50:32 2009 @@ -4860,8 +4860,7 @@ SmallVector OutsFlags; SmallVector Offsets; getReturnInfo(RetTy, CS.getAttributes().getRetAttributes(), - OutVTs, OutsFlags, TLI, &Offsets); - + OutVTs, OutsFlags, TLI, &Offsets); bool CanLowerReturn = TLI.CanLowerReturn(CS.getCallingConv(), FTy->isVarArg(), OutVTs, OutsFlags, DAG); @@ -4915,8 +4914,11 @@ // Both PendingLoads and PendingExports must be flushed here; // this call might not return. (void)getRoot(); - DAG.setRoot(DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), - getControlRoot(), BeginLabel)); + SDValue Label = DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), + getControlRoot(), BeginLabel); + DAG.setRoot(Label); + if (DisableScheduling) + DAG.AssignOrdering(Label.getNode(), SDNodeOrder); } // Check if target-independent constraints permit a tail call here. @@ -4940,9 +4942,11 @@ "Non-null chain expected with non-tail call!"); assert((Result.second.getNode() || !Result.first.getNode()) && "Null value expected with tail call!"); - if (Result.first.getNode()) + if (Result.first.getNode()) { setValue(CS.getInstruction(), Result.first); - else if (!CanLowerReturn && Result.second.getNode()) { + if (DisableScheduling) + DAG.AssignOrdering(Result.first.getNode(), SDNodeOrder); + } else if (!CanLowerReturn && Result.second.getNode()) { // The instruction result is the result of loading from the // hidden sret parameter. SmallVector PVTs; @@ -4956,41 +4960,62 @@ SmallVector Chains(NumValues); for (unsigned i = 0; i < NumValues; ++i) { + SDValue Add = DAG.getNode(ISD::ADD, getCurDebugLoc(), PtrVT, + DemoteStackSlot, + DAG.getConstant(Offsets[i], PtrVT)); SDValue L = DAG.getLoad(OutVTs[i], getCurDebugLoc(), Result.second, - DAG.getNode(ISD::ADD, getCurDebugLoc(), PtrVT, DemoteStackSlot, - DAG.getConstant(Offsets[i], PtrVT)), - NULL, Offsets[i], false, 1); + Add, NULL, Offsets[i], false, 1); Values[i] = L; Chains[i] = L.getValue(1); + + if (DisableScheduling) { + DAG.AssignOrdering(Add.getNode(), SDNodeOrder); + DAG.AssignOrdering(L.getNode(), SDNodeOrder); + } } + SDValue Chain = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), MVT::Other, &Chains[0], NumValues); PendingLoads.push_back(Chain); - setValue(CS.getInstruction(), DAG.getNode(ISD::MERGE_VALUES, - getCurDebugLoc(), DAG.getVTList(&OutVTs[0], NumValues), - &Values[0], NumValues)); - } - // As a special case, a null chain means that a tail call has - // been emitted and the DAG root is already updated. - if (Result.second.getNode()) + SDValue MV = DAG.getNode(ISD::MERGE_VALUES, + getCurDebugLoc(), + DAG.getVTList(&OutVTs[0], NumValues), + &Values[0], NumValues); + setValue(CS.getInstruction(), MV); + + if (DisableScheduling) { + DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); + DAG.AssignOrdering(MV.getNode(), SDNodeOrder); + } + } + + // As a special case, a null chain means that a tail call has been emitted and + // the DAG root is already updated. + if (Result.second.getNode()) { DAG.setRoot(Result.second); - else + if (DisableScheduling) + DAG.AssignOrdering(Result.second.getNode(), SDNodeOrder); + } else { HasTailCall = true; + } if (LandingPad && MMI) { // Insert a label at the end of the invoke call to mark the try range. This // can be used to detect deletion of the invoke via the MachineModuleInfo. EndLabel = MMI->NextLabelID(); - DAG.setRoot(DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), - getRoot(), EndLabel)); + SDValue Label = DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), + getRoot(), EndLabel); + DAG.setRoot(Label); + + if (DisableScheduling) + DAG.AssignOrdering(Label.getNode(), SDNodeOrder); // Inform MachineModuleInfo of range. MMI->addInvoke(LandingPad, BeginLabel, EndLabel); } } - void SelectionDAGBuilder::visitCall(CallInst &I) { const char *RenameFn = 0; if (Function *F = I.getCalledFunction()) { From sabre at nondot.org Mon Dec 21 18:51:57 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 00:51:57 -0000 Subject: [llvm-commits] [llvm] r91867 - /llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h Message-ID: <200912220051.nBM0pvJw000620@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 18:51:57 2009 New Revision: 91867 URL: http://llvm.org/viewvc/llvm-project?rev=91867&view=rev Log: comment fix: weakvh -> tracking vh Modified: llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h Modified: llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h?rev=91867&r1=91866&r2=91867&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h Mon Dec 21 18:51:57 2009 @@ -29,8 +29,8 @@ class SSAUpdater { /// AvailableVals - This keeps track of which value to use on a per-block /// basis. When we insert PHI nodes, we keep track of them here. We use - /// WeakVH's for the value of the map because we RAUW PHI nodes when we - /// eliminate them, and want the WeakVH to track this. + /// TrackingVH's for the value of the map because we RAUW PHI nodes when we + /// eliminate them, and want the TrackingVH's to track this. //typedef DenseMap > AvailableValsTy; void *AV; From sabre at nondot.org Mon Dec 21 19:00:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 01:00:32 -0000 Subject: [llvm-commits] [llvm] r91869 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Message-ID: <200912220100.nBM10WaA000887@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 19:00:32 2009 New Revision: 91869 URL: http://llvm.org/viewvc/llvm-project?rev=91869&view=rev Log: avoid calling extractMallocCall when it's obvious we don't have a call. This speeds up memdep ~1.5% Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=91869&r1=91868&r2=91869&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Mon Dec 21 19:00:32 2009 @@ -275,7 +275,8 @@ // a subsequent bitcast of the malloc call result. There can be stores to // the malloced memory between the malloc call and its bitcast uses, and we // need to continue scanning until the malloc call. - if (isa(Inst) || extractMallocCall(Inst)) { + if (isa(Inst) || + (isa(Inst) && extractMallocCall(Inst))) { Value *AccessPtr = MemPtr->getUnderlyingObject(); if (AccessPtr == Inst || From scallanan at apple.com Mon Dec 21 19:11:27 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 22 Dec 2009 01:11:27 -0000 Subject: [llvm-commits] [llvm] r91871 - in /llvm/trunk/lib/Target/X86: Disassembler/X86Disassembler.cpp Disassembler/X86DisassemblerDecoder.c X86TargetMachine.cpp Message-ID: <200912220111.nBM1BRCu001288@zion.cs.uiuc.edu> Author: spyffe Date: Mon Dec 21 19:11:26 2009 New Revision: 91871 URL: http://llvm.org/viewvc/llvm-project?rev=91871&view=rev Log: Fixed library dependencies between the X86 disassembler and X86 codegen that were causing circular symbol dependencies. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp?rev=91871&r1=91870&r2=91871&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp Mon Dec 21 19:11:26 2009 @@ -14,11 +14,8 @@ // //===----------------------------------------------------------------------===// -#if 0 - #include "X86Disassembler.h" #include "X86DisassemblerDecoder.h" -#include "X86InstrInfo.h" #include "llvm/MC/MCDisassembler.h" #include "llvm/MC/MCDisassembler.h" @@ -27,6 +24,9 @@ #include "llvm/Support/MemoryObject.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" + +#include "../X86GenRegisterNames.inc" + using namespace llvm; using namespace llvm::X86Disassembler; @@ -46,6 +46,8 @@ }; } +extern Target TheX86_32Target, TheX86_64Target; + } static void translateInstruction(MCInst &target, @@ -461,8 +463,3 @@ TargetRegistry::RegisterMCDisassembler(TheX86_64Target, createX86_64Disassembler); } - -#endif - -extern "C" void LLVMInitializeX86Disassembler() { -} Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=91871&r1=91870&r2=91871&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Mon Dec 21 19:11:26 2009 @@ -13,8 +13,6 @@ * *===----------------------------------------------------------------------===*/ -#if 0 - #include /* for assert() */ #include /* for va_*() */ #include /* for vsnprintf() */ @@ -1361,7 +1359,3 @@ return 0; } - -#endif - -int X86DissemblerDecoder_dummy = 0; Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=91871&r1=91870&r2=91871&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Dec 21 19:11:26 2009 @@ -38,8 +38,6 @@ } } -extern "C" void LLVMInitializeX86Disassembler(); - extern "C" void LLVMInitializeX86Target() { // Register the target. RegisterTargetMachine X(TheX86_32Target); @@ -49,8 +47,6 @@ RegisterAsmInfoFn A(TheX86_32Target, createMCAsmInfo); RegisterAsmInfoFn B(TheX86_64Target, createMCAsmInfo); - LLVMInitializeX86Disassembler(); - // Register the code emitter. TargetRegistry::RegisterCodeEmitter(TheX86_32Target, createX86MCCodeEmitter); TargetRegistry::RegisterCodeEmitter(TheX86_64Target, createX86MCCodeEmitter); From isanbard at gmail.com Mon Dec 21 19:11:43 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 01:11:43 -0000 Subject: [llvm-commits] [llvm] r91872 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912220111.nBM1Bh9O001305@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 19:11:43 2009 New Revision: 91872 URL: http://llvm.org/viewvc/llvm-project?rev=91872&view=rev Log: Adding more assignment of ordering to SDNodes. This time in the "call" and generic copy functions. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91872&r1=91871&r2=91872&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 19:11:43 2009 @@ -144,15 +144,15 @@ /// this value and returns the result as a ValueVTs value. This uses /// Chain/Flag as the input and updates them for the output Chain/Flag. /// If the Flag pointer is NULL, no flag is used. - SDValue getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl, - SDValue &Chain, SDValue *Flag) const; + SDValue getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl, unsigned Order, + SDValue &Chain, SDValue *Flag) const; /// getCopyToRegs - Emit a series of CopyToReg nodes that copies the /// specified value into the registers specified by this object. This uses /// Chain/Flag as the input and updates them for the output Chain/Flag. /// If the Flag pointer is NULL, no flag is used. void getCopyToRegs(SDValue Val, SelectionDAG &DAG, DebugLoc dl, - SDValue &Chain, SDValue *Flag) const; + unsigned Order, SDValue &Chain, SDValue *Flag) const; /// AddInlineAsmOperands - Add this value to the specified inlineasm node /// operand list. This adds the code marker, matching input operand index @@ -720,10 +720,8 @@ RegsForValue RFV(*DAG.getContext(), TLI, InReg, V->getType()); SDValue Chain = DAG.getEntryNode(); - SDValue Res = RFV.getCopyFromRegs(DAG, getCurDebugLoc(), Chain, NULL); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); - return Res; + return RFV.getCopyFromRegs(DAG, getCurDebugLoc(), + SDNodeOrder, Chain, NULL); } /// Get the EVTs and ArgFlags collections that represent the return type @@ -5046,8 +5044,11 @@ I.getType() == I.getOperand(2)->getType()) { SDValue LHS = getValue(I.getOperand(1)); SDValue RHS = getValue(I.getOperand(2)); - setValue(&I, DAG.getNode(ISD::FCOPYSIGN, getCurDebugLoc(), - LHS.getValueType(), LHS, RHS)); + SDValue Res = DAG.getNode(ISD::FCOPYSIGN, getCurDebugLoc(), + LHS.getValueType(), LHS, RHS); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return; } } else if (Name == "fabs" || Name == "fabsf" || Name == "fabsl") { @@ -5055,8 +5056,11 @@ I.getOperand(1)->getType()->isFloatingPoint() && I.getType() == I.getOperand(1)->getType()) { SDValue Tmp = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FABS, getCurDebugLoc(), - Tmp.getValueType(), Tmp)); + SDValue Res = DAG.getNode(ISD::FABS, getCurDebugLoc(), + Tmp.getValueType(), Tmp); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return; } } else if (Name == "sin" || Name == "sinf" || Name == "sinl") { @@ -5065,8 +5069,11 @@ I.getType() == I.getOperand(1)->getType() && I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FSIN, getCurDebugLoc(), - Tmp.getValueType(), Tmp)); + SDValue Res = DAG.getNode(ISD::FSIN, getCurDebugLoc(), + Tmp.getValueType(), Tmp); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return; } } else if (Name == "cos" || Name == "cosf" || Name == "cosl") { @@ -5075,8 +5082,11 @@ I.getType() == I.getOperand(1)->getType() && I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FCOS, getCurDebugLoc(), - Tmp.getValueType(), Tmp)); + SDValue Res = DAG.getNode(ISD::FCOS, getCurDebugLoc(), + Tmp.getValueType(), Tmp); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return; } } else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") { @@ -5085,8 +5095,11 @@ I.getType() == I.getOperand(1)->getType() && I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), - Tmp.getValueType(), Tmp)); + SDValue Res = DAG.getNode(ISD::FSQRT, getCurDebugLoc(), + Tmp.getValueType(), Tmp); + setValue(&I, Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); return; } } @@ -5102,6 +5115,9 @@ else Callee = DAG.getExternalSymbol(RenameFn, TLI.getPointerTy()); + if (DisableScheduling) + DAG.AssignOrdering(Callee.getNode(), SDNodeOrder); + // Check if we can potentially perform a tail call. More detailed // checking is be done within LowerCallTo, after more information // about the call is known. @@ -5110,13 +5126,12 @@ LowerCallTo(&I, Callee, isTailCall); } - /// getCopyFromRegs - Emit a series of CopyFromReg nodes that copies from /// this value and returns the result as a ValueVT value. This uses /// Chain/Flag as the input and updates them for the output Chain/Flag. /// If the Flag pointer is NULL, no flag is used. SDValue RegsForValue::getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl, - SDValue &Chain, + unsigned Order, SDValue &Chain, SDValue *Flag) const { // Assemble the legal parts into the final values. SmallVector Values(ValueVTs.size()); @@ -5130,14 +5145,18 @@ Parts.resize(NumRegs); for (unsigned i = 0; i != NumRegs; ++i) { SDValue P; - if (Flag == 0) + if (Flag == 0) { P = DAG.getCopyFromReg(Chain, dl, Regs[Part+i], RegisterVT); - else { + } else { P = DAG.getCopyFromReg(Chain, dl, Regs[Part+i], RegisterVT, *Flag); *Flag = P.getValue(2); } + Chain = P.getValue(1); + if (DisableScheduling) + DAG.AssignOrdering(P.getNode(), Order); + // If the source register was virtual and if we know something about it, // add an assert node. if (TargetRegisterInfo::isVirtualRegister(Regs[Part+i]) && @@ -5176,6 +5195,8 @@ P = DAG.getNode(isSExt ? ISD::AssertSext : ISD::AssertZext, dl, RegisterVT, P, DAG.getValueType(FromVT)); + if (DisableScheduling) + DAG.AssignOrdering(P.getNode(), Order); } } } @@ -5185,13 +5206,18 @@ Values[Value] = getCopyFromParts(DAG, dl, Parts.begin(), NumRegs, RegisterVT, ValueVT); + if (DisableScheduling) + DAG.AssignOrdering(Values[Value].getNode(), Order); Part += NumRegs; Parts.clear(); } - return DAG.getNode(ISD::MERGE_VALUES, dl, - DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Values[0], ValueVTs.size()); + SDValue Res = DAG.getNode(ISD::MERGE_VALUES, dl, + DAG.getVTList(&ValueVTs[0], ValueVTs.size()), + &Values[0], ValueVTs.size()); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), Order); + return Res; } /// getCopyToRegs - Emit a series of CopyToReg nodes that copies the @@ -5199,7 +5225,8 @@ /// Chain/Flag as the input and updates them for the output Chain/Flag. /// If the Flag pointer is NULL, no flag is used. void RegsForValue::getCopyToRegs(SDValue Val, SelectionDAG &DAG, DebugLoc dl, - SDValue &Chain, SDValue *Flag) const { + unsigned Order, SDValue &Chain, + SDValue *Flag) const { // Get the list of the values's legal parts. unsigned NumRegs = Regs.size(); SmallVector Parts(NumRegs); @@ -5217,13 +5244,17 @@ SmallVector Chains(NumRegs); for (unsigned i = 0; i != NumRegs; ++i) { SDValue Part; - if (Flag == 0) + if (Flag == 0) { Part = DAG.getCopyToReg(Chain, dl, Regs[i], Parts[i]); - else { + } else { Part = DAG.getCopyToReg(Chain, dl, Regs[i], Parts[i], *Flag); *Flag = Part.getValue(1); } + Chains[i] = Part.getValue(0); + + if (DisableScheduling) + DAG.AssignOrdering(Part.getNode(), Order); } if (NumRegs == 1 || Flag) @@ -5240,6 +5271,9 @@ Chain = Chains[NumRegs-1]; else Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &Chains[0], NumRegs); + + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), Order); } /// AddInlineAsmOperands - Add this value to the specified inlineasm node @@ -5876,7 +5910,7 @@ // Use the produced MatchedRegs object to MatchedRegs.getCopyToRegs(InOperandVal, DAG, getCurDebugLoc(), - Chain, &Flag); + SDNodeOrder, Chain, &Flag); MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, true, OpInfo.getMatchedOperand(), DAG, AsmNodeOperands); @@ -5939,7 +5973,7 @@ } OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, getCurDebugLoc(), - Chain, &Flag); + SDNodeOrder, Chain, &Flag); OpInfo.AssignedRegs.AddInlineAsmOperands(1/*REGUSE*/, false, 0, DAG, AsmNodeOperands); @@ -5969,7 +6003,7 @@ // and set it as the value of the call. if (!RetValRegs.Regs.empty()) { SDValue Val = RetValRegs.getCopyFromRegs(DAG, getCurDebugLoc(), - Chain, &Flag); + SDNodeOrder, Chain, &Flag); // FIXME: Why don't we do this for inline asms with MRVs? if (CS.getType()->isSingleValueType() && CS.getType()->isSized()) { @@ -6009,7 +6043,7 @@ RegsForValue &OutRegs = IndirectStoresToEmit[i].first; Value *Ptr = IndirectStoresToEmit[i].second; SDValue OutVal = OutRegs.getCopyFromRegs(DAG, getCurDebugLoc(), - Chain, &Flag); + SDNodeOrder, Chain, &Flag); StoresToEmit.push_back(std::make_pair(OutVal, Ptr)); } @@ -6251,7 +6285,7 @@ RegsForValue RFV(V->getContext(), TLI, Reg, V->getType()); SDValue Chain = DAG.getEntryNode(); - RFV.getCopyToRegs(Op, DAG, getCurDebugLoc(), Chain, 0); + RFV.getCopyToRegs(Op, DAG, getCurDebugLoc(), SDNodeOrder, Chain, 0); PendingExports.push_back(Chain); } From sabre at nondot.org Mon Dec 21 19:17:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 01:17:43 -0000 Subject: [llvm-commits] [llvm] r91873 - /llvm/trunk/include/llvm/Type.h Message-ID: <200912220117.nBM1HhEf001490@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 19:17:43 2009 New Revision: 91873 URL: http://llvm.org/viewvc/llvm-project?rev=91873&view=rev Log: types don't need atomic inc/dec, they are local to an llvmcontext. Modified: llvm/trunk/include/llvm/Type.h Modified: llvm/trunk/include/llvm/Type.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=91873&r1=91872&r2=91873&view=diff ============================================================================== --- llvm/trunk/include/llvm/Type.h (original) +++ llvm/trunk/include/llvm/Type.h Mon Dec 21 19:17:43 2009 @@ -7,14 +7,12 @@ // //===----------------------------------------------------------------------===// - #ifndef LLVM_TYPE_H #define LLVM_TYPE_H #include "llvm/AbstractTypeUser.h" #include "llvm/Support/Casting.h" #include "llvm/System/DataTypes.h" -#include "llvm/System/Atomic.h" #include "llvm/ADT/GraphTraits.h" #include #include @@ -104,7 +102,7 @@ /// has no AbstractTypeUsers, the type is deleted. This is only sensical for /// derived types. /// - mutable sys::cas_flag RefCount; + mutable unsigned RefCount; /// Context - This refers to the LLVMContext in which this type was uniqued. LLVMContext &Context; @@ -401,7 +399,7 @@ void addRef() const { assert(isAbstract() && "Cannot add a reference to a non-abstract type!"); - sys::AtomicIncrement(&RefCount); + ++RefCount; } void dropRef() const { @@ -410,8 +408,7 @@ // If this is the last PATypeHolder using this object, and there are no // PATypeHandles using it, the type is dead, delete it now. - sys::cas_flag OldCount = sys::AtomicDecrement(&RefCount); - if (OldCount == 0 && AbstractTypeUsers.empty()) + if (RefCount-- == 0 && AbstractTypeUsers.empty()) this->destroy(); } From daniel at zuster.org Mon Dec 21 19:17:56 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 21 Dec 2009 17:17:56 -0800 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: <200912212019.nBLKJbgb023078@zion.cs.uiuc.edu> References: <200912212019.nBLKJbgb023078@zion.cs.uiuc.edu> Message-ID: <6a8523d60912211717g3904851bv6daab52dddb51752@mail.gmail.com> This broke the MSVC build, please take a look. - Daniel On Mon, Dec 21, 2009 at 12:19 PM, Anton Korobeynikov wrote: > Author: asl > Date: Mon Dec 21 14:19:37 2009 > New Revision: 91842 > > URL: http://llvm.org/viewvc/llvm-project?rev=91842&view=rev > Log: > Remove uber-gross hack. The define _snprintf to snprintf is invalid due to two reasons: 1. Accroding to C++ standard snprintf should be available in std namespace (and __gnu_cxx in case of GCC to). Such ifdef will change all snprintf's to _snprintf's, but won't bring snprintf to all necessary namespaces. Thus e.g. any locale-using code on mingw will yield an error (include this file + string to see the result) 2. MSVCRT's _snprintf does not comply with C99 standard. Standard one is snprintf. > > Modified: > ? ?llvm/trunk/include/llvm/Support/Format.h > > Modified: llvm/trunk/include/llvm/Support/Format.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Format.h?rev=91842&r1=91841&r2=91842&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Support/Format.h (original) > +++ llvm/trunk/include/llvm/Support/Format.h Mon Dec 21 14:19:37 2009 > @@ -25,9 +25,6 @@ > > ?#include > ?#include > -#ifdef WIN32 > -#define snprintf _snprintf > -#endif > > ?namespace llvm { > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From echristo at apple.com Mon Dec 21 19:23:52 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 22 Dec 2009 01:23:52 -0000 Subject: [llvm-commits] [llvm] r91875 - /llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Message-ID: <200912220123.nBM1Nqrn001757@zion.cs.uiuc.edu> Author: echristo Date: Mon Dec 21 19:23:51 2009 New Revision: 91875 URL: http://llvm.org/viewvc/llvm-project?rev=91875&view=rev Log: Whitespace fixes. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=91875&r1=91874&r2=91875&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Mon Dec 21 19:23:51 2009 @@ -1142,8 +1142,8 @@ if (FT->getNumParams() != 4 || FT->getReturnType() != FT->getParamType(0) || !isa(FT->getParamType(0)) || !isa(FT->getParamType(1)) || - !isa(FT->getParamType(3)) || - FT->getParamType(2) != TD->getIntPtrType(*Context)) + !isa(FT->getParamType(3)) || + FT->getParamType(2) != TD->getIntPtrType(*Context)) return 0; ConstantInt *SizeCI = dyn_cast(CI->getOperand(4)); @@ -1170,7 +1170,7 @@ if (FT->getNumParams() != 4 || FT->getReturnType() != FT->getParamType(0) || !isa(FT->getParamType(0)) || !isa(FT->getParamType(1)) || - !isa(FT->getParamType(3)) || + !isa(FT->getParamType(3)) || FT->getParamType(2) != TD->getIntPtrType(*Context)) return 0; @@ -1200,7 +1200,7 @@ if (FT->getNumParams() != 4 || FT->getReturnType() != FT->getParamType(0) || !isa(FT->getParamType(0)) || !isa(FT->getParamType(1)) || - !isa(FT->getParamType(3)) || + !isa(FT->getParamType(3)) || FT->getParamType(2) != TD->getIntPtrType(*Context)) return 0; From isanbard at gmail.com Mon Dec 21 19:25:10 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 01:25:10 -0000 Subject: [llvm-commits] [llvm] r91876 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912220125.nBM1PAGq001804@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 19:25:10 2009 New Revision: 91876 URL: http://llvm.org/viewvc/llvm-project?rev=91876&view=rev Log: Add SDNode ordering to inlined asm and VA functions. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91876&r1=91875&r2=91876&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 19:25:10 2009 @@ -159,7 +159,8 @@ /// (if applicable), and includes the number of values added into it. void AddInlineAsmOperands(unsigned Code, bool HasMatching, unsigned MatchingIdx, - SelectionDAG &DAG, std::vector &Ops) const; + SelectionDAG &DAG, unsigned Order, + std::vector &Ops) const; }; } @@ -5281,20 +5282,30 @@ /// values added into it. void RegsForValue::AddInlineAsmOperands(unsigned Code, bool HasMatching,unsigned MatchingIdx, - SelectionDAG &DAG, + SelectionDAG &DAG, unsigned Order, std::vector &Ops) const { EVT IntPtrTy = DAG.getTargetLoweringInfo().getPointerTy(); assert(Regs.size() < (1 << 13) && "Too many inline asm outputs!"); unsigned Flag = Code | (Regs.size() << 3); if (HasMatching) Flag |= 0x80000000 | (MatchingIdx << 16); - Ops.push_back(DAG.getTargetConstant(Flag, IntPtrTy)); + + SDValue Res = DAG.getTargetConstant(Flag, IntPtrTy); + Ops.push_back(Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), Order); + for (unsigned Value = 0, Reg = 0, e = ValueVTs.size(); Value != e; ++Value) { unsigned NumRegs = TLI->getNumRegisters(*DAG.getContext(), ValueVTs[Value]); EVT RegisterVT = RegVTs[Value]; for (unsigned i = 0; i != NumRegs; ++i) { assert(Reg < Regs.size() && "Mismatch in # registers expected"); - Ops.push_back(DAG.getRegister(Regs[Reg++], RegisterVT)); + SDValue Res = DAG.getRegister(Regs[Reg++], RegisterVT); + Ops.push_back(Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), Order); } } } @@ -5509,6 +5520,9 @@ RegVT, OpInfo.CallOperand); OpInfo.ConstraintVT = RegVT; } + + if (DisableScheduling) + DAG.AssignOrdering(OpInfo.CallOperand.getNode(), SDNodeOrder); } NumRegs = TLI.getNumRegisters(Context, OpInfo.ConstraintVT); @@ -5545,6 +5559,7 @@ Regs.push_back(*I); } } + OpInfo.AssignedRegs = RegsForValue(TLI, Regs, RegVT, ValueVT); const TargetRegisterInfo *TRI = DAG.getTarget().getRegisterInfo(); OpInfo.MarkAllocatedRegs(isOutReg, isInReg, OutputRegs, InputRegs, *TRI); @@ -5775,12 +5790,18 @@ Chain = DAG.getStore(Chain, getCurDebugLoc(), OpInfo.CallOperand, StackSlot, NULL, 0); OpInfo.CallOperand = StackSlot; + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); } // There is no longer a Value* corresponding to this operand. OpInfo.CallOperandVal = 0; + // It is now an indirect operand. OpInfo.isIndirect = true; + + if (DisableScheduling) + DAG.AssignOrdering(OpInfo.CallOperand.getNode(), SDNodeOrder); } // If this constraint is for a specific register, allocate it before @@ -5788,8 +5809,8 @@ if (OpInfo.ConstraintType == TargetLowering::C_Register) GetRegistersForValue(OpInfo, OutputRegs, InputRegs); } - ConstraintInfos.clear(); + ConstraintInfos.clear(); // Second pass - Loop over all of the operands, assigning virtual or physregs // to register class operands. @@ -5863,7 +5884,8 @@ 2 /* REGDEF */ , false, 0, - DAG, AsmNodeOperands); + DAG, SDNodeOrder, + AsmNodeOperands); break; } case InlineAsm::isInput: { @@ -5913,7 +5935,7 @@ SDNodeOrder, Chain, &Flag); MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, true, OpInfo.getMatchedOperand(), - DAG, AsmNodeOperands); + DAG, SDNodeOrder, AsmNodeOperands); break; } else { assert(((OpFlag & 7) == 4) && "Unknown matching constraint!"); @@ -5976,7 +5998,8 @@ SDNodeOrder, Chain, &Flag); OpInfo.AssignedRegs.AddInlineAsmOperands(1/*REGUSE*/, false, 0, - DAG, AsmNodeOperands); + DAG, SDNodeOrder, + AsmNodeOperands); break; } case InlineAsm::isClobber: { @@ -5984,7 +6007,8 @@ // allocator is aware that the physreg got clobbered. if (!OpInfo.AssignedRegs.Regs.empty()) OpInfo.AssignedRegs.AddInlineAsmOperands(6 /* EARLYCLOBBER REGDEF */, - false, 0, DAG,AsmNodeOperands); + false, 0, DAG, SDNodeOrder, + AsmNodeOperands); break; } } @@ -5999,6 +6023,9 @@ &AsmNodeOperands[0], AsmNodeOperands.size()); Flag = Chain.getValue(1); + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); + // If this asm returns a register value, copy the result from that register // and set it as the value of the call. if (!RetValRegs.Regs.empty()) { @@ -6027,6 +6054,9 @@ } assert(ResultType == Val.getValueType() && "Asm result value mismatch!"); + + if (DisableScheduling) + DAG.AssignOrdering(Val.getNode(), SDNodeOrder); } setValue(CS.getInstruction(), Val); @@ -6050,22 +6080,34 @@ // Emit the non-flagged stores from the physregs. SmallVector OutChains; - for (unsigned i = 0, e = StoresToEmit.size(); i != e; ++i) - OutChains.push_back(DAG.getStore(Chain, getCurDebugLoc(), - StoresToEmit[i].first, - getValue(StoresToEmit[i].second), - StoresToEmit[i].second, 0)); + for (unsigned i = 0, e = StoresToEmit.size(); i != e; ++i) { + SDValue Val = DAG.getStore(Chain, getCurDebugLoc(), + StoresToEmit[i].first, + getValue(StoresToEmit[i].second), + StoresToEmit[i].second, 0); + OutChains.push_back(Val); + if (DisableScheduling) + DAG.AssignOrdering(Val.getNode(), SDNodeOrder); + } + if (!OutChains.empty()) Chain = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), MVT::Other, &OutChains[0], OutChains.size()); + + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); + DAG.setRoot(Chain); } void SelectionDAGBuilder::visitVAStart(CallInst &I) { - DAG.setRoot(DAG.getNode(ISD::VASTART, getCurDebugLoc(), - MVT::Other, getRoot(), - getValue(I.getOperand(1)), - DAG.getSrcValue(I.getOperand(1)))); + SDValue Res = DAG.getNode(ISD::VASTART, getCurDebugLoc(), + MVT::Other, getRoot(), + getValue(I.getOperand(1)), + DAG.getSrcValue(I.getOperand(1))); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitVAArg(VAArgInst &I) { @@ -6074,22 +6116,30 @@ DAG.getSrcValue(I.getOperand(0))); setValue(&I, V); DAG.setRoot(V.getValue(1)); + if (DisableScheduling) + DAG.AssignOrdering(V.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitVAEnd(CallInst &I) { - DAG.setRoot(DAG.getNode(ISD::VAEND, getCurDebugLoc(), - MVT::Other, getRoot(), - getValue(I.getOperand(1)), - DAG.getSrcValue(I.getOperand(1)))); + SDValue Res = DAG.getNode(ISD::VAEND, getCurDebugLoc(), + MVT::Other, getRoot(), + getValue(I.getOperand(1)), + DAG.getSrcValue(I.getOperand(1))); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitVACopy(CallInst &I) { - DAG.setRoot(DAG.getNode(ISD::VACOPY, getCurDebugLoc(), - MVT::Other, getRoot(), - getValue(I.getOperand(1)), - getValue(I.getOperand(2)), - DAG.getSrcValue(I.getOperand(1)), - DAG.getSrcValue(I.getOperand(2)))); + SDValue Res = DAG.getNode(ISD::VACOPY, getCurDebugLoc(), + MVT::Other, getRoot(), + getValue(I.getOperand(1)), + getValue(I.getOperand(2)), + DAG.getSrcValue(I.getOperand(1)), + DAG.getSrcValue(I.getOperand(2))); + DAG.setRoot(Res); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), SDNodeOrder); } /// TargetLowering::LowerCallTo - This is the default LowerCallTo From sabre at nondot.org Mon Dec 21 19:38:23 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 01:38:23 -0000 Subject: [llvm-commits] [llvm] r91877 - /llvm/trunk/include/llvm/Type.h Message-ID: <200912220138.nBM1cNxv002201@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 19:38:23 2009 New Revision: 91877 URL: http://llvm.org/viewvc/llvm-project?rev=91877&view=rev Log: fix unit test that I broke. Modified: llvm/trunk/include/llvm/Type.h Modified: llvm/trunk/include/llvm/Type.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=91877&r1=91876&r2=91877&view=diff ============================================================================== --- llvm/trunk/include/llvm/Type.h (original) +++ llvm/trunk/include/llvm/Type.h Mon Dec 21 19:38:23 2009 @@ -408,7 +408,7 @@ // If this is the last PATypeHolder using this object, and there are no // PATypeHandles using it, the type is dead, delete it now. - if (RefCount-- == 0 && AbstractTypeUsers.empty()) + if (--RefCount == 0 && AbstractTypeUsers.empty()) this->destroy(); } From daniel at zuster.org Mon Dec 21 19:41:37 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Dec 2009 01:41:37 -0000 Subject: [llvm-commits] [llvm] r91878 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Message-ID: <200912220141.nBM1fbpo002338@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Dec 21 19:41:37 2009 New Revision: 91878 URL: http://llvm.org/viewvc/llvm-project?rev=91878&view=rev Log: Fix some may-be-uninitialized var warnings. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=91878&r1=91877&r2=91878&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Mon Dec 21 19:41:37 2009 @@ -64,7 +64,7 @@ static inline int modRMRequired(OpcodeType type, InstructionContext insnContext, uint8_t opcode) { - const struct ContextDecision* decision; + const struct ContextDecision* decision = 0; switch (type) { case ONEBYTE: @@ -714,8 +714,8 @@ * @return - 0 if the SIB byte was successfully read; nonzero otherwise. */ static int readSIB(struct InternalInstruction* insn) { - SIBIndex sibIndexBase; - SIBBase sibBaseBase; + SIBIndex sibIndexBase = 0; + SIBBase sibBaseBase = 0; uint8_t index, base; dbgprintf(insn, "readSIB()"); From scallanan at apple.com Mon Dec 21 20:07:42 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 22 Dec 2009 02:07:42 -0000 Subject: [llvm-commits] [llvm] r91879 - in /llvm/trunk/lib/Target/X86/Disassembler: X86DisassemblerDecoder.c X86DisassemblerDecoder.h Message-ID: <200912220207.nBM27hXC003152@zion.cs.uiuc.edu> Author: spyffe Date: Mon Dec 21 20:07:42 2009 New Revision: 91879 URL: http://llvm.org/viewvc/llvm-project?rev=91879&view=rev Log: Changed REG_* to MODRM_REG_* to avoid conflicts with symbols in AuroraUX's global namespace. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=91879&r1=91878&r2=91879&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Mon Dec 21 20:07:42 2009 @@ -876,15 +876,15 @@ */ switch (insn->registerSize) { case 2: - insn->regBase = REG_AX; + insn->regBase = MODRM_REG_AX; insn->eaRegBase = EA_REG_AX; break; case 4: - insn->regBase = REG_EAX; + insn->regBase = MODRM_REG_EAX; insn->eaRegBase = EA_REG_EAX; break; case 8: - insn->regBase = REG_RAX; + insn->regBase = MODRM_REG_RAX; insn->eaRegBase = EA_REG_RAX; break; } @@ -1051,7 +1051,7 @@ * @param valid - The address of a uint8_t. The target is set to 1 if the * field is valid for the register class; 0 if not. */ -GENERIC_FIXUP_FUNC(fixupRegValue, insn->regBase, REG) +GENERIC_FIXUP_FUNC(fixupRegValue, insn->regBase, MODRM_REG) GENERIC_FIXUP_FUNC(fixupRMValue, insn->eaRegBase, EA_REG) /* @@ -1145,26 +1145,30 @@ switch (size) { case 1: - insn->opcodeRegister = (Reg)(REG_AL + ((bFromREX(insn->rexPrefix) << 3) - | insn->opcodeModifier)); + insn->opcodeRegister = (Reg)(MODRM_REG_AL + ((bFromREX(insn->rexPrefix) << 3) + | insn->opcodeModifier)); if(insn->rexPrefix && - insn->opcodeRegister >= REG_AL + 0x4 && - insn->opcodeRegister < REG_AL + 0x8) { - insn->opcodeRegister = (Reg)(REG_SPL + (insn->opcodeRegister - REG_AL - 4)); + insn->opcodeRegister >= MODRM_REG_AL + 0x4 && + insn->opcodeRegister < MODRM_REG_AL + 0x8) { + insn->opcodeRegister = (Reg)(MODRM_REG_SPL + + (insn->opcodeRegister - MODRM_REG_AL - 4)); } break; case 2: - insn->opcodeRegister = (Reg)(REG_AX + ((bFromREX(insn->rexPrefix) << 3) - | insn->opcodeModifier)); + insn->opcodeRegister = (Reg)(MODRM_REG_AX + + ((bFromREX(insn->rexPrefix) << 3) + | insn->opcodeModifier)); break; case 4: - insn->opcodeRegister = (Reg)(REG_EAX + ((bFromREX(insn->rexPrefix) << 3) - | insn->opcodeModifier)); + insn->opcodeRegister = (Reg)(MODRM_REG_EAX + + + ((bFromREX(insn->rexPrefix) << 3) + | insn->opcodeModifier)); break; case 8: - insn->opcodeRegister = (Reg)(REG_RAX + ((bFromREX(insn->rexPrefix) << 3) - |insn->opcodeModifier)); + insn->opcodeRegister = (Reg)(MODRM_REG_RAX + + ((bFromREX(insn->rexPrefix) << 3) + | insn->opcodeModifier)); break; } } Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h?rev=91879&r1=91878&r2=91879&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Mon Dec 21 20:07:42 2009 @@ -324,10 +324,10 @@ * Reg - All possible values of the reg field in the ModR/M byte. */ typedef enum { -#define ENTRY(x) REG_##x, +#define ENTRY(x) MODRM_REG_##x, ALL_REGS #undef ENTRY - REG_max + MODRM_REG_max } Reg; /* From isanbard at gmail.com Mon Dec 21 20:10:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 02:10:20 -0000 Subject: [llvm-commits] [llvm] r91880 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/X86/ lib/Target/XCore/ Message-ID: <200912220210.nBM2AKQ5003265@zion.cs.uiuc.edu> Author: void Date: Mon Dec 21 20:10:19 2009 New Revision: 91880 URL: http://llvm.org/viewvc/llvm-project?rev=91880&view=rev Log: Add more plumbing. This time in the LowerArguments and "get" functions which return partial registers. This affected the back-end lowering code some. Also patch up some places I missed before in the "get" functions. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Dec 21 20:10:19 2009 @@ -1136,7 +1136,7 @@ bool isVarArg, bool isInreg, unsigned NumFixedArgs, CallingConv::ID CallConv, bool isTailCall, bool isReturnValueUsed, SDValue Callee, ArgListTy &Args, - SelectionDAG &DAG, DebugLoc dl); + SelectionDAG &DAG, DebugLoc dl, unsigned Order); /// LowerCall - This hook must be implemented to lower calls into the /// the specified DAG. The outgoing arguments to the call are described Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 21 20:10:19 2009 @@ -1866,7 +1866,7 @@ 0, TLI.getLibcallCallingConv(LC), false, /*isReturnValueUsed=*/true, Callee, Args, DAG, - Node->getDebugLoc()); + Node->getDebugLoc(), DAG.GetOrdering(Node)); // Legalize the call sequence, starting with the chain. This will advance // the LastCALLSEQ_END to the legalized version of the CALLSEQ_END node that @@ -2271,7 +2271,7 @@ false, false, false, false, 0, CallingConv::C, false, /*isReturnValueUsed=*/true, DAG.getExternalSymbol("abort", TLI.getPointerTy()), - Args, DAG, dl); + Args, DAG, dl, DAG.GetOrdering(Node)); Results.push_back(CallResult.second); break; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Dec 21 20:10:19 2009 @@ -1033,7 +1033,8 @@ TLI.LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false, false, 0, TLI.getLibcallCallingConv(LC), false, /*isReturnValueUsed=*/true, - Callee, Args, DAG, dl); + Callee, Args, DAG, dl, + DAG.GetOrdering(DAG.getEntryNode().getNode())); return CallInfo.first; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Dec 21 20:10:19 2009 @@ -3449,7 +3449,7 @@ /*isReturnValueUsed=*/false, getExternalSymbol(TLI.getLibcallName(RTLIB::MEMCPY), TLI.getPointerTy()), - Args, *this, dl); + Args, *this, dl, GetOrdering(Chain.getNode())); return CallResult.second; } @@ -3498,7 +3498,7 @@ /*isReturnValueUsed=*/false, getExternalSymbol(TLI.getLibcallName(RTLIB::MEMMOVE), TLI.getPointerTy()), - Args, *this, dl); + Args, *this, dl, GetOrdering(Chain.getNode())); return CallResult.second; } @@ -3557,7 +3557,7 @@ /*isReturnValueUsed=*/false, getExternalSymbol(TLI.getLibcallName(RTLIB::MEMSET), TLI.getPointerTy()), - Args, *this, dl); + Args, *this, dl, GetOrdering(Chain.getNode())); return CallResult.second; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Dec 21 20:10:19 2009 @@ -169,13 +169,14 @@ /// larger then ValueVT then AssertOp can be used to specify whether the extra /// bits are known to be zero (ISD::AssertZext) or sign extended from ValueVT /// (ISD::AssertSext). -static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, +static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order, const SDValue *Parts, unsigned NumParts, EVT PartVT, EVT ValueVT, ISD::NodeType AssertOp = ISD::DELETED_NODE) { assert(NumParts > 0 && "No parts to assemble!"); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); SDValue Val = Parts[0]; + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); if (NumParts > 1) { // Assemble the value from multiple parts. @@ -194,23 +195,32 @@ EVT HalfVT = EVT::getIntegerVT(*DAG.getContext(), RoundBits/2); if (RoundParts > 2) { - Lo = getCopyFromParts(DAG, dl, Parts, RoundParts/2, PartVT, HalfVT); - Hi = getCopyFromParts(DAG, dl, Parts+RoundParts/2, RoundParts/2, + Lo = getCopyFromParts(DAG, dl, Order, Parts, RoundParts / 2, PartVT, HalfVT); + Hi = getCopyFromParts(DAG, dl, Order, Parts + RoundParts / 2, + RoundParts / 2, PartVT, HalfVT); } else { Lo = DAG.getNode(ISD::BIT_CONVERT, dl, HalfVT, Parts[0]); Hi = DAG.getNode(ISD::BIT_CONVERT, dl, HalfVT, Parts[1]); } + if (TLI.isBigEndian()) std::swap(Lo, Hi); + Val = DAG.getNode(ISD::BUILD_PAIR, dl, RoundVT, Lo, Hi); + if (DisableScheduling) { + DAG.AssignOrdering(Lo.getNode(), Order); + DAG.AssignOrdering(Hi.getNode(), Order); + DAG.AssignOrdering(Val.getNode(), Order); + } + if (RoundParts < NumParts) { // Assemble the trailing non-power-of-2 part. unsigned OddParts = NumParts - RoundParts; EVT OddVT = EVT::getIntegerVT(*DAG.getContext(), OddParts * PartBits); - Hi = getCopyFromParts(DAG, dl, - Parts+RoundParts, OddParts, PartVT, OddVT); + Hi = getCopyFromParts(DAG, dl, Order, + Parts + RoundParts, OddParts, PartVT, OddVT); // Combine the round and odd parts. Lo = Val; @@ -218,11 +228,15 @@ std::swap(Lo, Hi); EVT TotalVT = EVT::getIntegerVT(*DAG.getContext(), NumParts * PartBits); Hi = DAG.getNode(ISD::ANY_EXTEND, dl, TotalVT, Hi); + if (DisableScheduling) DAG.AssignOrdering(Hi.getNode(), Order); Hi = DAG.getNode(ISD::SHL, dl, TotalVT, Hi, DAG.getConstant(Lo.getValueType().getSizeInBits(), TLI.getPointerTy())); + if (DisableScheduling) DAG.AssignOrdering(Hi.getNode(), Order); Lo = DAG.getNode(ISD::ZERO_EXTEND, dl, TotalVT, Lo); + if (DisableScheduling) DAG.AssignOrdering(Lo.getNode(), Order); Val = DAG.getNode(ISD::OR, dl, TotalVT, Lo, Hi); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); } } else if (ValueVT.isVector()) { // Handle a multi-element vector. @@ -243,7 +257,7 @@ // If the register was not expanded, truncate or copy the value, // as appropriate. for (unsigned i = 0; i != NumParts; ++i) - Ops[i] = getCopyFromParts(DAG, dl, &Parts[i], 1, + Ops[i] = getCopyFromParts(DAG, dl, Order, &Parts[i], 1, PartVT, IntermediateVT); } else if (NumParts > 0) { // If the intermediate type was expanded, build the intermediate operands @@ -252,7 +266,7 @@ "Must expand into a divisible number of parts!"); unsigned Factor = NumParts / NumIntermediates; for (unsigned i = 0; i != NumIntermediates; ++i) - Ops[i] = getCopyFromParts(DAG, dl, &Parts[i * Factor], Factor, + Ops[i] = getCopyFromParts(DAG, dl, Order, &Parts[i * Factor], Factor, PartVT, IntermediateVT); } @@ -261,6 +275,7 @@ Val = DAG.getNode(IntermediateVT.isVector() ? ISD::CONCAT_VECTORS : ISD::BUILD_VECTOR, dl, ValueVT, &Ops[0], NumIntermediates); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); } else if (PartVT.isFloatingPoint()) { // FP split into multiple FP parts (for ppcf128) assert(ValueVT == EVT(MVT::ppcf128) && PartVT == EVT(MVT::f64) && @@ -271,12 +286,18 @@ if (TLI.isBigEndian()) std::swap(Lo, Hi); Val = DAG.getNode(ISD::BUILD_PAIR, dl, ValueVT, Lo, Hi); + + if (DisableScheduling) { + DAG.AssignOrdering(Hi.getNode(), Order); + DAG.AssignOrdering(Lo.getNode(), Order); + DAG.AssignOrdering(Val.getNode(), Order); + } } else { // FP split into integer parts (soft fp) assert(ValueVT.isFloatingPoint() && PartVT.isInteger() && !PartVT.isVector() && "Unexpected split"); EVT IntVT = EVT::getIntegerVT(*DAG.getContext(), ValueVT.getSizeInBits()); - Val = getCopyFromParts(DAG, dl, Parts, NumParts, PartVT, IntVT); + Val = getCopyFromParts(DAG, dl, Order, Parts, NumParts, PartVT, IntVT); } } @@ -288,14 +309,20 @@ if (PartVT.isVector()) { assert(ValueVT.isVector() && "Unknown vector conversion!"); - return DAG.getNode(ISD::BIT_CONVERT, dl, ValueVT, Val); + SDValue Res = DAG.getNode(ISD::BIT_CONVERT, dl, ValueVT, Val); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), Order); + return Res; } if (ValueVT.isVector()) { assert(ValueVT.getVectorElementType() == PartVT && ValueVT.getVectorNumElements() == 1 && "Only trivial scalar-to-vector conversions should get here!"); - return DAG.getNode(ISD::BUILD_VECTOR, dl, ValueVT, Val); + SDValue Res = DAG.getNode(ISD::BUILD_VECTOR, dl, ValueVT, Val); + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), Order); + return Res; } if (PartVT.isInteger() && @@ -307,22 +334,36 @@ if (AssertOp != ISD::DELETED_NODE) Val = DAG.getNode(AssertOp, dl, PartVT, Val, DAG.getValueType(ValueVT)); - return DAG.getNode(ISD::TRUNCATE, dl, ValueVT, Val); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); + Val = DAG.getNode(ISD::TRUNCATE, dl, ValueVT, Val); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); + return Val; } else { - return DAG.getNode(ISD::ANY_EXTEND, dl, ValueVT, Val); + Val = DAG.getNode(ISD::ANY_EXTEND, dl, ValueVT, Val); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); + return Val; } } if (PartVT.isFloatingPoint() && ValueVT.isFloatingPoint()) { - if (ValueVT.bitsLT(Val.getValueType())) + if (ValueVT.bitsLT(Val.getValueType())) { // FP_ROUND's are always exact here. - return DAG.getNode(ISD::FP_ROUND, dl, ValueVT, Val, - DAG.getIntPtrConstant(1)); - return DAG.getNode(ISD::FP_EXTEND, dl, ValueVT, Val); + Val = DAG.getNode(ISD::FP_ROUND, dl, ValueVT, Val, + DAG.getIntPtrConstant(1)); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); + return Val; + } + + Val = DAG.getNode(ISD::FP_EXTEND, dl, ValueVT, Val); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); + return Val; } - if (PartVT.getSizeInBits() == ValueVT.getSizeInBits()) - return DAG.getNode(ISD::BIT_CONVERT, dl, ValueVT, Val); + if (PartVT.getSizeInBits() == ValueVT.getSizeInBits()) { + Val = DAG.getNode(ISD::BIT_CONVERT, dl, ValueVT, Val); + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); + return Val; + } llvm_unreachable("Unknown mismatch!"); return SDValue(); @@ -331,8 +372,9 @@ /// getCopyToParts - Create a series of nodes that contain the specified value /// split into legal parts. If the parts contain more bits than Val, then, for /// integers, ExtendKind can be used to specify how to generate the extra bits. -static void getCopyToParts(SelectionDAG &DAG, DebugLoc dl, SDValue Val, - SDValue *Parts, unsigned NumParts, EVT PartVT, +static void getCopyToParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order, + SDValue Val, SDValue *Parts, unsigned NumParts, + EVT PartVT, ISD::NodeType ExtendKind = ISD::ANY_EXTEND) { const TargetLowering &TLI = DAG.getTargetLoweringInfo(); EVT PtrVT = TLI.getPointerTy(); @@ -376,6 +418,8 @@ } } + if (DisableScheduling) DAG.AssignOrdering(Val.getNode(), Order); + // The value may have changed - recompute ValueVT. ValueVT = Val.getValueType(); assert(NumParts * PartBits == ValueVT.getSizeInBits() && @@ -398,13 +442,21 @@ SDValue OddVal = DAG.getNode(ISD::SRL, dl, ValueVT, Val, DAG.getConstant(RoundBits, TLI.getPointerTy())); - getCopyToParts(DAG, dl, OddVal, Parts + RoundParts, OddParts, PartVT); + getCopyToParts(DAG, dl, Order, OddVal, Parts + RoundParts, + OddParts, PartVT); + if (TLI.isBigEndian()) // The odd parts were reversed by getCopyToParts - unreverse them. std::reverse(Parts + RoundParts, Parts + NumParts); + NumParts = RoundParts; ValueVT = EVT::getIntegerVT(*DAG.getContext(), NumParts * PartBits); Val = DAG.getNode(ISD::TRUNCATE, dl, ValueVT, Val); + + if (DisableScheduling) { + DAG.AssignOrdering(OddVal.getNode(), Order); + DAG.AssignOrdering(Val.getNode(), Order); + } } // The number of parts is a power of 2. Repeatedly bisect the value using @@ -412,6 +464,10 @@ Parts[0] = DAG.getNode(ISD::BIT_CONVERT, dl, EVT::getIntegerVT(*DAG.getContext(), ValueVT.getSizeInBits()), Val); + + if (DisableScheduling) + DAG.AssignOrdering(Parts[0].getNode(), Order); + for (unsigned StepSize = NumParts; StepSize > 1; StepSize /= 2) { for (unsigned i = 0; i < NumParts; i += StepSize) { unsigned ThisBits = StepSize * PartBits / 2; @@ -426,11 +482,20 @@ ThisVT, Part0, DAG.getConstant(0, PtrVT)); + if (DisableScheduling) { + DAG.AssignOrdering(Part0.getNode(), Order); + DAG.AssignOrdering(Part1.getNode(), Order); + } + if (ThisBits == PartBits && ThisVT != PartVT) { Part0 = DAG.getNode(ISD::BIT_CONVERT, dl, PartVT, Part0); Part1 = DAG.getNode(ISD::BIT_CONVERT, dl, PartVT, Part1); + if (DisableScheduling) { + DAG.AssignOrdering(Part0.getNode(), Order); + DAG.AssignOrdering(Part1.getNode(), Order); + } } } } @@ -456,6 +521,9 @@ } } + if (DisableScheduling) + DAG.AssignOrdering(Val.getNode(), Order); + Parts[0] = Val; return; } @@ -473,7 +541,7 @@ // Split the vector into intermediate operands. SmallVector Ops(NumIntermediates); - for (unsigned i = 0; i != NumIntermediates; ++i) + for (unsigned i = 0; i != NumIntermediates; ++i) { if (IntermediateVT.isVector()) Ops[i] = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, IntermediateVT, Val, @@ -484,12 +552,16 @@ IntermediateVT, Val, DAG.getConstant(i, PtrVT)); + if (DisableScheduling) + DAG.AssignOrdering(Ops[i].getNode(), Order); + } + // Split the intermediate operands into legal parts. if (NumParts == NumIntermediates) { // If the register was not expanded, promote or copy the value, // as appropriate. for (unsigned i = 0; i != NumParts; ++i) - getCopyToParts(DAG, dl, Ops[i], &Parts[i], 1, PartVT); + getCopyToParts(DAG, dl, Order, Ops[i], &Parts[i], 1, PartVT); } else if (NumParts > 0) { // If the intermediate type was expanded, split each the value into // legal parts. @@ -497,7 +569,7 @@ "Must expand into a divisible number of parts!"); unsigned Factor = NumParts / NumIntermediates; for (unsigned i = 0; i != NumIntermediates; ++i) - getCopyToParts(DAG, dl, Ops[i], &Parts[i * Factor], Factor, PartVT); + getCopyToParts(DAG, dl, Order, Ops[i], &Parts[i*Factor], Factor, PartVT); } } @@ -854,7 +926,7 @@ unsigned NumParts = TLI.getNumRegisters(*DAG.getContext(), VT); EVT PartVT = TLI.getRegisterType(*DAG.getContext(), VT); SmallVector Parts(NumParts); - getCopyToParts(DAG, getCurDebugLoc(), + getCopyToParts(DAG, getCurDebugLoc(), SDNodeOrder, SDValue(RetOp.getNode(), RetOp.getResNo() + j), &Parts[0], NumParts, PartVT, ExtendKind); @@ -4936,7 +5008,7 @@ CS.getCallingConv(), isTailCall, !CS.getInstruction()->use_empty(), - Callee, Args, DAG, getCurDebugLoc()); + Callee, Args, DAG, getCurDebugLoc(), SDNodeOrder); assert((isTailCall || Result.second.getNode()) && "Non-null chain expected with non-tail call!"); assert((Result.second.getNode() || !Result.first.getNode()) && @@ -5205,7 +5277,7 @@ Parts[i] = P; } - Values[Value] = getCopyFromParts(DAG, dl, Parts.begin(), + Values[Value] = getCopyFromParts(DAG, dl, Order, Parts.begin(), NumRegs, RegisterVT, ValueVT); if (DisableScheduling) DAG.AssignOrdering(Values[Value].getNode(), Order); @@ -5236,7 +5308,8 @@ unsigned NumParts = TLI->getNumRegisters(*DAG.getContext(), ValueVT); EVT RegisterVT = RegVTs[Value]; - getCopyToParts(DAG, dl, Val.getValue(Val.getResNo() + Value), + getCopyToParts(DAG, dl, Order, + Val.getValue(Val.getResNo() + Value), &Parts[Part], NumParts, RegisterVT); Part += NumParts; } @@ -6153,8 +6226,8 @@ CallingConv::ID CallConv, bool isTailCall, bool isReturnValueUsed, SDValue Callee, - ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl) { - + ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl, + unsigned Order) { assert((!isTailCall || PerformTailCallOpt) && "isTailCall set when tail-call optimizations are disabled!"); @@ -6208,7 +6281,8 @@ else if (Args[i].isZExt) ExtendKind = ISD::ZERO_EXTEND; - getCopyToParts(DAG, dl, Op, &Parts[0], NumParts, PartVT, ExtendKind); + getCopyToParts(DAG, dl, Order, Op, &Parts[0], NumParts, + PartVT, ExtendKind); for (unsigned j = 0; j != NumParts; ++j) { // if it isn't first piece, alignment must be 1 @@ -6269,6 +6343,9 @@ "LowerCall emitted a value with the wrong type!"); }); + if (DisableScheduling) + DAG.AssignOrdering(Chain.getNode(), Order); + // For a tail call, the return value is merely live-out and there aren't // any nodes in the DAG representing it. Return a special value to // indicate that a tail call has been emitted and no more Instructions @@ -6293,9 +6370,11 @@ unsigned NumRegs = getNumRegisters(RetTy->getContext(), VT); SDValue ReturnValue = - getCopyFromParts(DAG, dl, &InVals[CurReg], NumRegs, RegisterVT, VT, - AssertOp); + getCopyFromParts(DAG, dl, Order, &InVals[CurReg], NumRegs, + RegisterVT, VT, AssertOp); ReturnValues.push_back(ReturnValue); + if (DisableScheduling) + DAG.AssignOrdering(ReturnValue.getNode(), Order); CurReg += NumRegs; } @@ -6308,7 +6387,8 @@ SDValue Res = DAG.getNode(ISD::MERGE_VALUES, dl, DAG.getVTList(&RetTys[0], RetTys.size()), &ReturnValues[0], ReturnValues.size()); - + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), Order); return std::make_pair(Res, Chain); } @@ -6325,7 +6405,6 @@ return SDValue(); } - void SelectionDAGBuilder::CopyValueToVirtualRegister(Value *V, unsigned Reg) { SDValue Op = getValue(V); assert((Op.getOpcode() != ISD::CopyFromReg || @@ -6347,6 +6426,7 @@ SelectionDAG &DAG = SDB->DAG; SDValue OldRoot = DAG.getRoot(); DebugLoc dl = SDB->getCurDebugLoc(); + unsigned Order = SDB->getSDNodeOrder(); const TargetData *TD = TLI.getTargetData(); SmallVector Ins; @@ -6358,7 +6438,7 @@ FunctionLoweringInfo &FLI = DAG.getFunctionLoweringInfo(); FLI.CanLowerReturn = TLI.CanLowerReturn(F.getCallingConv(), F.isVarArg(), - OutVTs, OutsFlags, DAG); + OutVTs, OutsFlags, DAG); if (!FLI.CanLowerReturn) { // Put in an sret pointer parameter before all the other parameters. SmallVector ValueVTs; @@ -6445,6 +6525,9 @@ "LowerFormalArguments emitted a value with the wrong type!"); }); + if (DisableScheduling) + DAG.AssignOrdering(NewRoot.getNode(), Order); + // Update the DAG with the new chain value resulting from argument lowering. DAG.setRoot(NewRoot); @@ -6459,8 +6542,8 @@ EVT VT = ValueVTs[0]; EVT RegVT = TLI.getRegisterType(*CurDAG->getContext(), VT); ISD::NodeType AssertOp = ISD::DELETED_NODE; - SDValue ArgValue = getCopyFromParts(DAG, dl, &InVals[0], 1, RegVT, - VT, AssertOp); + SDValue ArgValue = getCopyFromParts(DAG, dl, Order, &InVals[0], 1, + RegVT, VT, AssertOp); MachineFunction& MF = SDB->DAG.getMachineFunction(); MachineRegisterInfo& RegInfo = MF.getRegInfo(); @@ -6468,11 +6551,14 @@ FLI.DemoteRegister = SRetReg; NewRoot = SDB->DAG.getCopyToReg(NewRoot, SDB->getCurDebugLoc(), SRetReg, ArgValue); DAG.setRoot(NewRoot); - + if (DisableScheduling) + DAG.AssignOrdering(NewRoot.getNode(), Order); + // i indexes lowered arguments. Bump it past the hidden sret argument. // Idx indexes LLVM arguments. Don't touch it. ++i; } + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++Idx) { SmallVector ArgValues; @@ -6491,19 +6577,28 @@ else if (F.paramHasAttr(Idx, Attribute::ZExt)) AssertOp = ISD::AssertZext; - ArgValues.push_back(getCopyFromParts(DAG, dl, &InVals[i], NumParts, - PartVT, VT, AssertOp)); + ArgValues.push_back(getCopyFromParts(DAG, dl, Order, &InVals[i], + NumParts, PartVT, VT, + AssertOp)); } + i += NumParts; } + if (!I->use_empty()) { - SDB->setValue(I, DAG.getMergeValues(&ArgValues[0], NumValues, - SDB->getCurDebugLoc())); + SDValue Res = DAG.getMergeValues(&ArgValues[0], NumValues, + SDB->getCurDebugLoc()); + SDB->setValue(I, Res); + + if (DisableScheduling) + DAG.AssignOrdering(Res.getNode(), Order); + // If this argument is live outside of the entry block, insert a copy from // whereever we got it to the vreg that other BB's will reference it as. SDB->CopyToExportRegsIfNeeded(I); } } + assert(i == InVals.size() && "Argument register count mismatch!"); // Finally, if the target has anything special to do, allow it to do so. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Mon Dec 21 20:10:19 2009 @@ -336,6 +336,8 @@ DebugLoc getCurDebugLoc() const { return CurDebugLoc; } void setCurDebugLoc(DebugLoc dl) { CurDebugLoc = dl; } + unsigned getSDNodeOrder() const { return SDNodeOrder; } + void CopyValueToVirtualRegister(Value *V, unsigned Reg); void visit(Instruction &I); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Dec 21 20:10:19 2009 @@ -1273,7 +1273,8 @@ LowerCallTo(Chain, (const Type *) Type::getInt32Ty(*DAG.getContext()), false, false, false, false, 0, CallingConv::C, false, /*isReturnValueUsed=*/true, - DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG, dl); + DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG, dl, + DAG.GetOrdering(Chain.getNode())); return CallResult.first; } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Dec 21 20:10:19 2009 @@ -118,8 +118,8 @@ TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false, 0, TLI.getLibcallCallingConv(LC), false, /*isReturnValueUsed=*/true, - Callee, Args, DAG, - Op.getDebugLoc()); + Callee, Args, DAG, Op.getDebugLoc(), + DAG.GetOrdering(InChain.getNode())); return CallInfo.first; } Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Mon Dec 21 20:10:19 2009 @@ -413,7 +413,8 @@ LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false, false, 0, CallingConv::C, false, /*isReturnValueUsed=*/true, - Callee, Args, DAG, dl); + Callee, Args, DAG, dl, + DAG.GetOrdering(DAG.getEntryNode().getNode())); return CallInfo.first; } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Dec 21 20:10:19 2009 @@ -1333,7 +1333,7 @@ false, false, false, false, 0, CallingConv::C, false, /*isReturnValueUsed=*/true, DAG.getExternalSymbol("__trampoline_setup", PtrVT), - Args, DAG, dl); + Args, DAG, dl, DAG.GetOrdering(Chain.getNode())); SDValue Ops[] = { CallResult.first, CallResult.second }; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Dec 21 20:10:19 2009 @@ -6194,7 +6194,8 @@ LowerCallTo(Chain, Type::getVoidTy(*DAG.getContext()), false, false, false, false, 0, CallingConv::C, false, /*isReturnValueUsed=*/false, - DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG, dl); + DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG, dl, + DAG.GetOrdering(Chain.getNode())); return CallResult.second; } Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=91880&r1=91879&r2=91880&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Mon Dec 21 20:10:19 2009 @@ -452,7 +452,7 @@ false, false, 0, CallingConv::C, false, /*isReturnValueUsed=*/true, DAG.getExternalSymbol("__misaligned_load", getPointerTy()), - Args, DAG, dl); + Args, DAG, dl, DAG.GetOrdering(Chain.getNode())); SDValue Ops[] = { CallResult.first, CallResult.second }; @@ -513,7 +513,7 @@ false, false, 0, CallingConv::C, false, /*isReturnValueUsed=*/true, DAG.getExternalSymbol("__misaligned_store", getPointerTy()), - Args, DAG, dl); + Args, DAG, dl, DAG.GetOrdering(Chain.getNode())); return CallResult.second; } From sabre at nondot.org Mon Dec 21 22:25:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 04:25:07 -0000 Subject: [llvm-commits] [llvm] r91885 - in /llvm/trunk: include/llvm/Analysis/MemoryDependenceAnalysis.h lib/Analysis/MemoryDependenceAnalysis.cpp lib/Transforms/Scalar/GVN.cpp Message-ID: <200912220425.nBM4P8SC007643@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 22:25:02 2009 New Revision: 91885 URL: http://llvm.org/viewvc/llvm-project?rev=91885&view=rev Log: The phi translated pointer can be computed when returning a partially cached result instead of stored. This reduces memdep memory usage, and also eliminates a bunch of weakvh's. This speeds up gvn on gcc.c-torture/20001226-1.c from 23.9s to 8.45s (2.8x) on a different machine than earlier. Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=91885&r1=91884&r2=91885&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original) +++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Mon Dec 21 22:25:02 2009 @@ -132,21 +132,17 @@ } }; - /// NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache, and an - /// entry in the results set for a non-local query. For each BasicBlock (the - /// BB entry) it keeps a MemDepResult and the (potentially phi translated) - /// address that was live in the block. - class NonLocalDepEntry { + /// NonLocalDepResult - This is a result from a NonLocal dependence query. + /// For each BasicBlock (the BB entry) it keeps a MemDepResult and the + /// (potentially phi translated) address that was live in the block. + class NonLocalDepResult { BasicBlock *BB; MemDepResult Result; - WeakVH Address; + Value *Address; public: - NonLocalDepEntry(BasicBlock *bb, MemDepResult result, Value *address) + NonLocalDepResult(BasicBlock *bb, MemDepResult result, Value *address) : BB(bb), Result(result), Address(address) {} - - // This is used for searches. - NonLocalDepEntry(BasicBlock *bb) : BB(bb) {} - + // BB is the sort key, it can't be changed. BasicBlock *getBB() const { return BB; } @@ -154,7 +150,7 @@ Result = R; Address = Addr; } - + const MemDepResult &getResult() const { return Result; } /// getAddress - Return the address of this pointer in this block. This can @@ -165,7 +161,27 @@ /// /// The address is always null for a non-local 'call' dependence. Value *getAddress() const { return Address; } + }; + + /// NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache. For + /// each BasicBlock (the BB entry) it keeps a MemDepResult. + class NonLocalDepEntry { + BasicBlock *BB; + MemDepResult Result; + public: + NonLocalDepEntry(BasicBlock *bb, MemDepResult result) + : BB(bb), Result(result) {} + + // This is used for searches. + NonLocalDepEntry(BasicBlock *bb) : BB(bb) {} + // BB is the sort key, it can't be changed. + BasicBlock *getBB() const { return BB; } + + void setResult(const MemDepResult &R) { Result = R; } + + const MemDepResult &getResult() const { return Result; } + bool operator<(const NonLocalDepEntry &RHS) const { return BB < RHS.BB; } @@ -283,7 +299,7 @@ /// This method assumes the pointer has a "NonLocal" dependency within BB. void getNonLocalPointerDependency(Value *Pointer, bool isLoad, BasicBlock *BB, - SmallVectorImpl &Result); + SmallVectorImpl &Result); /// removeInstruction - Remove an instruction from the dependence analysis, /// updating the dependence of instructions that previously depended on it. @@ -307,7 +323,7 @@ BasicBlock *BB); bool getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t Size, bool isLoad, BasicBlock *BB, - SmallVectorImpl &Result, + SmallVectorImpl &Result, DenseMap &Visited, bool SkipFirstBlock = false); MemDepResult GetNonLocalInfoForBlock(Value *Pointer, uint64_t PointeeSize, Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=91885&r1=91884&r2=91885&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Mon Dec 21 22:25:02 2009 @@ -547,9 +547,9 @@ // If we had a dirty entry for the block, update it. Otherwise, just add // a new entry. if (ExistingResult) - ExistingResult->setResult(Dep, 0); + ExistingResult->setResult(Dep); else - Cache.push_back(NonLocalDepEntry(DirtyBB, Dep, 0)); + Cache.push_back(NonLocalDepEntry(DirtyBB, Dep)); // If the block has a dependency (i.e. it isn't completely transparent to // the value), remember the association! @@ -579,7 +579,7 @@ /// void MemoryDependenceAnalysis:: getNonLocalPointerDependency(Value *Pointer, bool isLoad, BasicBlock *FromBB, - SmallVectorImpl &Result) { + SmallVectorImpl &Result) { assert(isa(Pointer->getType()) && "Can't get pointer deps of a non-pointer!"); Result.clear(); @@ -600,9 +600,9 @@ Result, Visited, true)) return; Result.clear(); - Result.push_back(NonLocalDepEntry(FromBB, - MemDepResult::getClobber(FromBB->begin()), - Pointer)); + Result.push_back(NonLocalDepResult(FromBB, + MemDepResult::getClobber(FromBB->begin()), + Pointer)); } /// GetNonLocalInfoForBlock - Compute the memdep value for BB with @@ -657,9 +657,9 @@ // If we had a dirty entry for the block, update it. Otherwise, just add // a new entry. if (ExistingResult) - ExistingResult->setResult(Dep, Pointer); + ExistingResult->setResult(Dep); else - Cache->push_back(NonLocalDepEntry(BB, Dep, Pointer)); + Cache->push_back(NonLocalDepEntry(BB, Dep)); // If the block has a dependency (i.e. it isn't completely transparent to // the value), remember the reverse association because we just added it @@ -727,7 +727,7 @@ bool MemoryDependenceAnalysis:: getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize, bool isLoad, BasicBlock *StartBB, - SmallVectorImpl &Result, + SmallVectorImpl &Result, DenseMap &Visited, bool SkipFirstBlock) { @@ -760,11 +760,12 @@ } } + Value *Addr = Pointer.getAddr(); for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end(); I != E; ++I) { - Visited.insert(std::make_pair(I->getBB(), Pointer.getAddr())); + Visited.insert(std::make_pair(I->getBB(), Addr)); if (!I->getResult().isNonLocal()) - Result.push_back(*I); + Result.push_back(NonLocalDepResult(I->getBB(), I->getResult(), Addr)); } ++NumCacheCompleteNonLocalPtr; return false; @@ -808,7 +809,7 @@ // If we got a Def or Clobber, add this to the list of results. if (!Dep.isNonLocal()) { - Result.push_back(NonLocalDepEntry(BB, Dep, Pointer.getAddr())); + Result.push_back(NonLocalDepResult(BB, Dep, Pointer.getAddr())); continue; } } @@ -890,9 +891,9 @@ // a computation of the pointer in this predecessor. if (PredPtrVal == 0) { // Add the entry to the Result list. - NonLocalDepEntry Entry(Pred, - MemDepResult::getClobber(Pred->getTerminator()), - PredPtrVal); + NonLocalDepResult Entry(Pred, + MemDepResult::getClobber(Pred->getTerminator()), + PredPtrVal); Result.push_back(Entry); // Since we had a phi translation failure, the cache for CacheKey won't @@ -960,9 +961,10 @@ assert(I->getResult().isNonLocal() && "Should only be here with transparent block"); - I->setResult(MemDepResult::getClobber(BB->begin()), Pointer.getAddr()); + I->setResult(MemDepResult::getClobber(BB->begin())); ReverseNonLocalPtrDeps[BB->begin()].insert(CacheKey); - Result.push_back(*I); + Result.push_back(NonLocalDepResult(I->getBB(), I->getResult(), + Pointer.getAddr())); break; } } @@ -1116,7 +1118,7 @@ if (DI->getResult().getInst() != RemInst) continue; // Convert to a dirty entry for the subsequent instruction. - DI->setResult(NewDirtyVal, DI->getAddress()); + DI->setResult(NewDirtyVal); if (Instruction *NextI = NewDirtyVal.getInst()) ReverseDepsToAdd.push_back(std::make_pair(NextI, *I)); @@ -1158,7 +1160,7 @@ if (DI->getResult().getInst() != RemInst) continue; // Convert to a dirty entry for the subsequent instruction. - DI->setResult(NewDirtyVal, DI->getAddress()); + DI->setResult(NewDirtyVal); if (Instruction *NewDirtyInst = NewDirtyVal.getInst()) ReversePtrDepsToAdd.push_back(std::make_pair(NewDirtyInst, P)); Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=91885&r1=91884&r2=91885&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Dec 21 22:25:02 2009 @@ -1358,7 +1358,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI, SmallVectorImpl &toErase) { // Find the non-local dependencies of the load. - SmallVector Deps; + SmallVector Deps; MD->getNonLocalPointerDependency(LI->getOperand(0), true, LI->getParent(), Deps); //DEBUG(errs() << "INVESTIGATING NONLOCAL LOAD: " From sabre at nondot.org Mon Dec 21 22:47:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 04:47:42 -0000 Subject: [llvm-commits] [llvm] r91886 - /llvm/trunk/include/llvm/Support/StandardPasses.h Message-ID: <200912220447.nBM4lhRT008264@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 21 22:47:41 2009 New Revision: 91886 URL: http://llvm.org/viewvc/llvm-project?rev=91886&view=rev Log: don't run GVN at -O1, GCC doesn't do it's equivalent at that optimization level. Modified: llvm/trunk/include/llvm/Support/StandardPasses.h Modified: llvm/trunk/include/llvm/Support/StandardPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=91886&r1=91885&r2=91886&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/StandardPasses.h (original) +++ llvm/trunk/include/llvm/Support/StandardPasses.h Mon Dec 21 22:47:41 2009 @@ -137,7 +137,8 @@ if (UnrollLoops) PM->add(createLoopUnrollPass()); // Unroll small loops PM->add(createInstructionCombiningPass()); // Clean up after the unroller - PM->add(createGVNPass()); // Remove redundancies + if (OptimizationLevel > 1) + PM->add(createGVNPass()); // Remove redundancies PM->add(createMemCpyOptPass()); // Remove memcpy / form memset PM->add(createSCCPPass()); // Constant prop with SCCP From nicolas.geoffray at gmail.com Mon Dec 21 23:38:06 2009 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Tue, 22 Dec 2009 06:38:06 +0100 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: Hi Jeffrey, > Ah, I see now. You have your own ModuleProvider, and it needs to know > precisely when the function is actually needed, right? Yeah, it sounds > like I need to roll back that part of this fix until PR5737 is fixed. > > Yes, thanks! > Could you please write some tests for the ways you're using > ModuleProviders and the other interfaces in LLVM? I keep breaking or > nearly breaking you, and I'd be much more likely to get this right if > a test broke when I got it wrong. > OK, I'll try to do that as soon as possible. Nicolas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091222/57b4aea6/attachment.html From nicholas at mxc.ca Mon Dec 21 23:44:22 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Dec 2009 00:44:22 -0500 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: <4B305CB6.80206@mxc.ca> nicolas geoffray wrote: > Hi Jeffrey, > > > Ah, I see now. You have your own ModuleProvider, and it needs to know > precisely when the function is actually needed, right? Yeah, it sounds > like I need to roll back that part of this fix until PR5737 is fixed. > > > Yes, thanks! > > > > Could you please write some tests for the ways you're using > ModuleProviders and the other interfaces in LLVM? I keep breaking or > nearly breaking you, and I'd be much more likely to get this right if > a test broke when I got it wrong. > > > OK, I'll try to do that as soon as possible. Hi Nicolas, While I agree we certainly don't want to break your stuff, I'm not comfortable with you relying on implementation details of how ModuleProvider is used. There's no documented restrictions on when materializeFunction may be called, so relying on it to happen to match Java (and apparently C#) for the correct operation of your VM seems dubious. Is it possible for you to detach the Java loading behaviour from the ModuleProvider at all? If not, are there semantics that we should guarantee on the MP that are shared across all languages that want lazy-loading? Nick From sabre at nondot.org Tue Dec 22 00:04:26 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 06:04:26 -0000 Subject: [llvm-commits] [llvm] r91889 - /llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll Message-ID: <200912220604.nBM64Q4B010689@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 00:04:26 2009 New Revision: 91889 URL: http://llvm.org/viewvc/llvm-project?rev=91889&view=rev Log: convert to filecheck Modified: llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll Modified: llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll?rev=91889&r1=91888&r2=91889&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll Tue Dec 22 00:04:26 2009 @@ -1,30 +1,40 @@ -; Test CFG simplify removal of branch instructions... +; Test CFG simplify removal of branch instructions. ; -; RUN: opt < %s -simplifycfg -S | not grep br +; RUN: opt < %s -simplifycfg -S | FileCheck %s define void @test1() { br label %BB1 BB1: ; preds = %0 ret void +; CHECK: @test1 +; CHECK-NEXT: ret void } define void @test2() { ret void BB1: ; No predecessors! ret void +; CHECK: @test2 +; CHECK-NEXT: ret void +; CHECK-NEXT: } } define void @test3(i1 %T) { br i1 %T, label %BB1, label %BB1 BB1: ; preds = %0, %0 ret void +; CHECK: @test3 +; CHECK-NEXT: ret void } define void @test4() { -entry: - br label %return + br label %return return: - ret void + ret void +; CHECK: @test4 +; CHECK-NEXT: ret void } @test4g = global i8* blockaddress(@test4, %return) + + From sabre at nondot.org Tue Dec 22 00:07:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 06:07:31 -0000 Subject: [llvm-commits] [llvm] r91890 - in /llvm/trunk: lib/Transforms/Scalar/SimplifyCFGPass.cpp test/Transforms/SimplifyCFG/basictest.ll Message-ID: <200912220607.nBM67Vj8010794@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 00:07:30 2009 New Revision: 91890 URL: http://llvm.org/viewvc/llvm-project?rev=91890&view=rev Log: Implement PR5795 by merging duplicated return blocks. This could go further by merging all returns in a function into a single one, but simplifycfg currently likes to duplicate the return (an unfortunate choice!) Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp?rev=91890&r1=91889&r2=91890&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Tue Dec 22 00:07:30 2009 @@ -189,6 +189,77 @@ return true; } +/// MergeEmptyReturnBlocks - If we have more than one empty (other than phi +/// node) return blocks, merge them together to promote recursive block merging. +static bool MergeEmptyReturnBlocks(Function &F) { + bool Changed = false; + + BasicBlock *RetBlock = 0; + + // Scan all the blocks in the function, looking for empty return blocks. + for (Function::iterator BBI = F.begin(), E = F.end(); BBI != E; ) { + BasicBlock &BB = *BBI++; + + // Only look at return blocks. + ReturnInst *Ret = dyn_cast(BB.getTerminator()); + if (Ret == 0) continue; + + // Only look at the block if it is empty or the only other thing in it is a + // single PHI node that is the operand to the return. + if (Ret != &BB.front()) { + // Check for something else in the block. + BasicBlock::iterator I = Ret; + --I; + if (!isa(I) || I != BB.begin() || + Ret->getNumOperands() == 0 || + Ret->getOperand(0) != I) + continue; + } + + // If this is the first returning block, remember it and keep going. + if (RetBlock == 0) { + RetBlock = &BB; + continue; + } + + // Otherwise, we found a duplicate return block. Merge the two. + Changed = true; + + // Case when there is no input to the return or when the returned values + // agree is trivial. Note that they can't agree if there are phis in the + // blocks. + if (Ret->getNumOperands() == 0 || + Ret->getOperand(0) == + cast(RetBlock->getTerminator())->getOperand(0)) { + BB.replaceAllUsesWith(RetBlock); + BB.eraseFromParent(); + continue; + } + + // If the canonical return block has no PHI node, create one now. + PHINode *RetBlockPHI = dyn_cast(RetBlock->begin()); + if (RetBlockPHI == 0) { + Value *InVal = cast(RetBlock->begin())->getOperand(0); + RetBlockPHI = PHINode::Create(Ret->getOperand(0)->getType(), "merge", + &RetBlock->front()); + + for (pred_iterator PI = pred_begin(RetBlock), E = pred_end(RetBlock); + PI != E; ++PI) + RetBlockPHI->addIncoming(InVal, *PI); + RetBlock->getTerminator()->setOperand(0, RetBlockPHI); + } + + // Turn BB into a block that just unconditionally branches to the return + // block. This handles the case when the two return blocks have a common + // predecessor but that return different things. + RetBlockPHI->addIncoming(Ret->getOperand(0), &BB); + BB.getTerminator()->eraseFromParent(); + BranchInst::Create(RetBlock, &BB); + } + + return Changed; +} + /// IterativeSimplifyCFG - Call SimplifyCFG on all the blocks in the function, /// iterating until no more changes are made. static bool IterativeSimplifyCFG(Function &F) { @@ -216,6 +287,7 @@ // bool CFGSimplifyPass::runOnFunction(Function &F) { bool EverChanged = RemoveUnreachableBlocksFromFn(F); + EverChanged |= MergeEmptyReturnBlocks(F); EverChanged |= IterativeSimplifyCFG(F); // If neither pass changed anything, we're done. Modified: llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll?rev=91890&r1=91889&r2=91890&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/basictest.ll Tue Dec 22 00:07:30 2009 @@ -38,3 +38,22 @@ @test4g = global i8* blockaddress(@test4, %return) +; PR5795 +define void @test5(i32 %A) { + switch i32 %A, label %return [ + i32 2, label %bb + i32 10, label %bb1 + ] + +bb: ; preds = %entry + ret void + +bb1: ; preds = %entry + ret void + +return: ; preds = %entry + ret void +; CHECK: @test5 +; CHECK-NEXT: bb: +; CHECK-NEXT: ret void +} From sabre at nondot.org Tue Dec 22 00:24:00 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 06:24:00 -0000 Subject: [llvm-commits] [llvm] r91892 - /llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Message-ID: <200912220624.nBM6O0W0011330@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 00:24:00 2009 New Revision: 91892 URL: http://llvm.org/viewvc/llvm-project?rev=91892&view=rev Log: don't crash on blank lines, rename some variables. Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91892&r1=91891&r2=91892&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Tue Dec 22 00:24:00 2009 @@ -84,75 +84,68 @@ } } -int HexDisassembler::disassemble(const Target &target, - const std::string &tripleString, - MemoryBuffer &buffer) { - // Set up disassembler +int HexDisassembler::disassemble(const Target &T, const std::string &Triple, + MemoryBuffer &Buffer) { + // Set up disassembler. + llvm::OwningPtr AsmInfo(T.createAsmInfo(Triple)); - llvm::OwningPtr asmInfo - (target.createAsmInfo(tripleString)); - - if (!asmInfo) { - errs() << "error: no assembly info for target " << tripleString << "\n"; + if (!AsmInfo) { + errs() << "error: no assembly info for target " << Triple << "\n"; return -1; } - llvm::OwningPtr disassembler - (target.createMCDisassembler()); - - if (!disassembler) { - errs() << "error: no disassembler for target " << tripleString << "\n"; + llvm::OwningPtr DisAsm(T.createMCDisassembler()); + if (!DisAsm) { + errs() << "error: no disassembler for target " << Triple << "\n"; return -1; } - llvm::MCInstPrinter *instPrinter = target.createMCInstPrinter(0, - *asmInfo, - outs()); + llvm::MCInstPrinter *InstPrinter = T.createMCInstPrinter(0, *AsmInfo, outs()); - if (!instPrinter) { - errs() << "error: no instruction printer for target " << tripleString + if (!InstPrinter) { + errs() << "error: no instruction printer for target " << Triple << "\n"; return -1; } // Convert the input to a vector for disassembly. + std::vector ByteArray; - std::vector bytes; - - StringRef str = buffer.getBuffer(); + StringRef Str = Buffer.getBuffer(); - while (!str.empty()) { - if(str.find_first_of("\n") < str.find_first_not_of(" \t\n\r")) { - printInst(*disassembler, *instPrinter, bytes); + while (!Str.empty()) { + if (Str.find_first_of('\n') < Str.find_first_not_of(" \t\n\r")) { + if (!ByteArray.empty()) + printInst(*DisAsm, *InstPrinter, ByteArray); - bytes.clear(); + ByteArray.clear(); } // Skip leading space. - str = str.substr(str.find_first_not_of(" \t\n\r")); + Str = Str.substr(Str.find_first_not_of(" \t\n\r")); // Get the current token. - size_t next = str.find_first_of(" \t\n\r"); + size_t Next = Str.find_first_of(" \t\n\r"); - if(next == (size_t)StringRef::npos) + if(Next == (size_t)StringRef::npos) break; - StringRef value = str.slice(0, next); + StringRef Value = Str.slice(0, Next); // Convert to a byte and add to the byte vector. - unsigned byte; - if (value.getAsInteger(0, byte) || byte > 255) { - errs() << "warning: invalid input token '" << value << "' of length " - << next << "\n"; + unsigned ByteVal; + if (Value.getAsInteger(0, ByteVal) || ByteVal > 255) { + errs() << "warning: invalid input token '" << Value << "' of length " + << Next << "\n"; } else { - bytes.push_back((unsigned char)byte); + ByteArray.push_back((unsigned char)ByteVal); } - str = str.substr(next); + Str = Str.substr(Next); } - if (!bytes.empty()) - printInst(*disassembler, *instPrinter, bytes); + if (!ByteArray.empty()) + printInst(*DisAsm, *InstPrinter, ByteArray); return 0; } From sabre at nondot.org Tue Dec 22 00:37:58 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 06:37:58 -0000 Subject: [llvm-commits] [llvm] r91894 - in /llvm/trunk: test/MC/Disassembler/ test/MC/Disassembler/dg.exp test/MC/Disassembler/simple-tests.txt tools/llvm-mc/HexDisassembler.cpp Message-ID: <200912220637.nBM6bwd6011737@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 00:37:58 2009 New Revision: 91894 URL: http://llvm.org/viewvc/llvm-project?rev=91894&view=rev Log: rewrite the file parser for the disassembler, implementing support for comments. Also, check in a simple testcase for the disassembler, including a test for r91864 Added: llvm/trunk/test/MC/Disassembler/ llvm/trunk/test/MC/Disassembler/dg.exp llvm/trunk/test/MC/Disassembler/simple-tests.txt Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Added: llvm/trunk/test/MC/Disassembler/dg.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/dg.exp?rev=91894&view=auto ============================================================================== --- llvm/trunk/test/MC/Disassembler/dg.exp (added) +++ llvm/trunk/test/MC/Disassembler/dg.exp Tue Dec 22 00:37:58 2009 @@ -0,0 +1,4 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{txt}]] + Added: llvm/trunk/test/MC/Disassembler/simple-tests.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/simple-tests.txt?rev=91894&view=auto ============================================================================== --- llvm/trunk/test/MC/Disassembler/simple-tests.txt (added) +++ llvm/trunk/test/MC/Disassembler/simple-tests.txt Tue Dec 22 00:37:58 2009 @@ -0,0 +1,15 @@ +# RUN: llvm-mc --disassemble %s | FileCheck %s + +# CHECK: int $33 +0xCD 0x21 + +# CHECK: int $33 +0xCD 0x21 + + +# CHECK: addb %al, (%rax) +0 0 0 0 0 0 + +# CHECK: callq -1234 +0xe8 0x2e 0xfb 0xff 0xff + Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91894&r1=91893&r2=91894&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Tue Dec 22 00:37:58 2009 @@ -114,31 +114,43 @@ StringRef Str = Buffer.getBuffer(); while (!Str.empty()) { - if (Str.find_first_of('\n') < Str.find_first_not_of(" \t\n\r")) { - if (!ByteArray.empty()) + // Strip horizontal whitespace. + if (size_t Pos = Str.find_first_not_of(" \t\r")) { + Str = Str.substr(Pos); + continue; + } + + // If this is the end of a line or start of a comment, process the + // instruction we have so far. + if (Str[0] == '\n' || Str[0] == '#') { + // If we have bytes to process, do so. + if (!ByteArray.empty()) { printInst(*DisAsm, *InstPrinter, ByteArray); + ByteArray.clear(); + } - ByteArray.clear(); + // Strip to the end of line if we already processed any bytes on this + // line. This strips the comment and/or the \n. + if (Str[0] == '\n') + Str = Str.substr(1); + else { + Str = Str.substr(Str.find_first_of('\n')); + if (!Str.empty()) + Str = Str.substr(1); + } + continue; } - // Skip leading space. - Str = Str.substr(Str.find_first_not_of(" \t\n\r")); - // Get the current token. - size_t Next = Str.find_first_of(" \t\n\r"); - - if(Next == (size_t)StringRef::npos) - break; - - StringRef Value = Str.slice(0, Next); + size_t Next = Str.find_first_of(" \t\n\r#"); + StringRef Value = Str.substr(0, Next); // Convert to a byte and add to the byte vector. unsigned ByteVal; if (Value.getAsInteger(0, ByteVal) || ByteVal > 255) { errs() << "warning: invalid input token '" << Value << "' of length " << Next << "\n"; - } - else { + } else { ByteArray.push_back((unsigned char)ByteVal); } Str = Str.substr(Next); From sabre at nondot.org Tue Dec 22 00:45:48 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 06:45:48 -0000 Subject: [llvm-commits] [llvm] r91895 - /llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Message-ID: <200912220645.nBM6jm8s011982@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 00:45:48 2009 New Revision: 91895 URL: http://llvm.org/viewvc/llvm-project?rev=91895&view=rev Log: If you thought that it didn't make sense for the disassembler to not produce caret diagnostics, you were right! Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91895&r1=91894&r2=91895&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Tue Dec 22 00:45:48 2009 @@ -23,8 +23,7 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryObject.h" #include "llvm/Support/raw_ostream.h" - -#include +#include "llvm/Support/SourceMgr.h" using namespace llvm; @@ -47,9 +46,7 @@ int readByte(uint64_t addr, uint8_t *byte) const { if (addr > getExtent()) return -1; - else - *byte = Bytes[addr]; - + *byte = Bytes[addr]; return 0; } }; @@ -58,26 +55,19 @@ llvm::MCInstPrinter &instPrinter, const std::vector &bytes) { // Wrap the vector in a MemoryObject. - VectorMemoryObject memoryObject(bytes); // Disassemble it. - MCInst inst; uint64_t size; std::string verboseOStr; llvm::raw_string_ostream verboseOS(verboseOStr); - if (disassembler.getInstruction(inst, - size, - memoryObject, - 0, - verboseOS)) { + if (disassembler.getInstruction(inst, size, memoryObject, 0, verboseOS)) { instPrinter.printInst(&inst); outs() << "\n"; - } - else { + } else { errs() << "error: invalid instruction" << "\n"; errs() << "Diagnostic log:" << "\n"; errs() << verboseOStr.c_str() << "\n"; @@ -108,11 +98,13 @@ return -1; } + SourceMgr SourceManager; + SourceManager.AddNewSourceBuffer(&Buffer, SMLoc()); + // Convert the input to a vector for disassembly. std::vector ByteArray; StringRef Str = Buffer.getBuffer(); - while (!Str.empty()) { // Strip horizontal whitespace. if (size_t Pos = Str.find_first_not_of(" \t\r")) { @@ -148,11 +140,15 @@ // Convert to a byte and add to the byte vector. unsigned ByteVal; if (Value.getAsInteger(0, ByteVal) || ByteVal > 255) { - errs() << "warning: invalid input token '" << Value << "' of length " - << Next << "\n"; - } else { - ByteArray.push_back((unsigned char)ByteVal); + // If we have an error, print it and skip to the end of line. + SourceManager.PrintMessage(SMLoc::getFromPointer(Value.data()), + "invalid input token", "error"); + Str = Str.substr(Str.find('\n')); + ByteArray.clear(); + continue; } + + ByteArray.push_back((unsigned char)ByteVal); Str = Str.substr(Next); } From sabre at nondot.org Tue Dec 22 00:56:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 06:56:51 -0000 Subject: [llvm-commits] [llvm] r91896 - in /llvm/trunk: test/MC/Disassembler/simple-tests.txt tools/llvm-mc/HexDisassembler.cpp Message-ID: <200912220656.nBM6upbS012284@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 00:56:51 2009 New Revision: 91896 URL: http://llvm.org/viewvc/llvm-project?rev=91896&view=rev Log: various cleanups, make the disassemble reject lines with too much data on them, for example: addb %al, (%rax) simple-tests.txt:11:5: error: excess data detected in input 0 0 0 0 0 ^ Modified: llvm/trunk/test/MC/Disassembler/simple-tests.txt llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Modified: llvm/trunk/test/MC/Disassembler/simple-tests.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/simple-tests.txt?rev=91896&r1=91895&r2=91896&view=diff ============================================================================== --- llvm/trunk/test/MC/Disassembler/simple-tests.txt (original) +++ llvm/trunk/test/MC/Disassembler/simple-tests.txt Tue Dec 22 00:56:51 2009 @@ -8,7 +8,7 @@ # CHECK: addb %al, (%rax) -0 0 0 0 0 0 +0 0 # CHECK: callq -1234 0xe8 0x2e 0xfb 0xff 0xff Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91896&r1=91895&r2=91896&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Tue Dec 22 00:56:51 2009 @@ -24,54 +24,62 @@ #include "llvm/Support/MemoryObject.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/SourceMgr.h" - using namespace llvm; +typedef std::vector > ByteArrayTy; + +namespace { class VectorMemoryObject : public MemoryObject { private: - const std::vector &Bytes; + const ByteArrayTy &Bytes; public: - VectorMemoryObject(const std::vector &bytes) : - Bytes(bytes) { - } - - uint64_t getBase() const { - return 0; - } + VectorMemoryObject(const ByteArrayTy &bytes) : Bytes(bytes) {} - uint64_t getExtent() const { - return Bytes.size(); - } + uint64_t getBase() const { return 0; } + uint64_t getExtent() const { return Bytes.size(); } - int readByte(uint64_t addr, uint8_t *byte) const { - if (addr > getExtent()) + int readByte(uint64_t Addr, uint8_t *Byte) const { + if (Addr > getExtent()) return -1; - *byte = Bytes[addr]; + *Byte = Bytes[Addr].first; return 0; } }; +} -void printInst(const llvm::MCDisassembler &disassembler, - llvm::MCInstPrinter &instPrinter, - const std::vector &bytes) { +static bool PrintInst(const llvm::MCDisassembler &DisAsm, + llvm::MCInstPrinter &Printer, const ByteArrayTy &Bytes, + SourceMgr &SM) { // Wrap the vector in a MemoryObject. - VectorMemoryObject memoryObject(bytes); + VectorMemoryObject memoryObject(Bytes); - // Disassemble it. - MCInst inst; - uint64_t size; + // Disassemble it to a string and get the size of the instruction. + MCInst Inst; + uint64_t Size; std::string verboseOStr; llvm::raw_string_ostream verboseOS(verboseOStr); - if (disassembler.getInstruction(inst, size, memoryObject, 0, verboseOS)) { - instPrinter.printInst(&inst); - outs() << "\n"; - } else { - errs() << "error: invalid instruction" << "\n"; - errs() << "Diagnostic log:" << "\n"; - errs() << verboseOStr.c_str() << "\n"; + if (!DisAsm.getInstruction(Inst, Size, memoryObject, 0, verboseOS)) { + // FIXME: Caret. + errs() << "error: invalid instruction\n"; + errs() << "Diagnostic log:" << '\n'; + errs() << verboseOS.str() << '\n'; + return true; + } + + Printer.printInst(&Inst); + outs() << "\n"; + + // If the disassembled instruction was smaller than the number of bytes we + // read, reject the excess bytes. + if (Bytes.size() != Size) { + SM.PrintMessage(SMLoc::getFromPointer(Bytes[Size].second), + "excess data detected in input", "error"); + return true; } + + return false; } int HexDisassembler::disassemble(const Target &T, const std::string &Triple, @@ -93,16 +101,17 @@ llvm::MCInstPrinter *InstPrinter = T.createMCInstPrinter(0, *AsmInfo, outs()); if (!InstPrinter) { - errs() << "error: no instruction printer for target " << Triple - << "\n"; + errs() << "error: no instruction printer for target " << Triple << '\n'; return -1; } - SourceMgr SourceManager; - SourceManager.AddNewSourceBuffer(&Buffer, SMLoc()); + bool ErrorOccurred = false; + + SourceMgr SM; + SM.AddNewSourceBuffer(&Buffer, SMLoc()); // Convert the input to a vector for disassembly. - std::vector ByteArray; + ByteArrayTy ByteArray; StringRef Str = Buffer.getBuffer(); while (!Str.empty()) { @@ -117,7 +126,7 @@ if (Str[0] == '\n' || Str[0] == '#') { // If we have bytes to process, do so. if (!ByteArray.empty()) { - printInst(*DisAsm, *InstPrinter, ByteArray); + ErrorOccurred |= PrintInst(*DisAsm, *InstPrinter, ByteArray, SM); ByteArray.clear(); } @@ -141,19 +150,20 @@ unsigned ByteVal; if (Value.getAsInteger(0, ByteVal) || ByteVal > 255) { // If we have an error, print it and skip to the end of line. - SourceManager.PrintMessage(SMLoc::getFromPointer(Value.data()), + SM.PrintMessage(SMLoc::getFromPointer(Value.data()), "invalid input token", "error"); + ErrorOccurred = true; Str = Str.substr(Str.find('\n')); ByteArray.clear(); continue; } - ByteArray.push_back((unsigned char)ByteVal); + ByteArray.push_back(std::make_pair((unsigned char)ByteVal, Value.data())); Str = Str.substr(Next); } if (!ByteArray.empty()) - printInst(*DisAsm, *InstPrinter, ByteArray); + ErrorOccurred |= PrintInst(*DisAsm, *InstPrinter, ByteArray, SM); - return 0; + return ErrorOccurred; } From bob.wilson at apple.com Tue Dec 22 00:57:14 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 22 Dec 2009 06:57:14 -0000 Subject: [llvm-commits] [llvm] r91897 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/nonzero-first-index.ll Message-ID: <200912220657.nBM6vEA4012313@zion.cs.uiuc.edu> Author: bwilson Date: Tue Dec 22 00:57:14 2009 New Revision: 91897 URL: http://llvm.org/viewvc/llvm-project?rev=91897&view=rev Log: Generalize SROA to allow the first index of a GEP to be non-zero. Add a missing check that an array reference doesn't go past the end of the array, and remove some redundant checks for in-bound array and vector references that are no longer needed. Added: llvm/trunk/test/Transforms/ScalarRepl/nonzero-first-index.ll 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=91897&r1=91896&r2=91897&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Dec 22 00:57:14 2009 @@ -464,13 +464,6 @@ if (GEPIt == E) return; - // The first GEP index must be zero. - if (!isa(GEPIt.getOperand()) || - !cast(GEPIt.getOperand())->isZero()) - return MarkUnsafe(Info); - if (++GEPIt == E) - return; - // Walk through the GEP type indices, checking the types that this indexes // into. for (; GEPIt != E; ++GEPIt) { @@ -481,24 +474,10 @@ ConstantInt *IdxVal = dyn_cast(GEPIt.getOperand()); if (!IdxVal) return MarkUnsafe(Info); - - if (const ArrayType *AT = dyn_cast(*GEPIt)) { - // This GEP indexes an array. Verify that this is an in-range constant - // integer. Specifically, consider A[0][i]. We cannot know that the user - // isn't doing invalid things like allowing i to index an out-of-range - // subscript that accesses A[1]. Because of this, we have to reject SROA - // of any accesses into structs where any of the components are variables. - if (IdxVal->getZExtValue() >= AT->getNumElements()) - return MarkUnsafe(Info); - } else { - const VectorType *VT = cast(*GEPIt); - if (IdxVal->getZExtValue() >= VT->getNumElements()) - return MarkUnsafe(Info); - } } - // All the indices are safe. Now compute the offset due to this GEP and - // check if the alloca has a component element at that offset. + // Compute the offset due to this GEP and check if the alloca has a + // component element at that offset. SmallVector Indices(GEPI->op_begin() + 1, GEPI->op_end()); Offset += TD->getIndexedOffset(GEPI->getPointerOperandType(), &Indices[0], Indices.size()); @@ -552,6 +531,8 @@ } else if (const ArrayType *AT = dyn_cast(T)) { EltTy = AT->getElementType(); EltSize = TD->getTypeAllocSize(EltTy); + if (Offset >= AT->getNumElements() * EltSize) + return false; Offset %= EltSize; } else { return false; Added: llvm/trunk/test/Transforms/ScalarRepl/nonzero-first-index.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/nonzero-first-index.ll?rev=91897&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ScalarRepl/nonzero-first-index.ll (added) +++ llvm/trunk/test/Transforms/ScalarRepl/nonzero-first-index.ll Tue Dec 22 00:57:14 2009 @@ -0,0 +1,53 @@ +; RUN: opt < %s -scalarrepl -S | FileCheck %s + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-linux-gnu" + +%nested = type { i32, [4 x i32] } + +; Check that a GEP with a non-zero first index does not prevent SROA as long +; as the resulting offset corresponds to an element in the alloca. +define i32 @test1() { +; CHECK: @test1 +; CHECK-NOT: = i160 +; CHECK: ret i32 undef + %A = alloca %nested + %B = getelementptr %nested* %A, i32 0, i32 1, i32 0 + %C = getelementptr i32* %B, i32 2 + %D = load i32* %C + ret i32 %D +} + +; But, if the offset is out of range, then it should not be transformed. +define i32 @test2() { +; CHECK: @test2 +; CHECK: i160 + %A = alloca %nested + %B = getelementptr %nested* %A, i32 0, i32 1, i32 0 + %C = getelementptr i32* %B, i32 4 + %D = load i32* %C + ret i32 %D +} + +; Try it with a bitcast and single GEP.... +define i32 @test3() { +; CHECK: @test3 +; CHECK-NOT: = i160 +; CHECK: ret i32 undef + %A = alloca %nested + %B = bitcast %nested* %A to i32* + %C = getelementptr i32* %B, i32 2 + %D = load i32* %C + ret i32 %D +} + +; ...and again make sure that out-of-range accesses are not transformed. +define i32 @test4() { +; CHECK: @test4 +; CHECK: i160 + %A = alloca %nested + %B = bitcast %nested* %A to i32* + %C = getelementptr i32* %B, i32 -1 + %D = load i32* %C + ret i32 %D +} From sabre at nondot.org Tue Dec 22 00:58:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 06:58:29 -0000 Subject: [llvm-commits] [llvm] r91898 - /llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Message-ID: <200912220658.nBM6wTZB012358@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 00:58:29 2009 New Revision: 91898 URL: http://llvm.org/viewvc/llvm-project?rev=91898&view=rev Log: reject invalid input with a caret, e.g.: simple-tests.txt:16:1: error: invalid instruction 0xff 0xff ^ Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91898&r1=91897&r2=91898&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Tue Dec 22 00:58:29 2009 @@ -61,8 +61,8 @@ llvm::raw_string_ostream verboseOS(verboseOStr); if (!DisAsm.getInstruction(Inst, Size, memoryObject, 0, verboseOS)) { - // FIXME: Caret. - errs() << "error: invalid instruction\n"; + SM.PrintMessage(SMLoc::getFromPointer(Bytes[0].second), + "invalid instruction", "error"); errs() << "Diagnostic log:" << '\n'; errs() << verboseOS.str() << '\n'; return true; From sabre at nondot.org Tue Dec 22 01:01:12 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 07:01:12 -0000 Subject: [llvm-commits] [llvm] r91900 - /llvm/trunk/test/MC/Disassembler/simple-tests.txt Message-ID: <200912220701.nBM71CIS012468@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 01:01:12 2009 New Revision: 91900 URL: http://llvm.org/viewvc/llvm-project?rev=91900&view=rev Log: specify a triple to use, fixing the test on non-x86-64 hosts. Modified: llvm/trunk/test/MC/Disassembler/simple-tests.txt Modified: llvm/trunk/test/MC/Disassembler/simple-tests.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/simple-tests.txt?rev=91900&r1=91899&r2=91900&view=diff ============================================================================== --- llvm/trunk/test/MC/Disassembler/simple-tests.txt (original) +++ llvm/trunk/test/MC/Disassembler/simple-tests.txt Tue Dec 22 01:01:12 2009 @@ -1,4 +1,4 @@ -# RUN: llvm-mc --disassemble %s | FileCheck %s +# RUN: llvm-mc --disassemble %s -triple=x86_64-apple-darwin9 | FileCheck %s # CHECK: int $33 0xCD 0x21 From sabre at nondot.org Tue Dec 22 01:03:22 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 07:03:22 -0000 Subject: [llvm-commits] [llvm] r91901 - /llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Message-ID: <200912220703.nBM73MtD012544@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 01:03:21 2009 New Revision: 91901 URL: http://llvm.org/viewvc/llvm-project?rev=91901&view=rev Log: specify what is invalid about it Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91901&r1=91900&r2=91901&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Tue Dec 22 01:03:21 2009 @@ -62,7 +62,7 @@ if (!DisAsm.getInstruction(Inst, Size, memoryObject, 0, verboseOS)) { SM.PrintMessage(SMLoc::getFromPointer(Bytes[0].second), - "invalid instruction", "error"); + "invalid instruction encoding", "error"); errs() << "Diagnostic log:" << '\n'; errs() << verboseOS.str() << '\n'; return true; From asl at math.spbu.ru Tue Dec 22 03:34:22 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Dec 2009 12:34:22 +0300 (MSK) Subject: [llvm-commits] =?koi8-r?b?W2xsdm1dIHI5MTg0MiAtIC9sbHZtL3RydW5r?= =?koi8-r?b?L2luY2x1ZGUvbGx2bS9TdXBwb3J0L0Zvcm1hdC5o?= Message-ID: <200912220934.nBM9YM2J064777@LocalMailer> Hello, Daniel > This broke the MSVC build, please take a look. I don't have vcpp around, but this patch unbreaks a mingw build (which was broken for quite long time). I explained, why it is incorrect regardless of compiler. I'd really appreciate if someone with vcpp access look into this issue. Maybe we should do a #ifdef _MSC_VER, but this is still a hackish way to do things :( Note, that the most notable difference of snprintf and _snprintf is that the latter *does not* guarantee NULL termination! -- WBR, Anton Korobeynikov From mm.beck at gmx.net Tue Dec 22 05:51:14 2009 From: mm.beck at gmx.net (Michael Beck) Date: Tue, 22 Dec 2009 12:51:14 +0100 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h References: <200912220934.nBM9YM2J064777@LocalMailer> Message-ID: <804C3255AE7A4635A3E7020B61EF8974@nvidia.com> >> This broke the MSVC build, please take a look. > I don't have vcpp around, but this patch unbreaks a mingw build (which > was broken for quite long time). I explained, why it is incorrect > regardless of compiler. > > I'd really appreciate if someone with vcpp access look into this issue. > Maybe we should do a #ifdef _MSC_VER, but this is still a hackish way to > do things :( > > Note, that the most notable difference of snprintf and _snprintf is that > the latter *does not* guarantee NULL termination! This is a "typical" problem on MSVC builds. The regulary solutions for this are a) the #define snprintf _snprintf way b) define an own snprintf() which handles the NULL termination. MSVC even supports a /Fi option that is called forced include. This way, a header file containing the snprintf can be included by the commandline ... b) Seems to be the right solution here with an #ifdef MSVC around the definition. best regards, -- Michael Beck From asl at math.spbu.ru Tue Dec 22 06:18:07 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Dec 2009 15:18:07 +0300 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: <804C3255AE7A4635A3E7020B61EF8974@nvidia.com> References: <200912220934.nBM9YM2J064777@LocalMailer> <804C3255AE7A4635A3E7020B61EF8974@nvidia.com> Message-ID: Hello, Michael > a) the #define snprintf _snprintf way In general, this is not a solution - see the commit comment. Nothing introduces _snprintf to 'std' namespace. Some additional bookkeeping is needed. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From sanjiv.gupta at microchip.com Tue Dec 22 08:25:37 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Tue, 22 Dec 2009 14:25:37 -0000 Subject: [llvm-commits] [llvm] r91904 - in /llvm/trunk: lib/Target/PIC16/PIC16ISelDAGToDAG.h lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.h test/CodeGen/PIC16/C16-49.ll Message-ID: <200912221425.nBMEPb12009936@zion.cs.uiuc.edu> Author: sgupta Date: Tue Dec 22 08:25:37 2009 New Revision: 91904 URL: http://llvm.org/viewvc/llvm-project?rev=91904&view=rev Log: While converting one of the operands to a memory operand, we need to check if it is Legal and does not result into a cyclic dep. Added: llvm/trunk/test/CodeGen/PIC16/C16-49.ll Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h?rev=91904&r1=91903&r2=91904&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h Tue Dec 22 08:25:37 2009 @@ -36,7 +36,10 @@ public: explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) : SelectionDAGISel(tm), - TM(tm), PIC16Lowering(*TM.getTargetLowering()) {} + TM(tm), PIC16Lowering(*TM.getTargetLowering()) { + // Keep PIC16 specific DAGISel to use during the lowering + PIC16Lowering.ISel = this; + } // Pass Name virtual const char *getPassName() const { Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=91904&r1=91903&r2=91904&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Tue Dec 22 08:25:37 2009 @@ -1482,7 +1482,8 @@ // operand no. of the operand to be converted in 'MemOp'. Remember, PIC16 has // no instruction that can operation on two registers. Most insns take // one register and one memory operand (addwf) / Constant (addlw). -bool PIC16TargetLowering::NeedToConvertToMemOp(SDValue Op, unsigned &MemOp) { +bool PIC16TargetLowering::NeedToConvertToMemOp(SDValue Op, unsigned &MemOp, + SelectionDAG &DAG) { // If one of the operand is a constant, return false. if (Op.getOperand(0).getOpcode() == ISD::Constant || Op.getOperand(1).getOpcode() == ISD::Constant) @@ -1491,11 +1492,33 @@ // Return false if one of the operands is already a direct // load and that operand has only one use. if (isDirectLoad(Op.getOperand(0))) { - if (Op.getOperand(0).hasOneUse()) - return false; - else - MemOp = 0; + if (Op.getOperand(0).hasOneUse()) { + // Legal and profitable folding check uses the NodeId of DAG nodes. + // This NodeId is assigned by topological order. Therefore first + // assign topological order then perform legal and profitable check. + // Note:- Though this ordering is done before begining with legalization, + // newly added node during legalization process have NodeId=-1 (NewNode) + // therefore before performing any check proper ordering of the node is + // required. + DAG.AssignTopologicalOrder(); + + // Direct load operands are folded in binary operations. But before folding + // verify if this folding is legal. Fold only if it is legal otherwise + // convert this direct load to a separate memory operation. + if(ISel->IsLegalAndProfitableToFold(Op.getOperand(0).getNode(), + Op.getNode(), Op.getNode())) + return false; + else + MemOp = 0; + } } + + // For operations that are non-cummutative there is no need to check + // for right operand because folding right operand may result in + // incorrect operation. + if (! SelectionDAG::isCommutativeBinOp(Op.getOpcode())) + return true; + if (isDirectLoad(Op.getOperand(1))) { if (Op.getOperand(1).hasOneUse()) return false; @@ -1514,7 +1537,7 @@ assert (Op.getValueType() == MVT::i8 && "illegal Op to lower"); unsigned MemOp = 1; - if (NeedToConvertToMemOp(Op, MemOp)) { + if (NeedToConvertToMemOp(Op, MemOp, DAG)) { // Put one value on stack. SDValue NewVal = ConvertToMemOperand (Op.getOperand(MemOp), DAG, dl); @@ -1533,7 +1556,7 @@ assert (Op.getValueType() == MVT::i8 && "illegal add to lower"); DebugLoc dl = Op.getDebugLoc(); unsigned MemOp = 1; - if (NeedToConvertToMemOp(Op, MemOp)) { + if (NeedToConvertToMemOp(Op, MemOp, DAG)) { // Put one value on stack. SDValue NewVal = ConvertToMemOperand (Op.getOperand(MemOp), DAG, dl); @@ -1564,7 +1587,8 @@ // Nothing to do if the first operand is already a direct load and it has // only one use. - if (isDirectLoad(Op.getOperand(0)) && Op.getOperand(0).hasOneUse()) + unsigned MemOp = 0; + if (! NeedToConvertToMemOp(Op, MemOp, DAG)) return Op; // Put first operand on stack. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=91904&r1=91903&r2=91904&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Tue Dec 22 08:25:37 2009 @@ -18,6 +18,7 @@ #include "PIC16.h" #include "PIC16Subtarget.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetLowering.h" #include @@ -216,7 +217,9 @@ // This function checks if we need to put an operand of an operation on // stack and generate a load or not. - bool NeedToConvertToMemOp(SDValue Op, unsigned &MemOp); + // DAG parameter is required to access DAG information during + // analysis. + bool NeedToConvertToMemOp(SDValue Op, unsigned &MemOp, SelectionDAG &DAG); /// Subtarget - Keep a pointer to the PIC16Subtarget around so that we can /// make the right decision when generating code for different targets. @@ -239,6 +242,11 @@ // Check if operation has a direct load operand. inline bool isDirectLoad(const SDValue Op); + public: + // Keep a pointer to SelectionDAGISel to access its public + // interface (It is required during legalization) + SelectionDAGISel *ISel; + private: // The frameindexes generated for spill/reload are stack based. // This maps maintain zero based indexes for these FIs. Added: llvm/trunk/test/CodeGen/PIC16/C16-49.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PIC16/C16-49.ll?rev=91904&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PIC16/C16-49.ll (added) +++ llvm/trunk/test/CodeGen/PIC16/C16-49.ll Tue Dec 22 08:25:37 2009 @@ -0,0 +1,15 @@ +;RUN: llvm-as < %s | llc -march=pic16 + + at aa = global i16 55, align 1 ; [#uses=1] + at bb = global i16 44, align 1 ; [#uses=1] + at PORTD = external global i8 ; [#uses=1] + +define void @foo() nounwind { +entry: + %tmp = volatile load i16* @aa ; [#uses=1] + %tmp1 = volatile load i16* @bb ; [#uses=1] + %sub = sub i16 %tmp, %tmp1 ; [#uses=1] + %conv = trunc i16 %sub to i8 ; [#uses=1] + store i8 %conv, i8* @PORTD + ret void +} From daniel at zuster.org Tue Dec 22 10:55:32 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Dec 2009 08:55:32 -0800 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: References: <200912220934.nBM9YM2J064777@LocalMailer> <804C3255AE7A4635A3E7020B61EF8974@nvidia.com> Message-ID: <6a8523d60912220855p397504f8p2d44b594d1c84d59@mail.gmail.com> On Tue, Dec 22, 2009 at 4:18 AM, Anton Korobeynikov wrote: > Hello, Michael > >> a) the #define snprintf _snprintf way > In general, this is not a solution - see the commit comment. Nothing > introduces _snprintf to 'std' namespace. Some additional bookkeeping > is needed. Are you going to fix? I want the msvc build back. - Daniel > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University > From dgregor at apple.com Tue Dec 22 11:25:11 2009 From: dgregor at apple.com (Douglas Gregor) Date: Tue, 22 Dec 2009 17:25:11 -0000 Subject: [llvm-commits] [llvm] r91908 - /llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp Message-ID: <200912221725.nBMHPB3i016444@zion.cs.uiuc.edu> Author: dgregor Date: Tue Dec 22 11:25:11 2009 New Revision: 91908 URL: http://llvm.org/viewvc/llvm-project?rev=91908&view=rev Log: Include based on the current path, since we already -I the X86 target's path. Fixes CMake build Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp?rev=91908&r1=91907&r2=91908&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp Tue Dec 22 11:25:11 2009 @@ -25,7 +25,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" -#include "../X86GenRegisterNames.inc" +#include "X86GenRegisterNames.inc" using namespace llvm; using namespace llvm::X86Disassembler; From evan.cheng at apple.com Tue Dec 22 11:47:23 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Dec 2009 17:47:23 -0000 Subject: [llvm-commits] [llvm] r91910 - in /llvm/trunk: lib/Target/X86/X86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/break-sse-dep.ll Message-ID: <200912221747.nBMHlNZT017174@zion.cs.uiuc.edu> Author: evancheng Date: Tue Dec 22 11:47:23 2009 New Revision: 91910 URL: http://llvm.org/viewvc/llvm-project?rev=91910&view=rev Log: Remove target attribute break-sse-dep. Instead, do not fold load into sse partial update instructions unless optimizing for size. Modified: llvm/trunk/lib/Target/X86/X86.td llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86Subtarget.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h llvm/trunk/test/CodeGen/X86/break-sse-dep.ll Modified: llvm/trunk/lib/Target/X86/X86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=91910&r1=91909&r2=91910&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.td (original) +++ llvm/trunk/lib/Target/X86/X86.td Tue Dec 22 11:47:23 2009 @@ -57,8 +57,6 @@ "Support 64-bit instructions">; def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true", "Bit testing of memory is slow">; -def FeatureBreakSSEDep : SubtargetFeature<"break-sse-dep", "BreakSSEDep","true", - "Should break SSE partial update dep with load / xorps">; def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true", "Support SSE 4a instructions">; @@ -88,27 +86,17 @@ def : Proc<"pentium3", [FeatureSSE1]>; def : Proc<"pentium-m", [FeatureSSE2, FeatureSlowBTMem]>; def : Proc<"pentium4", [FeatureSSE2]>; -def : Proc<"x86-64", [FeatureSSE2, Feature64Bit, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"yonah", [FeatureSSE3, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"prescott", [FeatureSSE3, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"nocona", [FeatureSSE3, Feature64Bit, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"core2", [FeatureSSSE3, Feature64Bit, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"penryn", [FeatureSSE41, Feature64Bit, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"atom", [FeatureSSE3, Feature64Bit, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"corei7", [FeatureSSE42, Feature64Bit, FeatureSlowBTMem, - FeatureBreakSSEDep]>; -def : Proc<"nehalem", [FeatureSSE42, Feature64Bit, FeatureSlowBTMem, - FeatureBreakSSEDep]>; +def : Proc<"x86-64", [FeatureSSE2, Feature64Bit, FeatureSlowBTMem]>; +def : Proc<"yonah", [FeatureSSE3, FeatureSlowBTMem]>; +def : Proc<"prescott", [FeatureSSE3, FeatureSlowBTMem]>; +def : Proc<"nocona", [FeatureSSE3, Feature64Bit, FeatureSlowBTMem]>; +def : Proc<"core2", [FeatureSSSE3, Feature64Bit, FeatureSlowBTMem]>; +def : Proc<"penryn", [FeatureSSE41, Feature64Bit, FeatureSlowBTMem]>; +def : Proc<"atom", [FeatureSSE3, Feature64Bit, FeatureSlowBTMem]>; +def : Proc<"corei7", [FeatureSSE42, Feature64Bit, FeatureSlowBTMem]>; +def : Proc<"nehalem", [FeatureSSE42, Feature64Bit, FeatureSlowBTMem]>; // Sandy Bridge does not have FMA -def : Proc<"sandybridge", [FeatureSSE42, FeatureAVX, Feature64Bit, - FeatureBreakSSEDep]>; +def : Proc<"sandybridge", [FeatureSSE42, FeatureAVX, Feature64Bit]>; def : Proc<"k6", [FeatureMMX]>; def : Proc<"k6-2", [FeatureMMX, Feature3DNow]>; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=91910&r1=91909&r2=91910&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Dec 22 11:47:23 2009 @@ -2370,7 +2370,7 @@ // Check switch flag if (NoFusing) return NULL; - if (TM.getSubtarget().shouldBreakSSEDep()) + if (!MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize)) switch (MI->getOpcode()) { case X86::CVTSD2SSrr: case X86::Int_CVTSD2SSrr: @@ -2422,7 +2422,7 @@ // Check switch flag if (NoFusing) return NULL; - if (TM.getSubtarget().shouldBreakSSEDep()) + if (!MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize)) switch (MI->getOpcode()) { case X86::CVTSD2SSrr: case X86::Int_CVTSD2SSrr: Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=91910&r1=91909&r2=91910&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Dec 22 11:47:23 2009 @@ -298,11 +298,10 @@ def NearData : Predicate<"TM.getCodeModel() == CodeModel::Small ||" "TM.getCodeModel() == CodeModel::Kernel">; def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">; +def OptForSize : Predicate<"OptForSize">; def OptForSpeed : Predicate<"!OptForSize">; def FastBTMem : Predicate<"!Subtarget->isBTMemSlow()">; def CallImmAddr : Predicate<"Subtarget->IsLegalToCallImmediateAddr(TM)">; -def SSEBreakDep : Predicate<"Subtarget->shouldBreakSSEDep() && !OptForSize">; -def NoSSEBreakDep: Predicate<"!Subtarget->shouldBreakSSEDep() || OptForSize">; //===----------------------------------------------------------------------===// // X86 Instruction Format Definitions. Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=91910&r1=91909&r2=91910&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Dec 22 11:47:23 2009 @@ -827,7 +827,7 @@ def SSm : I, XS, - Requires<[HasSSE1, NoSSEBreakDep]>; + Requires<[HasSSE1, OptForSize]>; // Vector operation, reg. def PSr : PSI, XD, - Requires<[HasSSE2, NoSSEBreakDep]>; + Requires<[HasSSE2, OptForSize]>; def CVTSI2SDrr : SDI<0x2A, MRMSrcReg, (outs FR64:$dst), (ins GR32:$src), "cvtsi2sd\t{$src, $dst|$dst, $src}", [(set FR64:$dst, (sint_to_fp GR32:$src))]>; @@ -1157,10 +1157,10 @@ def CVTSS2SDrm : I<0x5A, MRMSrcMem, (outs FR64:$dst), (ins f32mem:$src), "cvtss2sd\t{$src, $dst|$dst, $src}", [(set FR64:$dst, (extloadf32 addr:$src))]>, XS, - Requires<[HasSSE2, NoSSEBreakDep]>; + Requires<[HasSSE2, OptForSize]>; def : Pat<(extloadf32 addr:$src), - (CVTSS2SDrr (MOVSSrm addr:$src))>, Requires<[SSEBreakDep]>; + (CVTSS2SDrr (MOVSSrm addr:$src))>, Requires<[HasSSE2, OptForSpeed]>; // Match intrinsics which expect XMM operand(s). def Int_CVTSD2SIrr : SDI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), @@ -3232,7 +3232,7 @@ [(set VR128:$dst, (V4F32Int (memopv4f32 addr:$src1),imm:$src2))]>, TA, OpSize, - Requires<[HasSSE41, NoSSEBreakDep]>; + Requires<[HasSSE41]>; // Vector intrinsic operation, reg def PDr_Int : SS4AIi8= 13); - BreakSSEDep = IsIntel; GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX); HasX86_64 = (EDX >> 29) & 0x1; @@ -287,7 +286,6 @@ , HasFMA3(false) , HasFMA4(false) , IsBTMemSlow(false) - , BreakSSEDep(false) , DarwinVers(0) , stackAlignment(8) // FIXME: this is a known good value for Yonah. How about others? Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=91910&r1=91909&r2=91910&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Dec 22 11:47:23 2009 @@ -78,14 +78,6 @@ /// IsBTMemSlow - True if BT (bit test) of memory instructions are slow. bool IsBTMemSlow; - /// BreakSSEDep - True if codegen should unfold load or insert xorps / pxor - /// to break register dependency for a partial register update SSE - /// instruction. This is needed for instructions such as CVTSS2SD which - /// only update the lower part of the register, and the result of the updated - /// part does not depend on the contents of the destination before the - /// instruction, and the non-updated portion of the register is not used. - bool BreakSSEDep; - /// DarwinVers - Nonzero if this is a darwin platform: the numeric /// version of the platform, e.g. 8 = 10.4 (Tiger), 9 = 10.5 (Leopard), etc. unsigned char DarwinVers; // Is any darwin-x86 platform. @@ -150,7 +142,6 @@ bool hasFMA3() const { return HasFMA3; } bool hasFMA4() const { return HasFMA4; } bool isBTMemSlow() const { return IsBTMemSlow; } - bool shouldBreakSSEDep() const { return BreakSSEDep; } bool isTargetDarwin() const { return TargetType == isDarwin; } bool isTargetELF() const { return TargetType == isELF; } Modified: llvm/trunk/test/CodeGen/X86/break-sse-dep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/break-sse-dep.ll?rev=91910&r1=91909&r2=91910&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/break-sse-dep.ll (original) +++ llvm/trunk/test/CodeGen/X86/break-sse-dep.ll Tue Dec 22 11:47:23 2009 @@ -1,27 +1,20 @@ -; RUN: llc < %s -march=x86-64 -mattr=+sse2,+break-sse-dep | FileCheck %s --check-prefix=YES -; RUN: llc < %s -march=x86-64 -mattr=+sse2,-break-sse-dep | FileCheck %s --check-prefix=NO +; RUN: llc < %s -march=x86-64 -mattr=+sse2 | FileCheck %s define double @t1(float* nocapture %x) nounwind readonly ssp { entry: -; YES: t1: -; YES: movss (%rdi), %xmm0 -; YES; cvtss2sd %xmm0, %xmm0 +; CHECK: t1: +; CHECK: movss (%rdi), %xmm0 +; CHECK; cvtss2sd %xmm0, %xmm0 -; NO: t1: -; NO; cvtss2sd (%rdi), %xmm0 %0 = load float* %x, align 4 %1 = fpext float %0 to double ret double %1 } -define float @t2(double* nocapture %x) nounwind readonly ssp { +define float @t2(double* nocapture %x) nounwind readonly ssp optsize { entry: -; YES: t2: -; YES: movsd (%rdi), %xmm0 -; YES; cvtsd2ss %xmm0, %xmm0 - -; NO: t2: -; NO; cvtsd2ss (%rdi), %xmm0 +; CHECK: t2: +; CHECK; cvtsd2ss (%rdi), %xmm0 %0 = load double* %x, align 8 %1 = fptrunc double %0 to float ret float %1 From clattner at apple.com Tue Dec 22 12:07:42 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 10:07:42 -0800 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: <200912220934.nBM9YM2J064777@LocalMailer> References: <200912220934.nBM9YM2J064777@LocalMailer> Message-ID: On Dec 22, 2009, at 1:34 AM, Anton Korobeynikov wrote: > Hello, Daniel > >> This broke the MSVC build, please take a look. > I don't have vcpp around, but this patch unbreaks a mingw build (which > was broken for quite long time). I explained, why it is incorrect > regardless of compiler. > > I'd really appreciate if someone with vcpp access look into this issue. > Maybe we should do a #ifdef _MSC_VER, but this is still a hackish way to > do things :( Please restore the old code or check _MSC_VER, I don't care which. > Note, that the most notable difference of snprintf and _snprintf is that > the latter *does not* guarantee NULL termination! The code in question doesn't care about this. -Chris From bob.wilson at apple.com Tue Dec 22 12:34:19 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 22 Dec 2009 18:34:19 -0000 Subject: [llvm-commits] [llvm] r91913 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912221834.nBMIYJY7018789@zion.cs.uiuc.edu> Author: bwilson Date: Tue Dec 22 12:34:19 2009 New Revision: 91913 URL: http://llvm.org/viewvc/llvm-project?rev=91913&view=rev Log: Report an error for bad inline assembly, where the value passed for an "indirect" operand is not a pointer. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91913&r1=91912&r2=91913&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 22 12:34:19 2009 @@ -5482,8 +5482,12 @@ // If this is an indirect operand, the operand is a pointer to the // accessed type. - if (isIndirect) - OpTy = cast(OpTy)->getElementType(); + if (isIndirect) { + const llvm::PointerType *PtrTy = dyn_cast(OpTy); + if (!PtrTy) + llvm_report_error("Indirect operand for inline asm not a pointer!"); + OpTy = PtrTy->getElementType(); + } // If OpTy is not a single value, it may be a struct/union that we // can tile with integers. From stoklund at 2pi.dk Tue Dec 22 12:49:55 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Dec 2009 18:49:55 -0000 Subject: [llvm-commits] [llvm] r91914 - /llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Message-ID: <200912221849.nBMInuR0019393@zion.cs.uiuc.edu> Author: stoklund Date: Tue Dec 22 12:49:55 2009 New Revision: 91914 URL: http://llvm.org/viewvc/llvm-project?rev=91914&view=rev Log: Use proper move instructions. Make the verifier happy. Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=91914&r1=91913&r2=91914&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Tue Dec 22 12:49:55 2009 @@ -1373,7 +1373,7 @@ // bic r4, r4, MaxAlign // mov sp, r4 // FIXME: It will be better just to find spare register here. - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVtgpr2gpr), ARM::R4) + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVgpr2tgpr), ARM::R4) .addReg(ARM::SP, RegState::Kill); AddDefaultCC(AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::t2BICri), ARM::R4) From sabre at nondot.org Tue Dec 22 13:23:33 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 19:23:33 -0000 Subject: [llvm-commits] [llvm] r91916 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200912221923.nBMJNX0q020503@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 13:23:33 2009 New Revision: 91916 URL: http://llvm.org/viewvc/llvm-project?rev=91916&view=rev Log: fix some fixme's by using twines 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=91916&r1=91915&r2=91916&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Dec 22 13:23:33 2009 @@ -1373,9 +1373,7 @@ if (StoreInst *SI = dyn_cast(User)) { assert(SI->getOperand(0) != Ptr && "Consistency error!"); - // FIXME: Remove once builder has Twine API. - Value *Old = Builder.CreateLoad(NewAI, - (NewAI->getName()+".in").str().c_str()); + Value *Old = Builder.CreateLoad(NewAI, NewAI->getName()+".in"); Value *New = ConvertScalar_InsertValue(SI->getOperand(0), Old, Offset, Builder); Builder.CreateStore(New, NewAI); @@ -1399,9 +1397,7 @@ for (unsigned i = 1; i != NumBytes; ++i) APVal |= APVal << 8; - // FIXME: Remove once builder has Twine API. - Value *Old = Builder.CreateLoad(NewAI, - (NewAI->getName()+".in").str().c_str()); + Value *Old = Builder.CreateLoad(NewAI, NewAI->getName()+".in"); Value *New = ConvertScalar_InsertValue( ConstantInt::get(User->getContext(), APVal), Old, Offset, Builder); From sabre at nondot.org Tue Dec 22 13:33:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 19:33:29 -0000 Subject: [llvm-commits] [llvm] r91917 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200912221933.nBMJXTRJ020828@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 13:33:28 2009 New Revision: 91917 URL: http://llvm.org/viewvc/llvm-project?rev=91917&view=rev Log: Fix the Convert to scalar to not insert dead loads in the store case. The load is needed when we have a small store into a large alloca (at which point we get a load/insert/store sequence), but when you do a full-sized store, this load ends up being dead. This dead load is bad in really large nasty testcases where the load ends up causing mem2reg to insert large chains of dependent phi nodes which only ADCE can delete. Instead of doing this, just don't insert the dead load. This fixes rdar://6864035 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=91917&r1=91916&r2=91917&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Dec 22 13:33:28 2009 @@ -1373,11 +1373,16 @@ if (StoreInst *SI = dyn_cast(User)) { assert(SI->getOperand(0) != Ptr && "Consistency error!"); - Value *Old = Builder.CreateLoad(NewAI, NewAI->getName()+".in"); + Instruction *Old = Builder.CreateLoad(NewAI, NewAI->getName()+".in"); Value *New = ConvertScalar_InsertValue(SI->getOperand(0), Old, Offset, Builder); Builder.CreateStore(New, NewAI); SI->eraseFromParent(); + + // If the load we just inserted is now dead, then the inserted store + // overwrote the entire thing. + if (Old->use_empty()) + Old->eraseFromParent(); continue; } @@ -1397,11 +1402,16 @@ for (unsigned i = 1; i != NumBytes; ++i) APVal |= APVal << 8; - Value *Old = Builder.CreateLoad(NewAI, NewAI->getName()+".in"); + Instruction *Old = Builder.CreateLoad(NewAI, NewAI->getName()+".in"); Value *New = ConvertScalar_InsertValue( ConstantInt::get(User->getContext(), APVal), Old, Offset, Builder); Builder.CreateStore(New, NewAI); + + // If the load we just inserted is now dead, then the memset overwrote + // the entire thing. + if (Old->use_empty()) + Old->eraseFromParent(); } MSI->eraseFromParent(); continue; From asl at math.spbu.ru Tue Dec 22 14:11:00 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Dec 2009 20:11:00 -0000 Subject: [llvm-commits] [llvm] r91918 - /llvm/trunk/include/llvm/Support/Format.h Message-ID: <200912222011.nBMKB0dw022115@zion.cs.uiuc.edu> Author: asl Date: Tue Dec 22 14:11:00 2009 New Revision: 91918 URL: http://llvm.org/viewvc/llvm-project?rev=91918&view=rev Log: Restore snprintf weirdness for VCPP only Modified: llvm/trunk/include/llvm/Support/Format.h Modified: llvm/trunk/include/llvm/Support/Format.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Format.h?rev=91918&r1=91917&r2=91918&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Format.h (original) +++ llvm/trunk/include/llvm/Support/Format.h Tue Dec 22 14:11:00 2009 @@ -25,6 +25,14 @@ #include #include +#ifdef _MSC_VER +// FIXME: This define is wrong: +// - _snprintf does not guarantee that trailing null is always added - if +// there is no space for null, it does not report any error. +// - According to C++ standard, snprintf should be visible in the 'std' +// namespace - this define makes this impossible. +#define snprintf _snprintf +#endif namespace llvm { From anton at korobeynikov.info Tue Dec 22 14:11:24 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 22 Dec 2009 23:11:24 +0300 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: References: <200912220934.nBM9YM2J064777@LocalMailer> Message-ID: <1261512684.19129.3549.camel@aslstation> Hello, Chris > The code in question doesn't care about this. In fact it does - when there is no room for trailing NULL _snprintf does not report any error. Thus, we will end with invalid string (buffer won't be reallocated for bigger size). I've restored this behavior for VCPP only -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From asl at math.spbu.ru Tue Dec 22 14:11:04 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Dec 2009 23:11:04 +0300 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: References: <200912220934.nBM9YM2J064777@LocalMailer> Message-ID: <1261512665.19129.3547.camel@aslstation> Hello, Chris > The code in question doesn't care about this. In fact it does - when there is no room for trailing NULL _snprintf does not report any error. Thus, we will end with invalid string (buffer won't be reallocated for bigger size). I've restored this behavior for VCPP only -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From mm.beck at gmx.net Tue Dec 22 14:42:14 2009 From: mm.beck at gmx.net (Michael Beck) Date: Tue, 22 Dec 2009 21:42:14 +0100 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h References: <200912220934.nBM9YM2J064777@LocalMailer> <804C3255AE7A4635A3E7020B61EF8974@nvidia.com> <6a8523d60912220855p397504f8p2d44b594d1c84d59@mail.gmail.com> Message-ID: The following is a slightly better fix for the snprintf problem. It adds an implementation that at least ensures the '\0' at eos. best regards, -- Michael Beck -------------- next part -------------- A non-text attachment was scrubbed... Name: format.diff Type: application/octet-stream Size: 788 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091222/7daa4844/attachment.obj -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: VcSnprintf.cpp Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091222/7daa4844/attachment.pl From anton at korobeynikov.info Tue Dec 22 14:51:06 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 22 Dec 2009 23:51:06 +0300 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: References: <200912220934.nBM9YM2J064777@LocalMailer> <804C3255AE7A4635A3E7020B61EF8974@nvidia.com> <6a8523d60912220855p397504f8p2d44b594d1c84d59@mail.gmail.com> Message-ID: <1261515066.19129.3551.camel@aslstation> Hello, Michael > if (res == buff_size) { > // '\0' was not written, do it Shouldn't we return an error in such situation? -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From jyasskin at google.com Tue Dec 22 14:52:33 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Tue, 22 Dec 2009 12:52:33 -0800 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: On Mon, Dec 21, 2009 at 9:38 PM, nicolas geoffray wrote: > Hi Jeffrey, > >> >> Ah, I see now. You have your own ModuleProvider, and it needs to know >> precisely when the function is actually needed, right? Yeah, it sounds >> like I need to roll back that part of this fix until PR5737 is fixed. >> > > Yes, thanks! How's the attached patch look? I discovered that one of the isDeclaration()s was untested, so I added a test for it. -------------- next part -------------- A non-text attachment was scrubbed... Name: revert-materialize.patch Type: application/octet-stream Size: 7884 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091222/5986cf2c/attachment.obj From scallanan at apple.com Tue Dec 22 15:12:55 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 22 Dec 2009 21:12:55 -0000 Subject: [llvm-commits] [llvm] r91919 - in /llvm/trunk: lib/Target/X86/Disassembler/X86Disassembler.cpp lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h utils/TableGen/X86RecognizableInstr.cpp Message-ID: <200912222112.nBMLCtmW024326@zion.cs.uiuc.edu> Author: spyffe Date: Tue Dec 22 15:12:55 2009 New Revision: 91919 URL: http://llvm.org/viewvc/llvm-project?rev=91919&view=rev Log: Fixes to the X86 disassembler: Made LEA memory operands emit only 4 MCInst operands. Made the scale operand equal 1 for instructions that have no SIB byte. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Modified: llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp?rev=91919&r1=91918&r2=91919&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86Disassembler.cpp Tue Dec 22 15:12:55 2009 @@ -183,8 +183,12 @@ /// @param mcInst - The MCInst to append to. /// @param insn - The instruction to extract Mod, R/M, and SIB fields /// from. +/// @param sr - Whether or not to emit the segment register. The +/// LEA instruction does not expect a segment-register +/// operand. static void translateRMMemory(MCInst &mcInst, - InternalInstruction &insn) { + InternalInstruction &insn, + bool sr) { // Addresses in an MCInst are represented as five operands: // 1. basereg (register) The R/M base, or (if there is a SIB) the // SIB base @@ -209,7 +213,7 @@ default: llvm_unreachable("Unexpected sibBase"); #define ENTRY(x) \ - case SIB_BASE_##x: \ + case SIB_BASE_##x: \ baseReg = MCOperand::CreateReg(X86::x); break; ALL_SIB_BASES #undef ENTRY @@ -222,7 +226,7 @@ switch (insn.sibIndex) { default: llvm_unreachable("Unexpected sibIndex"); -#define ENTRY(x) \ +#define ENTRY(x) \ case SIB_INDEX_##x: \ indexReg = MCOperand::CreateReg(X86::x); break; EA_BASES_32BIT @@ -286,6 +290,8 @@ break; } } + + scaleAmount = MCOperand::CreateImm(1); } displacement = MCOperand::CreateImm(insn.displacement); @@ -306,7 +312,9 @@ mcInst.addOperand(scaleAmount); mcInst.addOperand(indexReg); mcInst.addOperand(displacement); - mcInst.addOperand(segmentReg); + + if (sr) + mcInst.addOperand(segmentReg); } /// translateRM - Translates an operand stored in the R/M (and possibly SIB) @@ -356,7 +364,10 @@ case TYPE_M1616: case TYPE_M1632: case TYPE_M1664: - translateRMMemory(mcInst, insn); + translateRMMemory(mcInst, insn, true); + break; + case TYPE_LEA: + translateRMMemory(mcInst, insn, false); break; } } Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h?rev=91919&r1=91918&r2=91919&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h Tue Dec 22 15:12:55 2009 @@ -245,6 +245,7 @@ ENUM_ENTRY(TYPE_M16, "2-byte") \ ENUM_ENTRY(TYPE_M32, "4-byte") \ ENUM_ENTRY(TYPE_M64, "8-byte") \ + ENUM_ENTRY(TYPE_LEA, "Effective address") \ ENUM_ENTRY(TYPE_M128, "16-byte (SSE/SSE2)") \ ENUM_ENTRY(TYPE_M1616, "2+2-byte segment+offset address") \ ENUM_ENTRY(TYPE_M1632, "2+4-byte") \ Modified: llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp?rev=91919&r1=91918&r2=91919&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp (original) +++ llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Tue Dec 22 15:12:55 2009 @@ -817,9 +817,9 @@ TYPE("brtarget", TYPE_RELv) TYPE("brtarget8", TYPE_REL8) TYPE("f80mem", TYPE_M80FP) - TYPE("lea32mem", TYPE_M32) - TYPE("lea64_32mem", TYPE_M64) - TYPE("lea64mem", TYPE_M64) + TYPE("lea32mem", TYPE_LEA) + TYPE("lea64_32mem", TYPE_LEA) + TYPE("lea64mem", TYPE_LEA) TYPE("VR64", TYPE_MM64) TYPE("i64imm", TYPE_IMMv) TYPE("opaque32mem", TYPE_M1616) From isanbard at gmail.com Tue Dec 22 15:35:02 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 21:35:02 -0000 Subject: [llvm-commits] [llvm] r91920 - in /llvm/trunk/lib/CodeGen/SelectionDAG: SDNodeOrdering.h SelectionDAGBuilder.cpp Message-ID: <200912222135.nBMLZ28k025053@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 15:35:02 2009 New Revision: 91920 URL: http://llvm.org/viewvc/llvm-project?rev=91920&view=rev Log: Allow 0 as an order number. Don't assign an order to formal arguments. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h?rev=91920&r1=91919&r2=91920&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h Tue Dec 22 15:35:02 2009 @@ -34,7 +34,6 @@ SDNodeOrdering() {} void add(const SDNode *Node, unsigned O) { - assert(O && "Invalid ordering!"); OrderMap[Node] = O; } void remove(const SDNode *Node) { @@ -46,9 +45,7 @@ OrderMap.clear(); } unsigned getOrder(const SDNode *Node) { - unsigned Order = OrderMap[Node]; - assert(Order && "Node isn't in ordering map!"); - return Order; + return OrderMap[Node]; } }; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91920&r1=91919&r2=91920&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 22 15:35:02 2009 @@ -6430,7 +6430,6 @@ SelectionDAG &DAG = SDB->DAG; SDValue OldRoot = DAG.getRoot(); DebugLoc dl = SDB->getCurDebugLoc(); - unsigned Order = SDB->getSDNodeOrder(); const TargetData *TD = TLI.getTargetData(); SmallVector Ins; @@ -6522,15 +6521,14 @@ "LowerFormalArguments didn't return a valid chain!"); assert(InVals.size() == Ins.size() && "LowerFormalArguments didn't emit the correct number of values!"); - DEBUG(for (unsigned i = 0, e = Ins.size(); i != e; ++i) { - assert(InVals[i].getNode() && - "LowerFormalArguments emitted a null value!"); - assert(Ins[i].VT == InVals[i].getValueType() && - "LowerFormalArguments emitted a value with the wrong type!"); - }); - - if (DisableScheduling) - DAG.AssignOrdering(NewRoot.getNode(), Order); + DEBUG({ + for (unsigned i = 0, e = Ins.size(); i != e; ++i) { + assert(InVals[i].getNode() && + "LowerFormalArguments emitted a null value!"); + assert(Ins[i].VT == InVals[i].getValueType() && + "LowerFormalArguments emitted a value with the wrong type!"); + } + }); // Update the DAG with the new chain value resulting from argument lowering. DAG.setRoot(NewRoot); @@ -6546,7 +6544,7 @@ EVT VT = ValueVTs[0]; EVT RegVT = TLI.getRegisterType(*CurDAG->getContext(), VT); ISD::NodeType AssertOp = ISD::DELETED_NODE; - SDValue ArgValue = getCopyFromParts(DAG, dl, Order, &InVals[0], 1, + SDValue ArgValue = getCopyFromParts(DAG, dl, 0, &InVals[0], 1, RegVT, VT, AssertOp); MachineFunction& MF = SDB->DAG.getMachineFunction(); @@ -6555,8 +6553,6 @@ FLI.DemoteRegister = SRetReg; NewRoot = SDB->DAG.getCopyToReg(NewRoot, SDB->getCurDebugLoc(), SRetReg, ArgValue); DAG.setRoot(NewRoot); - if (DisableScheduling) - DAG.AssignOrdering(NewRoot.getNode(), Order); // i indexes lowered arguments. Bump it past the hidden sret argument. // Idx indexes LLVM arguments. Don't touch it. @@ -6581,7 +6577,7 @@ else if (F.paramHasAttr(Idx, Attribute::ZExt)) AssertOp = ISD::AssertZext; - ArgValues.push_back(getCopyFromParts(DAG, dl, Order, &InVals[i], + ArgValues.push_back(getCopyFromParts(DAG, dl, 0, &InVals[i], NumParts, PartVT, VT, AssertOp)); } @@ -6594,9 +6590,6 @@ SDB->getCurDebugLoc()); SDB->setValue(I, Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), Order); - // If this argument is live outside of the entry block, insert a copy from // whereever we got it to the vreg that other BB's will reference it as. SDB->CopyToExportRegsIfNeeded(I); From mm.beck at gmx.net Tue Dec 22 15:15:25 2009 From: mm.beck at gmx.net (Michael Beck) Date: Tue, 22 Dec 2009 22:15:25 +0100 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h References: <200912220934.nBM9YM2J064777@LocalMailer> <804C3255AE7A4635A3E7020B61EF8974@nvidia.com> <6a8523d60912220855p397504f8p2d44b594d1c84d59@mail.gmail.com> <1261515066.19129.3551.camel@aslstation> Message-ID: <915B29A7D807420B987ED538B967DF53@sigma> > Hello, Michael > >> if (res == buff_size) { >> // '\0' was not written, do it > Shouldn't we return an error in such situation? Yep should return res, not res-1, this is the correct way: int snprintf(char *buffer, int buff_size, const char *format, ...) { va_list args; va_start(args, format); int res = vsnprintf(buffer, buff_size, format, args); va_end(args); // pre vc2005sp1 runtime versions return negative values in case of error if (res < 0) return res; if (res >= buff_size) { // '\0' was not written, do it buffer[buff_size - 1] = '\0'; } return res; } ^ -- Michael Beck From stoklund at 2pi.dk Tue Dec 22 15:48:58 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Dec 2009 21:48:58 -0000 Subject: [llvm-commits] [llvm] r91922 - /llvm/trunk/lib/CodeGen/MachineVerifier.cpp Message-ID: <200912222149.nBMLnCHH025581@zion.cs.uiuc.edu> Author: stoklund Date: Tue Dec 22 15:48:20 2009 New Revision: 91922 URL: http://llvm.org/viewvc/llvm-project?rev=91922&view=rev Log: Allow explicit %reg0 operands beyond what the .td file describes. ARM uses these to indicate predicates. Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=91922&r1=91921&r2=91922&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Tue Dec 22 15:48:20 2009 @@ -553,7 +553,8 @@ report("Explicit operand marked as implicit", MO, MONum); } } else { - if (MO->isReg() && !MO->isImplicit() && !TI.isVariadic()) + // ARM adds %reg0 operands to indicate predicates. We'll allow that. + if (MO->isReg() && !MO->isImplicit() && !TI.isVariadic() && MO->getReg()) report("Extra explicit operand on non-variadic instruction", MO, MONum); } From stoklund at 2pi.dk Tue Dec 22 15:52:43 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Dec 2009 21:52:43 -0000 Subject: [llvm-commits] [llvm] r91923 - /llvm/trunk/lib/CodeGen/MachineVerifier.cpp Message-ID: <200912222152.nBMLqp1q025758@zion.cs.uiuc.edu> Author: stoklund Date: Tue Dec 22 15:52:27 2009 New Revision: 91923 URL: http://llvm.org/viewvc/llvm-project?rev=91923&view=rev Log: Remove minimal CFG sanity checks from verifier. These checks would often trigger on unreachable statements inserted by bugpoint, leading it astray. It would be nice if we could distinguish unreachable blocks from errors. Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=91923&r1=91922&r2=91923&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Tue Dec 22 15:52:27 2009 @@ -365,24 +365,6 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) { const TargetInstrInfo *TII = MF->getTarget().getInstrInfo(); - // Start with minimal CFG sanity checks. - MachineFunction::const_iterator MBBI = MBB; - ++MBBI; - if (MBBI != MF->end()) { - // Block is not last in function. - if (!MBB->isSuccessor(MBBI)) { - // Block does not fall through. - if (MBB->empty()) { - report("MBB doesn't fall through but is empty!", MBB); - } - } - } else { - // Block is last in function. - if (MBB->empty()) { - report("MBB is last in function but is empty!", MBB); - } - } - // Call AnalyzeBranch. If it succeeds, there several more conditions to check. MachineBasicBlock *TBB = 0, *FBB = 0; SmallVector Cond; From daniel at zuster.org Tue Dec 22 16:02:47 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Dec 2009 22:02:47 -0000 Subject: [llvm-commits] [test-suite] r91925 - /test-suite/trunk/External/SPEC/CINT95/Makefile Message-ID: <200912222202.nBMM2lqN026093@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Dec 22 16:02:47 2009 New Revision: 91925 URL: http://llvm.org/viewvc/llvm-project?rev=91925&view=rev Log: 147.vortex doesn't work on x86_64, skip it. Modified: test-suite/trunk/External/SPEC/CINT95/Makefile Modified: test-suite/trunk/External/SPEC/CINT95/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT95/Makefile?rev=91925&r1=91924&r2=91925&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT95/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT95/Makefile Tue Dec 22 16:02:47 2009 @@ -9,6 +9,10 @@ 134.perl \ 147.vortex +ifeq ($(ARCH),x86_64) +PARALLEL_DIRS := $(filter-out 147.vortex, $(PARALLEL_DIRS)) +endif + # Include the standard makefiles include ${LEVEL}/External/Makefile.external From nicholas at mxc.ca Tue Dec 22 16:04:35 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Dec 2009 17:04:35 -0500 Subject: [llvm-commits] [test-suite] r91925 - /test-suite/trunk/External/SPEC/CINT95/Makefile In-Reply-To: <200912222202.nBMM2lqN026093@zion.cs.uiuc.edu> References: <200912222202.nBMM2lqN026093@zion.cs.uiuc.edu> Message-ID: <4B314273.1050403@mxc.ca> Daniel Dunbar wrote: > Author: ddunbar > Date: Tue Dec 22 16:02:47 2009 > New Revision: 91925 > > URL: http://llvm.org/viewvc/llvm-project?rev=91925&view=rev > Log: > 147.vortex doesn't work on x86_64, skip it. > What? We can't handle SPEC and that's okay now? Could you explain why this doesn't work? Nick > Modified: > test-suite/trunk/External/SPEC/CINT95/Makefile > > Modified: test-suite/trunk/External/SPEC/CINT95/Makefile > URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT95/Makefile?rev=91925&r1=91924&r2=91925&view=diff > > ============================================================================== > --- test-suite/trunk/External/SPEC/CINT95/Makefile (original) > +++ test-suite/trunk/External/SPEC/CINT95/Makefile Tue Dec 22 16:02:47 2009 > @@ -9,6 +9,10 @@ > 134.perl \ > 147.vortex > > +ifeq ($(ARCH),x86_64) > +PARALLEL_DIRS := $(filter-out 147.vortex, $(PARALLEL_DIRS)) > +endif > + > # Include the standard makefiles > include ${LEVEL}/External/Makefile.external > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From bob.wilson at apple.com Tue Dec 22 16:23:18 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 22 Dec 2009 14:23:18 -0800 Subject: [llvm-commits] [test-suite] r91925 - /test-suite/trunk/External/SPEC/CINT95/Makefile In-Reply-To: <4B314273.1050403@mxc.ca> References: <200912222202.nBMM2lqN026093@zion.cs.uiuc.edu> <4B314273.1050403@mxc.ca> Message-ID: <8E647BD6-CB84-4A5A-AA02-971A07A7C034@apple.com> On Dec 22, 2009, at 2:04 PM, Nick Lewycky wrote: > Daniel Dunbar wrote: >> Author: ddunbar >> Date: Tue Dec 22 16:02:47 2009 >> New Revision: 91925 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=91925&view=rev >> Log: >> 147.vortex doesn't work on x86_64, skip it. >> > What? We can't handle SPEC and that's okay now? > > Could you explain why this doesn't work? The source code is not 64-bit clean. It doesn't work with gcc, either. Daniel, I ran SPEC last week for x86_64 and I thought I remembered seeing more than just vortex failing. Are there more of them to skip or am I just misremembering? From nicholas at mxc.ca Tue Dec 22 16:28:11 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 22 Dec 2009 17:28:11 -0500 Subject: [llvm-commits] [test-suite] r91925 - /test-suite/trunk/External/SPEC/CINT95/Makefile In-Reply-To: <8E647BD6-CB84-4A5A-AA02-971A07A7C034@apple.com> References: <200912222202.nBMM2lqN026093@zion.cs.uiuc.edu> <4B314273.1050403@mxc.ca> <8E647BD6-CB84-4A5A-AA02-971A07A7C034@apple.com> Message-ID: <4B3147FB.1060803@mxc.ca> Bob Wilson wrote: > On Dec 22, 2009, at 2:04 PM, Nick Lewycky wrote: > > >> Daniel Dunbar wrote: >> >>> Author: ddunbar >>> Date: Tue Dec 22 16:02:47 2009 >>> New Revision: 91925 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=91925&view=rev >>> Log: >>> 147.vortex doesn't work on x86_64, skip it. >>> >>> >> What? We can't handle SPEC and that's okay now? >> >> Could you explain why this doesn't work? >> > > The source code is not 64-bit clean. It doesn't work with gcc, either. > Ah, it's a problem with the test, not with LLVM. Thanks for clarifying! Nick > Daniel, I ran SPEC last week for x86_64 and I thought I remembered seeing more than just vortex failing. Are there more of them to skip or am I just misremembering? From anon at cs.uiuc.edu Tue Dec 22 16:13:37 2009 From: anon at cs.uiuc.edu (anon at cs.uiuc.edu) Date: Tue, 22 Dec 2009 16:13:37 -0600 Subject: [llvm-commits] CVS: llvm-www/pubs/2010-04-ASPLOS-DeterministicCompiler.html 2010-04-ASPLOS-DeterministicCompiler.pdf pubs.js Message-ID: <200912222213.nBMMDb3R026448@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2010-04-ASPLOS-DeterministicCompiler.html added (r1.1) 2010-04-ASPLOS-DeterministicCompiler.pdf added (r1.1) pubs.js updated: 1.84 -> 1.85 --- Log message: Add a publication to appear in ASPLOS'10. --- Diffs of the changes: (+58 -0) 2010-04-ASPLOS-DeterministicCompiler.html | 50 ++++++++++++++++++++++++++++++ 2010-04-ASPLOS-DeterministicCompiler.pdf | 0 pubs.js | 8 ++++ 3 files changed, 58 insertions(+) Index: llvm-www/pubs/2010-04-ASPLOS-DeterministicCompiler.html diff -c /dev/null llvm-www/pubs/2010-04-ASPLOS-DeterministicCompiler.html:1.1 *** /dev/null Tue Dec 22 16:12:39 2009 --- llvm-www/pubs/2010-04-ASPLOS-DeterministicCompiler.html Tue Dec 22 16:12:25 2009 *************** *** 0 **** --- 1,50 ---- + + + + + + CoreDet: A Compiler and Runtime System for Deterministic Multithreaded Execution + + + +
+ CoreDet: A Compiler and Runtime System for Deterministic Multithreaded Execution +
+
+ Tom Bergan, Owen Anderson, Joseph Devietti, Luis Ceze, and Dan Grossman +
+ +

Abstract:

+
+

The behavior of a multithreaded program does not depend only on its inputs. Scheduling, memory reordering, timing, and low-level hardware effects all introduce nondeterminism in the execution of multithreaded programs. This severely complicates many tasks, including debugging, testing, and automatic replication. In this work, we avoid these complications by eliminating their root cause: we develop a compiler and runtime system that runs arbitrary multithreaded C/C++ POSIX Threads programs deterministically.

+ +

A trivial non-performant approach to providing determinism is simply deterministically serializing execution. Instead, we present a compiler and runtime infrastructure that ensures determinism but resorts to serialization rarely, for handling interthread communication and synchronization. We develop two basic approaches, both of which are largely dynamic with performance improved by some static compiler optimizations. First, an ownership-based approach detects interthread communication via an evolving table that tracks ownership of memory regions by threads. Second, a buffering approach uses versioned memory and employs a deterministic commit protocol to make changes visible to other threads. While buffering has larger single-threaded overhead than ownership, it tends to scale better (serializing less often). A hybrid system sometimes performs and scales better than either approach individually.

+
+ +

Published:

+
+ "CoreDet: A Compiler and Runtime System for Deterministic Multithreaded Execution" +
+ Tom Bergan, Owen Anderson, Joseph Devietti, Luis Ceze, and Dan Grossman. +
+ + Proc. of the 15th international conference on Architectural Support for Programming Languages and Operating Systems + , Pittsburgh, PA, March 2010. +
+

Download:

+

Paper:

+ + + +
+ Valid CSS! + Valid HTML 4.01! + + + Index: llvm-www/pubs/2010-04-ASPLOS-DeterministicCompiler.pdf Index: llvm-www/pubs/pubs.js diff -u llvm-www/pubs/pubs.js:1.84 llvm-www/pubs/pubs.js:1.85 --- llvm-www/pubs/pubs.js:1.84 Sun Nov 8 16:03:24 2009 +++ llvm-www/pubs/pubs.js Tue Dec 22 16:12:25 2009 @@ -1,6 +1,14 @@ // The array should be sorted reverse-chronologically, and will be displayed on // the page in the order listed. var PUBS = [ + {url: "2010-04-ASPLOS-DeterministicCompiler.html", + title: "CoreDet: A Compiler and Runtime System for Deterministic Multithreaded Execution", + published: "Proc. of the Fifteenth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS '10)", + author: "Tom Bergan, Owen Anderson, Joseph Devietti, Luis Ceze, and Dan Grossman", + location: "Pittsburgh, PA", + month: 4, + year: 2010}, + {url: "2009-10-TereiThesis.html", title: "Low Level Virtual Machine for Glasgow Haskell Compiler", published: "Bachelor's Thesis, Computer Science and Engineering Dept., The University of New South Wales", From asl at math.spbu.ru Tue Dec 22 16:37:24 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Dec 2009 22:37:24 -0000 Subject: [llvm-commits] [llvm] r91931 - /llvm/trunk/test/CodeGen/MSP430/2009-12-21-FrameAddr.ll Message-ID: <200912222237.nBMMbOH4027631@zion.cs.uiuc.edu> Author: asl Date: Tue Dec 22 16:37:23 2009 New Revision: 91931 URL: http://llvm.org/viewvc/llvm-project?rev=91931&view=rev Log: Add testcase for PR5703 Added: llvm/trunk/test/CodeGen/MSP430/2009-12-21-FrameAddr.ll Added: llvm/trunk/test/CodeGen/MSP430/2009-12-21-FrameAddr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MSP430/2009-12-21-FrameAddr.ll?rev=91931&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/MSP430/2009-12-21-FrameAddr.ll (added) +++ llvm/trunk/test/CodeGen/MSP430/2009-12-21-FrameAddr.ll Tue Dec 22 16:37:23 2009 @@ -0,0 +1,13 @@ +; RUN: llc < %s +; PR5703 +target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8" +target triple = "msp430-unknown-linux-gnu" + +define msp430_intrcc void @foo() nounwind { +entry: + %fa = call i16* @llvm.frameaddress(i32 0) + store i16 0, i16* %fa + ret void +} + +declare i16* @llvm.frameaddress(i32) From clattner at apple.com Tue Dec 22 16:40:20 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 14:40:20 -0800 Subject: [llvm-commits] [llvm] r91842 - /llvm/trunk/include/llvm/Support/Format.h In-Reply-To: <1261512665.19129.3547.camel@aslstation> References: <200912220934.nBM9YM2J064777@LocalMailer> <1261512665.19129.3547.camel@aslstation> Message-ID: <53B06FB4-1367-4A84-8792-55DD8732999E@apple.com> On Dec 22, 2009, at 12:11 PM, Anton Korobeynikov wrote: > Hello, Chris > >> The code in question doesn't care about this. > In fact it does - when there is no room for trailing NULL _snprintf > does > not report any error. Thus, we will end with invalid string (buffer > won't be reallocated for bigger size). > > I've restored this behavior for VCPP only Thanks Anton! -Chris From clattner at apple.com Tue Dec 22 16:41:29 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 14:41:29 -0800 Subject: [llvm-commits] [test-suite] r91925 - /test-suite/trunk/External/SPEC/CINT95/Makefile In-Reply-To: <4B3147FB.1060803@mxc.ca> References: <200912222202.nBMM2lqN026093@zion.cs.uiuc.edu> <4B314273.1050403@mxc.ca> <8E647BD6-CB84-4A5A-AA02-971A07A7C034@apple.com> <4B3147FB.1060803@mxc.ca> Message-ID: <8D39A3FC-7A79-4275-80E0-071C2DBB49D0@apple.com> On Dec 22, 2009, at 2:28 PM, Nick Lewycky wrote: >>> >>> What? We can't handle SPEC and that's okay now? >>> >>> Could you explain why this doesn't work? >>> >> >> The source code is not 64-bit clean. It doesn't work with gcc, >> either. >> > Ah, it's a problem with the test, not with LLVM. Thanks for > clarifying! Also, this is the vortex from spec95, not 2000. -Chris From clattner at apple.com Tue Dec 22 16:42:59 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 14:42:59 -0800 Subject: [llvm-commits] [llvm] r91919 - in /llvm/trunk: lib/Target/X86/Disassembler/X86Disassembler.cpp lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h utils/TableGen/X86RecognizableInstr.cpp In-Reply-To: <200912222112.nBMLCtmW024326@zion.cs.uiuc.edu> References: <200912222112.nBMLCtmW024326@zion.cs.uiuc.edu> Message-ID: <037C9B9E-306C-4B5E-A2D0-8EF8BF29D89F@apple.com> On Dec 22, 2009, at 1:12 PM, Sean Callanan wrote: > Author: spyffe > Date: Tue Dec 22 15:12:55 2009 > New Revision: 91919 > > URL: http://llvm.org/viewvc/llvm-project?rev=91919&view=rev > Log: > Fixes to the X86 disassembler: > Made LEA memory operands emit only 4 MCInst operands. > Made the scale operand equal 1 for instructions that have no > SIB byte. Thanks Sean! Can you add a testcase for these as you fix them? It should be really easy to extend llvm/test/MC/Disassembler/simple- tests.txt with an example of them, -Chris From dalej at apple.com Tue Dec 22 16:43:23 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 22 Dec 2009 14:43:23 -0800 Subject: [llvm-commits] [test-suite] r91925 - /test-suite/trunk/External/SPEC/CINT95/Makefile In-Reply-To: <8E647BD6-CB84-4A5A-AA02-971A07A7C034@apple.com> References: <200912222202.nBMM2lqN026093@zion.cs.uiuc.edu> <4B314273.1050403@mxc.ca> <8E647BD6-CB84-4A5A-AA02-971A07A7C034@apple.com> Message-ID: <0BCF8284-17B9-428B-AE37-2D15ED163BBA@apple.com> On Dec 22, 2009, at 2:23 PMPST, Bob Wilson wrote: > > On Dec 22, 2009, at 2:04 PM, Nick Lewycky wrote: > >> Daniel Dunbar wrote: >>> Author: ddunbar >>> Date: Tue Dec 22 16:02:47 2009 >>> New Revision: 91925 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=91925&view=rev >>> Log: >>> 147.vortex doesn't work on x86_64, skip it. >>> >> What? We can't handle SPEC and that's okay now? >> >> Could you explain why this doesn't work? > > The source code is not 64-bit clean. It doesn't work with gcc, > either. I'm pretty sure I got all of SPEC95 to run in a 64-bit environment, although not recently, but there is no clean way to do it from the top- level makefile as there is in later SPECs. Here, try -D__RISC_64__ (yes, it's a namespace violation). If it doesn't work with that there's probably something really wrong. Vortex has some violations of strict aliasing, like *((type1*)ptr-to- object-of-type2) . gcc routinely generates unexpected code for this (permitted by standards, it's undefined behavior), which is one reason vortex doesn't work there. It doesn't work with gcc in many 32-bit environments either. > Daniel, I ran SPEC last week for x86_64 and I thought I remembered > seeing more than just vortex failing. Are there more of them to > skip or am I just misremembering? > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicolas.geoffray at gmail.com Tue Dec 22 16:45:40 2009 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Tue, 22 Dec 2009 22:45:40 +0000 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: Yes! That patch works great for me! Thanks, Nicolas On Tue, Dec 22, 2009 at 8:52 PM, Jeffrey Yasskin wrote: > On Mon, Dec 21, 2009 at 9:38 PM, nicolas geoffray > wrote: > > Hi Jeffrey, > > > >> > >> Ah, I see now. You have your own ModuleProvider, and it needs to know > >> precisely when the function is actually needed, right? Yeah, it sounds > >> like I need to roll back that part of this fix until PR5737 is fixed. > >> > > > > Yes, thanks! > > How's the attached patch look? I discovered that one of the > isDeclaration()s was untested, so I added a test for it. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091222/dbdaea27/attachment.html From sabre at nondot.org Tue Dec 22 16:47:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 22:47:43 -0000 Subject: [llvm-commits] [llvm] r91933 - /llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Message-ID: <200912222247.nBMMlhHH028003@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 16:47:43 2009 New Revision: 91933 URL: http://llvm.org/viewvc/llvm-project?rev=91933&view=rev Log: just discard the debug output from the disassembler. Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Modified: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91933&r1=91932&r2=91933&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp Tue Dec 22 16:47:43 2009 @@ -57,14 +57,10 @@ MCInst Inst; uint64_t Size; - std::string verboseOStr; - llvm::raw_string_ostream verboseOS(verboseOStr); - - if (!DisAsm.getInstruction(Inst, Size, memoryObject, 0, verboseOS)) { + if (!DisAsm.getInstruction(Inst, Size, memoryObject, 0, + /*REMOVE*/ nulls())) { SM.PrintMessage(SMLoc::getFromPointer(Bytes[0].second), "invalid instruction encoding", "error"); - errs() << "Diagnostic log:" << '\n'; - errs() << verboseOS.str() << '\n'; return true; } From sabre at nondot.org Tue Dec 22 16:50:30 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 22 Dec 2009 22:50:30 -0000 Subject: [llvm-commits] [llvm] r91934 - in /llvm/trunk/tools/llvm-mc: CMakeLists.txt Disassembler.cpp Disassembler.h HexDisassembler.cpp HexDisassembler.h llvm-mc.cpp Message-ID: <200912222250.nBMMoUUc028108@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 16:50:29 2009 New Revision: 91934 URL: http://llvm.org/viewvc/llvm-project?rev=91934&view=rev Log: rename HexDisassembler -> Disassembler, it works on any input integer encoding (0123, 0b10101, 42, etc). Added: llvm/trunk/tools/llvm-mc/Disassembler.cpp - copied, changed from r91933, llvm/trunk/tools/llvm-mc/HexDisassembler.cpp llvm/trunk/tools/llvm-mc/Disassembler.h - copied, changed from r91931, llvm/trunk/tools/llvm-mc/HexDisassembler.h Removed: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp llvm/trunk/tools/llvm-mc/HexDisassembler.h Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/CMakeLists.txt?rev=91934&r1=91933&r2=91934&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/CMakeLists.txt (original) +++ llvm/trunk/tools/llvm-mc/CMakeLists.txt Tue Dec 22 16:50:29 2009 @@ -4,5 +4,5 @@ llvm-mc.cpp AsmLexer.cpp AsmParser.cpp - HexDisassembler.cpp + Disassembler.cpp ) Copied: llvm/trunk/tools/llvm-mc/Disassembler.cpp (from r91933, llvm/trunk/tools/llvm-mc/HexDisassembler.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/Disassembler.cpp?p2=llvm/trunk/tools/llvm-mc/Disassembler.cpp&p1=llvm/trunk/tools/llvm-mc/HexDisassembler.cpp&r1=91933&r2=91934&rev=91934&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/Disassembler.cpp Tue Dec 22 16:50:29 2009 @@ -1,4 +1,4 @@ -//===- HexDisassembler.cpp - Disassembler for hex strings -----------------===// +//===- Disassembler.cpp - Disassembler for hex strings --------------------===// // // The LLVM Compiler Infrastructure // @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#include "HexDisassembler.h" +#include "Disassembler.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/MC/MCAsmInfo.h" @@ -78,7 +78,7 @@ return false; } -int HexDisassembler::disassemble(const Target &T, const std::string &Triple, +int Disassembler::disassemble(const Target &T, const std::string &Triple, MemoryBuffer &Buffer) { // Set up disassembler. llvm::OwningPtr AsmInfo(T.createAsmInfo(Triple)); Copied: llvm/trunk/tools/llvm-mc/Disassembler.h (from r91931, llvm/trunk/tools/llvm-mc/HexDisassembler.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/Disassembler.h?p2=llvm/trunk/tools/llvm-mc/Disassembler.h&p1=llvm/trunk/tools/llvm-mc/HexDisassembler.h&r1=91931&r2=91934&rev=91934&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.h (original) +++ llvm/trunk/tools/llvm-mc/Disassembler.h Tue Dec 22 16:50:29 2009 @@ -1,4 +1,4 @@ -//===- HexDisassembler.h - Disassembler for hex strings -------------------===// +//===- Disassembler.h - Text File Disassembler ----------------------------===// // // The LLVM Compiler Infrastructure // @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#ifndef HEXDISASSEMBLER_H -#define HEXDISASSEMBLER_H +#ifndef DISASSEMBLER_H +#define DISASSEMBLER_H #include @@ -22,7 +22,7 @@ class Target; class MemoryBuffer; -class HexDisassembler { +class Disassembler { public: static int disassemble(const Target &target, const std::string &tripleString, Removed: llvm/trunk/tools/llvm-mc/HexDisassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.cpp?rev=91933&view=auto ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.cpp (removed) @@ -1,165 +0,0 @@ -//===- HexDisassembler.cpp - Disassembler for hex strings -----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This class implements the disassembler of strings of bytes written in -// hexadecimal, from standard input or from a file. -// -//===----------------------------------------------------------------------===// - -#include "HexDisassembler.h" - -#include "llvm/ADT/OwningPtr.h" -#include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCDisassembler.h" -#include "llvm/MC/MCInst.h" -#include "llvm/MC/MCInstPrinter.h" -#include "llvm/Target/TargetRegistry.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/MemoryObject.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/Support/SourceMgr.h" -using namespace llvm; - -typedef std::vector > ByteArrayTy; - -namespace { -class VectorMemoryObject : public MemoryObject { -private: - const ByteArrayTy &Bytes; -public: - VectorMemoryObject(const ByteArrayTy &bytes) : Bytes(bytes) {} - - uint64_t getBase() const { return 0; } - uint64_t getExtent() const { return Bytes.size(); } - - int readByte(uint64_t Addr, uint8_t *Byte) const { - if (Addr > getExtent()) - return -1; - *Byte = Bytes[Addr].first; - return 0; - } -}; -} - -static bool PrintInst(const llvm::MCDisassembler &DisAsm, - llvm::MCInstPrinter &Printer, const ByteArrayTy &Bytes, - SourceMgr &SM) { - // Wrap the vector in a MemoryObject. - VectorMemoryObject memoryObject(Bytes); - - // Disassemble it to a string and get the size of the instruction. - MCInst Inst; - uint64_t Size; - - if (!DisAsm.getInstruction(Inst, Size, memoryObject, 0, - /*REMOVE*/ nulls())) { - SM.PrintMessage(SMLoc::getFromPointer(Bytes[0].second), - "invalid instruction encoding", "error"); - return true; - } - - Printer.printInst(&Inst); - outs() << "\n"; - - // If the disassembled instruction was smaller than the number of bytes we - // read, reject the excess bytes. - if (Bytes.size() != Size) { - SM.PrintMessage(SMLoc::getFromPointer(Bytes[Size].second), - "excess data detected in input", "error"); - return true; - } - - return false; -} - -int HexDisassembler::disassemble(const Target &T, const std::string &Triple, - MemoryBuffer &Buffer) { - // Set up disassembler. - llvm::OwningPtr AsmInfo(T.createAsmInfo(Triple)); - - if (!AsmInfo) { - errs() << "error: no assembly info for target " << Triple << "\n"; - return -1; - } - - llvm::OwningPtr DisAsm(T.createMCDisassembler()); - if (!DisAsm) { - errs() << "error: no disassembler for target " << Triple << "\n"; - return -1; - } - - llvm::MCInstPrinter *InstPrinter = T.createMCInstPrinter(0, *AsmInfo, outs()); - - if (!InstPrinter) { - errs() << "error: no instruction printer for target " << Triple << '\n'; - return -1; - } - - bool ErrorOccurred = false; - - SourceMgr SM; - SM.AddNewSourceBuffer(&Buffer, SMLoc()); - - // Convert the input to a vector for disassembly. - ByteArrayTy ByteArray; - - StringRef Str = Buffer.getBuffer(); - while (!Str.empty()) { - // Strip horizontal whitespace. - if (size_t Pos = Str.find_first_not_of(" \t\r")) { - Str = Str.substr(Pos); - continue; - } - - // If this is the end of a line or start of a comment, process the - // instruction we have so far. - if (Str[0] == '\n' || Str[0] == '#') { - // If we have bytes to process, do so. - if (!ByteArray.empty()) { - ErrorOccurred |= PrintInst(*DisAsm, *InstPrinter, ByteArray, SM); - ByteArray.clear(); - } - - // Strip to the end of line if we already processed any bytes on this - // line. This strips the comment and/or the \n. - if (Str[0] == '\n') - Str = Str.substr(1); - else { - Str = Str.substr(Str.find_first_of('\n')); - if (!Str.empty()) - Str = Str.substr(1); - } - continue; - } - - // Get the current token. - size_t Next = Str.find_first_of(" \t\n\r#"); - StringRef Value = Str.substr(0, Next); - - // Convert to a byte and add to the byte vector. - unsigned ByteVal; - if (Value.getAsInteger(0, ByteVal) || ByteVal > 255) { - // If we have an error, print it and skip to the end of line. - SM.PrintMessage(SMLoc::getFromPointer(Value.data()), - "invalid input token", "error"); - ErrorOccurred = true; - Str = Str.substr(Str.find('\n')); - ByteArray.clear(); - continue; - } - - ByteArray.push_back(std::make_pair((unsigned char)ByteVal, Value.data())); - Str = Str.substr(Next); - } - - if (!ByteArray.empty()) - ErrorOccurred |= PrintInst(*DisAsm, *InstPrinter, ByteArray, SM); - - return ErrorOccurred; -} Removed: llvm/trunk/tools/llvm-mc/HexDisassembler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/HexDisassembler.h?rev=91933&view=auto ============================================================================== --- llvm/trunk/tools/llvm-mc/HexDisassembler.h (original) +++ llvm/trunk/tools/llvm-mc/HexDisassembler.h (removed) @@ -1,34 +0,0 @@ -//===- HexDisassembler.h - Disassembler for hex strings -------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This class implements the disassembler of strings of bytes written in -// hexadecimal, from standard input or from a file. -// -//===----------------------------------------------------------------------===// - -#ifndef HEXDISASSEMBLER_H -#define HEXDISASSEMBLER_H - -#include - -namespace llvm { - -class Target; -class MemoryBuffer; - -class HexDisassembler { -public: - static int disassemble(const Target &target, - const std::string &tripleString, - MemoryBuffer &buffer); -}; - -} // namespace llvm - -#endif Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=91934&r1=91933&r2=91934&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Dec 22 16:50:29 2009 @@ -32,7 +32,7 @@ #include "llvm/Target/TargetMachine.h" // FIXME. #include "llvm/Target/TargetSelect.h" #include "AsmParser.h" -#include "HexDisassembler.h" +#include "Disassembler.h" using namespace llvm; static cl::opt @@ -310,7 +310,7 @@ return 1; } - return HexDisassembler::disassemble(*TheTarget, TripleName, *Buffer); + return Disassembler::disassemble(*TheTarget, TripleName, *Buffer); } From scallanan at apple.com Tue Dec 22 16:51:40 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 22 Dec 2009 22:51:40 -0000 Subject: [llvm-commits] [llvm] r91935 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Message-ID: <200912222251.nBMMpecl028155@zion.cs.uiuc.edu> Author: spyffe Date: Tue Dec 22 16:51:40 2009 New Revision: 91935 URL: http://llvm.org/viewvc/llvm-project?rev=91935&view=rev Log: Removed the "inline" keyword from the disassembler decoder, because the Visual C++ build does not build .c files as C99 Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=91935&r1=91934&r2=91935&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Tue Dec 22 16:51:40 2009 @@ -46,7 +46,7 @@ * @return - The InstructionContext to use when looking up an * an instruction with these attributes. */ -static inline InstructionContext contextForAttrs(uint8_t attrMask) { +static InstructionContext contextForAttrs(uint8_t attrMask) { return CONTEXTS_SYM[attrMask]; } @@ -61,7 +61,7 @@ * ModR/M extensions and escapes. * @return - TRUE if the ModR/M byte is required, FALSE otherwise. */ -static inline int modRMRequired(OpcodeType type, +static int modRMRequired(OpcodeType type, InstructionContext insnContext, uint8_t opcode) { const struct ContextDecision* decision = 0; @@ -97,7 +97,7 @@ * @param opcode - See modRMRequired(). * @param modRM - The ModR/M byte if required, or any value if not. */ -static inline InstrUID decode(OpcodeType type, +static InstrUID decode(OpcodeType type, InstructionContext insnContext, uint8_t opcode, uint8_t modRM) { @@ -145,7 +145,7 @@ * decode(); specifierForUID will not check bounds. * @return - A pointer to the specification for that instruction. */ -static inline struct InstructionSpecifier* specifierForUID(InstrUID uid) { +static struct InstructionSpecifier* specifierForUID(InstrUID uid) { return &INSTRUCTIONS_SYM[uid]; } @@ -159,7 +159,7 @@ * with the data read. * @return - 0 if the read was successful; nonzero otherwise. */ -static inline int consumeByte(struct InternalInstruction* insn, uint8_t* byte) { +static int consumeByte(struct InternalInstruction* insn, uint8_t* byte) { int ret = insn->reader(insn->readerArg, byte, insn->readerCursor); if (!ret) @@ -175,30 +175,30 @@ * @param byte - See consumeByte(). * @return - See consumeByte(). */ -static inline int lookAtByte(struct InternalInstruction* insn, uint8_t* byte) { +static int lookAtByte(struct InternalInstruction* insn, uint8_t* byte) { return insn->reader(insn->readerArg, byte, insn->readerCursor); } -static inline void unconsumeByte(struct InternalInstruction* insn) { +static void unconsumeByte(struct InternalInstruction* insn) { insn->readerCursor--; } -#define CONSUME_FUNC(name, type) \ - static inline int name(struct InternalInstruction* insn, type* ptr) { \ - type combined = 0; \ - unsigned offset; \ - for (offset = 0; offset < sizeof(type); ++offset) { \ - uint8_t byte; \ - int ret = insn->reader(insn->readerArg, \ - &byte, \ - insn->readerCursor + offset); \ - if (ret) \ - return ret; \ - combined = combined | ((type)byte << ((type)offset * 8)); \ - } \ - *ptr = combined; \ - insn->readerCursor += sizeof(type); \ - return 0; \ +#define CONSUME_FUNC(name, type) \ + static int name(struct InternalInstruction* insn, type* ptr) { \ + type combined = 0; \ + unsigned offset; \ + for (offset = 0; offset < sizeof(type); ++offset) { \ + uint8_t byte; \ + int ret = insn->reader(insn->readerArg, \ + &byte, \ + insn->readerCursor + offset); \ + if (ret) \ + return ret; \ + combined = combined | ((type)byte << ((type)offset * 8)); \ + } \ + *ptr = combined; \ + insn->readerCursor += sizeof(type); \ + return 0; \ } /* @@ -226,9 +226,9 @@ * @param format - See printf(). * @param ... - See printf(). */ -static inline void dbgprintf(struct InternalInstruction* insn, - const char* format, - ...) { +static void dbgprintf(struct InternalInstruction* insn, + const char* format, + ...) { char buffer[256]; va_list ap; @@ -253,7 +253,7 @@ * @param location - The location where the prefix is located (in the address * space of the instruction's reader). */ -static inline void setPrefixPresent(struct InternalInstruction* insn, +static void setPrefixPresent(struct InternalInstruction* insn, uint8_t prefix, uint64_t location) { @@ -270,9 +270,9 @@ * @param location - The location to query. * @return - Whether the prefix is at that location. */ -static inline BOOL isPrefixAtLocation(struct InternalInstruction* insn, - uint8_t prefix, - uint64_t location) +static BOOL isPrefixAtLocation(struct InternalInstruction* insn, + uint8_t prefix, + uint64_t location) { if (insn->prefixPresent[prefix] == 1 && insn->prefixLocations[prefix] == location) From isanbard at gmail.com Tue Dec 22 16:53:40 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 22:53:40 -0000 Subject: [llvm-commits] [llvm] r91936 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp SelectionDAGBuilder.cpp Message-ID: <200912222253.nBMMre5W028245@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 16:53:39 2009 New Revision: 91936 URL: http://llvm.org/viewvc/llvm-project?rev=91936&view=rev Log: Assign ordering to SDNodes in PromoteNode. Also fixing a subtle bug where BSWAP was using "Tmp1" in the first getNode call instead of Node->getOperand(0). Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=91936&r1=91935&r2=91936&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 22 16:53:39 2009 @@ -2931,22 +2931,29 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node, SmallVectorImpl &Results) { EVT OVT = Node->getValueType(0); + if (Node->getOpcode() == ISD::UINT_TO_FP || Node->getOpcode() == ISD::SINT_TO_FP || - Node->getOpcode() == ISD::SETCC) { + Node->getOpcode() == ISD::SETCC) OVT = Node->getOperand(0).getValueType(); - } + EVT NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), OVT); DebugLoc dl = Node->getDebugLoc(); + unsigned Order = DAG.GetOrdering(Node); SDValue Tmp1, Tmp2, Tmp3; + switch (Node->getOpcode()) { case ISD::CTTZ: case ISD::CTLZ: case ISD::CTPOP: // Zero extend the argument. Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Node->getOperand(0)); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + // Perform the larger operation. Tmp1 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + if (Node->getOpcode() == ISD::CTTZ) { //if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT) Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(NVT), @@ -2954,21 +2961,37 @@ ISD::SETEQ); Tmp1 = DAG.getNode(ISD::SELECT, dl, NVT, Tmp2, DAG.getConstant(OVT.getSizeInBits(), NVT), Tmp1); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + } } else if (Node->getOpcode() == ISD::CTLZ) { // Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT)) Tmp1 = DAG.getNode(ISD::SUB, dl, NVT, Tmp1, DAG.getConstant(NVT.getSizeInBits() - OVT.getSizeInBits(), NVT)); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); } - Results.push_back(DAG.getNode(ISD::TRUNCATE, dl, OVT, Tmp1)); + + Tmp3 = DAG.getNode(ISD::TRUNCATE, dl, OVT, Tmp1); + Results.push_back(Tmp3); + if (DisableScheduling) DAG.AssignOrdering(Tmp3.getNode(), Order); break; case ISD::BSWAP: { unsigned DiffBits = NVT.getSizeInBits() - OVT.getSizeInBits(); - Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Tmp1); - Tmp1 = DAG.getNode(ISD::BSWAP, dl, NVT, Tmp1); - Tmp1 = DAG.getNode(ISD::SRL, dl, NVT, Tmp1, - DAG.getConstant(DiffBits, TLI.getShiftAmountTy())); - Results.push_back(Tmp1); + Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Node->getOperand(0)); + Tmp2 = DAG.getNode(ISD::BSWAP, dl, NVT, Tmp1); + Tmp3 = DAG.getNode(ISD::SRL, dl, NVT, Tmp2, + DAG.getConstant(DiffBits, TLI.getShiftAmountTy())); + Results.push_back(Tmp3); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + DAG.AssignOrdering(Tmp3.getNode(), Order); + } + break; } case ISD::FP_TO_UINT: @@ -2976,12 +2999,14 @@ Tmp1 = PromoteLegalFP_TO_INT(Node->getOperand(0), Node->getValueType(0), Node->getOpcode() == ISD::FP_TO_SINT, dl); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::UINT_TO_FP: case ISD::SINT_TO_FP: Tmp1 = PromoteLegalINT_TO_FP(Node->getOperand(0), Node->getValueType(0), Node->getOpcode() == ISD::SINT_TO_FP, dl); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::AND: case ISD::OR: @@ -2996,12 +3021,23 @@ } else { llvm_report_error("Cannot promote logic operation"); } + // Promote each of the values to the new type. Tmp1 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(0)); Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1)); + // Perform the larger operation, then convert back - Tmp1 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1, Tmp2); - Results.push_back(DAG.getNode(TruncOp, dl, OVT, Tmp1)); + Tmp3 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1, Tmp2); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + DAG.AssignOrdering(Tmp3.getNode(), Order); + } + + Tmp1 = DAG.getNode(TruncOp, dl, OVT, Tmp3); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SELECT: { @@ -3016,18 +3052,34 @@ ExtOp = ISD::FP_EXTEND; TruncOp = ISD::FP_ROUND; } + Tmp1 = Node->getOperand(0); + // Promote each of the values to the new type. Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1)); Tmp3 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(2)); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp2.getNode(), Order); + DAG.AssignOrdering(Tmp3.getNode(), Order); + } + // Perform the larger operation, then round down. Tmp1 = DAG.getNode(ISD::SELECT, dl, NVT, Tmp1, Tmp2, Tmp3); + if (TruncOp != ISD::FP_ROUND) - Tmp1 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1); + Tmp2 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1); else - Tmp1 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1, + Tmp2 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1, DAG.getIntPtrConstant(0)); - Results.push_back(Tmp1); + + Results.push_back(Tmp2); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + } + break; } case ISD::VECTOR_SHUFFLE: { @@ -3039,9 +3091,17 @@ Tmp2 = DAG.getNode(ISD::BIT_CONVERT, dl, NVT, Node->getOperand(1)); // Convert the shuffle mask to the right # elements. - Tmp1 = ShuffleWithNarrowerEltType(NVT, OVT, dl, Tmp1, Tmp2, Mask); - Tmp1 = DAG.getNode(ISD::BIT_CONVERT, dl, OVT, Tmp1); + Tmp3 = ShuffleWithNarrowerEltType(NVT, OVT, dl, Tmp1, Tmp2, Mask); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + DAG.AssignOrdering(Tmp3.getNode(), Order); + } + + Tmp1 = DAG.getNode(ISD::BIT_CONVERT, dl, OVT, Tmp3); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SETCC: { @@ -3051,10 +3111,17 @@ cast(Node->getOperand(2))->get(); ExtOp = isSignedIntSetCC(CCCode) ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND; } + Tmp1 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(0)); Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1)); Results.push_back(DAG.getNode(ISD::SETCC, dl, Node->getValueType(0), Tmp1, Tmp2, Node->getOperand(2))); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + } + break; } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91936&r1=91935&r2=91936&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 22 16:53:39 2009 @@ -648,6 +648,7 @@ PendingExports.size()); PendingExports.clear(); DAG.setRoot(Root); + if (DisableScheduling) DAG.AssignOrdering(Root.getNode(), SDNodeOrder); return Root; } From jyasskin at google.com Tue Dec 22 17:18:18 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Tue, 22 Dec 2009 23:18:18 -0000 Subject: [llvm-commits] [llvm] r91939 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp unittests/ExecutionEngine/JIT/JITTest.cpp Message-ID: <200912222318.nBMNIIFa029184@zion.cs.uiuc.edu> Author: jyasskin Date: Tue Dec 22 17:18:18 2009 New Revision: 91939 URL: http://llvm.org/viewvc/llvm-project?rev=91939&view=rev Log: Fix a crash in JIT::recompileAndRelinkFunction(). It doesn't pass the MCI argument to runJITOnFunction(), which caused a null pointer dereference at every call. Patch by Gianluca Guida! Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=91939&r1=91938&r2=91939&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Tue Dec 22 17:18:18 2009 @@ -611,11 +611,13 @@ } }; MCIListener MCIL(MCI); - RegisterJITEventListener(&MCIL); + if (MCI) + RegisterJITEventListener(&MCIL); runJITOnFunctionUnlocked(F, locked); - UnregisterJITEventListener(&MCIL); + if (MCI) + UnregisterJITEventListener(&MCIL); } void JIT::runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked) { Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=91939&r1=91938&r2=91939&view=diff ============================================================================== --- llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp (original) +++ llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Tue Dec 22 17:18:18 2009 @@ -534,6 +534,37 @@ #endif } +TEST_F(JITTest, FunctionIsRecompiledAndRelinked) { + Function *F = Function::Create(TypeBuilder::get(Context), + GlobalValue::ExternalLinkage, "test", M); + BasicBlock *Entry = BasicBlock::Create(Context, "entry", F); + IRBuilder<> Builder(Entry); + Value *Val = ConstantInt::get(TypeBuilder::get(Context), 1); + Builder.CreateRet(Val); + + TheJIT->DisableLazyCompilation(true); + // Compile the function once, and make sure it works. + int (*OrigFPtr)() = reinterpret_cast( + (intptr_t)TheJIT->recompileAndRelinkFunction(F)); + EXPECT_EQ(1, OrigFPtr()); + + // Now change the function to return a different value. + Entry->eraseFromParent(); + BasicBlock *NewEntry = BasicBlock::Create(Context, "new_entry", F); + Builder.SetInsertPoint(NewEntry); + Val = ConstantInt::get(TypeBuilder::get(Context), 2); + Builder.CreateRet(Val); + // Recompile it, which should produce a new function pointer _and_ update the + // old one. + int (*NewFPtr)() = reinterpret_cast( + (intptr_t)TheJIT->recompileAndRelinkFunction(F)); + + EXPECT_EQ(2, NewFPtr()) + << "The new pointer should call the new version of the function"; + EXPECT_EQ(2, OrigFPtr()) + << "The old pointer's target should now jump to the new version"; +} + } // anonymous namespace // This variable is intentionally defined differently in the statically-compiled // program from the IR input to the JIT to assert that the JIT doesn't use its From isanbard at gmail.com Tue Dec 22 17:44:57 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Dec 2009 23:44:57 -0000 Subject: [llvm-commits] [llvm] r91942 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200912222344.nBMNivQq030315@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 17:44:56 2009 New Revision: 91942 URL: http://llvm.org/viewvc/llvm-project?rev=91942&view=rev Log: Assign ordering to nodes created in ExpandNode. Only roughly 1/2 of the function is finished. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=91942&r1=91941&r2=91942&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 22 17:44:56 2009 @@ -2220,6 +2220,7 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node, SmallVectorImpl &Results) { DebugLoc dl = Node->getDebugLoc(); + unsigned Order = DAG.GetOrdering(Node); SDValue Tmp1, Tmp2, Tmp3, Tmp4; switch (Node->getOpcode()) { case ISD::CTPOP: @@ -2227,9 +2228,12 @@ case ISD::CTTZ: Tmp1 = ExpandBitCount(Node->getOpcode(), Node->getOperand(0), dl); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::BSWAP: - Results.push_back(ExpandBSWAP(Node->getOperand(0), dl)); + Tmp1 = ExpandBSWAP(Node->getOperand(0), dl); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FRAMEADDR: case ISD::RETURNADDR: @@ -2280,12 +2284,14 @@ Tmp1 = EmitStackConvert(Node->getOperand(0), Node->getValueType(0), Node->getValueType(0), dl); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FP_EXTEND: Tmp1 = EmitStackConvert(Node->getOperand(0), Node->getOperand(0).getValueType(), Node->getValueType(0), dl); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::SIGN_EXTEND_INREG: { // NOTE: we could fall back on load/store here too for targets without @@ -2302,8 +2308,14 @@ SDValue ShiftCst = DAG.getConstant(BitsDiff, ShiftAmountTy); Tmp1 = DAG.getNode(ISD::SHL, dl, Node->getValueType(0), Node->getOperand(0), ShiftCst); - Tmp1 = DAG.getNode(ISD::SRA, dl, Node->getValueType(0), Tmp1, ShiftCst); - Results.push_back(Tmp1); + Tmp2 = DAG.getNode(ISD::SRA, dl, Node->getValueType(0), Tmp1, ShiftCst); + Results.push_back(Tmp2); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + } + break; } case ISD::FP_ROUND_INREG: { @@ -2317,6 +2329,7 @@ Tmp1 = EmitStackConvert(Node->getOperand(0), ExtraVT, Node->getValueType(0), dl); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SINT_TO_FP: @@ -2324,6 +2337,7 @@ Tmp1 = ExpandLegalINT_TO_FP(Node->getOpcode() == ISD::SINT_TO_FP, Node->getOperand(0), Node->getValueType(0), dl); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FP_TO_UINT: { SDValue True, False; @@ -2332,19 +2346,35 @@ const uint64_t zero[] = {0, 0}; APFloat apf = APFloat(APInt(VT.getSizeInBits(), 2, zero)); APInt x = APInt::getSignBit(NVT.getSizeInBits()); + (void)apf.convertFromAPInt(x, false, APFloat::rmNearestTiesToEven); Tmp1 = DAG.getConstantFP(apf, VT); Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(VT), Node->getOperand(0), Tmp1, ISD::SETLT); + + if (DisableScheduling) DAG.AssignOrdering(Tmp2.getNode(), Order); + True = DAG.getNode(ISD::FP_TO_SINT, dl, NVT, Node->getOperand(0)); - False = DAG.getNode(ISD::FP_TO_SINT, dl, NVT, - DAG.getNode(ISD::FSUB, dl, VT, - Node->getOperand(0), Tmp1)); + Tmp1 = DAG.getNode(ISD::FSUB, dl, VT, Node->getOperand(0), Tmp1); + False = DAG.getNode(ISD::FP_TO_SINT, dl, NVT, Tmp1); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(True.getNode(), Order); + DAG.AssignOrdering(False.getNode(), Order); + } + False = DAG.getNode(ISD::XOR, dl, NVT, False, DAG.getConstant(x, NVT)); Tmp1 = DAG.getNode(ISD::SELECT, dl, NVT, Tmp2, True, False); Results.push_back(Tmp1); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(False.getNode(), Order); + } + break; } case ISD::VAARG: { @@ -2353,16 +2383,31 @@ Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); SDValue VAList = DAG.getLoad(TLI.getPointerTy(), dl, Tmp1, Tmp2, V, 0); + // Increment the pointer, VAList, to the next vaarg Tmp3 = DAG.getNode(ISD::ADD, dl, TLI.getPointerTy(), VAList, DAG.getConstant(TLI.getTargetData()-> - getTypeAllocSize(VT.getTypeForEVT(*DAG.getContext())), + getTypeAllocSize(VT.getTypeForEVT(*DAG.getContext())), TLI.getPointerTy())); + // Store the incremented VAList to the legalized pointer - Tmp3 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Tmp2, V, 0); + Tmp4 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Tmp2, V, 0); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp3.getNode(), Order); + DAG.AssignOrdering(Tmp4.getNode(), Order); + } + // Load the actual argument out of the pointer VAList - Results.push_back(DAG.getLoad(VT, dl, Tmp3, VAList, NULL, 0)); + Tmp1 = DAG.getLoad(VT, dl, Tmp4, VAList, NULL, 0); + Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); + } + break; } case ISD::VACOPY: { @@ -2372,8 +2417,14 @@ const Value *VS = cast(Node->getOperand(4))->getValue(); Tmp1 = DAG.getLoad(TLI.getPointerTy(), dl, Node->getOperand(0), Node->getOperand(2), VS, 0); - Tmp1 = DAG.getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1), VD, 0); - Results.push_back(Tmp1); + Tmp2 = DAG.getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1), VD, 0); + Results.push_back(Tmp2); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + } + break; } case ISD::EXTRACT_VECTOR_ELT: @@ -2383,22 +2434,32 @@ Node->getOperand(0)); else Tmp1 = ExpandExtractFromVectorThroughStack(SDValue(Node, 0)); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::EXTRACT_SUBVECTOR: - Results.push_back(ExpandExtractFromVectorThroughStack(SDValue(Node, 0))); + Tmp1 = ExpandExtractFromVectorThroughStack(SDValue(Node, 0)); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::CONCAT_VECTORS: { - Results.push_back(ExpandVectorBuildThroughStack(Node)); + Tmp1 = ExpandVectorBuildThroughStack(Node); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SCALAR_TO_VECTOR: - Results.push_back(ExpandSCALAR_TO_VECTOR(Node)); + Tmp1 = ExpandSCALAR_TO_VECTOR(Node); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::INSERT_VECTOR_ELT: - Results.push_back(ExpandINSERT_VECTOR_ELT(Node->getOperand(0), - Node->getOperand(1), - Node->getOperand(2), dl)); + Tmp1 = ExpandINSERT_VECTOR_ELT(Node->getOperand(0), + Node->getOperand(1), + Node->getOperand(2), dl); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::VECTOR_SHUFFLE: { SmallVector Mask; @@ -2408,65 +2469,88 @@ EVT EltVT = VT.getVectorElementType(); unsigned NumElems = VT.getVectorNumElements(); SmallVector Ops; + for (unsigned i = 0; i != NumElems; ++i) { if (Mask[i] < 0) { Ops.push_back(DAG.getUNDEF(EltVT)); continue; } + unsigned Idx = Mask[i]; if (Idx < NumElems) - Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, - Node->getOperand(0), - DAG.getIntPtrConstant(Idx))); + Tmp1 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, + Node->getOperand(0), + DAG.getIntPtrConstant(Idx)); else - Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, - Node->getOperand(1), - DAG.getIntPtrConstant(Idx - NumElems))); + Tmp1 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, + Node->getOperand(1), + DAG.getIntPtrConstant(Idx - NumElems)); + + Ops.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); } + Tmp1 = DAG.getNode(ISD::BUILD_VECTOR, dl, VT, &Ops[0], Ops.size()); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::EXTRACT_ELEMENT: { EVT OpTy = Node->getOperand(0).getValueType(); + if (cast(Node->getOperand(1))->getZExtValue()) { // 1 -> Hi Tmp1 = DAG.getNode(ISD::SRL, dl, OpTy, Node->getOperand(0), DAG.getConstant(OpTy.getSizeInBits()/2, TLI.getShiftAmountTy())); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); Tmp1 = DAG.getNode(ISD::TRUNCATE, dl, Node->getValueType(0), Tmp1); } else { // 0 -> Lo Tmp1 = DAG.getNode(ISD::TRUNCATE, dl, Node->getValueType(0), Node->getOperand(0)); } + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::STACKSAVE: // Expand to CopyFromReg if the target set // StackPointerRegisterToSaveRestore. if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) { - Results.push_back(DAG.getCopyFromReg(Node->getOperand(0), dl, SP, - Node->getValueType(0))); + Tmp1 = DAG.getCopyFromReg(Node->getOperand(0), dl, SP, + Node->getValueType(0)); + Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); + } } else { - Results.push_back(DAG.getUNDEF(Node->getValueType(0))); + Tmp1 = DAG.getUNDEF(Node->getValueType(0)); + Results.push_back(Tmp1); Results.push_back(Node->getOperand(0)); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); } + break; case ISD::STACKRESTORE: - // Expand to CopyToReg if the target set - // StackPointerRegisterToSaveRestore. - if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) { - Results.push_back(DAG.getCopyToReg(Node->getOperand(0), dl, SP, - Node->getOperand(1))); - } else { - Results.push_back(Node->getOperand(0)); - } + // Expand to CopyToReg if the target set StackPointerRegisterToSaveRestore. + if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) + Tmp1 = DAG.getCopyToReg(Node->getOperand(0), dl, SP, + Node->getOperand(1)); + else + Tmp1 = Node->getOperand(0); + + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FCOPYSIGN: - Results.push_back(ExpandFCOPYSIGN(Node)); + Tmp1 = ExpandFCOPYSIGN(Node); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FNEG: // Expand Y = FNEG(X) -> Y = SUB -0.0, X @@ -2474,113 +2558,172 @@ Tmp1 = DAG.getNode(ISD::FSUB, dl, Node->getValueType(0), Tmp1, Node->getOperand(0)); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FABS: { // Expand Y = FABS(X) -> Y = (X >u 0.0) ? X : fneg(X). EVT VT = Node->getValueType(0); Tmp1 = Node->getOperand(0); Tmp2 = DAG.getConstantFP(0.0, VT); - Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(Tmp1.getValueType()), + Tmp3 = DAG.getSetCC(dl, TLI.getSetCCResultType(Tmp1.getValueType()), Tmp1, Tmp2, ISD::SETUGT); - Tmp3 = DAG.getNode(ISD::FNEG, dl, VT, Tmp1); - Tmp1 = DAG.getNode(ISD::SELECT, dl, VT, Tmp2, Tmp1, Tmp3); + Tmp4 = DAG.getNode(ISD::FNEG, dl, VT, Tmp1); + Tmp1 = DAG.getNode(ISD::SELECT, dl, VT, Tmp3, Tmp1, Tmp4); Results.push_back(Tmp1); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp3.getNode(), Order); + DAG.AssignOrdering(Tmp4.getNode(), Order); + } + break; } case ISD::FSQRT: - Results.push_back(ExpandFPLibCall(Node, RTLIB::SQRT_F32, RTLIB::SQRT_F64, - RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::SQRT_F32, RTLIB::SQRT_F64, + RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FSIN: - Results.push_back(ExpandFPLibCall(Node, RTLIB::SIN_F32, RTLIB::SIN_F64, - RTLIB::SIN_F80, RTLIB::SIN_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::SIN_F32, RTLIB::SIN_F64, + RTLIB::SIN_F80, RTLIB::SIN_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FCOS: - Results.push_back(ExpandFPLibCall(Node, RTLIB::COS_F32, RTLIB::COS_F64, - RTLIB::COS_F80, RTLIB::COS_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::COS_F32, RTLIB::COS_F64, + RTLIB::COS_F80, RTLIB::COS_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FLOG: - Results.push_back(ExpandFPLibCall(Node, RTLIB::LOG_F32, RTLIB::LOG_F64, - RTLIB::LOG_F80, RTLIB::LOG_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::LOG_F32, RTLIB::LOG_F64, + RTLIB::LOG_F80, RTLIB::LOG_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FLOG2: - Results.push_back(ExpandFPLibCall(Node, RTLIB::LOG2_F32, RTLIB::LOG2_F64, - RTLIB::LOG2_F80, RTLIB::LOG2_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::LOG2_F32, RTLIB::LOG2_F64, + RTLIB::LOG2_F80, RTLIB::LOG2_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FLOG10: - Results.push_back(ExpandFPLibCall(Node, RTLIB::LOG10_F32, RTLIB::LOG10_F64, - RTLIB::LOG10_F80, RTLIB::LOG10_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::LOG10_F32, RTLIB::LOG10_F64, + RTLIB::LOG10_F80, RTLIB::LOG10_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FEXP: - Results.push_back(ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64, - RTLIB::EXP_F80, RTLIB::EXP_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64, + RTLIB::EXP_F80, RTLIB::EXP_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FEXP2: - Results.push_back(ExpandFPLibCall(Node, RTLIB::EXP2_F32, RTLIB::EXP2_F64, - RTLIB::EXP2_F80, RTLIB::EXP2_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::EXP2_F32, RTLIB::EXP2_F64, + RTLIB::EXP2_F80, RTLIB::EXP2_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FTRUNC: - Results.push_back(ExpandFPLibCall(Node, RTLIB::TRUNC_F32, RTLIB::TRUNC_F64, - RTLIB::TRUNC_F80, RTLIB::TRUNC_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::TRUNC_F32, RTLIB::TRUNC_F64, + RTLIB::TRUNC_F80, RTLIB::TRUNC_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FFLOOR: - Results.push_back(ExpandFPLibCall(Node, RTLIB::FLOOR_F32, RTLIB::FLOOR_F64, - RTLIB::FLOOR_F80, RTLIB::FLOOR_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::FLOOR_F32, RTLIB::FLOOR_F64, + RTLIB::FLOOR_F80, RTLIB::FLOOR_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FCEIL: - Results.push_back(ExpandFPLibCall(Node, RTLIB::CEIL_F32, RTLIB::CEIL_F64, - RTLIB::CEIL_F80, RTLIB::CEIL_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::CEIL_F32, RTLIB::CEIL_F64, + RTLIB::CEIL_F80, RTLIB::CEIL_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FRINT: - Results.push_back(ExpandFPLibCall(Node, RTLIB::RINT_F32, RTLIB::RINT_F64, - RTLIB::RINT_F80, RTLIB::RINT_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::RINT_F32, RTLIB::RINT_F64, + RTLIB::RINT_F80, RTLIB::RINT_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FNEARBYINT: - Results.push_back(ExpandFPLibCall(Node, RTLIB::NEARBYINT_F32, - RTLIB::NEARBYINT_F64, - RTLIB::NEARBYINT_F80, - RTLIB::NEARBYINT_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::NEARBYINT_F32, + RTLIB::NEARBYINT_F64, + RTLIB::NEARBYINT_F80, + RTLIB::NEARBYINT_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FPOWI: - Results.push_back(ExpandFPLibCall(Node, RTLIB::POWI_F32, RTLIB::POWI_F64, - RTLIB::POWI_F80, RTLIB::POWI_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::POWI_F32, RTLIB::POWI_F64, + RTLIB::POWI_F80, RTLIB::POWI_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FPOW: - Results.push_back(ExpandFPLibCall(Node, RTLIB::POW_F32, RTLIB::POW_F64, - RTLIB::POW_F80, RTLIB::POW_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::POW_F32, RTLIB::POW_F64, + RTLIB::POW_F80, RTLIB::POW_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FDIV: - Results.push_back(ExpandFPLibCall(Node, RTLIB::DIV_F32, RTLIB::DIV_F64, - RTLIB::DIV_F80, RTLIB::DIV_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::DIV_F32, RTLIB::DIV_F64, + RTLIB::DIV_F80, RTLIB::DIV_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FREM: - Results.push_back(ExpandFPLibCall(Node, RTLIB::REM_F32, RTLIB::REM_F64, - RTLIB::REM_F80, RTLIB::REM_PPCF128)); + Tmp1 = ExpandFPLibCall(Node, RTLIB::REM_F32, RTLIB::REM_F64, + RTLIB::REM_F80, RTLIB::REM_PPCF128); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::ConstantFP: { ConstantFPSDNode *CFP = cast(Node); - // Check to see if this FP immediate is already legal. - // If this is a legal constant, turn it into a TargetConstantFP node. + // Check to see if this FP immediate is already legal. If this is a legal + // constant, turn it into a TargetConstantFP node. if (TLI.isFPImmLegal(CFP->getValueAPF(), Node->getValueType(0))) - Results.push_back(SDValue(Node, 0)); + Tmp1 = SDValue(Node, 0); else - Results.push_back(ExpandConstantFP(CFP, true, DAG, TLI)); + Tmp1 = ExpandConstantFP(CFP, true, DAG, TLI); + + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::EHSELECTION: { unsigned Reg = TLI.getExceptionSelectorRegister(); assert(Reg && "Can't expand to unknown register!"); - Results.push_back(DAG.getCopyFromReg(Node->getOperand(1), dl, Reg, - Node->getValueType(0))); + Tmp1 = DAG.getCopyFromReg(Node->getOperand(1), dl, Reg, + Node->getValueType(0)); + Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); + } + break; } case ISD::EXCEPTIONADDR: { unsigned Reg = TLI.getExceptionAddressRegister(); assert(Reg && "Can't expand to unknown register!"); - Results.push_back(DAG.getCopyFromReg(Node->getOperand(0), dl, Reg, - Node->getValueType(0))); + Tmp1 = DAG.getCopyFromReg(Node->getOperand(0), dl, Reg, + Node->getValueType(0)); + Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); + } + break; } case ISD::SUB: { @@ -2590,8 +2733,16 @@ "Don't know how to expand this subtraction!"); Tmp1 = DAG.getNode(ISD::XOR, dl, VT, Node->getOperand(1), DAG.getConstant(APInt::getAllOnesValue(VT.getSizeInBits()), VT)); - Tmp1 = DAG.getNode(ISD::ADD, dl, VT, Tmp2, DAG.getConstant(1, VT)); - Results.push_back(DAG.getNode(ISD::ADD, dl, VT, Node->getOperand(0), Tmp1)); + Tmp2 = DAG.getNode(ISD::ADD, dl, VT, Tmp2, DAG.getConstant(1, VT)); + Tmp3 = DAG.getNode(ISD::ADD, dl, VT, Node->getOperand(0), Tmp2); + Results.push_back(Tmp3); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + DAG.AssignOrdering(Tmp3.getNode(), Order); + } + break; } case ISD::UREM: @@ -2603,6 +2754,7 @@ unsigned DivRemOpc = isSigned ? ISD::SDIVREM : ISD::UDIVREM; Tmp2 = Node->getOperand(0); Tmp3 = Node->getOperand(1); + if (TLI.isOperationLegalOrCustom(DivRemOpc, VT)) { Tmp1 = DAG.getNode(DivRemOpc, dl, VTs, Tmp2, Tmp3).getValue(1); } else if (TLI.isOperationLegalOrCustom(DivOpc, VT)) { @@ -2621,6 +2773,7 @@ RTLIB::UREM_I16, RTLIB::UREM_I32, RTLIB::UREM_I64, RTLIB::UREM_I128); } + Results.push_back(Tmp1); break; } From jyasskin at google.com Tue Dec 22 17:47:23 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Tue, 22 Dec 2009 23:47:23 -0000 Subject: [llvm-commits] [llvm] r91943 - in /llvm/trunk: lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp unittests/ExecutionEngine/JIT/Makefile Message-ID: <200912222347.nBMNlNji030403@zion.cs.uiuc.edu> Author: jyasskin Date: Tue Dec 22 17:47:23 2009 New Revision: 91943 URL: http://llvm.org/viewvc/llvm-project?rev=91943&view=rev Log: Partially revert r91626. Materializing extra functions to determine whether they're available_externally broke VMKit, which was relying on the fact that functions would only be materialized when they were first called. We'll have to wait for http://llvm.org/PR5737 to really fix this. I also added a test for one of the F->isDeclaration() calls which wasn't covered by anything else in the test suite. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp llvm/trunk/unittests/ExecutionEngine/JIT/Makefile Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=91943&r1=91942&r2=91943&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Dec 22 17:47:23 2009 @@ -59,6 +59,12 @@ static JIT *TheJIT = 0; +// A declaration may stop being a declaration once it's fully read from bitcode. +// This function returns true if F is fully read and is still a declaration. +static bool isNonGhostDeclaration(const Function *F) { + return F->isDeclaration() && !F->hasNotBeenReadFromBitcode(); +} + //===----------------------------------------------------------------------===// // JIT lazy compilation code. // @@ -517,15 +523,9 @@ void *Actual = TheJIT->isCompilingLazily() ? (void *)(intptr_t)LazyResolverFn : (void *)0; - // TODO: Delete this when PR5737 is fixed. - std::string ErrorMsg; - if (TheJIT->materializeFunction(F, &ErrorMsg)) { - llvm_report_error("Error reading function '" + F->getName()+ - "' from bitcode file: " + ErrorMsg); - } // If this is an external declaration, attempt to resolve the address now // to place in the stub. - if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) { + if (isNonGhostDeclaration(F) || F->hasAvailableExternallyLinkage()) { Actual = TheJIT->getPointerToFunction(F); // If we resolved the symbol to a null address (eg. a weak external) @@ -558,7 +558,7 @@ // exist yet, add it to the JIT's work list so that we can fill in the stub // address later. if (!Actual && !TheJIT->isCompilingLazily()) - if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage()) + if (!isNonGhostDeclaration(F) && !F->hasAvailableExternallyLinkage()) TheJIT->addPendingFunction(F); return Stub; @@ -761,16 +761,9 @@ void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F); if (ResultPtr) return ResultPtr; - // TODO: Delete this when PR5737 is fixed. - std::string ErrorMsg; - if (TheJIT->materializeFunction(F, &ErrorMsg)) { - llvm_report_error("Error reading function '" + F->getName()+ - "' from bitcode file: " + ErrorMsg); - } - // If this is an external function pointer, we can force the JIT to // 'compile' it, which really just adds it to the map. - if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) + if (isNonGhostDeclaration(F) || F->hasAvailableExternallyLinkage()) return TheJIT->getPointerToFunction(F); } Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=91943&r1=91942&r2=91943&view=diff ============================================================================== --- llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp (original) +++ llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Tue Dec 22 17:47:23 2009 @@ -12,6 +12,7 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Assembly/Parser.h" #include "llvm/BasicBlock.h" +#include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Constant.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -24,6 +25,7 @@ #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/Support/IRBuilder.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/TypeBuilder.h" #include "llvm/Target/TargetSelect.h" @@ -177,6 +179,17 @@ } }; +bool LoadAssemblyInto(Module *M, const char *assembly) { + SMDiagnostic Error; + bool success = + NULL != ParseAssemblyString(assembly, M, Error, M->getContext()); + std::string errMsg; + raw_string_ostream os(errMsg); + Error.Print("", os); + EXPECT_TRUE(success) << os.str(); + return success; +} + class JITTest : public testing::Test { protected: virtual void SetUp() { @@ -192,12 +205,7 @@ } void LoadAssembly(const char *assembly) { - SMDiagnostic Error; - bool success = NULL != ParseAssemblyString(assembly, M, Error, Context); - std::string errMsg; - raw_string_ostream os(errMsg); - Error.Print("", os); - ASSERT_TRUE(success) << os.str(); + LoadAssemblyInto(M, assembly); } LLVMContext Context; @@ -619,6 +627,88 @@ << " not 7 from the IR version."; } +// Converts the LLVM assembly to bitcode and returns it in a std::string. An +// empty string indicates an error. +std::string AssembleToBitcode(LLVMContext &Context, const char *Assembly) { + Module TempModule("TempModule", Context); + if (!LoadAssemblyInto(&TempModule, Assembly)) { + return ""; + } + + std::string Result; + raw_string_ostream OS(Result); + WriteBitcodeToFile(&TempModule, OS); + OS.flush(); + return Result; +} + +// Returns a newly-created ExecutionEngine that reads the bitcode in 'Bitcode' +// lazily. The associated ModuleProvider (owned by the ExecutionEngine) is +// returned in MP. Both will be NULL on an error. Bitcode must live at least +// as long as the ExecutionEngine. +ExecutionEngine *getJITFromBitcode( + LLVMContext &Context, const std::string &Bitcode, ModuleProvider *&MP) { + // c_str() is null-terminated like MemoryBuffer::getMemBuffer requires. + MemoryBuffer *BitcodeBuffer = + MemoryBuffer::getMemBuffer(Bitcode.c_str(), + Bitcode.c_str() + Bitcode.size(), + "Bitcode for test"); + std::string errMsg; + MP = getBitcodeModuleProvider(BitcodeBuffer, Context, &errMsg); + if (MP == NULL) { + ADD_FAILURE() << errMsg; + delete BitcodeBuffer; + return NULL; + } + ExecutionEngine *TheJIT = EngineBuilder(MP) + .setEngineKind(EngineKind::JIT) + .setErrorStr(&errMsg) + .create(); + if (TheJIT == NULL) { + ADD_FAILURE() << errMsg; + delete MP; + MP = NULL; + return NULL; + } + return TheJIT; +} + +TEST(LazyLoadedJITTest, EagerCompiledRecursionThroughGhost) { + LLVMContext Context; + const std::string Bitcode = + AssembleToBitcode(Context, + "define i32 @recur1(i32 %a) { " + " %zero = icmp eq i32 %a, 0 " + " br i1 %zero, label %done, label %notdone " + "done: " + " ret i32 3 " + "notdone: " + " %am1 = sub i32 %a, 1 " + " %result = call i32 @recur2(i32 %am1) " + " ret i32 %result " + "} " + " " + "define i32 @recur2(i32 %b) { " + " %result = call i32 @recur1(i32 %b) " + " ret i32 %result " + "} "); + ASSERT_FALSE(Bitcode.empty()) << "Assembling failed"; + ModuleProvider *MP; + OwningPtr TheJIT(getJITFromBitcode(Context, Bitcode, MP)); + ASSERT_TRUE(TheJIT.get()) << "Failed to create JIT."; + TheJIT->DisableLazyCompilation(true); + + Module *M = MP->getModule(); + Function *recur1IR = M->getFunction("recur1"); + Function *recur2IR = M->getFunction("recur2"); + EXPECT_TRUE(recur1IR->hasNotBeenReadFromBitcode()); + EXPECT_TRUE(recur2IR->hasNotBeenReadFromBitcode()); + + int32_t (*recur1)(int32_t) = reinterpret_cast( + (intptr_t)TheJIT->getPointerToFunction(recur1IR)); + EXPECT_EQ(3, recur1(4)); +} + // This code is copied from JITEventListenerTest, but it only runs once for all // the tests in this directory. Everything seems fine, but that's strange // behavior. Modified: llvm/trunk/unittests/ExecutionEngine/JIT/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/Makefile?rev=91943&r1=91942&r2=91943&view=diff ============================================================================== --- llvm/trunk/unittests/ExecutionEngine/JIT/Makefile (original) +++ llvm/trunk/unittests/ExecutionEngine/JIT/Makefile Tue Dec 22 17:47:23 2009 @@ -9,7 +9,7 @@ LEVEL = ../../.. TESTNAME = JIT -LINK_COMPONENTS := asmparser core support jit native +LINK_COMPONENTS := asmparser bitreader bitwriter core jit native support include $(LEVEL)/Makefile.config include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest From stoklund at 2pi.dk Tue Dec 22 17:54:44 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Dec 2009 23:54:44 -0000 Subject: [llvm-commits] [llvm] r91944 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td ARMRegisterInfo.td Message-ID: <200912222354.nBMNsijI030671@zion.cs.uiuc.edu> Author: stoklund Date: Tue Dec 22 17:54:44 2009 New Revision: 91944 URL: http://llvm.org/viewvc/llvm-project?rev=91944&view=rev Log: Add a SPR register class to the ARM target. Certain Thumb instructions require only SP (e.g. tSTRspi). Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=91944&r1=91943&r2=91944&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Tue Dec 22 17:54:44 2009 @@ -113,7 +113,7 @@ def t_addrmode_sp : Operand, ComplexPattern { let PrintMethod = "printThumbAddrModeSPOperand"; - let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm); + let MIOperandInfo = (ops JustSP:$base, i32imm:$offsimm); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td?rev=91944&r1=91943&r2=91944&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td Tue Dec 22 17:54:44 2009 @@ -367,6 +367,19 @@ // Condition code registers. def CCR : RegisterClass<"ARM", [i32], 32, [CPSR]>; +// Just the stack pointer (for tSTRspi and friends). +def JustSP : RegisterClass<"ARM", [i32], 32, [SP]> { + let MethodProtos = [{ + iterator allocation_order_end(const MachineFunction &MF) const; + }]; + let MethodBodies = [{ + JustSPClass::iterator + JustSPClass::allocation_order_end(const MachineFunction &MF) const { + return allocation_order_begin(MF); + } + }]; +} + //===----------------------------------------------------------------------===// // Subregister Set Definitions... now that we have all of the pieces, define the // sub registers for each register. From stoklund at 2pi.dk Tue Dec 22 17:54:54 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Dec 2009 23:54:54 -0000 Subject: [llvm-commits] [llvm] r91945 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200912222354.nBMNssuJ030687@zion.cs.uiuc.edu> Author: stoklund Date: Tue Dec 22 17:54:54 2009 New Revision: 91945 URL: http://llvm.org/viewvc/llvm-project?rev=91945&view=rev Log: Add coalescer asserts. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=91945&r1=91944&r2=91945&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Dec 22 17:54:54 2009 @@ -2246,8 +2246,9 @@ continue; // Figure out the value # from the RHS. - LHSValsDefinedFromRHS[VNI]= - RHS.getLiveRangeContaining(VNI->def.getPrevSlot())->valno; + LiveRange *lr = RHS.getLiveRangeContaining(VNI->def.getPrevSlot()); + assert(lr && "Cannot find live range"); + LHSValsDefinedFromRHS[VNI] = lr->valno; } // Loop over the value numbers of the RHS, seeing if any are defined from @@ -2264,8 +2265,9 @@ continue; // Figure out the value # from the LHS. - RHSValsDefinedFromLHS[VNI]= - LHS.getLiveRangeContaining(VNI->def.getPrevSlot())->valno; + LiveRange *lr = LHS.getLiveRangeContaining(VNI->def.getPrevSlot()); + assert(lr && "Cannot find live range"); + RHSValsDefinedFromLHS[VNI] = lr->valno; } LHSValNoAssignments.resize(LHS.getNumValNums(), -1); From jyasskin at google.com Tue Dec 22 17:56:03 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Tue, 22 Dec 2009 15:56:03 -0800 Subject: [llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp In-Reply-To: References: <200912172135.nBHLZU71005142@zion.cs.uiuc.edu> Message-ID: Ok, committed as r91943. Sorry for the trouble. (I do have the same reservations as Nick, but if we're going to break you, we should _decide_ to break you, not do it accidentally. ;) Also, FYI, the fix for http://llvm.org/PR5737 is probably going to involve a change to the ModuleProvider interface. It'll still support everything it supports today, but you'll probably have to create Modules slightly differently. I'll try to remember to cc you on the patch for that. On Tue, Dec 22, 2009 at 2:45 PM, nicolas geoffray wrote: > Yes! That patch works great for me! > Thanks, > Nicolas > > On Tue, Dec 22, 2009 at 8:52 PM, Jeffrey Yasskin > wrote: >> >> On Mon, Dec 21, 2009 at 9:38 PM, nicolas geoffray >> wrote: >> > Hi Jeffrey, >> > >> >> >> >> Ah, I see now. You have your own ModuleProvider, and it needs to know >> >> precisely when the function is actually needed, right? Yeah, it sounds >> >> like I need to roll back that part of this fix until PR5737 is fixed. >> >> >> > >> > Yes, thanks! >> >> How's the attached patch look? I discovered that one of the >> isDeclaration()s was untested, so I added a test for it. > > From clattner at apple.com Tue Dec 22 18:01:10 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 16:01:10 -0800 Subject: [llvm-commits] [llvm] r91944 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td ARMRegisterInfo.td In-Reply-To: <200912222354.nBMNsijI030671@zion.cs.uiuc.edu> References: <200912222354.nBMNsijI030671@zion.cs.uiuc.edu> Message-ID: <0C388768-E586-4F09-A0B5-D7F69889436B@apple.com> On Dec 22, 2009, at 3:54 PM, Jakob Stoklund Olesen wrote: > Author: stoklund > Date: Tue Dec 22 17:54:44 2009 > New Revision: 91944 > > URL: http://llvm.org/viewvc/llvm-project?rev=91944&view=rev > Log: > Add a SPR register class to the ARM target. > > Certain Thumb instructions require only SP (e.g. tSTRspi). Hi Jakob, If it only allows one register, doesn't it make more sense to make it an implicit reg operand instead of a regclass operand? -Chris > > Modified: > llvm/trunk/lib/Target/ARM/ARMInstrThumb.td > llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td > > Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=91944&r1=91943&r2=91944&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) > +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Tue Dec 22 17:54:44 > 2009 > @@ -113,7 +113,7 @@ > def t_addrmode_sp : Operand, > ComplexPattern []> { > let PrintMethod = "printThumbAddrModeSPOperand"; > - let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm); > + let MIOperandInfo = (ops JustSP:$base, i32imm:$offsimm); > } > > // > = > = > = > ----------------------------------------------------------------------= > ==// > > Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td?rev=91944&r1=91943&r2=91944&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td (original) > +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td Tue Dec 22 17:54:44 > 2009 > @@ -367,6 +367,19 @@ > // Condition code registers. > def CCR : RegisterClass<"ARM", [i32], 32, [CPSR]>; > > +// Just the stack pointer (for tSTRspi and friends). > +def JustSP : RegisterClass<"ARM", [i32], 32, [SP]> { > + let MethodProtos = [{ > + iterator allocation_order_end(const MachineFunction &MF) const; > + }]; > + let MethodBodies = [{ > + JustSPClass::iterator > + JustSPClass::allocation_order_end(const MachineFunction &MF) > const { > + return allocation_order_begin(MF); > + } > + }]; > +} > + > // > = > = > = > ----------------------------------------------------------------------= > ==// > // Subregister Set Definitions... now that we have all of the > pieces, define the > // sub registers for each register. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Dec 22 18:05:09 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Dec 2009 00:05:09 -0000 Subject: [llvm-commits] [llvm] r91949 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200912230005.nBN059Hn031186@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 18:05:09 2009 New Revision: 91949 URL: http://llvm.org/viewvc/llvm-project?rev=91949&view=rev Log: Finish up node ordering in ExpandNode. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=91949&r1=91948&r2=91949&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 22 18:05:09 2009 @@ -142,7 +142,7 @@ SmallPtrSet &NodesLeadingTo); void LegalizeSetCCCondCode(EVT VT, SDValue &LHS, SDValue &RHS, SDValue &CC, - DebugLoc dl); + DebugLoc dl, unsigned Order); SDValue ExpandLibCall(RTLIB::Libcall LC, SDNode *Node, bool isSigned); SDValue ExpandFPLibCall(SDNode *Node, RTLIB::Libcall Call_F32, @@ -1633,7 +1633,7 @@ void SelectionDAGLegalize::LegalizeSetCCCondCode(EVT VT, SDValue &LHS, SDValue &RHS, SDValue &CC, - DebugLoc dl) { + DebugLoc dl, unsigned Order) { EVT OpVT = LHS.getValueType(); ISD::CondCode CCCode = cast(CC)->get(); switch (TLI.getCondCodeAction(CCCode, OpVT)) { @@ -1666,6 +1666,13 @@ LHS = DAG.getNode(Opc, dl, VT, SetCC1, SetCC2); RHS = SDValue(); CC = SDValue(); + + if (DisableScheduling) { + DAG.AssignOrdering(LHS.getNode(), Order); + DAG.AssignOrdering(SetCC1.getNode(), Order); + DAG.AssignOrdering(SetCC2.getNode(), Order); + } + break; } } @@ -2402,12 +2409,7 @@ Tmp1 = DAG.getLoad(VT, dl, Tmp4, VAList, NULL, 0); Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); - } - + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::VACOPY: { @@ -2523,18 +2525,13 @@ Node->getValueType(0)); Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); - } } else { Tmp1 = DAG.getUNDEF(Node->getValueType(0)); Results.push_back(Tmp1); Results.push_back(Node->getOperand(0)); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); } + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::STACKRESTORE: // Expand to CopyToReg if the target set StackPointerRegisterToSaveRestore. @@ -2703,12 +2700,7 @@ Node->getValueType(0)); Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); - } - + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::EXCEPTIONADDR: { @@ -2718,12 +2710,7 @@ Node->getValueType(0)); Results.push_back(Tmp1); Results.push_back(Results[0].getValue(1)); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Results[0].getValue(1).getNode(), Order); - } - + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SUB: { @@ -2757,10 +2744,13 @@ if (TLI.isOperationLegalOrCustom(DivRemOpc, VT)) { Tmp1 = DAG.getNode(DivRemOpc, dl, VTs, Tmp2, Tmp3).getValue(1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); } else if (TLI.isOperationLegalOrCustom(DivOpc, VT)) { // X % Y -> X-X/Y*Y Tmp1 = DAG.getNode(DivOpc, dl, VT, Tmp2, Tmp3); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); Tmp1 = DAG.getNode(ISD::MUL, dl, VT, Tmp1, Tmp3); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); Tmp1 = DAG.getNode(ISD::SUB, dl, VT, Tmp2, Tmp1); } else if (isSigned) { Tmp1 = ExpandIntLibCall(Node, true, @@ -2775,6 +2765,7 @@ } Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::UDIV: @@ -2797,6 +2788,7 @@ RTLIB::UDIV_I16, RTLIB::UDIV_I32, RTLIB::UDIV_I64, RTLIB::UDIV_I128); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::MULHU: @@ -2810,6 +2802,7 @@ Tmp1 = DAG.getNode(ExpandOpcode, dl, VTs, Node->getOperand(0), Node->getOperand(1)); Results.push_back(Tmp1.getValue(1)); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::MUL: { @@ -2825,6 +2818,7 @@ bool HasMULHS = TLI.isOperationLegalOrCustom(ISD::MULHS, VT); bool HasMULHU = TLI.isOperationLegalOrCustom(ISD::MULHU, VT); unsigned OpToUse = 0; + if (HasSMUL_LOHI && !HasMULHS) { OpToUse = ISD::SMUL_LOHI; } else if (HasUMUL_LOHI && !HasMULHU) { @@ -2834,16 +2828,21 @@ } else if (HasUMUL_LOHI) { OpToUse = ISD::UMUL_LOHI; } + if (OpToUse) { - Results.push_back(DAG.getNode(OpToUse, dl, VTs, Node->getOperand(0), - Node->getOperand(1))); + Tmp1 = DAG.getNode(OpToUse, dl, VTs, Node->getOperand(0), + Node->getOperand(1)); + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } + Tmp1 = ExpandIntLibCall(Node, false, RTLIB::MUL_I8, RTLIB::MUL_I16, RTLIB::MUL_I32, RTLIB::MUL_I64, RTLIB::MUL_I128); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SADDO: @@ -2854,8 +2853,9 @@ ISD::ADD : ISD::SUB, dl, LHS.getValueType(), LHS, RHS); Results.push_back(Sum); - EVT OType = Node->getValueType(1); + if (DisableScheduling) DAG.AssignOrdering(Sum.getNode(), Order); + EVT OType = Node->getValueType(1); SDValue Zero = DAG.getConstant(0, LHS.getValueType()); // LHSSign -> LHS >= 0 @@ -2878,6 +2878,16 @@ SDValue Cmp = DAG.getNode(ISD::AND, dl, OType, SignsMatch, SumSignNE); Results.push_back(Cmp); + + if (DisableScheduling) { + DAG.AssignOrdering(LHSSign.getNode(), Order); + DAG.AssignOrdering(RHSSign.getNode(), Order); + DAG.AssignOrdering(SignsMatch.getNode(), Order); + DAG.AssignOrdering(SumSign.getNode(), Order); + DAG.AssignOrdering(SumSignNE.getNode(), Order); + DAG.AssignOrdering(Cmp.getNode(), Order); + } + break; } case ISD::UADDO: @@ -2888,9 +2898,17 @@ ISD::ADD : ISD::SUB, dl, LHS.getValueType(), LHS, RHS); Results.push_back(Sum); - Results.push_back(DAG.getSetCC(dl, Node->getValueType(1), Sum, LHS, - Node->getOpcode () == ISD::UADDO ? - ISD::SETULT : ISD::SETUGT)); + + Tmp1 = DAG.getSetCC(dl, Node->getValueType(1), Sum, LHS, + Node->getOpcode () == ISD::UADDO ? + ISD::SETULT : ISD::SETUGT); + Results.push_back(Tmp1); + + if (DisableScheduling) { + DAG.AssignOrdering(Sum.getNode(), Order); + DAG.AssignOrdering(Tmp1.getNode(), Order); + } + break; } case ISD::UMULO: @@ -2904,6 +2922,7 @@ { { ISD::MULHU, ISD::UMUL_LOHI, ISD::ZERO_EXTEND }, { ISD::MULHS, ISD::SMUL_LOHI, ISD::SIGN_EXTEND }}; bool isSigned = Node->getOpcode() == ISD::SMULO; + if (TLI.isOperationLegalOrCustom(Ops[isSigned][0], VT)) { BottomHalf = DAG.getNode(ISD::MUL, dl, VT, LHS, RHS); TopHalf = DAG.getNode(Ops[isSigned][0], dl, VT, LHS, RHS); @@ -2920,6 +2939,12 @@ DAG.getIntPtrConstant(0)); TopHalf = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, VT, Tmp1, DAG.getIntPtrConstant(1)); + + if (DisableScheduling) { + DAG.AssignOrdering(LHS.getNode(), Order); + DAG.AssignOrdering(RHS.getNode(), Order); + DAG.AssignOrdering(Tmp1.getNode(), Order); + } } else { // FIXME: We should be able to fall back to a libcall with an illegal // type in some cases cases. @@ -2927,6 +2952,12 @@ // performance hit in the general case. llvm_unreachable("Don't know how to expand this operation yet!"); } + + if (DisableScheduling) { + DAG.AssignOrdering(BottomHalf.getNode(), Order); + DAG.AssignOrdering(TopHalf.getNode(), Order); + } + if (isSigned) { Tmp1 = DAG.getConstant(VT.getSizeInBits() - 1, TLI.getShiftAmountTy()); Tmp1 = DAG.getNode(ISD::SRA, dl, VT, BottomHalf, Tmp1); @@ -2936,34 +2967,52 @@ TopHalf = DAG.getSetCC(dl, TLI.getSetCCResultType(VT), TopHalf, DAG.getConstant(0, VT), ISD::SETNE); } + Results.push_back(BottomHalf); Results.push_back(TopHalf); + + if (DisableScheduling) { + DAG.AssignOrdering(BottomHalf.getNode(), Order); + DAG.AssignOrdering(TopHalf.getNode(), Order); + } + break; } case ISD::BUILD_PAIR: { EVT PairTy = Node->getValueType(0); Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, PairTy, Node->getOperand(0)); Tmp2 = DAG.getNode(ISD::ANY_EXTEND, dl, PairTy, Node->getOperand(1)); - Tmp2 = DAG.getNode(ISD::SHL, dl, PairTy, Tmp2, + Tmp3 = DAG.getNode(ISD::SHL, dl, PairTy, Tmp2, DAG.getConstant(PairTy.getSizeInBits()/2, TLI.getShiftAmountTy())); - Results.push_back(DAG.getNode(ISD::OR, dl, PairTy, Tmp1, Tmp2)); + Tmp4 = DAG.getNode(ISD::OR, dl, PairTy, Tmp1, Tmp3); + Results.push_back(Tmp4); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Tmp2.getNode(), Order); + DAG.AssignOrdering(Tmp3.getNode(), Order); + DAG.AssignOrdering(Tmp4.getNode(), Order); + } + break; } case ISD::SELECT: Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); Tmp3 = Node->getOperand(2); - if (Tmp1.getOpcode() == ISD::SETCC) { + + if (Tmp1.getOpcode() == ISD::SETCC) Tmp1 = DAG.getSelectCC(dl, Tmp1.getOperand(0), Tmp1.getOperand(1), Tmp2, Tmp3, cast(Tmp1.getOperand(2))->get()); - } else { + else Tmp1 = DAG.getSelectCC(dl, Tmp1, DAG.getConstant(0, Tmp1.getValueType()), Tmp2, Tmp3, ISD::SETNE); - } + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::BR_JT: { SDValue Chain = Node->getOperand(0); @@ -2973,9 +3022,11 @@ EVT PTy = TLI.getPointerTy(); MachineFunction &MF = DAG.getMachineFunction(); unsigned EntrySize = MF.getJumpTableInfo()->getEntrySize(); - Index= DAG.getNode(ISD::MUL, dl, PTy, + Index = DAG.getNode(ISD::MUL, dl, PTy, Index, DAG.getConstant(EntrySize, PTy)); + SDValue Addr = DAG.getNode(ISD::ADD, dl, PTy, Index, Table); + if (DisableScheduling) DAG.AssignOrdering(Addr.getNode(), Order); EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), EntrySize * 8); SDValue LD = DAG.getExtLoad(ISD::SEXTLOAD, dl, PTy, Chain, Addr, @@ -2983,13 +3034,24 @@ Addr = LD; if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) { // For PIC, the sequence is: - // BRIND(load(Jumptable + index) + RelocBase) + // + // BRIND(load(Jumptable + index) + RelocBase) + // // RelocBase can be JumpTable, GOT or some sort of global base. Addr = DAG.getNode(ISD::ADD, dl, PTy, Addr, TLI.getPICJumpTableRelocBase(Table, DAG)); + if (DisableScheduling) DAG.AssignOrdering(Addr.getNode(), Order); } + Tmp1 = DAG.getNode(ISD::BRIND, dl, MVT::Other, LD.getValue(1), Addr); Results.push_back(Tmp1); + + if (DisableScheduling) { + DAG.AssignOrdering(Tmp1.getNode(), Order); + DAG.AssignOrdering(Index.getNode(), Order); + DAG.AssignOrdering(LD.getNode(), Order); + } + break; } case ISD::BRCOND: @@ -2997,24 +3059,26 @@ // Node. Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); - if (Tmp2.getOpcode() == ISD::SETCC) { + + if (Tmp2.getOpcode() == ISD::SETCC) Tmp1 = DAG.getNode(ISD::BR_CC, dl, MVT::Other, Tmp1, Tmp2.getOperand(2), Tmp2.getOperand(0), Tmp2.getOperand(1), Node->getOperand(2)); - } else { + else Tmp1 = DAG.getNode(ISD::BR_CC, dl, MVT::Other, Tmp1, DAG.getCondCode(ISD::SETNE), Tmp2, DAG.getConstant(0, Tmp2.getValueType()), Node->getOperand(2)); - } + Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::SETCC: { Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); Tmp3 = Node->getOperand(2); - LegalizeSetCCCondCode(Node->getValueType(0), Tmp1, Tmp2, Tmp3, dl); + LegalizeSetCCCondCode(Node->getValueType(0), Tmp1, Tmp2, Tmp3, dl, Order); // If we expanded the SETCC into an AND/OR, return the new node if (Tmp2.getNode() == 0) { @@ -3028,6 +3092,7 @@ Tmp1 = DAG.getNode(ISD::SELECT_CC, dl, VT, Tmp1, Tmp2, DAG.getConstant(1, VT), DAG.getConstant(0, VT), Tmp3); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SELECT_CC: { @@ -3038,7 +3103,7 @@ SDValue CC = Node->getOperand(4); LegalizeSetCCCondCode(TLI.getSetCCResultType(Tmp1.getValueType()), - Tmp1, Tmp2, CC, dl); + Tmp1, Tmp2, CC, dl, Order); assert(!Tmp2.getNode() && "Can't legalize SELECT_CC with legal condition!"); Tmp2 = DAG.getConstant(0, Tmp1.getValueType()); @@ -3046,6 +3111,7 @@ Tmp1 = DAG.getNode(ISD::SELECT_CC, dl, Node->getValueType(0), Tmp1, Tmp2, Tmp3, Tmp4, CC); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::BR_CC: { @@ -3055,7 +3121,7 @@ Tmp4 = Node->getOperand(1); // CC LegalizeSetCCCondCode(TLI.getSetCCResultType(Tmp2.getValueType()), - Tmp2, Tmp3, Tmp4, dl); + Tmp2, Tmp3, Tmp4, dl, Order); LastCALLSEQ_END = DAG.getEntryNode(); assert(!Tmp3.getNode() && "Can't legalize BR_CC with legal condition!"); @@ -3064,6 +3130,7 @@ Tmp1 = DAG.getNode(ISD::BR_CC, dl, Node->getValueType(0), Tmp1, Tmp4, Tmp2, Tmp3, Node->getOperand(4)); Results.push_back(Tmp1); + if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::GLOBAL_OFFSET_TABLE: @@ -3081,6 +3148,7 @@ break; } } + void SelectionDAGLegalize::PromoteNode(SDNode *Node, SmallVectorImpl &Results) { EVT OVT = Node->getValueType(0); From stoklund at 2pi.dk Tue Dec 22 18:17:34 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Dec 2009 16:17:34 -0800 Subject: [llvm-commits] [llvm] r91944 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td ARMRegisterInfo.td In-Reply-To: <0C388768-E586-4F09-A0B5-D7F69889436B@apple.com> References: <200912222354.nBMNsijI030671@zion.cs.uiuc.edu> <0C388768-E586-4F09-A0B5-D7F69889436B@apple.com> Message-ID: <2B790CFB-500B-49FA-9B59-72ED1B2BBC2A@2pi.dk> On Dec 22, 2009, at 4:01 PM, Chris Lattner wrote: > > On Dec 22, 2009, at 3:54 PM, Jakob Stoklund Olesen wrote: > >> Author: stoklund >> Date: Tue Dec 22 17:54:44 2009 >> New Revision: 91944 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=91944&view=rev >> Log: >> Add a SPR register class to the ARM target. >> >> Certain Thumb instructions require only SP (e.g. tSTRspi). > > Hi Jakob, > > If it only allows one register, doesn't it make more sense to make it an implicit reg operand instead of a regclass operand? Maybe. How would it look in this pattern? def t_addrmode_sp : Operand, ComplexPattern { let PrintMethod = "printThumbAddrModeSPOperand"; let MIOperandInfo = (ops JustSP:$base, i32imm:$offsimm); } let canFoldAsLoad = 1 in def tLDRspi : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoadi, "ldr", "\t$dst, $addr", [(set tGPR:$dst, (load t_addrmode_sp:$addr))]>, T1LdStSP<{1,?,?}>; There is some magic in ARMDAGToDAGISel::SelectThumbAddrModeRI5 to make the pattern match. I would think that only eliminateFrameIndex() would be interested in SP-relative addressing, but I am not completely sure what is going on. I was trying to break as little as possible. /jakob From ggreif at gmail.com Tue Dec 22 18:18:40 2009 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 23 Dec 2009 00:18:40 -0000 Subject: [llvm-commits] [llvm] r91950 - /llvm/trunk/tools/ Message-ID: <200912230018.nBN0IetX031745@zion.cs.uiuc.edu> Author: ggreif Date: Tue Dec 22 18:18:40 2009 New Revision: 91950 URL: http://llvm.org/viewvc/llvm-project?rev=91950&view=rev Log: restore 'make update' functionality by not ignoring 'clang' here Modified: llvm/trunk/tools/ (props changed) Propchange: llvm/trunk/tools/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore (removed) @@ -1 +0,0 @@ -clang From isanbard at gmail.com Tue Dec 22 18:28:23 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Dec 2009 00:28:23 -0000 Subject: [llvm-commits] [llvm] r91953 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200912230028.nBN0SO2m032213@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 18:28:23 2009 New Revision: 91953 URL: http://llvm.org/viewvc/llvm-project?rev=91953&view=rev Log: Revert r91949 r91942 and r91936. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=91953&r1=91952&r2=91953&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 22 18:28:23 2009 @@ -142,7 +142,7 @@ SmallPtrSet &NodesLeadingTo); void LegalizeSetCCCondCode(EVT VT, SDValue &LHS, SDValue &RHS, SDValue &CC, - DebugLoc dl, unsigned Order); + DebugLoc dl); SDValue ExpandLibCall(RTLIB::Libcall LC, SDNode *Node, bool isSigned); SDValue ExpandFPLibCall(SDNode *Node, RTLIB::Libcall Call_F32, @@ -1633,7 +1633,7 @@ void SelectionDAGLegalize::LegalizeSetCCCondCode(EVT VT, SDValue &LHS, SDValue &RHS, SDValue &CC, - DebugLoc dl, unsigned Order) { + DebugLoc dl) { EVT OpVT = LHS.getValueType(); ISD::CondCode CCCode = cast(CC)->get(); switch (TLI.getCondCodeAction(CCCode, OpVT)) { @@ -1666,13 +1666,6 @@ LHS = DAG.getNode(Opc, dl, VT, SetCC1, SetCC2); RHS = SDValue(); CC = SDValue(); - - if (DisableScheduling) { - DAG.AssignOrdering(LHS.getNode(), Order); - DAG.AssignOrdering(SetCC1.getNode(), Order); - DAG.AssignOrdering(SetCC2.getNode(), Order); - } - break; } } @@ -2227,7 +2220,6 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node, SmallVectorImpl &Results) { DebugLoc dl = Node->getDebugLoc(); - unsigned Order = DAG.GetOrdering(Node); SDValue Tmp1, Tmp2, Tmp3, Tmp4; switch (Node->getOpcode()) { case ISD::CTPOP: @@ -2235,12 +2227,9 @@ case ISD::CTTZ: Tmp1 = ExpandBitCount(Node->getOpcode(), Node->getOperand(0), dl); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::BSWAP: - Tmp1 = ExpandBSWAP(Node->getOperand(0), dl); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandBSWAP(Node->getOperand(0), dl)); break; case ISD::FRAMEADDR: case ISD::RETURNADDR: @@ -2291,14 +2280,12 @@ Tmp1 = EmitStackConvert(Node->getOperand(0), Node->getValueType(0), Node->getValueType(0), dl); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FP_EXTEND: Tmp1 = EmitStackConvert(Node->getOperand(0), Node->getOperand(0).getValueType(), Node->getValueType(0), dl); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::SIGN_EXTEND_INREG: { // NOTE: we could fall back on load/store here too for targets without @@ -2315,14 +2302,8 @@ SDValue ShiftCst = DAG.getConstant(BitsDiff, ShiftAmountTy); Tmp1 = DAG.getNode(ISD::SHL, dl, Node->getValueType(0), Node->getOperand(0), ShiftCst); - Tmp2 = DAG.getNode(ISD::SRA, dl, Node->getValueType(0), Tmp1, ShiftCst); - Results.push_back(Tmp2); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - } - + Tmp1 = DAG.getNode(ISD::SRA, dl, Node->getValueType(0), Tmp1, ShiftCst); + Results.push_back(Tmp1); break; } case ISD::FP_ROUND_INREG: { @@ -2336,7 +2317,6 @@ Tmp1 = EmitStackConvert(Node->getOperand(0), ExtraVT, Node->getValueType(0), dl); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SINT_TO_FP: @@ -2344,7 +2324,6 @@ Tmp1 = ExpandLegalINT_TO_FP(Node->getOpcode() == ISD::SINT_TO_FP, Node->getOperand(0), Node->getValueType(0), dl); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FP_TO_UINT: { SDValue True, False; @@ -2353,35 +2332,19 @@ const uint64_t zero[] = {0, 0}; APFloat apf = APFloat(APInt(VT.getSizeInBits(), 2, zero)); APInt x = APInt::getSignBit(NVT.getSizeInBits()); - (void)apf.convertFromAPInt(x, false, APFloat::rmNearestTiesToEven); Tmp1 = DAG.getConstantFP(apf, VT); Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(VT), Node->getOperand(0), Tmp1, ISD::SETLT); - - if (DisableScheduling) DAG.AssignOrdering(Tmp2.getNode(), Order); - True = DAG.getNode(ISD::FP_TO_SINT, dl, NVT, Node->getOperand(0)); - Tmp1 = DAG.getNode(ISD::FSUB, dl, VT, Node->getOperand(0), Tmp1); - False = DAG.getNode(ISD::FP_TO_SINT, dl, NVT, Tmp1); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(True.getNode(), Order); - DAG.AssignOrdering(False.getNode(), Order); - } - + False = DAG.getNode(ISD::FP_TO_SINT, dl, NVT, + DAG.getNode(ISD::FSUB, dl, VT, + Node->getOperand(0), Tmp1)); False = DAG.getNode(ISD::XOR, dl, NVT, False, DAG.getConstant(x, NVT)); Tmp1 = DAG.getNode(ISD::SELECT, dl, NVT, Tmp2, True, False); Results.push_back(Tmp1); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(False.getNode(), Order); - } - break; } case ISD::VAARG: { @@ -2390,26 +2353,16 @@ Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); SDValue VAList = DAG.getLoad(TLI.getPointerTy(), dl, Tmp1, Tmp2, V, 0); - // Increment the pointer, VAList, to the next vaarg Tmp3 = DAG.getNode(ISD::ADD, dl, TLI.getPointerTy(), VAList, DAG.getConstant(TLI.getTargetData()-> - getTypeAllocSize(VT.getTypeForEVT(*DAG.getContext())), + getTypeAllocSize(VT.getTypeForEVT(*DAG.getContext())), TLI.getPointerTy())); - // Store the incremented VAList to the legalized pointer - Tmp4 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Tmp2, V, 0); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp3.getNode(), Order); - DAG.AssignOrdering(Tmp4.getNode(), Order); - } - + Tmp3 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Tmp2, V, 0); // Load the actual argument out of the pointer VAList - Tmp1 = DAG.getLoad(VT, dl, Tmp4, VAList, NULL, 0); - Results.push_back(Tmp1); + Results.push_back(DAG.getLoad(VT, dl, Tmp3, VAList, NULL, 0)); Results.push_back(Results[0].getValue(1)); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::VACOPY: { @@ -2419,14 +2372,8 @@ const Value *VS = cast(Node->getOperand(4))->getValue(); Tmp1 = DAG.getLoad(TLI.getPointerTy(), dl, Node->getOperand(0), Node->getOperand(2), VS, 0); - Tmp2 = DAG.getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1), VD, 0); - Results.push_back(Tmp2); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - } - + Tmp1 = DAG.getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1), VD, 0); + Results.push_back(Tmp1); break; } case ISD::EXTRACT_VECTOR_ELT: @@ -2436,32 +2383,22 @@ Node->getOperand(0)); else Tmp1 = ExpandExtractFromVectorThroughStack(SDValue(Node, 0)); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::EXTRACT_SUBVECTOR: - Tmp1 = ExpandExtractFromVectorThroughStack(SDValue(Node, 0)); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandExtractFromVectorThroughStack(SDValue(Node, 0))); break; case ISD::CONCAT_VECTORS: { - Tmp1 = ExpandVectorBuildThroughStack(Node); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandVectorBuildThroughStack(Node)); break; } case ISD::SCALAR_TO_VECTOR: - Tmp1 = ExpandSCALAR_TO_VECTOR(Node); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandSCALAR_TO_VECTOR(Node)); break; case ISD::INSERT_VECTOR_ELT: - Tmp1 = ExpandINSERT_VECTOR_ELT(Node->getOperand(0), - Node->getOperand(1), - Node->getOperand(2), dl); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandINSERT_VECTOR_ELT(Node->getOperand(0), + Node->getOperand(1), + Node->getOperand(2), dl)); break; case ISD::VECTOR_SHUFFLE: { SmallVector Mask; @@ -2471,83 +2408,65 @@ EVT EltVT = VT.getVectorElementType(); unsigned NumElems = VT.getVectorNumElements(); SmallVector Ops; - for (unsigned i = 0; i != NumElems; ++i) { if (Mask[i] < 0) { Ops.push_back(DAG.getUNDEF(EltVT)); continue; } - unsigned Idx = Mask[i]; if (Idx < NumElems) - Tmp1 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, - Node->getOperand(0), - DAG.getIntPtrConstant(Idx)); + Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, + Node->getOperand(0), + DAG.getIntPtrConstant(Idx))); else - Tmp1 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, - Node->getOperand(1), - DAG.getIntPtrConstant(Idx - NumElems)); - - Ops.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, + Node->getOperand(1), + DAG.getIntPtrConstant(Idx - NumElems))); } - Tmp1 = DAG.getNode(ISD::BUILD_VECTOR, dl, VT, &Ops[0], Ops.size()); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::EXTRACT_ELEMENT: { EVT OpTy = Node->getOperand(0).getValueType(); - if (cast(Node->getOperand(1))->getZExtValue()) { // 1 -> Hi Tmp1 = DAG.getNode(ISD::SRL, dl, OpTy, Node->getOperand(0), DAG.getConstant(OpTy.getSizeInBits()/2, TLI.getShiftAmountTy())); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); Tmp1 = DAG.getNode(ISD::TRUNCATE, dl, Node->getValueType(0), Tmp1); } else { // 0 -> Lo Tmp1 = DAG.getNode(ISD::TRUNCATE, dl, Node->getValueType(0), Node->getOperand(0)); } - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::STACKSAVE: // Expand to CopyFromReg if the target set // StackPointerRegisterToSaveRestore. if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) { - Tmp1 = DAG.getCopyFromReg(Node->getOperand(0), dl, SP, - Node->getValueType(0)); - Results.push_back(Tmp1); + Results.push_back(DAG.getCopyFromReg(Node->getOperand(0), dl, SP, + Node->getValueType(0))); Results.push_back(Results[0].getValue(1)); } else { - Tmp1 = DAG.getUNDEF(Node->getValueType(0)); - Results.push_back(Tmp1); + Results.push_back(DAG.getUNDEF(Node->getValueType(0))); Results.push_back(Node->getOperand(0)); } - - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::STACKRESTORE: - // Expand to CopyToReg if the target set StackPointerRegisterToSaveRestore. - if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) - Tmp1 = DAG.getCopyToReg(Node->getOperand(0), dl, SP, - Node->getOperand(1)); - else - Tmp1 = Node->getOperand(0); - - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + // Expand to CopyToReg if the target set + // StackPointerRegisterToSaveRestore. + if (unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) { + Results.push_back(DAG.getCopyToReg(Node->getOperand(0), dl, SP, + Node->getOperand(1))); + } else { + Results.push_back(Node->getOperand(0)); + } break; case ISD::FCOPYSIGN: - Tmp1 = ExpandFCOPYSIGN(Node); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFCOPYSIGN(Node)); break; case ISD::FNEG: // Expand Y = FNEG(X) -> Y = SUB -0.0, X @@ -2555,162 +2474,113 @@ Tmp1 = DAG.getNode(ISD::FSUB, dl, Node->getValueType(0), Tmp1, Node->getOperand(0)); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::FABS: { // Expand Y = FABS(X) -> Y = (X >u 0.0) ? X : fneg(X). EVT VT = Node->getValueType(0); Tmp1 = Node->getOperand(0); Tmp2 = DAG.getConstantFP(0.0, VT); - Tmp3 = DAG.getSetCC(dl, TLI.getSetCCResultType(Tmp1.getValueType()), + Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(Tmp1.getValueType()), Tmp1, Tmp2, ISD::SETUGT); - Tmp4 = DAG.getNode(ISD::FNEG, dl, VT, Tmp1); - Tmp1 = DAG.getNode(ISD::SELECT, dl, VT, Tmp3, Tmp1, Tmp4); + Tmp3 = DAG.getNode(ISD::FNEG, dl, VT, Tmp1); + Tmp1 = DAG.getNode(ISD::SELECT, dl, VT, Tmp2, Tmp1, Tmp3); Results.push_back(Tmp1); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp3.getNode(), Order); - DAG.AssignOrdering(Tmp4.getNode(), Order); - } - break; } case ISD::FSQRT: - Tmp1 = ExpandFPLibCall(Node, RTLIB::SQRT_F32, RTLIB::SQRT_F64, - RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::SQRT_F32, RTLIB::SQRT_F64, + RTLIB::SQRT_F80, RTLIB::SQRT_PPCF128)); break; case ISD::FSIN: - Tmp1 = ExpandFPLibCall(Node, RTLIB::SIN_F32, RTLIB::SIN_F64, - RTLIB::SIN_F80, RTLIB::SIN_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::SIN_F32, RTLIB::SIN_F64, + RTLIB::SIN_F80, RTLIB::SIN_PPCF128)); break; case ISD::FCOS: - Tmp1 = ExpandFPLibCall(Node, RTLIB::COS_F32, RTLIB::COS_F64, - RTLIB::COS_F80, RTLIB::COS_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::COS_F32, RTLIB::COS_F64, + RTLIB::COS_F80, RTLIB::COS_PPCF128)); break; case ISD::FLOG: - Tmp1 = ExpandFPLibCall(Node, RTLIB::LOG_F32, RTLIB::LOG_F64, - RTLIB::LOG_F80, RTLIB::LOG_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::LOG_F32, RTLIB::LOG_F64, + RTLIB::LOG_F80, RTLIB::LOG_PPCF128)); break; case ISD::FLOG2: - Tmp1 = ExpandFPLibCall(Node, RTLIB::LOG2_F32, RTLIB::LOG2_F64, - RTLIB::LOG2_F80, RTLIB::LOG2_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::LOG2_F32, RTLIB::LOG2_F64, + RTLIB::LOG2_F80, RTLIB::LOG2_PPCF128)); break; case ISD::FLOG10: - Tmp1 = ExpandFPLibCall(Node, RTLIB::LOG10_F32, RTLIB::LOG10_F64, - RTLIB::LOG10_F80, RTLIB::LOG10_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::LOG10_F32, RTLIB::LOG10_F64, + RTLIB::LOG10_F80, RTLIB::LOG10_PPCF128)); break; case ISD::FEXP: - Tmp1 = ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64, - RTLIB::EXP_F80, RTLIB::EXP_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64, + RTLIB::EXP_F80, RTLIB::EXP_PPCF128)); break; case ISD::FEXP2: - Tmp1 = ExpandFPLibCall(Node, RTLIB::EXP2_F32, RTLIB::EXP2_F64, - RTLIB::EXP2_F80, RTLIB::EXP2_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::EXP2_F32, RTLIB::EXP2_F64, + RTLIB::EXP2_F80, RTLIB::EXP2_PPCF128)); break; case ISD::FTRUNC: - Tmp1 = ExpandFPLibCall(Node, RTLIB::TRUNC_F32, RTLIB::TRUNC_F64, - RTLIB::TRUNC_F80, RTLIB::TRUNC_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::TRUNC_F32, RTLIB::TRUNC_F64, + RTLIB::TRUNC_F80, RTLIB::TRUNC_PPCF128)); break; case ISD::FFLOOR: - Tmp1 = ExpandFPLibCall(Node, RTLIB::FLOOR_F32, RTLIB::FLOOR_F64, - RTLIB::FLOOR_F80, RTLIB::FLOOR_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::FLOOR_F32, RTLIB::FLOOR_F64, + RTLIB::FLOOR_F80, RTLIB::FLOOR_PPCF128)); break; case ISD::FCEIL: - Tmp1 = ExpandFPLibCall(Node, RTLIB::CEIL_F32, RTLIB::CEIL_F64, - RTLIB::CEIL_F80, RTLIB::CEIL_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::CEIL_F32, RTLIB::CEIL_F64, + RTLIB::CEIL_F80, RTLIB::CEIL_PPCF128)); break; case ISD::FRINT: - Tmp1 = ExpandFPLibCall(Node, RTLIB::RINT_F32, RTLIB::RINT_F64, - RTLIB::RINT_F80, RTLIB::RINT_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::RINT_F32, RTLIB::RINT_F64, + RTLIB::RINT_F80, RTLIB::RINT_PPCF128)); break; case ISD::FNEARBYINT: - Tmp1 = ExpandFPLibCall(Node, RTLIB::NEARBYINT_F32, - RTLIB::NEARBYINT_F64, - RTLIB::NEARBYINT_F80, - RTLIB::NEARBYINT_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::NEARBYINT_F32, + RTLIB::NEARBYINT_F64, + RTLIB::NEARBYINT_F80, + RTLIB::NEARBYINT_PPCF128)); break; case ISD::FPOWI: - Tmp1 = ExpandFPLibCall(Node, RTLIB::POWI_F32, RTLIB::POWI_F64, - RTLIB::POWI_F80, RTLIB::POWI_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::POWI_F32, RTLIB::POWI_F64, + RTLIB::POWI_F80, RTLIB::POWI_PPCF128)); break; case ISD::FPOW: - Tmp1 = ExpandFPLibCall(Node, RTLIB::POW_F32, RTLIB::POW_F64, - RTLIB::POW_F80, RTLIB::POW_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::POW_F32, RTLIB::POW_F64, + RTLIB::POW_F80, RTLIB::POW_PPCF128)); break; case ISD::FDIV: - Tmp1 = ExpandFPLibCall(Node, RTLIB::DIV_F32, RTLIB::DIV_F64, - RTLIB::DIV_F80, RTLIB::DIV_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::DIV_F32, RTLIB::DIV_F64, + RTLIB::DIV_F80, RTLIB::DIV_PPCF128)); break; case ISD::FREM: - Tmp1 = ExpandFPLibCall(Node, RTLIB::REM_F32, RTLIB::REM_F64, - RTLIB::REM_F80, RTLIB::REM_PPCF128); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandFPLibCall(Node, RTLIB::REM_F32, RTLIB::REM_F64, + RTLIB::REM_F80, RTLIB::REM_PPCF128)); break; case ISD::ConstantFP: { ConstantFPSDNode *CFP = cast(Node); - // Check to see if this FP immediate is already legal. If this is a legal - // constant, turn it into a TargetConstantFP node. + // Check to see if this FP immediate is already legal. + // If this is a legal constant, turn it into a TargetConstantFP node. if (TLI.isFPImmLegal(CFP->getValueAPF(), Node->getValueType(0))) - Tmp1 = SDValue(Node, 0); + Results.push_back(SDValue(Node, 0)); else - Tmp1 = ExpandConstantFP(CFP, true, DAG, TLI); - - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(ExpandConstantFP(CFP, true, DAG, TLI)); break; } case ISD::EHSELECTION: { unsigned Reg = TLI.getExceptionSelectorRegister(); assert(Reg && "Can't expand to unknown register!"); - Tmp1 = DAG.getCopyFromReg(Node->getOperand(1), dl, Reg, - Node->getValueType(0)); - Results.push_back(Tmp1); + Results.push_back(DAG.getCopyFromReg(Node->getOperand(1), dl, Reg, + Node->getValueType(0))); Results.push_back(Results[0].getValue(1)); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::EXCEPTIONADDR: { unsigned Reg = TLI.getExceptionAddressRegister(); assert(Reg && "Can't expand to unknown register!"); - Tmp1 = DAG.getCopyFromReg(Node->getOperand(0), dl, Reg, - Node->getValueType(0)); - Results.push_back(Tmp1); + Results.push_back(DAG.getCopyFromReg(Node->getOperand(0), dl, Reg, + Node->getValueType(0))); Results.push_back(Results[0].getValue(1)); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SUB: { @@ -2720,16 +2590,8 @@ "Don't know how to expand this subtraction!"); Tmp1 = DAG.getNode(ISD::XOR, dl, VT, Node->getOperand(1), DAG.getConstant(APInt::getAllOnesValue(VT.getSizeInBits()), VT)); - Tmp2 = DAG.getNode(ISD::ADD, dl, VT, Tmp2, DAG.getConstant(1, VT)); - Tmp3 = DAG.getNode(ISD::ADD, dl, VT, Node->getOperand(0), Tmp2); - Results.push_back(Tmp3); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - DAG.AssignOrdering(Tmp3.getNode(), Order); - } - + Tmp1 = DAG.getNode(ISD::ADD, dl, VT, Tmp2, DAG.getConstant(1, VT)); + Results.push_back(DAG.getNode(ISD::ADD, dl, VT, Node->getOperand(0), Tmp1)); break; } case ISD::UREM: @@ -2741,16 +2603,12 @@ unsigned DivRemOpc = isSigned ? ISD::SDIVREM : ISD::UDIVREM; Tmp2 = Node->getOperand(0); Tmp3 = Node->getOperand(1); - if (TLI.isOperationLegalOrCustom(DivRemOpc, VT)) { Tmp1 = DAG.getNode(DivRemOpc, dl, VTs, Tmp2, Tmp3).getValue(1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); } else if (TLI.isOperationLegalOrCustom(DivOpc, VT)) { // X % Y -> X-X/Y*Y Tmp1 = DAG.getNode(DivOpc, dl, VT, Tmp2, Tmp3); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); Tmp1 = DAG.getNode(ISD::MUL, dl, VT, Tmp1, Tmp3); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); Tmp1 = DAG.getNode(ISD::SUB, dl, VT, Tmp2, Tmp1); } else if (isSigned) { Tmp1 = ExpandIntLibCall(Node, true, @@ -2763,9 +2621,7 @@ RTLIB::UREM_I16, RTLIB::UREM_I32, RTLIB::UREM_I64, RTLIB::UREM_I128); } - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::UDIV: @@ -2788,7 +2644,6 @@ RTLIB::UDIV_I16, RTLIB::UDIV_I32, RTLIB::UDIV_I64, RTLIB::UDIV_I128); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::MULHU: @@ -2802,7 +2657,6 @@ Tmp1 = DAG.getNode(ExpandOpcode, dl, VTs, Node->getOperand(0), Node->getOperand(1)); Results.push_back(Tmp1.getValue(1)); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::MUL: { @@ -2818,7 +2672,6 @@ bool HasMULHS = TLI.isOperationLegalOrCustom(ISD::MULHS, VT); bool HasMULHU = TLI.isOperationLegalOrCustom(ISD::MULHU, VT); unsigned OpToUse = 0; - if (HasSMUL_LOHI && !HasMULHS) { OpToUse = ISD::SMUL_LOHI; } else if (HasUMUL_LOHI && !HasMULHU) { @@ -2828,21 +2681,16 @@ } else if (HasUMUL_LOHI) { OpToUse = ISD::UMUL_LOHI; } - if (OpToUse) { - Tmp1 = DAG.getNode(OpToUse, dl, VTs, Node->getOperand(0), - Node->getOperand(1)); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Results.push_back(DAG.getNode(OpToUse, dl, VTs, Node->getOperand(0), + Node->getOperand(1))); break; } - Tmp1 = ExpandIntLibCall(Node, false, RTLIB::MUL_I8, RTLIB::MUL_I16, RTLIB::MUL_I32, RTLIB::MUL_I64, RTLIB::MUL_I128); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SADDO: @@ -2853,9 +2701,8 @@ ISD::ADD : ISD::SUB, dl, LHS.getValueType(), LHS, RHS); Results.push_back(Sum); - if (DisableScheduling) DAG.AssignOrdering(Sum.getNode(), Order); - EVT OType = Node->getValueType(1); + SDValue Zero = DAG.getConstant(0, LHS.getValueType()); // LHSSign -> LHS >= 0 @@ -2878,16 +2725,6 @@ SDValue Cmp = DAG.getNode(ISD::AND, dl, OType, SignsMatch, SumSignNE); Results.push_back(Cmp); - - if (DisableScheduling) { - DAG.AssignOrdering(LHSSign.getNode(), Order); - DAG.AssignOrdering(RHSSign.getNode(), Order); - DAG.AssignOrdering(SignsMatch.getNode(), Order); - DAG.AssignOrdering(SumSign.getNode(), Order); - DAG.AssignOrdering(SumSignNE.getNode(), Order); - DAG.AssignOrdering(Cmp.getNode(), Order); - } - break; } case ISD::UADDO: @@ -2898,17 +2735,9 @@ ISD::ADD : ISD::SUB, dl, LHS.getValueType(), LHS, RHS); Results.push_back(Sum); - - Tmp1 = DAG.getSetCC(dl, Node->getValueType(1), Sum, LHS, - Node->getOpcode () == ISD::UADDO ? - ISD::SETULT : ISD::SETUGT); - Results.push_back(Tmp1); - - if (DisableScheduling) { - DAG.AssignOrdering(Sum.getNode(), Order); - DAG.AssignOrdering(Tmp1.getNode(), Order); - } - + Results.push_back(DAG.getSetCC(dl, Node->getValueType(1), Sum, LHS, + Node->getOpcode () == ISD::UADDO ? + ISD::SETULT : ISD::SETUGT)); break; } case ISD::UMULO: @@ -2922,7 +2751,6 @@ { { ISD::MULHU, ISD::UMUL_LOHI, ISD::ZERO_EXTEND }, { ISD::MULHS, ISD::SMUL_LOHI, ISD::SIGN_EXTEND }}; bool isSigned = Node->getOpcode() == ISD::SMULO; - if (TLI.isOperationLegalOrCustom(Ops[isSigned][0], VT)) { BottomHalf = DAG.getNode(ISD::MUL, dl, VT, LHS, RHS); TopHalf = DAG.getNode(Ops[isSigned][0], dl, VT, LHS, RHS); @@ -2939,12 +2767,6 @@ DAG.getIntPtrConstant(0)); TopHalf = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, VT, Tmp1, DAG.getIntPtrConstant(1)); - - if (DisableScheduling) { - DAG.AssignOrdering(LHS.getNode(), Order); - DAG.AssignOrdering(RHS.getNode(), Order); - DAG.AssignOrdering(Tmp1.getNode(), Order); - } } else { // FIXME: We should be able to fall back to a libcall with an illegal // type in some cases cases. @@ -2952,12 +2774,6 @@ // performance hit in the general case. llvm_unreachable("Don't know how to expand this operation yet!"); } - - if (DisableScheduling) { - DAG.AssignOrdering(BottomHalf.getNode(), Order); - DAG.AssignOrdering(TopHalf.getNode(), Order); - } - if (isSigned) { Tmp1 = DAG.getConstant(VT.getSizeInBits() - 1, TLI.getShiftAmountTy()); Tmp1 = DAG.getNode(ISD::SRA, dl, VT, BottomHalf, Tmp1); @@ -2967,52 +2783,34 @@ TopHalf = DAG.getSetCC(dl, TLI.getSetCCResultType(VT), TopHalf, DAG.getConstant(0, VT), ISD::SETNE); } - Results.push_back(BottomHalf); Results.push_back(TopHalf); - - if (DisableScheduling) { - DAG.AssignOrdering(BottomHalf.getNode(), Order); - DAG.AssignOrdering(TopHalf.getNode(), Order); - } - break; } case ISD::BUILD_PAIR: { EVT PairTy = Node->getValueType(0); Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, PairTy, Node->getOperand(0)); Tmp2 = DAG.getNode(ISD::ANY_EXTEND, dl, PairTy, Node->getOperand(1)); - Tmp3 = DAG.getNode(ISD::SHL, dl, PairTy, Tmp2, + Tmp2 = DAG.getNode(ISD::SHL, dl, PairTy, Tmp2, DAG.getConstant(PairTy.getSizeInBits()/2, TLI.getShiftAmountTy())); - Tmp4 = DAG.getNode(ISD::OR, dl, PairTy, Tmp1, Tmp3); - Results.push_back(Tmp4); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - DAG.AssignOrdering(Tmp3.getNode(), Order); - DAG.AssignOrdering(Tmp4.getNode(), Order); - } - + Results.push_back(DAG.getNode(ISD::OR, dl, PairTy, Tmp1, Tmp2)); break; } case ISD::SELECT: Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); Tmp3 = Node->getOperand(2); - - if (Tmp1.getOpcode() == ISD::SETCC) + if (Tmp1.getOpcode() == ISD::SETCC) { Tmp1 = DAG.getSelectCC(dl, Tmp1.getOperand(0), Tmp1.getOperand(1), Tmp2, Tmp3, cast(Tmp1.getOperand(2))->get()); - else + } else { Tmp1 = DAG.getSelectCC(dl, Tmp1, DAG.getConstant(0, Tmp1.getValueType()), Tmp2, Tmp3, ISD::SETNE); - + } Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::BR_JT: { SDValue Chain = Node->getOperand(0); @@ -3022,11 +2820,9 @@ EVT PTy = TLI.getPointerTy(); MachineFunction &MF = DAG.getMachineFunction(); unsigned EntrySize = MF.getJumpTableInfo()->getEntrySize(); - Index = DAG.getNode(ISD::MUL, dl, PTy, + Index= DAG.getNode(ISD::MUL, dl, PTy, Index, DAG.getConstant(EntrySize, PTy)); - SDValue Addr = DAG.getNode(ISD::ADD, dl, PTy, Index, Table); - if (DisableScheduling) DAG.AssignOrdering(Addr.getNode(), Order); EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), EntrySize * 8); SDValue LD = DAG.getExtLoad(ISD::SEXTLOAD, dl, PTy, Chain, Addr, @@ -3034,24 +2830,13 @@ Addr = LD; if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) { // For PIC, the sequence is: - // - // BRIND(load(Jumptable + index) + RelocBase) - // + // BRIND(load(Jumptable + index) + RelocBase) // RelocBase can be JumpTable, GOT or some sort of global base. Addr = DAG.getNode(ISD::ADD, dl, PTy, Addr, TLI.getPICJumpTableRelocBase(Table, DAG)); - if (DisableScheduling) DAG.AssignOrdering(Addr.getNode(), Order); } - Tmp1 = DAG.getNode(ISD::BRIND, dl, MVT::Other, LD.getValue(1), Addr); Results.push_back(Tmp1); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Index.getNode(), Order); - DAG.AssignOrdering(LD.getNode(), Order); - } - break; } case ISD::BRCOND: @@ -3059,26 +2844,24 @@ // Node. Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); - - if (Tmp2.getOpcode() == ISD::SETCC) + if (Tmp2.getOpcode() == ISD::SETCC) { Tmp1 = DAG.getNode(ISD::BR_CC, dl, MVT::Other, Tmp1, Tmp2.getOperand(2), Tmp2.getOperand(0), Tmp2.getOperand(1), Node->getOperand(2)); - else + } else { Tmp1 = DAG.getNode(ISD::BR_CC, dl, MVT::Other, Tmp1, DAG.getCondCode(ISD::SETNE), Tmp2, DAG.getConstant(0, Tmp2.getValueType()), Node->getOperand(2)); - + } Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::SETCC: { Tmp1 = Node->getOperand(0); Tmp2 = Node->getOperand(1); Tmp3 = Node->getOperand(2); - LegalizeSetCCCondCode(Node->getValueType(0), Tmp1, Tmp2, Tmp3, dl, Order); + LegalizeSetCCCondCode(Node->getValueType(0), Tmp1, Tmp2, Tmp3, dl); // If we expanded the SETCC into an AND/OR, return the new node if (Tmp2.getNode() == 0) { @@ -3092,7 +2875,6 @@ Tmp1 = DAG.getNode(ISD::SELECT_CC, dl, VT, Tmp1, Tmp2, DAG.getConstant(1, VT), DAG.getConstant(0, VT), Tmp3); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SELECT_CC: { @@ -3103,7 +2885,7 @@ SDValue CC = Node->getOperand(4); LegalizeSetCCCondCode(TLI.getSetCCResultType(Tmp1.getValueType()), - Tmp1, Tmp2, CC, dl, Order); + Tmp1, Tmp2, CC, dl); assert(!Tmp2.getNode() && "Can't legalize SELECT_CC with legal condition!"); Tmp2 = DAG.getConstant(0, Tmp1.getValueType()); @@ -3111,7 +2893,6 @@ Tmp1 = DAG.getNode(ISD::SELECT_CC, dl, Node->getValueType(0), Tmp1, Tmp2, Tmp3, Tmp4, CC); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::BR_CC: { @@ -3121,7 +2902,7 @@ Tmp4 = Node->getOperand(1); // CC LegalizeSetCCCondCode(TLI.getSetCCResultType(Tmp2.getValueType()), - Tmp2, Tmp3, Tmp4, dl, Order); + Tmp2, Tmp3, Tmp4, dl); LastCALLSEQ_END = DAG.getEntryNode(); assert(!Tmp3.getNode() && "Can't legalize BR_CC with legal condition!"); @@ -3130,7 +2911,6 @@ Tmp1 = DAG.getNode(ISD::BR_CC, dl, Node->getValueType(0), Tmp1, Tmp4, Tmp2, Tmp3, Node->getOperand(4)); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::GLOBAL_OFFSET_TABLE: @@ -3148,33 +2928,25 @@ break; } } - void SelectionDAGLegalize::PromoteNode(SDNode *Node, SmallVectorImpl &Results) { EVT OVT = Node->getValueType(0); - if (Node->getOpcode() == ISD::UINT_TO_FP || Node->getOpcode() == ISD::SINT_TO_FP || - Node->getOpcode() == ISD::SETCC) + Node->getOpcode() == ISD::SETCC) { OVT = Node->getOperand(0).getValueType(); - + } EVT NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), OVT); DebugLoc dl = Node->getDebugLoc(); - unsigned Order = DAG.GetOrdering(Node); SDValue Tmp1, Tmp2, Tmp3; - switch (Node->getOpcode()) { case ISD::CTTZ: case ISD::CTLZ: case ISD::CTPOP: // Zero extend the argument. Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Node->getOperand(0)); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); - // Perform the larger operation. Tmp1 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); - if (Node->getOpcode() == ISD::CTTZ) { //if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT) Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(NVT), @@ -3182,37 +2954,21 @@ ISD::SETEQ); Tmp1 = DAG.getNode(ISD::SELECT, dl, NVT, Tmp2, DAG.getConstant(OVT.getSizeInBits(), NVT), Tmp1); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - } } else if (Node->getOpcode() == ISD::CTLZ) { // Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT)) Tmp1 = DAG.getNode(ISD::SUB, dl, NVT, Tmp1, DAG.getConstant(NVT.getSizeInBits() - OVT.getSizeInBits(), NVT)); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); } - - Tmp3 = DAG.getNode(ISD::TRUNCATE, dl, OVT, Tmp1); - Results.push_back(Tmp3); - if (DisableScheduling) DAG.AssignOrdering(Tmp3.getNode(), Order); + Results.push_back(DAG.getNode(ISD::TRUNCATE, dl, OVT, Tmp1)); break; case ISD::BSWAP: { unsigned DiffBits = NVT.getSizeInBits() - OVT.getSizeInBits(); Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, dl, NVT, Node->getOperand(0)); - Tmp2 = DAG.getNode(ISD::BSWAP, dl, NVT, Tmp1); - Tmp3 = DAG.getNode(ISD::SRL, dl, NVT, Tmp2, - DAG.getConstant(DiffBits, TLI.getShiftAmountTy())); - Results.push_back(Tmp3); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - DAG.AssignOrdering(Tmp3.getNode(), Order); - } - + Tmp1 = DAG.getNode(ISD::BSWAP, dl, NVT, Tmp1); + Tmp1 = DAG.getNode(ISD::SRL, dl, NVT, Tmp1, + DAG.getConstant(DiffBits, TLI.getShiftAmountTy())); + Results.push_back(Tmp1); break; } case ISD::FP_TO_UINT: @@ -3220,14 +2976,12 @@ Tmp1 = PromoteLegalFP_TO_INT(Node->getOperand(0), Node->getValueType(0), Node->getOpcode() == ISD::FP_TO_SINT, dl); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::UINT_TO_FP: case ISD::SINT_TO_FP: Tmp1 = PromoteLegalINT_TO_FP(Node->getOperand(0), Node->getValueType(0), Node->getOpcode() == ISD::SINT_TO_FP, dl); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; case ISD::AND: case ISD::OR: @@ -3242,23 +2996,12 @@ } else { llvm_report_error("Cannot promote logic operation"); } - // Promote each of the values to the new type. Tmp1 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(0)); Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1)); - // Perform the larger operation, then convert back - Tmp3 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1, Tmp2); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - DAG.AssignOrdering(Tmp3.getNode(), Order); - } - - Tmp1 = DAG.getNode(TruncOp, dl, OVT, Tmp3); - Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); + Tmp1 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1, Tmp2); + Results.push_back(DAG.getNode(TruncOp, dl, OVT, Tmp1)); break; } case ISD::SELECT: { @@ -3273,34 +3016,18 @@ ExtOp = ISD::FP_EXTEND; TruncOp = ISD::FP_ROUND; } - Tmp1 = Node->getOperand(0); - // Promote each of the values to the new type. Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1)); Tmp3 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(2)); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp2.getNode(), Order); - DAG.AssignOrdering(Tmp3.getNode(), Order); - } - // Perform the larger operation, then round down. Tmp1 = DAG.getNode(ISD::SELECT, dl, NVT, Tmp1, Tmp2, Tmp3); - if (TruncOp != ISD::FP_ROUND) - Tmp2 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1); + Tmp1 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1); else - Tmp2 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1, + Tmp1 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1, DAG.getIntPtrConstant(0)); - - Results.push_back(Tmp2); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - } - + Results.push_back(Tmp1); break; } case ISD::VECTOR_SHUFFLE: { @@ -3312,17 +3039,9 @@ Tmp2 = DAG.getNode(ISD::BIT_CONVERT, dl, NVT, Node->getOperand(1)); // Convert the shuffle mask to the right # elements. - Tmp3 = ShuffleWithNarrowerEltType(NVT, OVT, dl, Tmp1, Tmp2, Mask); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - DAG.AssignOrdering(Tmp3.getNode(), Order); - } - - Tmp1 = DAG.getNode(ISD::BIT_CONVERT, dl, OVT, Tmp3); + Tmp1 = ShuffleWithNarrowerEltType(NVT, OVT, dl, Tmp1, Tmp2, Mask); + Tmp1 = DAG.getNode(ISD::BIT_CONVERT, dl, OVT, Tmp1); Results.push_back(Tmp1); - if (DisableScheduling) DAG.AssignOrdering(Tmp1.getNode(), Order); break; } case ISD::SETCC: { @@ -3332,17 +3051,10 @@ cast(Node->getOperand(2))->get(); ExtOp = isSignedIntSetCC(CCCode) ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND; } - Tmp1 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(0)); Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1)); Results.push_back(DAG.getNode(ISD::SETCC, dl, Node->getValueType(0), Tmp1, Tmp2, Node->getOperand(2))); - - if (DisableScheduling) { - DAG.AssignOrdering(Tmp1.getNode(), Order); - DAG.AssignOrdering(Tmp2.getNode(), Order); - } - break; } } From clattner at apple.com Tue Dec 22 18:29:19 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 16:29:19 -0800 Subject: [llvm-commits] [llvm] r91944 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td ARMRegisterInfo.td In-Reply-To: <2B790CFB-500B-49FA-9B59-72ED1B2BBC2A@2pi.dk> References: <200912222354.nBMNsijI030671@zion.cs.uiuc.edu> <0C388768-E586-4F09-A0B5-D7F69889436B@apple.com> <2B790CFB-500B-49FA-9B59-72ED1B2BBC2A@2pi.dk> Message-ID: On Dec 22, 2009, at 4:17 PM, Jakob Stoklund Olesen wrote: > > On Dec 22, 2009, at 4:01 PM, Chris Lattner wrote: > >> >> On Dec 22, 2009, at 3:54 PM, Jakob Stoklund Olesen wrote: >> >>> Author: stoklund >>> Date: Tue Dec 22 17:54:44 2009 >>> New Revision: 91944 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=91944&view=rev >>> Log: >>> Add a SPR register class to the ARM target. >>> >>> Certain Thumb instructions require only SP (e.g. tSTRspi). >> >> Hi Jakob, >> >> If it only allows one register, doesn't it make more sense to make >> it an implicit reg operand instead of a regclass operand? > > Maybe. How would it look in this pattern? > > def t_addrmode_sp : Operand, > ComplexPattern []> { > let PrintMethod = "printThumbAddrModeSPOperand"; > let MIOperandInfo = (ops JustSP:$base, i32imm:$offsimm); > } Eww, gross. :) Two separate issues: 1. How to model this: This instruction should be modeled as taking SP as an implicit input, and take an i32imm operand. I think this should be pretty simple and any non-isel code that generates this can easily adjust to not passing in SP. 2. How to match this: If you really want dag isel to match these as loads, you'd need to write a pat pattern (or manual matching) that matches load(addr) and uses an SDNodeTransform to extract the immediate, maybe something like this: Pat<(load (t_addrmode_sp:$addr)), (tLDRspi (EXTRACT_IMM_FROM_ADDRMODE_SP t_addrmode_sp:$addr))>; Some simple examples of sdnode transforms are things like this from PPC: def : Pat<(i32 imm:$imm), (ORI (LIS (HI16 imm:$imm)), (LO16 imm:$imm))>; Which matches an arbitrary 32-bit immediate with a "ori" and "lis" instruction to get the two 16-bit halves. > I was trying to break as little as possible. I appreciate that, but single-register register classes aren't really register classes :). Thanks for working on this! -Chris From echristo at apple.com Tue Dec 22 18:29:50 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 23 Dec 2009 00:29:50 -0000 Subject: [llvm-commits] [llvm] r91954 - /llvm/trunk/docs/LangRef.html Message-ID: <200912230029.nBN0ToAV032280@zion.cs.uiuc.edu> Author: echristo Date: Tue Dec 22 18:29:49 2009 New Revision: 91954 URL: http://llvm.org/viewvc/llvm-project?rev=91954&view=rev Log: Update docs for bitcode changes. For object size checking we won't work with partial objects so just count the type as a boolean. Update appropriately. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=91954&r1=91953&r2=91954&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Tue Dec 22 18:29:49 2009 @@ -7257,8 +7257,8 @@
Syntax:
-  declare i32 @llvm.objectsize.i32( i8* <ptr>, i32 <type> )
-  declare i64 @llvm.objectsize.i64( i8* <ptr>, i32 <type> )
+  declare i32 @llvm.objectsize.i32( i8* <object>, i1 <type> )
+  declare i64 @llvm.objectsize.i64( i8* <object>, i1 <type> )
 
Overview:
@@ -7267,34 +7267,15 @@ operation like memcpy will either overflow a buffer that corresponds to an object, or b) to determine that a runtime check for overflow isn't necessary. An object in this context means an allocation of a - specific type.

+ specific class, structure, array, or other object.

Arguments:

The llvm.objectsize intrinsic takes two arguments. The first - argument is a pointer to the object ptr. The second argument - is an integer type which ranges from 0 to 3. The first bit in - the type corresponds to a return value based on whole objects, - and the second bit whether or not we return the maximum or minimum - remaining bytes computed.

- - - - - - - - - - - - - - - - - -
00whole object, maximum number of bytes
01partial object, maximum number of bytes
10whole object, minimum number of bytes
11partial object, minimum number of bytes
- + argument is a pointer to or into the object. The second argument + is a boolean 0 or 1. This argument determines whether you want the + maximum (0) or minimum (1) bytes remaining. This needs to be a literal 0 or + 1, variables are not allowed.

+
Semantics:

The llvm.objectsize intrinsic is lowered to either a constant representing the size of the object concerned or i32/i64 -1 or 0 From echristo at apple.com Tue Dec 22 18:31:11 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 23 Dec 2009 00:31:11 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r91955 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200912230031.nBN0VBWA032332@zion.cs.uiuc.edu> Author: echristo Date: Tue Dec 22 18:31:11 2009 New Revision: 91955 URL: http://llvm.org/viewvc/llvm-project?rev=91955&view=rev Log: Update llvm-convert for bitcode changes. Convert last argument to a boolean. 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=91955&r1=91954&r2=91955&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Dec 22 18:31:11 2009 @@ -4972,9 +4972,21 @@ tree Object = TREE_VALUE(arglist); tree ObjTy = TREE_VALUE(TREE_CHAIN(arglist)); + // LLVM doesn't handle type 1 or type 3. Deal with that here. + Value *Tmp = Emit(ObjTy, 0); + + ConstantInt *CI = dyn_cast(Tmp); + assert(CI); + + // Clear the bottom bit since we only handle whole objects and shift to turn + // the second bit into our boolean. + uint64_t val = (CI->getZExtValue() & 0x2) >> 1; + + Value *NewTy = ConstantInt::get(Tmp->getType(), val); + Value* Args[] = { Emit(Object, 0), - Emit(ObjTy, 0) + NewTy }; // Grab the current return type. @@ -4987,10 +4999,10 @@ false); Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::objectsize, - &Ty, - 1), - Args, Args + 2); + Intrinsic::objectsize, + &Ty, + 1), + Args, Args + 2); return true; } // Unary bit counting intrinsics. From clattner at apple.com Tue Dec 22 18:36:16 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 16:36:16 -0800 Subject: [llvm-commits] [llvm] r91392 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp In-Reply-To: References: <200912150154.nBF1spun028126@zion.cs.uiuc.edu> <36ED7EB5-3000-4621-80A1-3B5EC80E965C@apple.com> Message-ID: On Dec 17, 2009, at 3:37 PM, Bill Wendling wrote: >> >> I don't think that this is the right layer to do this at. The >> "Ordering" of nodes is only defined at Builder time, not in general >> when instructions are randomly created by other parts of SD >> machinery. The various calls to Ordering->add should only happen >> from the builder. >> >> OTOH, calls to *remove* a node from the ordering *should* happen >> from the common SD code when the node is about to be deleted. >> > Hmm...I was hoping to make this a very low-level thing so that the > higher levels wouldn't even know about it. There may be a problem > because node creation & modification doesn't stop at the builder, > but could happen when lowering to target nodes. I'll look into it, > though. > Yeah, I see where you're coming from. My hope is that only the builder, the target-indep parts of isel, and the scheduler will have to know about this stuff. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20091222/52701f66/attachment.html From isanbard at gmail.com Tue Dec 22 18:44:52 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Dec 2009 00:44:52 -0000 Subject: [llvm-commits] [llvm] r91958 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912230044.nBN0iqZS000449@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 18:44:51 2009 New Revision: 91958 URL: http://llvm.org/viewvc/llvm-project?rev=91958&view=rev Log: Remove node ordering from VA nodes. It's not needed. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91958&r1=91957&r2=91958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 22 18:44:51 2009 @@ -6179,13 +6179,10 @@ } void SelectionDAGBuilder::visitVAStart(CallInst &I) { - SDValue Res = DAG.getNode(ISD::VASTART, getCurDebugLoc(), - MVT::Other, getRoot(), - getValue(I.getOperand(1)), - DAG.getSrcValue(I.getOperand(1))); - DAG.setRoot(Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + DAG.setRoot(DAG.getNode(ISD::VASTART, getCurDebugLoc(), + MVT::Other, getRoot(), + getValue(I.getOperand(1)), + DAG.getSrcValue(I.getOperand(1)))); } void SelectionDAGBuilder::visitVAArg(VAArgInst &I) { @@ -6194,30 +6191,22 @@ DAG.getSrcValue(I.getOperand(0))); setValue(&I, V); DAG.setRoot(V.getValue(1)); - if (DisableScheduling) - DAG.AssignOrdering(V.getNode(), SDNodeOrder); } void SelectionDAGBuilder::visitVAEnd(CallInst &I) { - SDValue Res = DAG.getNode(ISD::VAEND, getCurDebugLoc(), - MVT::Other, getRoot(), - getValue(I.getOperand(1)), - DAG.getSrcValue(I.getOperand(1))); - DAG.setRoot(Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + DAG.setRoot(DAG.getNode(ISD::VAEND, getCurDebugLoc(), + MVT::Other, getRoot(), + getValue(I.getOperand(1)), + DAG.getSrcValue(I.getOperand(1)))); } void SelectionDAGBuilder::visitVACopy(CallInst &I) { - SDValue Res = DAG.getNode(ISD::VACOPY, getCurDebugLoc(), - MVT::Other, getRoot(), - getValue(I.getOperand(1)), - getValue(I.getOperand(2)), - DAG.getSrcValue(I.getOperand(1)), - DAG.getSrcValue(I.getOperand(2))); - DAG.setRoot(Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + DAG.setRoot(DAG.getNode(ISD::VACOPY, getCurDebugLoc(), + MVT::Other, getRoot(), + getValue(I.getOperand(1)), + getValue(I.getOperand(2)), + DAG.getSrcValue(I.getOperand(1)), + DAG.getSrcValue(I.getOperand(2)))); } /// TargetLowering::LowerCallTo - This is the default LowerCallTo From daniel at zuster.org Tue Dec 22 18:45:10 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 23 Dec 2009 00:45:10 -0000 Subject: [llvm-commits] [llvm] r91959 - /llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp Message-ID: <200912230045.nBN0jAbf000505@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Dec 22 18:45:10 2009 New Revision: 91959 URL: http://llvm.org/viewvc/llvm-project?rev=91959&view=rev Log: Suppress compiler warning. Modified: llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp Modified: llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp?rev=91959&r1=91958&r2=91959&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp (original) +++ llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp Tue Dec 22 18:45:10 2009 @@ -105,6 +105,8 @@ INSTRUCTION_CONTEXTS #undef ENUM_ENTRY } + + return 0; } /// stringForOperandType - Like stringForContext, but for OperandTypes. From stoklund at 2pi.dk Tue Dec 22 18:46:51 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Dec 2009 16:46:51 -0800 Subject: [llvm-commits] [llvm] r91944 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td ARMRegisterInfo.td In-Reply-To: References: <200912222354.nBMNsijI030671@zion.cs.uiuc.edu> <0C388768-E586-4F09-A0B5-D7F69889436B@apple.com> <2B790CFB-500B-49FA-9B59-72ED1B2BBC2A@2pi.dk> Message-ID: <83551DBC-1A42-4165-AD3C-2025F5965F18@2pi.dk> On Dec 22, 2009, at 4:29 PM, Chris Lattner wrote: > > On Dec 22, 2009, at 4:17 PM, Jakob Stoklund Olesen wrote: > >> >> On Dec 22, 2009, at 4:01 PM, Chris Lattner wrote: >> >>> >>> On Dec 22, 2009, at 3:54 PM, Jakob Stoklund Olesen wrote: >>> >>>> Author: stoklund >>>> Date: Tue Dec 22 17:54:44 2009 >>>> New Revision: 91944 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=91944&view=rev >>>> Log: >>>> Add a SPR register class to the ARM target. >>>> >>>> Certain Thumb instructions require only SP (e.g. tSTRspi). >>> >>> Hi Jakob, >>> >>> If it only allows one register, doesn't it make more sense to make it an implicit reg operand instead of a regclass operand? >> >> Maybe. How would it look in this pattern? >> >> def t_addrmode_sp : Operand, >> ComplexPattern { >> let PrintMethod = "printThumbAddrModeSPOperand"; >> let MIOperandInfo = (ops JustSP:$base, i32imm:$offsimm); >> } > > Eww, gross. :) Two separate issues: Yup :-) > 1. How to model this: This instruction should be modeled as taking SP as an implicit input, and take an i32imm operand. I think this should be pretty simple and any non-isel code that generates this can easily adjust to not passing in SP. Agreed. This would be the best way of representing that instruction. > 2. How to match this: If you really want dag isel to match these as loads, you'd need to write a pat pattern (or manual matching) that matches load(addr) and uses an SDNodeTransform to extract the immediate, maybe something like this: > > Pat<(load (t_addrmode_sp:$addr)), > (tLDRspi (EXTRACT_IMM_FROM_ADDRMODE_SP t_addrmode_sp:$addr))>; > > Some simple examples of sdnode transforms are things like this from PPC: > > def : Pat<(i32 imm:$imm), > (ORI (LIS (HI16 imm:$imm)), (LO16 imm:$imm))>; > > Which matches an arbitrary 32-bit immediate with a "ori" and "lis" instruction to get the two 16-bit halves. IMHO, this is stretching the pattern matching too far. It is much easier to write custom code to insert this kind of instruction. I will try to figure out why ARM is pattern-matching an SP-relative load. >> I was trying to break as little as possible. > > I appreciate that, but single-register register classes aren't really register classes :). Of course. BTW, there is no need for you to look at the end of BlackfinRegisterInfo.td. Ever. :-) Thanks, Chris! /jakob From isanbard at gmail.com Tue Dec 22 18:47:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Dec 2009 00:47:20 -0000 Subject: [llvm-commits] [llvm] r91961 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912230047.nBN0lKxV000615@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 18:47:20 2009 New Revision: 91961 URL: http://llvm.org/viewvc/llvm-project?rev=91961&view=rev Log: Remove node ordering from inline asm nodes. It's not needed. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91961&r1=91960&r2=91961&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 22 18:47:20 2009 @@ -5868,8 +5868,6 @@ Chain = DAG.getStore(Chain, getCurDebugLoc(), OpInfo.CallOperand, StackSlot, NULL, 0); OpInfo.CallOperand = StackSlot; - if (DisableScheduling) - DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); } // There is no longer a Value* corresponding to this operand. @@ -5877,9 +5875,6 @@ // It is now an indirect operand. OpInfo.isIndirect = true; - - if (DisableScheduling) - DAG.AssignOrdering(OpInfo.CallOperand.getNode(), SDNodeOrder); } // If this constraint is for a specific register, allocate it before @@ -6101,9 +6096,6 @@ &AsmNodeOperands[0], AsmNodeOperands.size()); Flag = Chain.getValue(1); - if (DisableScheduling) - DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); - // If this asm returns a register value, copy the result from that register // and set it as the value of the call. if (!RetValRegs.Regs.empty()) { @@ -6132,9 +6124,6 @@ } assert(ResultType == Val.getValueType() && "Asm result value mismatch!"); - - if (DisableScheduling) - DAG.AssignOrdering(Val.getNode(), SDNodeOrder); } setValue(CS.getInstruction(), Val); @@ -6164,17 +6153,12 @@ getValue(StoresToEmit[i].second), StoresToEmit[i].second, 0); OutChains.push_back(Val); - if (DisableScheduling) - DAG.AssignOrdering(Val.getNode(), SDNodeOrder); } if (!OutChains.empty()) Chain = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), MVT::Other, &OutChains[0], OutChains.size()); - if (DisableScheduling) - DAG.AssignOrdering(Chain.getNode(), SDNodeOrder); - DAG.setRoot(Chain); } From clattner at apple.com Tue Dec 22 18:51:09 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 16:51:09 -0800 Subject: [llvm-commits] [llvm] r91944 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td ARMRegisterInfo.td In-Reply-To: <83551DBC-1A42-4165-AD3C-2025F5965F18@2pi.dk> References: <200912222354.nBMNsijI030671@zion.cs.uiuc.edu> <0C388768-E586-4F09-A0B5-D7F69889436B@apple.com> <2B790CFB-500B-49FA-9B59-72ED1B2BBC2A@2pi.dk> <83551DBC-1A42-4165-AD3C-2025F5965F18@2pi.dk> Message-ID: On Dec 22, 2009, at 4:46 PM, Jakob Stoklund Olesen wrote: >> 2. How to match this: If you really want dag isel to match these as >> loads, you'd need to write a pat pattern (or manual matching) that >> matches load(addr) and uses an SDNodeTransform to extract the >> immediate, maybe something like this: >> >> Pat<(load (t_addrmode_sp:$addr)), >> (tLDRspi (EXTRACT_IMM_FROM_ADDRMODE_SP t_addrmode_sp:$addr))>; >> >> Some simple examples of sdnode transforms are things like this from >> PPC: >> >> def : Pat<(i32 imm:$imm), >> (ORI (LIS (HI16 imm:$imm)), (LO16 imm:$imm))>; >> >> Which matches an arbitrary 32-bit immediate with a "ori" and "lis" >> instruction to get the two 16-bit halves. > > IMHO, this is stretching the pattern matching too far. It is much > easier to write custom code to insert this kind of instruction. I > will try to figure out why ARM is pattern-matching an SP-relative > load. Using custom code also works for me, thanks! > >>> I was trying to break as little as possible. >> >> I appreciate that, but single-register register classes aren't >> really register classes :). > > Of course. BTW, there is no need for you to look at the end of > BlackfinRegisterInfo.td. Ever. :-) hehe, it's a deal! :) -Chris From jyasskin at google.com Tue Dec 22 18:58:02 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Wed, 23 Dec 2009 00:58:02 -0000 Subject: [llvm-commits] [llvm] r91963 - /llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Message-ID: <200912230058.nBN0w2QS000962@zion.cs.uiuc.edu> Author: jyasskin Date: Tue Dec 22 18:58:02 2009 New Revision: 91963 URL: http://llvm.org/viewvc/llvm-project?rev=91963&view=rev Log: Disable JITTest.FunctionIsRecompiledAndRelinked on ARM where it's not implemented. Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=91963&r1=91962&r2=91963&view=diff ============================================================================== --- llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp (original) +++ llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Tue Dec 22 18:58:02 2009 @@ -542,6 +542,9 @@ #endif } +// ARM doesn't have an implementation of replaceMachineCodeForFunction(), so +// recompileAndRelinkFunction doesn't work. +#if !defined(__arm__) TEST_F(JITTest, FunctionIsRecompiledAndRelinked) { Function *F = Function::Create(TypeBuilder::get(Context), GlobalValue::ExternalLinkage, "test", M); @@ -572,6 +575,7 @@ EXPECT_EQ(2, OrigFPtr()) << "The old pointer's target should now jump to the new version"; } +#endif // !defined(__arm__) } // anonymous namespace // This variable is intentionally defined differently in the statically-compiled From bob.wilson at apple.com Tue Dec 22 19:03:43 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 23 Dec 2009 01:03:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r91964 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200912230103.nBN13hxR001169@zion.cs.uiuc.edu> Author: bwilson Date: Tue Dec 22 19:03:43 2009 New Revision: 91964 URL: http://llvm.org/viewvc/llvm-project?rev=91964&view=rev Log: When a large aggregate is passed as an operand to an inline asm with a register constraint, report an error instead of treating it as an "indirect" operand. Codegen only supports indirect operands with memory constraints, and it will just assert or crash otherwise. For 128-bit aggregate asm operands, pass them as integers, but only if they must be in registers. This is important for compatibility with gcc for inline asm using types from . The llvm versions of those types have the vector values wrapped in structs. Radar 7483577. 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=91964&r1=91963&r2=91964&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Dec 22 19:03:43 2009 @@ -4450,17 +4450,19 @@ LValue LV = EmitLV(Val); assert(!LV.isBitfield() && "Inline asm can't have bitfield operand"); - // Structs and unions are permitted here, as long as they're the - // same size as a register. + // Small structs and unions can be treated as integers. uint64_t TySize = TD.getTypeSizeInBits(LLVMTy); if (TySize == 1 || TySize == 8 || TySize == 16 || - TySize == 32 || TySize == 64) { + TySize == 32 || TySize == 64 || (TySize == 128 && !AllowsMem)) { LLVMTy = IntegerType::get(Context, TySize); Op = Builder.CreateLoad(BitCastToType(LV.Ptr, - LLVMTy->getPointerTo())); + LLVMTy->getPointerTo())); } else { - // Otherwise, emit our value as a lvalue and let the codegen deal with - // it. + // Codegen only supports indirect operands with mem constraints. + if (!AllowsMem) + error("%Haggregate does not match inline asm register constraint", + &EXPR_LOCATION(exp)); + // Otherwise, emit our value as a lvalue. isIndirect = true; Op = LV.Ptr; } From isanbard at gmail.com Tue Dec 22 19:28:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 23 Dec 2009 01:28:20 -0000 Subject: [llvm-commits] [llvm] r91971 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <200912230128.nBN1SKAY002127@zion.cs.uiuc.edu> Author: void Date: Tue Dec 22 19:28:19 2009 New Revision: 91971 URL: http://llvm.org/viewvc/llvm-project?rev=91971&view=rev Log: Remove superfluous SDNode ordering. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91971&r1=91970&r2=91971&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 22 19:28:19 2009 @@ -648,7 +648,6 @@ PendingExports.size()); PendingExports.clear(); DAG.setRoot(Root); - if (DisableScheduling) DAG.AssignOrdering(Root.getNode(), SDNodeOrder); return Root; } @@ -4986,11 +4985,8 @@ // Both PendingLoads and PendingExports must be flushed here; // this call might not return. (void)getRoot(); - SDValue Label = DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), - getControlRoot(), BeginLabel); - DAG.setRoot(Label); - if (DisableScheduling) - DAG.AssignOrdering(Label.getNode(), SDNodeOrder); + DAG.setRoot(DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), + getControlRoot(), BeginLabel)); } // Check if target-independent constraints permit a tail call here. @@ -5039,11 +5035,6 @@ Add, NULL, Offsets[i], false, 1); Values[i] = L; Chains[i] = L.getValue(1); - - if (DisableScheduling) { - DAG.AssignOrdering(Add.getNode(), SDNodeOrder); - DAG.AssignOrdering(L.getNode(), SDNodeOrder); - } } SDValue Chain = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(), @@ -5076,12 +5067,8 @@ // Insert a label at the end of the invoke call to mark the try range. This // can be used to detect deletion of the invoke via the MachineModuleInfo. EndLabel = MMI->NextLabelID(); - SDValue Label = DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), - getRoot(), EndLabel); - DAG.setRoot(Label); - - if (DisableScheduling) - DAG.AssignOrdering(Label.getNode(), SDNodeOrder); + DAG.setRoot(DAG.getLabel(ISD::EH_LABEL, getCurDebugLoc(), + getRoot(), EndLabel)); // Inform MachineModuleInfo of range. MMI->addInvoke(LandingPad, BeginLabel, EndLabel); @@ -5118,11 +5105,8 @@ I.getType() == I.getOperand(2)->getType()) { SDValue LHS = getValue(I.getOperand(1)); SDValue RHS = getValue(I.getOperand(2)); - SDValue Res = DAG.getNode(ISD::FCOPYSIGN, getCurDebugLoc(), - LHS.getValueType(), LHS, RHS); - setValue(&I, Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + setValue(&I, DAG.getNode(ISD::FCOPYSIGN, getCurDebugLoc(), + LHS.getValueType(), LHS, RHS)); return; } } else if (Name == "fabs" || Name == "fabsf" || Name == "fabsl") { @@ -5130,11 +5114,8 @@ I.getOperand(1)->getType()->isFloatingPoint() && I.getType() == I.getOperand(1)->getType()) { SDValue Tmp = getValue(I.getOperand(1)); - SDValue Res = DAG.getNode(ISD::FABS, getCurDebugLoc(), - Tmp.getValueType(), Tmp); - setValue(&I, Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + setValue(&I, DAG.getNode(ISD::FABS, getCurDebugLoc(), + Tmp.getValueType(), Tmp)); return; } } else if (Name == "sin" || Name == "sinf" || Name == "sinl") { @@ -5143,11 +5124,8 @@ I.getType() == I.getOperand(1)->getType() && I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); - SDValue Res = DAG.getNode(ISD::FSIN, getCurDebugLoc(), - Tmp.getValueType(), Tmp); - setValue(&I, Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + setValue(&I, DAG.getNode(ISD::FSIN, getCurDebugLoc(), + Tmp.getValueType(), Tmp)); return; } } else if (Name == "cos" || Name == "cosf" || Name == "cosl") { @@ -5156,11 +5134,8 @@ I.getType() == I.getOperand(1)->getType() && I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); - SDValue Res = DAG.getNode(ISD::FCOS, getCurDebugLoc(), - Tmp.getValueType(), Tmp); - setValue(&I, Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + setValue(&I, DAG.getNode(ISD::FCOS, getCurDebugLoc(), + Tmp.getValueType(), Tmp)); return; } } else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") { @@ -5169,11 +5144,8 @@ I.getType() == I.getOperand(1)->getType() && I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); - SDValue Res = DAG.getNode(ISD::FSQRT, getCurDebugLoc(), - Tmp.getValueType(), Tmp); - setValue(&I, Res); - if (DisableScheduling) - DAG.AssignOrdering(Res.getNode(), SDNodeOrder); + setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), + Tmp.getValueType(), Tmp)); return; } } @@ -5189,12 +5161,8 @@ else Callee = DAG.getExternalSymbol(RenameFn, TLI.getPointerTy()); - if (DisableScheduling) - DAG.AssignOrdering(Callee.getNode(), SDNodeOrder); - - // Check if we can potentially perform a tail call. More detailed - // checking is be done within LowerCallTo, after more information - // about the call is known. + // Check if we can potentially perform a tail call. More detailed checking is + // be done within LowerCallTo, after more information about the call is known. bool isTailCall = PerformTailCallOpt && I.isTailCall(); LowerCallTo(&I, Callee, isTailCall); From sabre at nondot.org Tue Dec 22 19:30:26 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Dec 2009 01:30:26 -0000 Subject: [llvm-commits] [llvm] r91972 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td Message-ID: <200912230130.nBN1UQeP002200@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 19:30:26 2009 New Revision: 91972 URL: http://llvm.org/viewvc/llvm-project?rev=91972&view=rev Log: stop pattern matching 16-bit zero's of a register to MOV16r0, instead use the appropriate subreggy thing. This generates identical code on some large apps (thanks to Evan's cross class coalescing stuff he did back in july). This means that MOV16r0 can go away completely in the future soon. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=91972&r1=91971&r2=91972&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Dec 22 19:30:26 2009 @@ -3700,15 +3700,21 @@ def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins), "xor{b}\t$dst, $dst", [(set GR8:$dst, 0)]>; + + def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins), + "xor{l}\t$dst, $dst", + [(set GR32:$dst, 0)]>; + // Use xorl instead of xorw since we don't care about the high 16 bits, // it's smaller, and it avoids a partial-register update. def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins), - "", [(set GR16:$dst, 0)]>; -def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins), - "xor{l}\t$dst, $dst", - [(set GR32:$dst, 0)]>; + "", [/*(set GR16:$dst, 0)*/]>; } +let AddedComplexity = 1 in +def : Pat<(i16 0), + (EXTRACT_SUBREG (MOV32r0), x86_subreg_16bit)>; + //===----------------------------------------------------------------------===// // Thread Local Storage Instructions // From scallanan at apple.com Tue Dec 22 19:32:29 2009 From: scallanan at apple.com (Sean Callanan) Date: Wed, 23 Dec 2009 01:32:29 -0000 Subject: [llvm-commits] [llvm] r91973 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Message-ID: <200912230132.nBN1WTQx002271@zion.cs.uiuc.edu> Author: spyffe Date: Tue Dec 22 19:32:29 2009 New Revision: 91973 URL: http://llvm.org/viewvc/llvm-project?rev=91973&view=rev Log: More fixes for Visual C++. Replaced several very small static inline functions with macros. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h?rev=91973&r1=91972&r2=91973&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Tue Dec 22 19:32:29 2009 @@ -34,16 +34,16 @@ /* * Accessor functions for various fields of an Intel instruction */ -static inline uint8_t modFromModRM(uint8_t modRM){ return (modRM & 0xc0) >> 6; } -static inline uint8_t regFromModRM(uint8_t modRM){ return (modRM & 0x38) >> 3; } -static inline uint8_t rmFromModRM(uint8_t modRM) { return (modRM & 0x7); } -static inline uint8_t scaleFromSIB(uint8_t sib) { return (sib & 0xc0) >> 6; } -static inline uint8_t indexFromSIB(uint8_t sib) { return (sib & 0x38) >> 3; } -static inline uint8_t baseFromSIB(uint8_t sib) { return (sib & 0x7); } -static inline uint8_t wFromREX(uint8_t rex) { return (rex & 0x8) >> 3; } -static inline uint8_t rFromREX(uint8_t rex) { return (rex & 0x4) >> 2; } -static inline uint8_t xFromREX(uint8_t rex) { return (rex & 0x2) >> 1; } -static inline uint8_t bFromREX(uint8_t rex) { return (rex & 0x1); } +#define modFromModRM(modRM) ((modRM & 0xc0) >> 6) +#define regFromModRM(modRM) ((modRM & 0x38) >> 3) +#define rmFromModRM(modRM) (modRM & 0x7) +#define scaleFromSIB(sib) ((sib & 0xc0) >> 6) +#define indexFromSIB(sib) ((sib & 0x38) >> 3) +#define baseFromSIB(sib) (sib & 0x7) +#define wFromREX(rex) ((rex & 0x8) >> 3) +#define rFromREX(rex) ((rex & 0x4) >> 2) +#define xFromREX(rex) ((rex & 0x2) >> 1) +#define bFromREX(rex) (rex & 0x1) /* * These enums represent Intel registers for use by the decoder. From anton at korobeynikov.info Tue Dec 22 19:42:38 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Wed, 23 Dec 2009 04:42:38 +0300 Subject: [llvm-commits] [llvm] r91973 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h In-Reply-To: <200912230132.nBN1WTQx002271@zion.cs.uiuc.edu> References: <200912230132.nBN1WTQx002271@zion.cs.uiuc.edu> Message-ID: <1261532558.19129.3580.camel@aslstation> Hello, Sean > More fixes for Visual C++. Replaced several very small > static inline functions with macros. What was the reason of writing the huge chunk of disassembler in C? Maybe all the problems will be solved if the code will be rewritten to C+ ? :) -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From sabre at nondot.org Tue Dec 22 19:45:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Dec 2009 01:45:04 -0000 Subject: [llvm-commits] [llvm] r91975 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86MCInstLower.cpp X86ISelDAGToDAG.cpp X86InstrInfo.cpp X86InstrInfo.td Message-ID: <200912230145.nBN1j4n9002762@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 19:45:04 2009 New Revision: 91975 URL: http://llvm.org/viewvc/llvm-project?rev=91975&view=rev Log: completely eliminate the MOV16r0 'instruction'. The only interesting part of this is the divrem changes, which are already tested by CodeGen/X86/divrem.ll. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=91975&r1=91974&r2=91975&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Tue Dec 22 19:45:04 2009 @@ -355,10 +355,6 @@ case X86::LEA64_32r: // Handle 'subreg rewriting' for the lea64_32mem operand. lower_lea64_32mem(&OutMI, 1); break; - case X86::MOV16r0: - OutMI.setOpcode(X86::MOV32r0); - lower_subreg32(&OutMI, 0); - break; case X86::MOVZX16rr8: OutMI.setOpcode(X86::MOVZX32rr8); lower_subreg32(&OutMI, 0); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=91975&r1=91974&r2=91975&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Dec 22 19:45:04 2009 @@ -1867,27 +1867,28 @@ } } - unsigned LoReg, HiReg; + unsigned LoReg, HiReg, ClrReg; unsigned ClrOpcode, SExtOpcode; + EVT ClrVT = NVT; switch (NVT.getSimpleVT().SimpleTy) { default: llvm_unreachable("Unsupported VT!"); case MVT::i8: - LoReg = X86::AL; HiReg = X86::AH; + LoReg = X86::AL; ClrReg = HiReg = X86::AH; ClrOpcode = 0; SExtOpcode = X86::CBW; break; case MVT::i16: LoReg = X86::AX; HiReg = X86::DX; - ClrOpcode = X86::MOV16r0; + ClrOpcode = X86::MOV32r0; ClrReg = X86::EDX; ClrVT = MVT::i32; SExtOpcode = X86::CWD; break; case MVT::i32: - LoReg = X86::EAX; HiReg = X86::EDX; + LoReg = X86::EAX; ClrReg = HiReg = X86::EDX; ClrOpcode = X86::MOV32r0; SExtOpcode = X86::CDQ; break; case MVT::i64: - LoReg = X86::RAX; HiReg = X86::RDX; + LoReg = X86::RAX; ClrReg = HiReg = X86::RDX; ClrOpcode = ~0U; // NOT USED. SExtOpcode = X86::CQO; break; @@ -1942,10 +1943,10 @@ MVT::i64, Zero, ClrNode, SubRegNo), 0); } else { - ClrNode = SDValue(CurDAG->getMachineNode(ClrOpcode, dl, NVT), 0); + ClrNode = SDValue(CurDAG->getMachineNode(ClrOpcode, dl, ClrVT), 0); } - InFlag = CurDAG->getCopyToReg(CurDAG->getEntryNode(), dl, HiReg, + InFlag = CurDAG->getCopyToReg(CurDAG->getEntryNode(), dl, ClrReg, ClrNode, InFlag).getValue(1); } } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=91975&r1=91974&r2=91975&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Dec 22 19:45:04 2009 @@ -1018,13 +1018,11 @@ switch (Opc) { default: break; case X86::MOV8r0: - case X86::MOV16r0: case X86::MOV32r0: { if (!isSafeToClobberEFLAGS(MBB, I)) { switch (Opc) { default: break; case X86::MOV8r0: Opc = X86::MOV8ri; break; - case X86::MOV16r0: Opc = X86::MOV16ri; break; case X86::MOV32r0: Opc = X86::MOV32ri; break; } Clone = false; @@ -2292,9 +2290,7 @@ OpcodeTablePtr = &RegOp2MemOpTable2Addr; isTwoAddrFold = true; } else if (i == 0) { // If operand 0 - if (MI->getOpcode() == X86::MOV16r0) - NewMI = MakeM0Inst(*this, X86::MOV16mi, MOs, MI); - else if (MI->getOpcode() == X86::MOV32r0) + if (MI->getOpcode() == X86::MOV32r0) NewMI = MakeM0Inst(*this, X86::MOV32mi, MOs, MI); else if (MI->getOpcode() == X86::MOV8r0) NewMI = MakeM0Inst(*this, X86::MOV8mi, MOs, MI); @@ -2563,7 +2559,6 @@ } else if (OpNum == 0) { // If operand 0 switch (Opc) { case X86::MOV8r0: - case X86::MOV16r0: case X86::MOV32r0: return true; default: break; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=91975&r1=91974&r2=91975&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Dec 22 19:45:04 2009 @@ -3707,8 +3707,8 @@ // Use xorl instead of xorw since we don't care about the high 16 bits, // it's smaller, and it avoids a partial-register update. -def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins), - "", [/*(set GR16:$dst, 0)*/]>; +//def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins), +// "", [/*(set GR16:$dst, 0)*/]>; } let AddedComplexity = 1 in From sabre at nondot.org Tue Dec 22 19:46:41 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Dec 2009 01:46:41 -0000 Subject: [llvm-commits] [llvm] r91976 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td Message-ID: <200912230146.nBN1kfml002821@zion.cs.uiuc.edu> Author: lattner Date: Tue Dec 22 19:46:40 2009 New Revision: 91976 URL: http://llvm.org/viewvc/llvm-project?rev=91976&view=rev Log: really remove the instruction, don't just comment it out Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=91976&r1=91975&r2=91976&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Dec 22 19:46:40 2009 @@ -3701,16 +3701,13 @@ "xor{b}\t$dst, $dst", [(set GR8:$dst, 0)]>; - def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins), - "xor{l}\t$dst, $dst", - [(set GR32:$dst, 0)]>; +def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins), + "xor{l}\t$dst, $dst", + [(set GR32:$dst, 0)]>; +} // Use xorl instead of xorw since we don't care about the high 16 bits, // it's smaller, and it avoids a partial-register update. -//def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins), -// "", [/*(set GR16:$dst, 0)*/]>; -} - let AddedComplexity = 1 in def : Pat<(i16 0), (EXTRACT_SUBREG (MOV32r0), x86_subreg_16bit)>; From clattner at apple.com Tue Dec 22 19:48:51 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 17:48:51 -0800 Subject: [llvm-commits] [llvm] r91973 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h In-Reply-To: <200912230132.nBN1WTQx002271@zion.cs.uiuc.edu> References: <200912230132.nBN1WTQx002271@zion.cs.uiuc.edu> Message-ID: <0EB4D934-FCF0-4C35-95B4-D3814D115A22@apple.com> On Dec 22, 2009, at 5:32 PM, Sean Callanan wrote: > Author: spyffe > Date: Tue Dec 22 19:32:29 2009 > New Revision: 91973 > > URL: http://llvm.org/viewvc/llvm-project?rev=91973&view=rev > Log: > More fixes for Visual C++. Replaced several very small > static inline functions with macros. Please make these static functions. Compilers inline static functions too. Anton has a good point though, why is this a C file? -Chris > > Modified: > llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h > > Modified: llvm/trunk/lib/Target/X86/Disassembler/ > X86DisassemblerDecoder.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h?rev=91973&r1=91972&r2=91973&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h > (original) > +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h > Tue Dec 22 19:32:29 2009 > @@ -34,16 +34,16 @@ > /* > * Accessor functions for various fields of an Intel instruction > */ > -static inline uint8_t modFromModRM(uint8_t modRM){ return (modRM & > 0xc0) >> 6; } > -static inline uint8_t regFromModRM(uint8_t modRM){ return (modRM & > 0x38) >> 3; } > -static inline uint8_t rmFromModRM(uint8_t modRM) { return (modRM & > 0x7); } > -static inline uint8_t scaleFromSIB(uint8_t sib) { return (sib & > 0xc0) >> 6; } > -static inline uint8_t indexFromSIB(uint8_t sib) { return (sib & > 0x38) >> 3; } > -static inline uint8_t baseFromSIB(uint8_t sib) { return (sib & > 0x7); } > -static inline uint8_t wFromREX(uint8_t rex) { return (rex & > 0x8) >> 3; } > -static inline uint8_t rFromREX(uint8_t rex) { return (rex & > 0x4) >> 2; } > -static inline uint8_t xFromREX(uint8_t rex) { return (rex & > 0x2) >> 1; } > -static inline uint8_t bFromREX(uint8_t rex) { return (rex & > 0x1); } > +#define modFromModRM(modRM) ((modRM & 0xc0) >> 6) > +#define regFromModRM(modRM) ((modRM & 0x38) >> 3) > +#define rmFromModRM(modRM) (modRM & 0x7) > +#define scaleFromSIB(sib) ((sib & 0xc0) >> 6) > +#define indexFromSIB(sib) ((sib & 0x38) >> 3) > +#define baseFromSIB(sib) (sib & 0x7) > +#define wFromREX(rex) ((rex & 0x8) >> 3) > +#define rFromREX(rex) ((rex & 0x4) >> 2) > +#define xFromREX(rex) ((rex & 0x2) >> 1) > +#define bFromREX(rex) (rex & 0x1) > > /* > * These enums represent Intel registers for use by the decoder. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From scallanan at apple.com Tue Dec 22 19:55:17 2009 From: scallanan at apple.com (Sean Callanan) Date: Tue, 22 Dec 2009 17:55:17 -0800 Subject: [llvm-commits] [llvm] r91973 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h In-Reply-To: <0EB4D934-FCF0-4C35-95B4-D3814D115A22@apple.com> References: <200912230132.nBN1WTQx002271@zion.cs.uiuc.edu> <0EB4D934-FCF0-4C35-95B4-D3814D115A22@apple.com> Message-ID: <509118BE-4DAB-4507-B075-A1D624F16B8B@apple.com> Chris, Anton, I tried static functions but they don't work because the compiler warns about unused functions in files that #include the header but don't call the functions. As an alternative, I could simply move the functions into the file that uses them and declare them static there? is that preferable? The reason I wrote this portion of the disassembler in C is to allow projects that need a disassembler but reside (for example) in a kernel or some other source base that does not allow C++ to use the disassembler core. Sean On Dec 22, 2009, at 5:48 PM, Chris Lattner wrote: > > On Dec 22, 2009, at 5:32 PM, Sean Callanan wrote: > >> Author: spyffe >> Date: Tue Dec 22 19:32:29 2009 >> New Revision: 91973 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=91973&view=rev >> Log: >> More fixes for Visual C++. Replaced several very small >> static inline functions with macros. > > Please make these static functions. Compilers inline static functions too. Anton has a good point though, why is this a C file? > > -Chris > >> >> Modified: >> llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h >> >> Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h?rev=91973&r1=91972&r2=91973&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h (original) >> +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h Tue Dec 22 19:32:29 2009 >> @@ -34,16 +34,16 @@ >> /* >> * Accessor functions for various fields of an Intel instruction >> */ >> -static inline uint8_t modFromModRM(uint8_t modRM){ return (modRM & 0xc0) >> 6; } >> -static inline uint8_t regFromModRM(uint8_t modRM){ return (modRM & 0x38) >> 3; } >> -static inline uint8_t rmFromModRM(uint8_t modRM) { return (modRM & 0x7); } >> -static inline uint8_t scaleFromSIB(uint8_t sib) { return (sib & 0xc0) >> 6; } >> -static inline uint8_t indexFromSIB(uint8_t sib) { return (sib & 0x38) >> 3; } >> -static inline uint8_t baseFromSIB(uint8_t sib) { return (sib & 0x7); } >> -static inline uint8_t wFromREX(uint8_t rex) { return (rex & 0x8) >> 3; } >> -static inline uint8_t rFromREX(uint8_t rex) { return (rex & 0x4) >> 2; } >> -static inline uint8_t xFromREX(uint8_t rex) { return (rex & 0x2) >> 1; } >> -static inline uint8_t bFromREX(uint8_t rex) { return (rex & 0x1); } >> +#define modFromModRM(modRM) ((modRM & 0xc0) >> 6) >> +#define regFromModRM(modRM) ((modRM & 0x38) >> 3) >> +#define rmFromModRM(modRM) (modRM & 0x7) >> +#define scaleFromSIB(sib) ((sib & 0xc0) >> 6) >> +#define indexFromSIB(sib) ((sib & 0x38) >> 3) >> +#define baseFromSIB(sib) (sib & 0x7) >> +#define wFromREX(rex) ((rex & 0x8) >> 3) >> +#define rFromREX(rex) ((rex & 0x4) >> 2) >> +#define xFromREX(rex) ((rex & 0x2) >> 1) >> +#define bFromREX(rex) (rex & 0x1) >> >> /* >> * These enums represent Intel registers for use by the decoder. >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From clattner at apple.com Tue Dec 22 20:00:03 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Dec 2009 18:00:03 -0800 Subject: [llvm-commits] [llvm] r91973 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h In-Reply-To: <509118BE-4DAB-4507-B075-A1D624F16B8B@apple.com> References: <200912230132.nBN1WTQx002271@zion.cs.uiuc.edu> <0EB4D934-FCF0-4C35-95B4-D3814D115A22@apple.com> <509118BE-4DAB-4507-B075-A1D624F16B8B@apple.com> Message-ID: On Dec 22, 2009, at 5:55 PM, Sean Callanan wrote: > Chris, Anton, > > I tried static functions but they don't work because the compiler > warns about unused functions in files that #include the header but > don't call the functions. As an alternative, I could simply move > the functions into the file that uses them and declare them static > there? is that preferable? > > The reason I wrote this portion of the disassembler in C is to allow > projects that need a disassembler but reside (for example) in a > kernel or some other source base that does not allow C++ to use the > disassembler core. The mac kernel (at least) includes a large set of C++ code (in IOKit). They generally just don't allow the exact same stuff that LLVM doesn't allow: RTTI and exceptions. -Chris From echristo at apple.com Tue Dec 22 20:51:48 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 23 Dec 2009 02:51:48 -0000 Subject: [llvm-commits] [llvm] r91979 - in /llvm/trunk: include/llvm/Intrinsics.td lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/Transforms/Scalar/SimplifyLibCalls.cpp test/CodeGen/X86/object-size.ll Message-ID: <200912230251.nBN2pmnR004796@zion.cs.uiuc.edu> Author: echristo Date: Tue Dec 22 20:51:48 2009 New Revision: 91979 URL: http://llvm.org/viewvc/llvm-project?rev=91979&view=rev Log: Update objectsize intrinsic and associated dependencies. Fix lowering code and update testcases. Modified: llvm/trunk/include/llvm/Intrinsics.td llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/test/CodeGen/X86/object-size.ll Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=91979&r1=91978&r2=91979&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Tue Dec 22 20:51:48 2009 @@ -260,7 +260,7 @@ def int_siglongjmp : Intrinsic<[llvm_void_ty], [llvm_ptr_ty, llvm_i32_ty]>; // Internal interface for object size checking -def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_ptr_ty, llvm_i32_ty], +def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_ptr_ty, llvm_i1_ty], [IntrReadArgMem]>, GCCBuiltin<"__builtin_object_size">; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91979&r1=91978&r2=91979&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 22 20:51:48 2009 @@ -4688,7 +4688,7 @@ SDValue Arg = getValue(I.getOperand(0)); EVT Ty = Arg.getValueType(); - if (CI->getZExtValue() < 2) + if (CI->getZExtValue() == 0) Res = DAG.getConstant(-1ULL, Ty); else Res = DAG.getConstant(0, Ty); Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=91979&r1=91978&r2=91979&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Tue Dec 22 20:51:48 2009 @@ -1122,7 +1122,7 @@ const Type *Ty = Callee->getFunctionType()->getReturnType(); - if (Const->getZExtValue() < 2) + if (Const->getZExtValue() == 0) return Constant::getAllOnesValue(Ty); else return ConstantInt::get(Ty, 0); Modified: llvm/trunk/test/CodeGen/X86/object-size.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/object-size.ll?rev=91979&r1=91978&r2=91979&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/object-size.ll (original) +++ llvm/trunk/test/CodeGen/X86/object-size.ll Tue Dec 22 20:51:48 2009 @@ -10,7 +10,7 @@ define void @bar() nounwind ssp { entry: %tmp = load i8** @p ; [#uses=1] - %0 = call i64 @llvm.objectsize.i64(i8* %tmp, i32 0) ; [#uses=1] + %0 = call i64 @llvm.objectsize.i64(i8* %tmp, i1 0) ; [#uses=1] %cmp = icmp ne i64 %0, -1 ; [#uses=1] ; X64: movq $-1, %rax ; X64: cmpq $-1, %rax @@ -19,7 +19,7 @@ cond.true: ; preds = %entry %tmp1 = load i8** @p ; [#uses=1] %tmp2 = load i8** @p ; [#uses=1] - %1 = call i64 @llvm.objectsize.i64(i8* %tmp2, i32 1) ; [#uses=1] + %1 = call i64 @llvm.objectsize.i64(i8* %tmp2, i1 1) ; [#uses=1] %call = call i8* @__strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 %1) ssp ; [#uses=1] br label %cond.end @@ -33,7 +33,7 @@ ret void } -declare i64 @llvm.objectsize.i64(i8*, i32) nounwind readonly +declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly declare i8* @__strcpy_chk(i8*, i8*, i64) ssp @@ -47,7 +47,7 @@ %tmp = load i8** %__dest.addr ; [#uses=1] %tmp1 = load i8** %__src.addr ; [#uses=1] %tmp2 = load i8** %__dest.addr ; [#uses=1] - %0 = call i64 @llvm.objectsize.i64(i8* %tmp2, i32 1) ; [#uses=1] + %0 = call i64 @llvm.objectsize.i64(i8* %tmp2, i1 1) ; [#uses=1] %call = call i8* @__strcpy_chk(i8* %tmp, i8* %tmp1, i64 %0) ssp ; [#uses=1] store i8* %call, i8** %retval %1 = load i8** %retval ; [#uses=1] From echristo at apple.com Tue Dec 22 20:52:12 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 23 Dec 2009 02:52:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r91980 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200912230252.nBN2qC3d004821@zion.cs.uiuc.edu> Author: echristo Date: Tue Dec 22 20:52:12 2009 New Revision: 91980 URL: http://llvm.org/viewvc/llvm-project?rev=91980&view=rev Log: Update for intrinsic change. 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=91980&r1=91979&r2=91980&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Dec 22 20:52:12 2009 @@ -4997,7 +4997,7 @@ // Manually coerce the arg to the correct pointer type. Args[0] = Builder.CreateBitCast(Args[0], Type::getInt8PtrTy(Context)); - Args[1] = Builder.CreateIntCast(Args[1], Type::getInt32Ty(Context), + Args[1] = Builder.CreateIntCast(Args[1], Type::getInt1Ty(Context), false); Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, From dalej at apple.com Wed Dec 23 01:32:53 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Dec 2009 07:32:53 -0000 Subject: [llvm-commits] [llvm] r91988 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/MSP430/2009-12-22-InlineAsm.ll Message-ID: <200912230732.nBN7Wr9T013491@zion.cs.uiuc.edu> Author: johannes Date: Wed Dec 23 01:32:51 2009 New Revision: 91988 URL: http://llvm.org/viewvc/llvm-project?rev=91988&view=rev Log: Use more sensible type for flags in asms. PR 5570. Patch by Sylve`re Teissier (sorry, ASCII only). Added: llvm/trunk/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=91988&r1=91987&r2=91988&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Dec 23 01:32:51 2009 @@ -5326,13 +5326,11 @@ bool HasMatching,unsigned MatchingIdx, SelectionDAG &DAG, unsigned Order, std::vector &Ops) const { - EVT IntPtrTy = DAG.getTargetLoweringInfo().getPointerTy(); assert(Regs.size() < (1 << 13) && "Too many inline asm outputs!"); unsigned Flag = Code | (Regs.size() << 3); if (HasMatching) Flag |= 0x80000000 | (MatchingIdx << 16); - - SDValue Res = DAG.getTargetConstant(Flag, IntPtrTy); + SDValue Res = DAG.getTargetConstant(Flag, MVT::i32); Ops.push_back(Res); if (DisableScheduling) Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=91988&r1=91987&r2=91988&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Dec 23 01:32:51 2009 @@ -1182,9 +1182,8 @@ } // Add this to the output node. - EVT IntPtrTy = TLI.getPointerTy(); Ops.push_back(CurDAG->getTargetConstant(4/*MEM*/ | (SelOps.size()<< 3), - IntPtrTy)); + MVT::i32)); Ops.insert(Ops.end(), SelOps.begin(), SelOps.end()); i += 2; } Added: llvm/trunk/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll?rev=91988&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll (added) +++ llvm/trunk/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll Wed Dec 23 01:32:51 2009 @@ -0,0 +1,29 @@ +; RUN: llc < %s +; PR 5570 +; ModuleID = 'test.c' +target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-n8:16" +target triple = "msp430-unknown-unknown" + + at buf = common global [10 x i8] zeroinitializer, align 1 ; <[10 x i8]*> [#uses=2] + +define i16 @main() noreturn nounwind { +entry: + %0 = tail call i8* asm "", "=r,0"(i8* getelementptr inbounds ([10 x i8]* @buf, i16 0, i16 0)) nounwind ; [#uses=1] + %sub.ptr = getelementptr inbounds i8* %0, i16 1 ; [#uses=1] + %sub.ptr.lhs.cast = ptrtoint i8* %sub.ptr to i16 ; [#uses=1] + %sub.ptr.sub = sub i16 %sub.ptr.lhs.cast, ptrtoint ([10 x i8]* @buf to i16) ; [#uses=1] + %cmp = icmp eq i16 %sub.ptr.sub, 1 ; [#uses=1] + br i1 %cmp, label %bar.exit, label %if.then.i + +if.then.i: ; preds = %entry + tail call void @abort() nounwind + br label %bar.exit + +bar.exit: ; preds = %entry, %if.then.i + tail call void @exit(i16 0) nounwind + unreachable +} + +declare void @exit(i16) noreturn + +declare void @abort() From sanjiv.gupta at microchip.com Wed Dec 23 03:46:02 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Wed, 23 Dec 2009 09:46:02 -0000 Subject: [llvm-commits] [llvm] r91993 - in /llvm/trunk: lib/Target/PIC16/PIC16ISelDAGToDAG.h lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.h test/CodeGen/PIC16/C16-49.ll Message-ID: <200912230946.nBN9k2BE032252@zion.cs.uiuc.edu> Author: sgupta Date: Wed Dec 23 03:46:01 2009 New Revision: 91993 URL: http://llvm.org/viewvc/llvm-project?rev=91993&view=rev Log: Reverting back 91904. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h llvm/trunk/test/CodeGen/PIC16/C16-49.ll Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h?rev=91993&r1=91992&r2=91993&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h Wed Dec 23 03:46:01 2009 @@ -36,10 +36,7 @@ public: explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) : SelectionDAGISel(tm), - TM(tm), PIC16Lowering(*TM.getTargetLowering()) { - // Keep PIC16 specific DAGISel to use during the lowering - PIC16Lowering.ISel = this; - } + TM(tm), PIC16Lowering(*TM.getTargetLowering()) {} // Pass Name virtual const char *getPassName() const { Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=91993&r1=91992&r2=91993&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Wed Dec 23 03:46:01 2009 @@ -1482,8 +1482,7 @@ // operand no. of the operand to be converted in 'MemOp'. Remember, PIC16 has // no instruction that can operation on two registers. Most insns take // one register and one memory operand (addwf) / Constant (addlw). -bool PIC16TargetLowering::NeedToConvertToMemOp(SDValue Op, unsigned &MemOp, - SelectionDAG &DAG) { +bool PIC16TargetLowering::NeedToConvertToMemOp(SDValue Op, unsigned &MemOp) { // If one of the operand is a constant, return false. if (Op.getOperand(0).getOpcode() == ISD::Constant || Op.getOperand(1).getOpcode() == ISD::Constant) @@ -1492,33 +1491,11 @@ // Return false if one of the operands is already a direct // load and that operand has only one use. if (isDirectLoad(Op.getOperand(0))) { - if (Op.getOperand(0).hasOneUse()) { - // Legal and profitable folding check uses the NodeId of DAG nodes. - // This NodeId is assigned by topological order. Therefore first - // assign topological order then perform legal and profitable check. - // Note:- Though this ordering is done before begining with legalization, - // newly added node during legalization process have NodeId=-1 (NewNode) - // therefore before performing any check proper ordering of the node is - // required. - DAG.AssignTopologicalOrder(); - - // Direct load operands are folded in binary operations. But before folding - // verify if this folding is legal. Fold only if it is legal otherwise - // convert this direct load to a separate memory operation. - if(ISel->IsLegalAndProfitableToFold(Op.getOperand(0).getNode(), - Op.getNode(), Op.getNode())) - return false; - else - MemOp = 0; - } + if (Op.getOperand(0).hasOneUse()) + return false; + else + MemOp = 0; } - - // For operations that are non-cummutative there is no need to check - // for right operand because folding right operand may result in - // incorrect operation. - if (! SelectionDAG::isCommutativeBinOp(Op.getOpcode())) - return true; - if (isDirectLoad(Op.getOperand(1))) { if (Op.getOperand(1).hasOneUse()) return false; @@ -1537,7 +1514,7 @@ assert (Op.getValueType() == MVT::i8 && "illegal Op to lower"); unsigned MemOp = 1; - if (NeedToConvertToMemOp(Op, MemOp, DAG)) { + if (NeedToConvertToMemOp(Op, MemOp)) { // Put one value on stack. SDValue NewVal = ConvertToMemOperand (Op.getOperand(MemOp), DAG, dl); @@ -1556,7 +1533,7 @@ assert (Op.getValueType() == MVT::i8 && "illegal add to lower"); DebugLoc dl = Op.getDebugLoc(); unsigned MemOp = 1; - if (NeedToConvertToMemOp(Op, MemOp, DAG)) { + if (NeedToConvertToMemOp(Op, MemOp)) { // Put one value on stack. SDValue NewVal = ConvertToMemOperand (Op.getOperand(MemOp), DAG, dl); @@ -1587,8 +1564,7 @@ // Nothing to do if the first operand is already a direct load and it has // only one use. - unsigned MemOp = 0; - if (! NeedToConvertToMemOp(Op, MemOp, DAG)) + if (isDirectLoad(Op.getOperand(0)) && Op.getOperand(0).hasOneUse()) return Op; // Put first operand on stack. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=91993&r1=91992&r2=91993&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Wed Dec 23 03:46:01 2009 @@ -18,7 +18,6 @@ #include "PIC16.h" #include "PIC16Subtarget.h" #include "llvm/CodeGen/SelectionDAG.h" -#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetLowering.h" #include @@ -217,9 +216,7 @@ // This function checks if we need to put an operand of an operation on // stack and generate a load or not. - // DAG parameter is required to access DAG information during - // analysis. - bool NeedToConvertToMemOp(SDValue Op, unsigned &MemOp, SelectionDAG &DAG); + bool NeedToConvertToMemOp(SDValue Op, unsigned &MemOp); /// Subtarget - Keep a pointer to the PIC16Subtarget around so that we can /// make the right decision when generating code for different targets. @@ -242,11 +239,6 @@ // Check if operation has a direct load operand. inline bool isDirectLoad(const SDValue Op); - public: - // Keep a pointer to SelectionDAGISel to access its public - // interface (It is required during legalization) - SelectionDAGISel *ISel; - private: // The frameindexes generated for spill/reload are stack based. // This maps maintain zero based indexes for these FIs. Modified: llvm/trunk/test/CodeGen/PIC16/C16-49.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PIC16/C16-49.ll?rev=91993&r1=91992&r2=91993&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PIC16/C16-49.ll (original) +++ llvm/trunk/test/CodeGen/PIC16/C16-49.ll Wed Dec 23 03:46:01 2009 @@ -1,15 +0,0 @@ -;RUN: llvm-as < %s | llc -march=pic16 - - at aa = global i16 55, align 1 ; [#uses=1] - at bb = global i16 44, align 1 ; [#uses=1] - at PORTD = external global i8 ; [#uses=1] - -define void @foo() nounwind { -entry: - %tmp = volatile load i16* @aa ; [#uses=1] - %tmp1 = volatile load i16* @bb ; [#uses=1] - %sub = sub i16 %tmp, %tmp1 ; [#uses=1] - %conv = trunc i16 %sub to i8 ; [#uses=1] - store i8 %conv, i8* @PORTD - ret void -} From sanjiv.gupta at microchip.com Wed Dec 23 04:35:28 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Wed, 23 Dec 2009 10:35:28 -0000 Subject: [llvm-commits] [llvm] r91994 - /llvm/trunk/test/CodeGen/PIC16/C16-49.ll Message-ID: <200912231035.nBNAZS54001903@zion.cs.uiuc.edu> Author: sgupta Date: Wed Dec 23 04:35:24 2009 New Revision: 91994 URL: http://llvm.org/viewvc/llvm-project?rev=91994&view=rev Log: deleting empty file. Removed: llvm/trunk/test/CodeGen/PIC16/C16-49.ll Removed: llvm/trunk/test/CodeGen/PIC16/C16-49.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PIC16/C16-49.ll?rev=91993&view=auto ============================================================================== (empty) From sanjiv.gupta at microchip.com Wed Dec 23 04:56:02 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Wed, 23 Dec 2009 10:56:02 -0000 Subject: [llvm-commits] [llvm] r91995 - in /llvm/trunk/lib/Target/PIC16: PIC16ISelLowering.cpp PIC16InstrInfo.td Message-ID: <200912231056.nBNAu2dk002622@zion.cs.uiuc.edu> Author: sgupta Date: Wed Dec 23 04:56:02 2009 New Revision: 91995 URL: http://llvm.org/viewvc/llvm-project?rev=91995&view=rev Log: Added missing patterns for subtract instruction. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=91995&r1=91994&r2=91995&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Wed Dec 23 04:56:02 2009 @@ -1561,30 +1561,47 @@ DebugLoc dl = Op.getDebugLoc(); // We should have handled larger operands in type legalizer itself. assert (Op.getValueType() == MVT::i8 && "illegal sub to lower"); + unsigned MemOp = 1; + SDVTList Tys = DAG.getVTList(MVT::i8, MVT::Flag); - // Nothing to do if the first operand is already a direct load and it has - // only one use. - if (isDirectLoad(Op.getOperand(0)) && Op.getOperand(0).hasOneUse()) - return Op; - - // Put first operand on stack. - SDValue NewVal = ConvertToMemOperand (Op.getOperand(0), DAG, dl); + // Since we don't have an instruction for X - c , + // we can change it to X + (-c) + ConstantSDNode *C = dyn_cast(Op.getOperand(1)); + if (C && (Op.getOpcode() == ISD::SUB)) + { + return DAG.getNode(ISD::ADD, + dl, MVT::i8, Op.getOperand(0), + DAG.getConstant(0-(C->getZExtValue()), MVT::i8)); + } - SDVTList Tys = DAG.getVTList(MVT::i8, MVT::Flag); - switch (Op.getOpcode()) { - default: - assert (0 && "Opcode unknown."); - case ISD::SUBE: - return DAG.getNode(Op.getOpcode(), dl, Tys, NewVal, Op.getOperand(1), - Op.getOperand(2)); - break; - case ISD::SUBC: - return DAG.getNode(Op.getOpcode(), dl, Tys, NewVal, Op.getOperand(1)); - break; - case ISD::SUB: - return DAG.getNode(Op.getOpcode(), dl, MVT::i8, NewVal, Op.getOperand(1)); - break; - } + if (NeedToConvertToMemOp(Op, MemOp) || + (isDirectLoad(Op.getOperand(1)) && + (!isDirectLoad(Op.getOperand(0))) && + (Op.getOperand(0).getOpcode() != ISD::Constant))) + { + // Put first operand on stack. + SDValue NewVal = ConvertToMemOperand (Op.getOperand(0), DAG, dl); + + switch (Op.getOpcode()) { + default: + assert (0 && "Opcode unknown."); + case ISD::SUBE: + return DAG.getNode(Op.getOpcode(), + dl, Tys, NewVal, Op.getOperand(1), + Op.getOperand(2)); + break; + case ISD::SUBC: + return DAG.getNode(Op.getOpcode(), + dl, Tys, NewVal, Op.getOperand(1)); + break; + case ISD::SUB: + return DAG.getNode(Op.getOpcode(), + dl, MVT::i8, NewVal, Op.getOperand(1)); + break; + } + } + else + return Op; } void PIC16TargetLowering::InitReservedFrameCount(const Function *F) { Modified: llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td?rev=91995&r1=91994&r2=91995&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td (original) +++ llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.td Wed Dec 23 04:56:02 2009 @@ -161,7 +161,7 @@ // W = W Op L : Do Op of L with W and place result in W. let isTwoAddress = 1 in -class BinOpLW opcode, string OpcStr, SDNode OpNode> : +class BinOpWL opcode, string OpcStr, SDNode OpNode> : LiteralFormat; -def addlw_2 : BinOpLW<0, "addlw", addc>; +def addlw_1 : BinOpWL<0, "addlw", add>; +def addlw_2 : BinOpWL<0, "addlw", addc>; let Uses = [STATUS] in -def addlwc : BinOpLW<0, "addlwc", adde>; // With Carry. (Assembler macro). +def addlwc : BinOpWL<0, "addlwc", adde>; // With Carry. (Assembler macro). // bitwise operations involving a literal and w. -def andlw : BinOpLW<0, "andlw", and>; -def xorlw : BinOpLW<0, "xorlw", xor>; -def orlw : BinOpLW<0, "iorlw", or>; +def andlw : BinOpWL<0, "andlw", and>; +def xorlw : BinOpWL<0, "xorlw", xor>; +def orlw : BinOpWL<0, "iorlw", or>; } // sublw // W = C - W ; sub W from literal. (Without borrow). let isTwoAddress = 1 in -class SUBLW opcode, SDNode OpNode> : +class SUBLW opcode, string OpcStr, SDNode OpNode> : LiteralFormat; +// subwl +// W = W - C ; sub literal from W (Without borrow). +let isTwoAddress = 1 in +class SUBWL opcode, string OpcStr, SDNode OpNode> : + LiteralFormat; let Defs = [STATUS] in { -def sublw_1 : SUBLW<0, sub>; -def sublw_2 : SUBLW<0, subc>; +def sublw_1 : SUBLW<0, "sublw", sub>; +def sublw_2 : SUBLW<0, "sublw", subc>; +def sublw_3 : SUBLW<0, "sublwb", sube>; // With borrow (Assembler macro). + +def sublw_4 : SUBWL<0, "subwl", sub>; // Assembler macro replace with addlw +def sublw_5 : SUBWL<0, "subwl", subc>; // Assembler macro replace with addlw +def sublw_6 : SUBWL<0, "subwlb", sube>; // With borrow (Assembler macro). } let Defs = [STATUS], isTerminator = 1 in -def sublw_cc : SUBLW<0, PIC16Subcc>; +def sublw_cc : SUBLW<0, "sublw", PIC16Subcc>; // Call instruction. let isCall = 1, From sanjiv.gupta at microchip.com Wed Dec 23 05:19:09 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Wed, 23 Dec 2009 11:19:09 -0000 Subject: [llvm-commits] [llvm] r91996 - in /llvm/trunk: lib/Target/PIC16/PIC16ISelDAGToDAG.h lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.h test/CodeGen/PIC16/C16-49.ll Message-ID: <200912231119.nBNBJ9rs003276@zion.cs.uiuc.edu> Author: sgupta Date: Wed Dec 23 05:19:09 2009 New Revision: 91996 URL: http://llvm.org/viewvc/llvm-project?rev=91996&view=rev Log: Reapply 91904. Added: llvm/trunk/test/CodeGen/PIC16/C16-49.ll Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h?rev=91996&r1=91995&r2=91996&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h Wed Dec 23 05:19:09 2009 @@ -36,7 +36,10 @@ public: explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) : SelectionDAGISel(tm), - TM(tm), PIC16Lowering(*TM.getTargetLowering()) {} + TM(tm), PIC16Lowering(*TM.getTargetLowering()) { + // Keep PIC16 specific DAGISel to use during the lowering + PIC16Lowering.ISel = this; + } // Pass Name virtual const char *getPassName() const { Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=91996&r1=91995&r2=91996&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Wed Dec 23 05:19:09 2009 @@ -1482,7 +1482,8 @@ // operand no. of the operand to be converted in 'MemOp'. Remember, PIC16 has // no instruction that can operation on two registers. Most insns take // one register and one memory operand (addwf) / Constant (addlw). -bool PIC16TargetLowering::NeedToConvertToMemOp(SDValue Op, unsigned &MemOp) { +bool PIC16TargetLowering::NeedToConvertToMemOp(SDValue Op, unsigned &MemOp, + SelectionDAG &DAG) { // If one of the operand is a constant, return false. if (Op.getOperand(0).getOpcode() == ISD::Constant || Op.getOperand(1).getOpcode() == ISD::Constant) @@ -1491,11 +1492,33 @@ // Return false if one of the operands is already a direct // load and that operand has only one use. if (isDirectLoad(Op.getOperand(0))) { - if (Op.getOperand(0).hasOneUse()) - return false; - else - MemOp = 0; + if (Op.getOperand(0).hasOneUse()) { + // Legal and profitable folding check uses the NodeId of DAG nodes. + // This NodeId is assigned by topological order. Therefore first + // assign topological order then perform legal and profitable check. + // Note:- Though this ordering is done before begining with legalization, + // newly added node during legalization process have NodeId=-1 (NewNode) + // therefore before performing any check proper ordering of the node is + // required. + DAG.AssignTopologicalOrder(); + + // Direct load operands are folded in binary operations. But before folding + // verify if this folding is legal. Fold only if it is legal otherwise + // convert this direct load to a separate memory operation. + if(ISel->IsLegalAndProfitableToFold(Op.getOperand(0).getNode(), + Op.getNode(), Op.getNode())) + return false; + else + MemOp = 0; + } } + + // For operations that are non-cummutative there is no need to check + // for right operand because folding right operand may result in + // incorrect operation. + if (! SelectionDAG::isCommutativeBinOp(Op.getOpcode())) + return true; + if (isDirectLoad(Op.getOperand(1))) { if (Op.getOperand(1).hasOneUse()) return false; @@ -1514,7 +1537,7 @@ assert (Op.getValueType() == MVT::i8 && "illegal Op to lower"); unsigned MemOp = 1; - if (NeedToConvertToMemOp(Op, MemOp)) { + if (NeedToConvertToMemOp(Op, MemOp, DAG)) { // Put one value on stack. SDValue NewVal = ConvertToMemOperand (Op.getOperand(MemOp), DAG, dl); @@ -1533,7 +1556,7 @@ assert (Op.getValueType() == MVT::i8 && "illegal add to lower"); DebugLoc dl = Op.getDebugLoc(); unsigned MemOp = 1; - if (NeedToConvertToMemOp(Op, MemOp)) { + if (NeedToConvertToMemOp(Op, MemOp, DAG)) { // Put one value on stack. SDValue NewVal = ConvertToMemOperand (Op.getOperand(MemOp), DAG, dl); @@ -1574,7 +1597,7 @@ DAG.getConstant(0-(C->getZExtValue()), MVT::i8)); } - if (NeedToConvertToMemOp(Op, MemOp) || + if (NeedToConvertToMemOp(Op, MemOp, DAG) || (isDirectLoad(Op.getOperand(1)) && (!isDirectLoad(Op.getOperand(0))) && (Op.getOperand(0).getOpcode() != ISD::Constant))) Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=91996&r1=91995&r2=91996&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Wed Dec 23 05:19:09 2009 @@ -18,6 +18,7 @@ #include "PIC16.h" #include "PIC16Subtarget.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetLowering.h" #include @@ -216,7 +217,9 @@ // This function checks if we need to put an operand of an operation on // stack and generate a load or not. - bool NeedToConvertToMemOp(SDValue Op, unsigned &MemOp); + // DAG parameter is required to access DAG information during + // analysis. + bool NeedToConvertToMemOp(SDValue Op, unsigned &MemOp, SelectionDAG &DAG); /// Subtarget - Keep a pointer to the PIC16Subtarget around so that we can /// make the right decision when generating code for different targets. @@ -239,6 +242,11 @@ // Check if operation has a direct load operand. inline bool isDirectLoad(const SDValue Op); + public: + // Keep a pointer to SelectionDAGISel to access its public + // interface (It is required during legalization) + SelectionDAGISel *ISel; + private: // The frameindexes generated for spill/reload are stack based. // This maps maintain zero based indexes for these FIs. Added: llvm/trunk/test/CodeGen/PIC16/C16-49.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PIC16/C16-49.ll?rev=91996&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PIC16/C16-49.ll (added) +++ llvm/trunk/test/CodeGen/PIC16/C16-49.ll Wed Dec 23 05:19:09 2009 @@ -0,0 +1,15 @@ +;RUN: llvm-as < %s | llc -march=pic16 + + at aa = global i16 55, align 1 ; [#uses=1] + at bb = global i16 44, align 1 ; [#uses=1] + at PORTD = external global i8 ; [#uses=1] + +define void @foo() nounwind { +entry: + %tmp = volatile load i16* @aa ; [#uses=1] + %tmp1 = volatile load i16* @bb ; [#uses=1] + %sub = sub i16 %tmp, %tmp1 ; [#uses=1] + %conv = trunc i16 %sub to i8 ; [#uses=1] + store i8 %conv, i8* @PORTD + ret void +} From foldr at codedgers.com Wed Dec 23 06:49:31 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Wed, 23 Dec 2009 12:49:31 -0000 Subject: [llvm-commits] [llvm] r91997 - in /llvm/trunk: test/LLVMC/OptionPreprocessor.td tools/llvmc/doc/LLVMC-Reference.rst utils/TableGen/LLVMCConfigurationEmitter.cpp Message-ID: <200912231249.nBNCnVcM006317@zion.cs.uiuc.edu> Author: foldr Date: Wed Dec 23 06:49:30 2009 New Revision: 91997 URL: http://llvm.org/viewvc/llvm-project?rev=91997&view=rev Log: Allow (set_option SwitchOption, true). Modified: llvm/trunk/test/LLVMC/OptionPreprocessor.td llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Modified: llvm/trunk/test/LLVMC/OptionPreprocessor.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/OptionPreprocessor.td?rev=91997&r1=91996&r2=91997&view=diff ============================================================================== --- llvm/trunk/test/LLVMC/OptionPreprocessor.td (original) +++ llvm/trunk/test/LLVMC/OptionPreprocessor.td Wed Dec 23 06:49:30 2009 @@ -1,4 +1,4 @@ -// Test for the OptionPreprocessor and any*. +// Test for the OptionPreprocessor and related functionality. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t // RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t @@ -26,13 +26,18 @@ (unset_option "foo_p"), (unset_option "foo_l")], // CHECK: W2 // CHECK: foo = true; + // CHECK: bar = true; + // CHECK: baz = false; // CHECK: foo_p = "asdf"; // CHECK: foo_l.clear(); // CHECK: foo_l.push_back("qwert"); // CHECK: foo_l.push_back("yuiop"); // CHECK: foo_l.push_back("asdf"); (and (switch_on ["foo", "bar"]), (any_empty ["foo_p", "bar_p"])), - [(warning "W2"), (set_option "foo"), (set_option "foo_p", "asdf"), + [(warning "W2"), (set_option "foo"), + (set_option "bar", true), + (set_option "baz", false), + (set_option "foo_p", "asdf"), (set_option "foo_l", ["qwert", "yuiop", "asdf"])], // CHECK: W3 // CHECK: foo = true; Modified: llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst?rev=91997&r1=91996&r2=91997&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst (original) +++ llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Wed Dec 23 06:49:30 2009 @@ -690,13 +690,16 @@ ``OptionPreprocessor`` is basically a single big ``case`` expression, which is evaluated only once right after the plugin is loaded. The only allowed actions -in ``OptionPreprocessor`` are ``error``, ``warning`` and two special actions: +in ``OptionPreprocessor`` are ``error``, ``warning``, and two special actions: ``unset_option`` and ``set_option``. As their names suggest, they can be used to -set or unset a given option. To set a parameter option with ``set_option``, use -the two-argument form: ``(set_option "parameter", "value")``. For convenience, -``set_option`` and ``unset_option`` also work on lists (that is, instead of -``[(unset_option "A"), (unset_option "B")]`` you can use ``(unset_option ["A", -"B"])``). +set or unset a given option. To set an option with ``set_option``, use the +two-argument form: ``(set_option "parameter", VALUE)``. Here, ``VALUE`` can be +either a string, a string list, or a boolean constant. + +For convenience, ``set_option`` and ``unset_option`` also work on lists. That +is, instead of ``[(unset_option "A"), (unset_option "B")]`` you can use +``(unset_option ["A", "B"])``. Obviously, ``(set_option ["A", "B"])`` is valid +only if both ``A`` and ``B`` are switches. More advanced topics Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=91997&r1=91996&r2=91997&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Wed Dec 23 06:49:30 2009 @@ -17,6 +17,7 @@ #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSet.h" + #include #include #include @@ -89,6 +90,17 @@ return D.getOperator()->getAsString(); } +/// CheckBooleanConstant - Check that the provided value is a boolean constant. +void CheckBooleanConstant(const Init* I) { + const DefInit& val = dynamic_cast(*I); + const std::string& str = val.getAsString(); + + if (str != "true" && str != "false") { + throw "Incorrect boolean value: '" + str + + "': must be either 'true' or 'false'"; + } +} + // checkNumberOfArguments - Ensure that the number of args in d is // greater than or equal to min_arguments, otherwise throw an exception. void checkNumberOfArguments (const DagInit& d, unsigned minArgs) { @@ -2309,8 +2321,8 @@ const OptionDescriptions& OptDescs_; - void onListOrDag(HandlerImpl h, - const DagInit& d, unsigned IndentLevel, raw_ostream& O) const + void onListOrDag(const DagInit& d, HandlerImpl h, + unsigned IndentLevel, raw_ostream& O) const { checkNumberOfArguments(d, 1); const Init* I = d.getArg(0); @@ -2350,12 +2362,12 @@ void onUnsetOption(const DagInit& d, unsigned IndentLevel, raw_ostream& O) const { - this->onListOrDag(&EmitPreprocessOptionsCallback::onUnsetOptionImpl, - d, IndentLevel, O); + this->onListOrDag(d, &EmitPreprocessOptionsCallback::onUnsetOptionImpl, + IndentLevel, O); } - void onSetListOrParameter(const DagInit& d, - unsigned IndentLevel, raw_ostream& O) const { + void onSetOptionImpl(const DagInit& d, + unsigned IndentLevel, raw_ostream& O) const { checkNumberOfArguments(d, 2); const std::string& OptName = InitPtrToString(d.getArg(0)); const Init* Value = d.getArg(1); @@ -2371,13 +2383,18 @@ << InitPtrToString(*B) << "\");\n"; } } + else if (OptDesc.isSwitch()) { + CheckBooleanConstant(Value); + O.indent(IndentLevel) << OptDesc.GenVariableName() + << " = " << Value->getAsString() << ";\n"; + } else if (OptDesc.isParameter()) { const std::string& Str = InitPtrToString(Value); O.indent(IndentLevel) << OptDesc.GenVariableName() << " = \"" << Str << "\";\n"; } else { - throw "set_option: -" + OptName + ": is not a list or parameter option!"; + throw "Can't apply 'set_option' to alias option -" + OptName + " !"; } } @@ -2397,15 +2414,15 @@ { checkNumberOfArguments(d, 1); - // Two arguments: (set_option "parameter", VALUE), where VALUE is either a - // string or a string list. + // Two arguments: (set_option "parameter", VALUE), where VALUE can be a + // boolean, a string or a string list. if (d.getNumArgs() > 1) - this->onSetListOrParameter(d, IndentLevel, O); + this->onSetOptionImpl(d, IndentLevel, O); // One argument: (set_option "switch") // or (set_option ["switch1", "switch2", ...]) else - this->onListOrDag(&EmitPreprocessOptionsCallback::onSetSwitch, - d, IndentLevel, O); + this->onListOrDag(d, &EmitPreprocessOptionsCallback::onSetSwitch, + IndentLevel, O); } public: From foldr at codedgers.com Wed Dec 23 06:49:42 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Wed, 23 Dec 2009 12:49:42 -0000 Subject: [llvm-commits] [llvm] r91998 - /llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Message-ID: <200912231249.nBNCngiN006334@zion.cs.uiuc.edu> Author: foldr Date: Wed Dec 23 06:49:41 2009 New Revision: 91998 URL: http://llvm.org/viewvc/llvm-project?rev=91998&view=rev Log: Cosmetic issue: more consistent naming. Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=91998&r1=91997&r2=91998&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Wed Dec 23 06:49:41 2009 @@ -101,15 +101,15 @@ } } -// checkNumberOfArguments - Ensure that the number of args in d is +// CheckNumberOfArguments - Ensure that the number of args in d is // greater than or equal to min_arguments, otherwise throw an exception. -void checkNumberOfArguments (const DagInit& d, unsigned minArgs) { +void CheckNumberOfArguments (const DagInit& d, unsigned minArgs) { if (d.getNumArgs() < minArgs) throw GetOperatorName(d) + ": too few arguments!"; } -// isDagEmpty - is this DAG marked with an empty marker? -bool isDagEmpty (const DagInit& d) { +// IsDagEmpty - is this DAG marked with an empty marker? +bool IsDagEmpty (const DagInit& d) { return GetOperatorName(d) == "empty_dag_marker"; } @@ -136,8 +136,8 @@ return ret; } -/// oneOf - Does the input string contain this character? -bool oneOf(const char* lst, char c) { +/// OneOf - Does the input string contain this character? +bool OneOf(const char* lst, char c) { while (*lst) { if (*lst++ == c) return true; @@ -146,7 +146,7 @@ } template -void checkedIncrement(I& P, I E, S ErrorString) { +void CheckedIncrement(I& P, I E, S ErrorString) { ++P; if (P == E) throw ErrorString; @@ -588,34 +588,34 @@ /// Methods that handle option properties such as (help) or (hidden). void onExtern (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); optDesc_.setExtern(); } void onHelp (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); optDesc_.Help = InitPtrToString(d.getArg(0)); } void onHidden (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); optDesc_.setHidden(); } void onReallyHidden (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); optDesc_.setReallyHidden(); } void onCommaSeparated (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); if (!optDesc_.isList()) throw "'comma_separated' is valid only on list options!"; optDesc_.setCommaSeparated(); } void onRequired (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); if (optDesc_.isOneOrMore() || optDesc_.isOptional()) throw "Only one of (required), (optional) or " "(one_or_more) properties is allowed!"; @@ -623,7 +623,7 @@ } void onInit (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); Init* i = d.getArg(0); const std::string& str = i->getAsString(); @@ -637,7 +637,7 @@ } void onOneOrMore (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); if (optDesc_.isRequired() || optDesc_.isOptional()) throw "Only one of (required), (optional) or " "(one_or_more) properties is allowed!"; @@ -648,7 +648,7 @@ } void onOptional (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); if (optDesc_.isRequired() || optDesc_.isOneOrMore()) throw "Only one of (required), (optional) or " "(one_or_more) properties is allowed!"; @@ -659,7 +659,7 @@ } void onMultiVal (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); int val = InitPtrToInt(d.getArg(0)); if (val < 2) throw "Error in the 'multi_val' property: " @@ -683,7 +683,7 @@ void operator()(const Init* i) { const DagInit& d = InitPtrToDag(i); - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); const OptionType::OptionType Type = stringToOptionType(GetOperatorName(d)); @@ -692,7 +692,7 @@ OptionDescription OD(Type, Name); if (!OD.isExtern()) - checkNumberOfArguments(d, 2); + CheckNumberOfArguments(d, 2); if (OD.isAlias()) { // Aliases store the aliased option name in the 'Help' field. @@ -708,7 +708,7 @@ /// processOptionProperties - Go through the list of option /// properties and call a corresponding handler for each. static void processOptionProperties (const DagInit& d, OptionDescription& o) { - checkNumberOfArguments(d, 2); + CheckNumberOfArguments(d, 2); DagInit::const_arg_iterator B = d.arg_begin(); // Skip the first argument: it's always the option name. ++B; @@ -813,7 +813,7 @@ /// DAG representation. void onActions (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); Init* Case = d.getArg(0); if (typeid(*Case) != typeid(DagInit) || GetOperatorName(static_cast(*Case)) != "case") @@ -822,12 +822,12 @@ } void onCmdLine (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); toolDesc_.CmdLine = d.getArg(0); } void onInLanguage (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); Init* arg = d.getArg(0); // Find out the argument's type. @@ -854,22 +854,22 @@ } void onJoin (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); toolDesc_.setJoin(); } void onOutLanguage (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); toolDesc_.OutLanguage = InitPtrToString(d.getArg(0)); } void onOutputSuffix (const DagInit& d) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); toolDesc_.OutputSuffix = InitPtrToString(d.getArg(0)); } void onSink (const DagInit& d) { - checkNumberOfArguments(d, 0); + CheckNumberOfArguments(d, 0); toolDesc_.setSink(); } @@ -1089,7 +1089,7 @@ ActionName == "switch_on" || ActionName == "parameter_equals" || ActionName == "element_in_list" || ActionName == "not_empty" || ActionName == "empty") { - checkNumberOfArguments(Stmt, 1); + CheckNumberOfArguments(Stmt, 1); const std::string& Name = InitPtrToString(Stmt.getArg(0)); OptionNames_.insert(Name); } @@ -1150,7 +1150,7 @@ const Record* Edge = *B; DagInit& Weight = *Edge->getValueAsDag("weight"); - if (!isDagEmpty(Weight)) + if (!IsDagEmpty(Weight)) WalkCase(&Weight, ExtractOptionNames(nonSuperfluousOptions), Id()); } @@ -1307,7 +1307,7 @@ const DagInit& d, const OptionDescriptions& OptDescs, raw_ostream& O) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); if (typeid(*d.getArg(0)) == typeid(ListInit)) return EmitCaseTest1ArgList(TestName, d, OptDescs, O); else @@ -1320,7 +1320,7 @@ unsigned IndentLevel, const OptionDescriptions& OptDescs, raw_ostream& O) { - checkNumberOfArguments(d, 2); + CheckNumberOfArguments(d, 2); const std::string& OptName = InitPtrToString(d.getArg(0)); const std::string& OptArg = InitPtrToString(d.getArg(1)); @@ -1371,7 +1371,7 @@ void EmitLogicalNot(const DagInit& d, unsigned IndentLevel, const OptionDescriptions& OptDescs, raw_ostream& O) { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); const DagInit& InnerTest = InitPtrToDag(d.getArg(0)); O << "! ("; EmitCaseTest(InnerTest, IndentLevel, OptDescs, O); @@ -1500,7 +1500,7 @@ cur_st = SpecialCommand; break; } - if (oneOf(Delimiters, cur_ch)) { + if (OneOf(Delimiters, cur_ch)) { // Skip whitespace B = CmdLine.find_first_not_of(Delimiters, B); if (B == std::string::npos) { @@ -1515,7 +1515,7 @@ case SpecialCommand: - if (oneOf(Delimiters, cur_ch)) { + if (OneOf(Delimiters, cur_ch)) { cur_st = Normal; Out.push_back(""); continue; @@ -1528,7 +1528,7 @@ break; case InsideSpecialCommand: - if (oneOf(Delimiters, cur_ch)) { + if (OneOf(Delimiters, cur_ch)) { continue; } if (cur_ch == '\'') { @@ -1567,7 +1567,7 @@ bool IsJoin, raw_ostream& O) { const char* errorMessage = "Syntax error in $CALL invocation!"; - checkedIncrement(Pos, End, errorMessage); + CheckedIncrement(Pos, End, errorMessage); const std::string& CmdName = *Pos; if (CmdName == ")") @@ -1579,7 +1579,7 @@ bool firstIteration = true; while (true) { - checkedIncrement(Pos, End, errorMessage); + CheckedIncrement(Pos, End, errorMessage); const std::string& Arg = *Pos; assert(Arg.size() != 0); @@ -1614,7 +1614,7 @@ StrVector::const_iterator End, raw_ostream& O) { const char* errorMessage = "Syntax error in $ENV invocation!"; - checkedIncrement(Pos, End, errorMessage); + CheckedIncrement(Pos, End, errorMessage); const std::string& EnvName = *Pos; if (EnvName == ")") @@ -1624,7 +1624,7 @@ O << EnvName; O << "\"))"; - checkedIncrement(Pos, End, errorMessage); + CheckedIncrement(Pos, End, errorMessage); return Pos; } @@ -1825,7 +1825,7 @@ void onWarningDag(const DagInit& d, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); O.indent(IndentLevel) << "llvm::errs() << \"" << InitPtrToString(d.getArg(0)) << "\";\n"; } @@ -1875,7 +1875,7 @@ void onAppendCmd (const DagInit& Dag, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(Dag, 1); + CheckNumberOfArguments(Dag, 1); this->EmitHookInvocation(InitPtrToString(Dag.getArg(0)), "vec.push_back(", ");\n", IndentLevel, O); } @@ -1883,7 +1883,7 @@ void onForward (const DagInit& Dag, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(Dag, 1); + CheckNumberOfArguments(Dag, 1); const std::string& Name = InitPtrToString(Dag.getArg(0)); EmitForwardOptionPropertyHandlingCode(OptDescs.FindOption(Name), IndentLevel, "", O); @@ -1892,7 +1892,7 @@ void onForwardAs (const DagInit& Dag, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(Dag, 2); + CheckNumberOfArguments(Dag, 2); const std::string& Name = InitPtrToString(Dag.getArg(0)); const std::string& NewName = InitPtrToString(Dag.getArg(1)); EmitForwardOptionPropertyHandlingCode(OptDescs.FindOption(Name), @@ -1902,7 +1902,7 @@ void onForwardValue (const DagInit& Dag, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(Dag, 1); + CheckNumberOfArguments(Dag, 1); const std::string& Name = InitPtrToString(Dag.getArg(0)); const OptionDescription& D = OptDescs.FindListOrParameter(Name); @@ -1920,7 +1920,7 @@ void onForwardTransformedValue (const DagInit& Dag, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(Dag, 2); + CheckNumberOfArguments(Dag, 2); const std::string& Name = InitPtrToString(Dag.getArg(0)); const std::string& Hook = InitPtrToString(Dag.getArg(1)); const OptionDescription& D = OptDescs.FindListOrParameter(Name); @@ -1933,7 +1933,7 @@ void onOutputSuffix (const DagInit& Dag, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(Dag, 1); + CheckNumberOfArguments(Dag, 1); this->EmitHookInvocation(InitPtrToString(Dag.getArg(0)), "output_suffix = ", ";\n", IndentLevel, O); } @@ -2324,7 +2324,7 @@ void onListOrDag(const DagInit& d, HandlerImpl h, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); const Init* I = d.getArg(0); // If I is a list, apply h to each element. @@ -2368,7 +2368,7 @@ void onSetOptionImpl(const DagInit& d, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(d, 2); + CheckNumberOfArguments(d, 2); const std::string& OptName = InitPtrToString(d.getArg(0)); const Init* Value = d.getArg(1); const OptionDescription& OptDesc = OptDescs_.FindOption(OptName); @@ -2412,7 +2412,7 @@ void onSetOption(const DagInit& d, unsigned IndentLevel, raw_ostream& O) const { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); // Two arguments: (set_option "parameter", VALUE), where VALUE can be a // boolean, a string or a string list. @@ -2513,7 +2513,7 @@ O.indent(IndentLevel) << "ret -= "; } else if (OpName == "error") { - checkNumberOfArguments(d, 1); + CheckNumberOfArguments(d, 1); O.indent(IndentLevel) << "throw std::runtime_error(\"" << InitPtrToString(d.getArg(0)) << "\");\n"; @@ -2565,7 +2565,7 @@ const std::string& NodeB = Edge->getValueAsString("b"); DagInit& Weight = *Edge->getValueAsDag("weight"); - if (!isDagEmpty(Weight)) + if (!IsDagEmpty(Weight)) EmitEdgeClass(i, NodeB, &Weight, OptDescs, O); ++i; } @@ -2597,7 +2597,7 @@ O.indent(Indent1) << "G.insertEdge(\"" << NodeA << "\", "; - if (isDagEmpty(Weight)) + if (IsDagEmpty(Weight)) O << "new SimpleEdge(\"" << NodeB << "\")"; else O << "new Edge" << i << "()"; @@ -2646,7 +2646,7 @@ const std::string& Name = GetOperatorName(Dag); if (Name == "forward_transformed_value") { - checkNumberOfArguments(Dag, 2); + CheckNumberOfArguments(Dag, 2); const std::string& OptName = InitPtrToString(Dag.getArg(0)); const std::string& HookName = InitPtrToString(Dag.getArg(1)); const OptionDescription& D = OptDescs_.FindOption(OptName); @@ -2655,7 +2655,7 @@ : HookInfo::ArgHook); } else if (Name == "append_cmd" || Name == "output_suffix") { - checkNumberOfArguments(Dag, 1); + CheckNumberOfArguments(Dag, 1); this->onCmdLine(InitPtrToString(Dag.getArg(0))); } } @@ -2670,7 +2670,7 @@ if (cmd == "$CALL") { unsigned NumArgs = 0; - checkedIncrement(B, E, "Syntax error in $CALL invocation!"); + CheckedIncrement(B, E, "Syntax error in $CALL invocation!"); const std::string& HookName = *B; if (HookName.at(0) == ')') From foldr at codedgers.com Wed Dec 23 06:49:51 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Wed, 23 Dec 2009 12:49:51 -0000 Subject: [llvm-commits] [llvm] r91999 - /llvm/trunk/docs/CompilerDriver.html Message-ID: <200912231249.nBNCnp6B006351@zion.cs.uiuc.edu> Author: foldr Date: Wed Dec 23 06:49:51 2009 New Revision: 91999 URL: http://llvm.org/viewvc/llvm-project?rev=91999&view=rev Log: Regenerate. Modified: llvm/trunk/docs/CompilerDriver.html Modified: llvm/trunk/docs/CompilerDriver.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CompilerDriver.html?rev=91999&r1=91998&r2=91999&view=diff ============================================================================== --- llvm/trunk/docs/CompilerDriver.html (original) +++ llvm/trunk/docs/CompilerDriver.html Wed Dec 23 06:49:51 2009 @@ -635,13 +635,15 @@ specified, -O2 is enabled.

OptionPreprocessor is basically a single big case expression, which is evaluated only once right after the plugin is loaded. The only allowed actions -in OptionPreprocessor are error, warning and two special actions: +in OptionPreprocessor are error, warning, and two special actions: unset_option and set_option. As their names suggest, they can be used to -set or unset a given option. To set a parameter option with set_option, use -the two-argument form: (set_option "parameter", "value"). For convenience, -set_option and unset_option also work on lists (that is, instead of -[(unset_option "A"), (unset_option "B")] you can use (unset_option ["A", -"B"])).

+set or unset a given option. To set an option with set_option, use the +two-argument form: (set_option "parameter", VALUE). Here, VALUE can be +either a string, a string list, or a boolean constant.

+

For convenience, set_option and unset_option also work on lists. That +is, instead of [(unset_option "A"), (unset_option "B")] you can use +(unset_option ["A", "B"]). Obviously, (set_option ["A", "B"]) is valid +only if both A and B are switches.

More advanced topics

From foldr at codedgers.com Wed Dec 23 06:50:03 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Wed, 23 Dec 2009 12:50:03 -0000 Subject: [llvm-commits] [llvm] r92000 - /llvm/trunk/tools/llvmc/doc/Makefile Message-ID: <200912231250.nBNCo47K006370@zion.cs.uiuc.edu> Author: foldr Date: Wed Dec 23 06:50:03 2009 New Revision: 92000 URL: http://llvm.org/viewvc/llvm-project?rev=92000&view=rev Log: Make it easier to regenerate docs when srcdir != objdir. Modified: llvm/trunk/tools/llvmc/doc/Makefile Modified: llvm/trunk/tools/llvmc/doc/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/doc/Makefile?rev=92000&r1=91999&r2=92000&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/doc/Makefile (original) +++ llvm/trunk/tools/llvmc/doc/Makefile Wed Dec 23 06:50:03 2009 @@ -8,7 +8,13 @@ ##===----------------------------------------------------------------------===## LEVEL=../../.. + +ifneq (,$(strip $(wildcard $(LEVEL)/Makefile.config))) include $(LEVEL)/Makefile.config +else +CP=cp +RM=rm +endif DOC_DIR=../../../docs RST2HTML=rst2html --stylesheet=llvm.css --link-stylesheet From greened at obbligato.org Wed Dec 23 10:08:16 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 16:08:16 -0000 Subject: [llvm-commits] [llvm] r92001 - in /llvm/trunk: include/llvm/Support/circular_raw_ostream.h lib/Support/circular_raw_ostream.cpp Message-ID: <200912231608.nBNG8GcZ012827@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 10:08:15 2009 New Revision: 92001 URL: http://llvm.org/viewvc/llvm-project?rev=92001&view=rev Log: Add circular_raw_ostream, which buffers its output in a circular queue and outputs it when explicitly flushed. The intent is to use it in situations such as debug output logging where a signal handler can take care of flushing the buffer at program termination. Added: llvm/trunk/include/llvm/Support/circular_raw_ostream.h llvm/trunk/lib/Support/circular_raw_ostream.cpp Added: llvm/trunk/include/llvm/Support/circular_raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/circular_raw_ostream.h?rev=92001&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/circular_raw_ostream.h (added) +++ llvm/trunk/include/llvm/Support/circular_raw_ostream.h Wed Dec 23 10:08:15 2009 @@ -0,0 +1,171 @@ +//===-- llvm/Support/circular_raw_ostream.h - Buffered streams --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains raw_ostream implementations for streams to do circular +// buffering of their output. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_CIRCULAR_RAW_OSTREAM_H +#define LLVM_SUPPORT_CIRCULAR_RAW_OSTREAM_H + +#include "llvm/Support/raw_ostream.h" + +namespace llvm +{ + /// circular_raw_ostream - A raw_ostream which *can* save its data + /// to a circular buffer, or can pass it through directly to an + /// underlying stream if specified with a buffer of zero. + /// + class circular_raw_ostream : public raw_ostream { + public: + /// TAKE_OWNERSHIP - Tell this stream that it owns the underlying + /// stream and is responsible for cleanup, memory management + /// issues, etc. + /// + static const bool TAKE_OWNERSHIP = true; + + /// REFERENCE_ONLY - Tell this stream it should not manage the + /// held stream. + /// + static const bool REFERENCE_ONLY = false; + + private: + /// TheStream - The real stream we output to. We set it to be + /// unbuffered, since we're already doing our own buffering. + /// + raw_ostream *TheStream; + + /// OwnsStream - Are we responsible for managing the underlying + /// stream? + /// + bool OwnsStream; + + /// BufferSize - The size of the buffer in bytes. + /// + size_t BufferSize; + + /// BufferArray - The actual buffer storage. + /// + char *BufferArray; + + /// Cur - Pointer to the current output point in BufferArray. + /// + char *Cur; + + /// Filled - Indicate whether the buffer has been completely + /// filled. This helps avoid garbage output. + /// + bool Filled; + + /// Banner - A pointer to a banner to print before dumping the + /// log. + /// + const char *Banner; + + /// flushBuffer - Dump the contents of the buffer to Stream. + /// + void flushBuffer(void) { + if (Filled) + // Write the older portion of the buffer. + TheStream->write(Cur, BufferArray + BufferSize - Cur); + // Write the newer portion of the buffer. + TheStream->write(BufferArray, Cur - BufferArray); + Cur = BufferArray; + Filled = false; + } + + virtual void write_impl(const char *Ptr, size_t Size); + + /// current_pos - Return the current position within the stream, + /// not counting the bytes currently in the buffer. + /// + virtual uint64_t current_pos() const { + // This has the same effect as calling TheStream.current_pos(), + // but that interface is private. + return TheStream->tell() - TheStream->GetNumBytesInBuffer(); + } + + public: + /// circular_raw_ostream - Construct an optionally + /// circular-buffered stream, handing it an underlying stream to + /// do the "real" output. + /// + /// As a side effect, if BuffSize is nonzero, the given Stream is + /// set to be Unbuffered. This is because circular_raw_ostream + /// does its own buffering, so it doesn't want another layer of + /// buffering to be happening underneath it. + /// + /// "Owns" tells the circular_raw_ostream whether it is + /// responsible for managing the held stream, doing memory + /// management of it, etc. + /// + circular_raw_ostream(raw_ostream &Stream, const char *Header, + size_t BuffSize = 0, bool Owns = REFERENCE_ONLY) + : raw_ostream(/*unbuffered*/true), + TheStream(0), + OwnsStream(Owns), + BufferSize(BuffSize), + BufferArray(0), + Filled(false), + Banner(Header) { + if (BufferSize != 0) + BufferArray = new char[BufferSize]; + Cur = BufferArray; + setStream(Stream, Owns); + } + explicit circular_raw_ostream() + : raw_ostream(/*unbuffered*/true), + TheStream(0), + OwnsStream(REFERENCE_ONLY), + BufferArray(0), + Filled(false), + Banner("") { + Cur = BufferArray; + } + + ~circular_raw_ostream() { + flush(); + flushBufferWithBanner(); + releaseStream(); + delete[] BufferArray; + } + + /// setStream - Tell the circular_raw_ostream to output a + /// different stream. "Owns" tells circular_raw_ostream whether + /// it should take responsibility for managing the underlying + /// stream. + /// + void setStream(raw_ostream &Stream, bool Owns = REFERENCE_ONLY) { + releaseStream(); + TheStream = &Stream; + OwnsStream = Owns; + } + + /// flushBufferWithBanner - Force output of the buffer along with + /// a small header. + /// + void flushBufferWithBanner(void); + + private: + /// releaseStream - Delete the held stream if needed. Otherwise, + /// transfer the buffer settings from this circular_raw_ostream + /// back to the underlying stream. + /// + void releaseStream() { + if (!TheStream) + return; + if (OwnsStream) + delete TheStream; + } + }; +} // end llvm namespace + + +#endif Added: llvm/trunk/lib/Support/circular_raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/circular_raw_ostream.cpp?rev=92001&view=auto ============================================================================== --- llvm/trunk/lib/Support/circular_raw_ostream.cpp (added) +++ llvm/trunk/lib/Support/circular_raw_ostream.cpp Wed Dec 23 10:08:15 2009 @@ -0,0 +1,47 @@ +//===- circulat_raw_ostream.cpp - Implement the circular_raw_ostream class -===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This implements support for circular buffered streams. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/circular_raw_ostream.h" + +#include + +using namespace llvm; + +void circular_raw_ostream::write_impl(const char *Ptr, size_t Size) { + if (BufferSize == 0) { + TheStream->write(Ptr, Size); + return; + } + + // Write into the buffer, wrapping if necessary. + while (Size != 0) { + unsigned Bytes = std::min(Size, BufferSize - (Cur - BufferArray)); + memcpy(Cur, Ptr, Bytes); + Size -= Bytes; + Cur += Bytes; + if (Cur == BufferArray + BufferSize) { + // Reset the output pointer to the start of the buffer. + Cur = BufferArray; + Filled = true; + } + } +} + +void circular_raw_ostream::flushBufferWithBanner(void) { + if (BufferSize != 0) { + // Write out the buffer + int num = std::strlen(Banner); + TheStream->write(Banner, num); + flushBuffer(); + } +} From greened at obbligato.org Wed Dec 23 10:39:06 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 16:39:06 -0000 Subject: [llvm-commits] [llvm] r92002 - in /llvm/trunk: include/llvm/Support/Debug.h lib/Support/Debug.cpp Message-ID: <200912231639.nBNGd6jV014010@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 10:39:06 2009 New Revision: 92002 URL: http://llvm.org/viewvc/llvm-project?rev=92002&view=rev Log: Provide dbgs(), a circular-buffering debug output stream. By default it simply passes output to errs(). If -debug-buffer-size=N is set N > 0, dbgs() buffers its output until program termination and dumps the last N characters sent to it. This is handy when debugging very large inputs. Modified: llvm/trunk/include/llvm/Support/Debug.h llvm/trunk/lib/Support/Debug.cpp Modified: llvm/trunk/include/llvm/Support/Debug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Debug.h?rev=92002&r1=92001&r2=92002&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Debug.h (original) +++ llvm/trunk/include/llvm/Support/Debug.h Wed Dec 23 10:39:06 2009 @@ -28,6 +28,8 @@ namespace llvm { +class raw_ostream; + /// DEBUG_TYPE macro - Files can specify a DEBUG_TYPE as a string, which causes /// all of their DEBUG statements to be activatable with -debug-only=thatstring. #ifndef DEBUG_TYPE @@ -58,7 +60,7 @@ /// this is a debug build, then the code specified as the option to the macro /// will be executed. Otherwise it will not be. Example: /// -/// DEBUG_WITH_TYPE("bitset", errs() << "Bitset contains: " << Bitset << "\n"); +/// DEBUG_WITH_TYPE("bitset", dbgs() << "Bitset contains: " << Bitset << "\n"); /// /// This will emit the debug information if -debug is present, and -debug-only /// is not specified, or is specified as "bitset". @@ -72,15 +74,28 @@ #define DEBUG_WITH_TYPE(TYPE, X) do { } while (0) #endif +/// EnableDebugBuffering - This defaults to false. If true, the debug +/// stream will install signal handlers to dump any buffered debug +/// output. It allows clients to selectively allow the debug stream +/// to install signal handlers if they are certain there will be no +/// conflict. +/// +extern bool EnableDebugBuffering; + +/// dbgs() - This returns a reference to a raw_ostream for debugging +/// messages. If debugging is disabled it returns dbgs(). Use it +/// like: dbgs() << "foo" << "bar"; +raw_ostream &dbgs(); + // DEBUG macro - This macro should be used by passes to emit debug information. // In the '-debug' option is specified on the commandline, and if this is a // debug build, then the code specified as the option to the macro will be // executed. Otherwise it will not be. Example: // -// DEBUG(errs() << "Bitset contains: " << Bitset << "\n"); +// DEBUG(dbgs() << "Bitset contains: " << Bitset << "\n"); // #define DEBUG(X) DEBUG_WITH_TYPE(DEBUG_TYPE, X) - + } // End llvm namespace #endif Modified: llvm/trunk/lib/Support/Debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Debug.cpp?rev=92002&r1=92001&r2=92002&view=diff ============================================================================== --- llvm/trunk/lib/Support/Debug.cpp (original) +++ llvm/trunk/lib/Support/Debug.cpp Wed Dec 23 10:39:06 2009 @@ -25,6 +25,9 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/circular_raw_ostream.h" +#include "llvm/System/Signals.h" + using namespace llvm; // All Debug.h functionality is a no-op in NDEBUG mode. @@ -37,6 +40,16 @@ Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag)); +// -debug-buffer-size - Buffer the last N characters of debug output +//until program termination. +static cl::opt +DebugBufferSize("debug-buffer-size", + cl::desc("Buffer the last N characters of debug output" + "until program termination. " + "[default 0 -- immediate print-out]"), + cl::Hidden, + cl::init(0)); + static std::string CurrentDebugType; static struct DebugOnlyOpt { void operator=(const std::string &Val) const { @@ -50,6 +63,18 @@ cl::Hidden, cl::value_desc("debug string"), cl::location(DebugOnlyOptLoc), cl::ValueRequired); +// Signal handlers - dump debug output on termination. +static void debug_user_sig_handler(void *Cookie) +{ + // This is a bit sneaky. Since this is under #ifndef NDEBUG, we + // know that debug mode is enabled and dbgs() really is a + // circular_raw_ostream. If NDEBUG is defined, then dbgs() == + // errs() but this will never be invoked. + llvm::circular_raw_ostream *dbgout = + static_cast(&llvm::dbgs()); + dbgout->flushBufferWithBanner(); +} + // isCurrentDebugType - Return true if the specified string is the debug type // specified on the command line, or if none was specified on the command line // with the -debug-only=X option. @@ -66,9 +91,38 @@ CurrentDebugType = Type; } +/// dbgs - Return a circular-buffered debug stream. +raw_ostream &llvm::dbgs() { + // Do one-time initialization in a thread-safe way. + static struct dbgstream { + circular_raw_ostream strm; + + dbgstream() : + strm(errs(), "*** Debug Log Output ***\n", + (!EnableDebugBuffering || !DebugFlag) ? 0 : DebugBufferSize) { + if (EnableDebugBuffering && DebugFlag && DebugBufferSize != 0) + // TODO: Add a handler for SIGUSER1-type signals so the user can + // force a debug dump. + sys::AddSignalHandler(&debug_user_sig_handler, 0); + // Otherwise we've already set the debug stream buffer size to + // zero, disabling buffering. + } + } thestrm; + + return thestrm.strm; +} + #else // Avoid "has no symbols" warning. namespace llvm { -int Debug_dummy = 0; + /// dbgs - Return dbgs(). + raw_ostream &dbgs() { + return dbgs(); + } } + #endif + +/// EnableDebugBuffering - Turn on signal handler installation. +/// +bool llvm::EnableDebugBuffering = false; From dgregor at apple.com Wed Dec 23 11:03:46 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 23 Dec 2009 17:03:46 -0000 Subject: [llvm-commits] [llvm] r92003 - /llvm/trunk/lib/Support/CMakeLists.txt Message-ID: <200912231703.nBNH3kRU014819@zion.cs.uiuc.edu> Author: dgregor Date: Wed Dec 23 11:03:46 2009 New Revision: 92003 URL: http://llvm.org/viewvc/llvm-project?rev=92003&view=rev Log: De-bork CMake build Modified: llvm/trunk/lib/Support/CMakeLists.txt Modified: llvm/trunk/lib/Support/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=92003&r1=92002&r2=92003&view=diff ============================================================================== --- llvm/trunk/lib/Support/CMakeLists.txt (original) +++ llvm/trunk/lib/Support/CMakeLists.txt Wed Dec 23 11:03:46 2009 @@ -3,6 +3,7 @@ APInt.cpp APSInt.cpp Allocator.cpp + circular_raw_ostream.cpp CommandLine.cpp ConstantRange.cpp Debug.cpp From dgregor at apple.com Wed Dec 23 11:05:08 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 23 Dec 2009 17:05:08 -0000 Subject: [llvm-commits] [llvm] r92004 - in /llvm/trunk/tools/lto: LTOCodeGenerator.h LTOModule.h Message-ID: <200912231705.nBNH58RR014882@zion.cs.uiuc.edu> Author: dgregor Date: Wed Dec 23 11:05:07 2009 New Revision: 92004 URL: http://llvm.org/viewvc/llvm-project?rev=92004&view=rev Log: Fix struct/class mismatch for LTOModule and LTOCodeGenerator, detected by Clang Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h llvm/trunk/tools/lto/LTOModule.h Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=92004&r1=92003&r2=92004&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Wed Dec 23 11:05:07 2009 @@ -27,8 +27,7 @@ // C++ class which implements the opaque lto_code_gen_t // -class LTOCodeGenerator { -public: +struct LTOCodeGenerator { static const char* getVersionString(); LTOCodeGenerator(); Modified: llvm/trunk/tools/lto/LTOModule.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.h?rev=92004&r1=92003&r2=92004&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.h (original) +++ llvm/trunk/tools/lto/LTOModule.h Wed Dec 23 11:05:07 2009 @@ -38,8 +38,7 @@ // // C++ class which implements the opaque lto_module_t // -class LTOModule { -public: +struct LTOModule { static bool isBitcodeFile(const void* mem, size_t length); static bool isBitcodeFile(const char* path); From greened at obbligato.org Wed Dec 23 11:18:22 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 17:18:22 -0000 Subject: [llvm-commits] [llvm] r92005 - /llvm/trunk/include/llvm/ADT/SCCIterator.h Message-ID: <200912231718.nBNHIMjj015418@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 11:18:22 2009 New Revision: 92005 URL: http://llvm.org/viewvc/llvm-project?rev=92005&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SCCIterator.h?rev=92005&r1=92004&r2=92005&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SCCIterator.h (original) +++ llvm/trunk/include/llvm/ADT/SCCIterator.h Wed Dec 23 11:18:22 2009 @@ -72,7 +72,7 @@ SCCNodeStack.push_back(N); MinVisitNumStack.push_back(visitNum); VisitStack.push_back(std::make_pair(N, GT::child_begin(N))); - //errs() << "TarjanSCC: Node " << N << + //dbgs() << "TarjanSCC: Node " << N << // " : visitNum = " << visitNum << "\n"; } @@ -107,7 +107,7 @@ if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum) MinVisitNumStack.back() = minVisitNum; - //errs() << "TarjanSCC: Popped node " << visitingN << + //dbgs() << "TarjanSCC: Popped node " << visitingN << // " : minVisitNum = " << minVisitNum << "; Node visit num = " << // nodeVisitNumbers[visitingN] << "\n"; From greened at obbligato.org Wed Dec 23 11:24:22 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 17:24:22 -0000 Subject: [llvm-commits] [llvm] r92006 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h Message-ID: <200912231724.nBNHOMNN015604@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 11:24:22 2009 New Revision: 92006 URL: http://llvm.org/viewvc/llvm-project?rev=92006&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=92006&r1=92005&r2=92006&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Wed Dec 23 11:24:22 2009 @@ -37,6 +37,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include @@ -480,7 +481,7 @@ } void dump() const { - print(errs()); + print(dbgs()); } protected: From nunoplopes at sapo.pt Wed Dec 23 11:48:10 2009 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Wed, 23 Dec 2009 17:48:10 -0000 Subject: [llvm-commits] [llvm] r92011 - in /llvm/trunk/lib: CodeGen/SelectionDAG/LegalizeDAG.cpp System/Unix/Process.inc Message-ID: <200912231748.nBNHmAEe016412@zion.cs.uiuc.edu> Author: nlopes Date: Wed Dec 23 11:48:10 2009 New Revision: 92011 URL: http://llvm.org/viewvc/llvm-project?rev=92011&view=rev Log: move a few more symbols to .rodata Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/System/Unix/Process.inc Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=92011&r1=92010&r2=92011&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Dec 23 11:48:10 2009 @@ -2747,7 +2747,7 @@ SDValue RHS = Node->getOperand(1); SDValue BottomHalf; SDValue TopHalf; - static unsigned Ops[2][3] = + static const unsigned Ops[2][3] = { { ISD::MULHU, ISD::UMUL_LOHI, ISD::ZERO_EXTEND }, { ISD::MULHS, ISD::SMUL_LOHI, ISD::SIGN_EXTEND }}; bool isSigned = Node->getOpcode() == ISD::SMULO; Modified: llvm/trunk/lib/System/Unix/Process.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Process.inc?rev=92011&r1=92010&r2=92011&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Process.inc (original) +++ llvm/trunk/lib/System/Unix/Process.inc Wed Dec 23 11:48:10 2009 @@ -277,7 +277,7 @@ COLOR(FGBG, "7", BOLD)\ } -static const char* colorcodes[2][2][8] = { +static const char colorcodes[2][2][8][10] = { { ALLCOLORS("3",""), ALLCOLORS("3","1;") }, { ALLCOLORS("4",""), ALLCOLORS("4","1;") } }; From clattner at apple.com Wed Dec 23 11:52:29 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 09:52:29 -0800 Subject: [llvm-commits] [llvm] r92006 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h In-Reply-To: <200912231724.nBNHOMNN015604@zion.cs.uiuc.edu> References: <200912231724.nBNHOMNN015604@zion.cs.uiuc.edu> Message-ID: <6E81F214-0810-46CA-961F-79A429EB78B5@apple.com> Please pull the dump() implementation out of line. We don't want to include debug.h from other headers. Thanks! -Chris On Dec 23, 2009, at 9:24 AM, David Greene wrote: > Author: greened > Date: Wed Dec 23 11:24:22 2009 > New Revision: 92006 > > URL: http://llvm.org/viewvc/llvm-project?rev=92006&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. > > Modified: > llvm/trunk/include/llvm/Analysis/LoopInfo.h > > Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=92006&r1=92005&r2=92006&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) > +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Wed Dec 23 11:24:22 > 2009 > @@ -37,6 +37,7 @@ > #include "llvm/ADT/SmallVector.h" > #include "llvm/Analysis/Dominators.h" > #include "llvm/Support/CFG.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/raw_ostream.h" > #include > > @@ -480,7 +481,7 @@ > } > > void dump() const { > - print(errs()); > + print(dbgs()); > } > > protected: > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From greened at obbligato.org Wed Dec 23 11:55:11 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 17:55:11 -0000 Subject: [llvm-commits] [llvm] r92013 - /llvm/trunk/include/llvm/Analysis/ProfileInfo.h Message-ID: <200912231755.nBNHtB3V016640@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 11:55:11 2009 New Revision: 92013 URL: http://llvm.org/viewvc/llvm-project?rev=92013&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/include/llvm/Analysis/ProfileInfo.h Modified: llvm/trunk/include/llvm/Analysis/ProfileInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileInfo.h?rev=92013&r1=92012&r2=92013&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ProfileInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/ProfileInfo.h Wed Dec 23 11:55:11 2009 @@ -38,7 +38,7 @@ class MachineBasicBlock; class MachineFunction; - // Helper for dumping edges to errs(). + // Helper for dumping edges to dbgs(). raw_ostream& operator<<(raw_ostream &O, std::pair E); raw_ostream& operator<<(raw_ostream &O, std::pair E); @@ -123,7 +123,7 @@ void setEdgeWeight(Edge e, double w) { DEBUG_WITH_TYPE("profile-info", - errs() << "Creating Edge " << e + dbgs() << "Creating Edge " << e << " (weight: " << format("%.20g",w) << ")\n"); EdgeInformation[getFunction(e)][e] = w; } @@ -170,18 +170,18 @@ void repair(const FType *F); void dump(FType *F = 0, bool real = true) { - errs() << "**** This is ProfileInfo " << this << " speaking:\n"; + dbgs() << "**** This is ProfileInfo " << this << " speaking:\n"; if (!real) { typename std::set Functions; - errs() << "Functions: \n"; + dbgs() << "Functions: \n"; if (F) { - errs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n"; + dbgs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n"; Functions.insert(F); } else { for (typename std::map::iterator fi = FunctionInformation.begin(), fe = FunctionInformation.end(); fi != fe; ++fi) { - errs() << fi->first << "@" << format("%p",fi->first) << ": " << format("%.20g",fi->second) << "\n"; + dbgs() << fi->first << "@" << format("%p",fi->first) << ": " << format("%.20g",fi->second) << "\n"; Functions.insert(fi->first); } } @@ -190,34 +190,34 @@ FI != FE; ++FI) { const FType *F = *FI; typename std::map::iterator bwi = BlockInformation.find(F); - errs() << "BasicBlocks for Function " << F << ":\n"; + dbgs() << "BasicBlocks for Function " << F << ":\n"; for (typename BlockCounts::const_iterator bi = bwi->second.begin(), be = bwi->second.end(); bi != be; ++bi) { - errs() << bi->first << "@" << format("%p", bi->first) << ": " << format("%.20g",bi->second) << "\n"; + dbgs() << bi->first << "@" << format("%p", bi->first) << ": " << format("%.20g",bi->second) << "\n"; } } for (typename std::set::iterator FI = Functions.begin(), FE = Functions.end(); FI != FE; ++FI) { typename std::map::iterator ei = EdgeInformation.find(*FI); - errs() << "Edges for Function " << ei->first << ":\n"; + dbgs() << "Edges for Function " << ei->first << ":\n"; for (typename EdgeWeights::iterator ewi = ei->second.begin(), ewe = ei->second.end(); ewi != ewe; ++ewi) { - errs() << ewi->first << ": " << format("%.20g",ewi->second) << "\n"; + dbgs() << ewi->first << ": " << format("%.20g",ewi->second) << "\n"; } } } else { assert(F && "No function given, this is not supported!"); - errs() << "Functions: \n"; - errs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n"; + dbgs() << "Functions: \n"; + dbgs() << F << "@" << format("%p", F) << ": " << format("%.20g",getExecutionCount(F)) << "\n"; - errs() << "BasicBlocks for Function " << F << ":\n"; + dbgs() << "BasicBlocks for Function " << F << ":\n"; for (typename FType::const_iterator BI = F->begin(), BE = F->end(); BI != BE; ++BI) { const BType *BB = &(*BI); - errs() << BB << "@" << format("%p", BB) << ": " << format("%.20g",getExecutionCount(BB)) << "\n"; + dbgs() << BB << "@" << format("%p", BB) << ": " << format("%.20g",getExecutionCount(BB)) << "\n"; } } - errs() << "**** ProfileInfo " << this << ", over and out.\n"; + dbgs() << "**** ProfileInfo " << this << ", over and out.\n"; } bool CalculateMissingEdge(const BType *BB, Edge &removed, bool assumeEmptyExit = false); From dag at cray.com Wed Dec 23 12:14:13 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 12:14:13 -0600 Subject: [llvm-commits] [llvm] r92006 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h In-Reply-To: <6E81F214-0810-46CA-961F-79A429EB78B5@apple.com> References: <200912231724.nBNHOMNN015604@zion.cs.uiuc.edu> <6E81F214-0810-46CA-961F-79A429EB78B5@apple.com> Message-ID: <200912231214.14264.dag@cray.com> On Wednesday 23 December 2009 11:52, Chris Lattner wrote: > Please pull the dump() implementation out of line. How? LoopBase is a template. I could go through various contortions to produce a .ipp file with template implementation code and then #include that everywhere LoopInfo.h is included, but is it worth it? Especially given that other headers already include Debug.h? See ProfileInfo.h. -Dave From clattner at apple.com Wed Dec 23 12:20:33 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 10:20:33 -0800 Subject: [llvm-commits] [llvm] r92006 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h In-Reply-To: <200912231214.14264.dag@cray.com> References: <200912231724.nBNHOMNN015604@zion.cs.uiuc.edu> <6E81F214-0810-46CA-961F-79A429EB78B5@apple.com> <200912231214.14264.dag@cray.com> Message-ID: On Dec 23, 2009, at 10:14 AM, David Greene wrote: > On Wednesday 23 December 2009 11:52, Chris Lattner wrote: >> Please pull the dump() implementation out of line. > > How? LoopBase is a template. I could go through various contortions > to produce a .ipp file with template implementation code and then > #include that everywhere LoopInfo.h is included, but is it worth it? Ugh, that's unfortunate. Lets just remove dump() from loopinfo, I don't think anyone uses it in practice anyway. > Especially given that other headers already include Debug.h? See > ProfileInfo.h. I didn't know about that one either, it should be fixed or at least not propagated. #includ'ing Debug.h into LLVM headers is particularly bad because LLVM headers are often included into random other code (clients of llvm) and the DEBUG macro conflicts with their random view of what DEBUG should be. -Chris From greened at obbligato.org Wed Dec 23 12:25:38 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 18:25:38 -0000 Subject: [llvm-commits] [llvm] r92016 - /llvm/trunk/include/llvm/Support/Casting.h Message-ID: <200912231825.nBNIPc2S017643@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 12:25:37 2009 New Revision: 92016 URL: http://llvm.org/viewvc/llvm-project?rev=92016&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/include/llvm/Support/Casting.h Modified: llvm/trunk/include/llvm/Support/Casting.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Casting.h?rev=92016&r1=92015&r2=92016&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Casting.h (original) +++ llvm/trunk/include/llvm/Support/Casting.h Wed Dec 23 12:25:37 2009 @@ -251,7 +251,7 @@ }; template <> inline bool isa_impl(const bar &Val) { - errs() << "Classof: " << &Val << "\n"; + dbgs() << "Classof: " << &Val << "\n"; return true; } From dgregor at apple.com Wed Dec 23 12:27:13 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 23 Dec 2009 18:27:13 -0000 Subject: [llvm-commits] [llvm] r92017 - /llvm/trunk/tools/lto/LTOCodeGenerator.h Message-ID: <200912231827.nBNIRDQC017704@zion.cs.uiuc.edu> Author: dgregor Date: Wed Dec 23 12:27:13 2009 New Revision: 92017 URL: http://llvm.org/viewvc/llvm-project?rev=92017&view=rev Log: Fix another -Wmismatched-tags warning Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=92017&r1=92016&r2=92017&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Wed Dec 23 12:27:13 2009 @@ -33,7 +33,7 @@ LTOCodeGenerator(); ~LTOCodeGenerator(); - bool addModule(class LTOModule*, std::string& errMsg); + bool addModule(struct LTOModule*, std::string& errMsg); bool setDebugInfo(lto_debug_model, std::string& errMsg); bool setCodePICModel(lto_codegen_model, std::string& errMsg); void setAssemblerPath(const char* path); From dag at cray.com Wed Dec 23 12:39:00 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 12:39:00 -0600 Subject: [llvm-commits] [llvm] r92006 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h In-Reply-To: References: <200912231724.nBNHOMNN015604@zion.cs.uiuc.edu> <200912231214.14264.dag@cray.com> Message-ID: <200912231239.00743.dag@cray.com> On Wednesday 23 December 2009 12:20, Chris Lattner wrote: > On Dec 23, 2009, at 10:14 AM, David Greene wrote: > > On Wednesday 23 December 2009 11:52, Chris Lattner wrote: > >> Please pull the dump() implementation out of line. > > > > How? LoopBase is a template. I could go through various contortions > > to produce a .ipp file with template implementation code and then > > #include that everywhere LoopInfo.h is included, but is it worth it? > > Ugh, that's unfortunate. Lets just remove dump() from loopinfo, I > don't think anyone uses it in practice anyway. LoopStrengthReduce.cpp. I agree with you that conflicting definitions of DEBUG are problematic. We ran into that here a long time ago. I would like to get these issues fixed but it either involves generating .ipp files and puting an additional #include burden on clients or redesigning the classes themselves. In both cases, the code owner should probably decide what to do. I don't want to go back to errs() for cases like this because it will present inconsistent debug output. And I don't want to remove dumps from clients that use them for debugging purposes. Hmm, what to do? I'm ok with leaving the "bad" include of Debug.h in for now with the understanding that the code owners will fix the problems. We've dealt with conflicting DEBUG for some time now and a little more workaround work here isn't too big a burden for us. -Dave From dgregor at apple.com Wed Dec 23 12:56:28 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 23 Dec 2009 18:56:28 -0000 Subject: [llvm-commits] [llvm] r92020 - in /llvm/trunk/lib/System: DynamicLibrary.cpp DynamicLibrarySymbolDefs.def Message-ID: <200912231856.nBNIuSHG018793@zion.cs.uiuc.edu> Author: dgregor Date: Wed Dec 23 12:56:27 2009 New Revision: 92020 URL: http://llvm.org/viewvc/llvm-project?rev=92020&view=rev Log: Move the extern symbol declarations outside of DynamicLibrary::SearchForAddressOfSymbol and force them to have "C" linkage. Interestingly, GCC treats the block-scoped "extern" declarations we previously had as if they were extern "C" declarations (or, at least, were in the global namespace), so that GCC bug papered over this LLVM bug. Clang and EDG get the linkage correct; this new variant seems to work for both GCC and Clang. Added: llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def Modified: llvm/trunk/lib/System/DynamicLibrary.cpp Modified: llvm/trunk/lib/System/DynamicLibrary.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrary.cpp?rev=92020&r1=92019&r2=92020&view=diff ============================================================================== --- llvm/trunk/lib/System/DynamicLibrary.cpp (original) +++ llvm/trunk/lib/System/DynamicLibrary.cpp Wed Dec 23 12:56:27 2009 @@ -69,6 +69,10 @@ return false; } +#define EXPLICIT_SYMBOL(SYM) \ + extern "C" void *SYM; +#include "DynamicLibrarySymbolDefs.def" + void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { // First check symbols added via AddSymbol(). if (ExplicitSymbols) { @@ -93,41 +97,15 @@ } #define EXPLICIT_SYMBOL(SYM) \ - extern void *SYM; if (!strcmp(symbolName, #SYM)) return &SYM + if (!strcmp(symbolName, #SYM)) return &SYM; // If this is darwin, it has some funky issues, try to solve them here. Some // important symbols are marked 'private external' which doesn't allow // SearchForAddressOfSymbol to find them. As such, we special case them here, // there is only a small handful of them. - -#ifdef __APPLE__ - { - EXPLICIT_SYMBOL(__ashldi3); - EXPLICIT_SYMBOL(__ashrdi3); - EXPLICIT_SYMBOL(__cmpdi2); - EXPLICIT_SYMBOL(__divdi3); - EXPLICIT_SYMBOL(__eprintf); - EXPLICIT_SYMBOL(__fixdfdi); - EXPLICIT_SYMBOL(__fixsfdi); - EXPLICIT_SYMBOL(__fixunsdfdi); - EXPLICIT_SYMBOL(__fixunssfdi); - EXPLICIT_SYMBOL(__floatdidf); - EXPLICIT_SYMBOL(__floatdisf); - EXPLICIT_SYMBOL(__lshrdi3); - EXPLICIT_SYMBOL(__moddi3); - EXPLICIT_SYMBOL(__udivdi3); - EXPLICIT_SYMBOL(__umoddi3); - } -#endif - -#ifdef __CYGWIN__ { - EXPLICIT_SYMBOL(_alloca); - EXPLICIT_SYMBOL(__main); +#include "DynamicLibrarySymbolDefs.def" } -#endif - -#undef EXPLICIT_SYMBOL // This macro returns the address of a well-known, explicit symbol #define EXPLICIT_SYMBOL(SYM) \ Added: llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def?rev=92020&view=auto ============================================================================== --- llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def (added) +++ llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def Wed Dec 23 12:56:27 2009 @@ -0,0 +1,41 @@ +//===-- DynamicLibrarySymbolDefs.def - Extra symbol definitions -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file enumerates the set of extra external symbol definitions needed for +// dynamic libraries. +// +//===----------------------------------------------------------------------===// +#ifndef EXPLICIT_SYMBOL +# error Must define EXPLICIT_SYMBOL to include this definitions file +#endif + +#ifdef __APPLE__ +EXPLICIT_SYMBOL(__ashldi3) +EXPLICIT_SYMBOL(__ashrdi3) +EXPLICIT_SYMBOL(__cmpdi2) +EXPLICIT_SYMBOL(__divdi3) +EXPLICIT_SYMBOL(__eprintf) +EXPLICIT_SYMBOL(__fixdfdi) +EXPLICIT_SYMBOL(__fixsfdi) +EXPLICIT_SYMBOL(__fixunsdfdi) +EXPLICIT_SYMBOL(__fixunssfdi) +EXPLICIT_SYMBOL(__floatdidf) +EXPLICIT_SYMBOL(__floatdisf) +EXPLICIT_SYMBOL(__lshrdi3) +EXPLICIT_SYMBOL(__moddi3) +EXPLICIT_SYMBOL(__udivdi3) +EXPLICIT_SYMBOL(__umoddi3) +#endif + +#ifdef __CYGWIN__ +EXPLICIT_SYMBOL(_alloca) +EXPLICIT_SYMBOL(__main) +#endif + +#undef EXPLICIT_SYMBOL From dgregor at apple.com Wed Dec 23 13:04:11 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 23 Dec 2009 19:04:11 -0000 Subject: [llvm-commits] [llvm] r92021 - in /llvm/trunk/lib/System: DynamicLibrary.cpp DynamicLibrarySymbolDefs.def Message-ID: <200912231904.nBNJ4Br0019005@zion.cs.uiuc.edu> Author: dgregor Date: Wed Dec 23 13:04:10 2009 New Revision: 92021 URL: http://llvm.org/viewvc/llvm-project?rev=92021&view=rev Log: Revert 92020 until I figure out a more portable fix Removed: llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def Modified: llvm/trunk/lib/System/DynamicLibrary.cpp Modified: llvm/trunk/lib/System/DynamicLibrary.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrary.cpp?rev=92021&r1=92020&r2=92021&view=diff ============================================================================== --- llvm/trunk/lib/System/DynamicLibrary.cpp (original) +++ llvm/trunk/lib/System/DynamicLibrary.cpp Wed Dec 23 13:04:10 2009 @@ -69,10 +69,6 @@ return false; } -#define EXPLICIT_SYMBOL(SYM) \ - extern "C" void *SYM; -#include "DynamicLibrarySymbolDefs.def" - void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { // First check symbols added via AddSymbol(). if (ExplicitSymbols) { @@ -97,15 +93,41 @@ } #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return &SYM; + extern void *SYM; if (!strcmp(symbolName, #SYM)) return &SYM // If this is darwin, it has some funky issues, try to solve them here. Some // important symbols are marked 'private external' which doesn't allow // SearchForAddressOfSymbol to find them. As such, we special case them here, // there is only a small handful of them. + +#ifdef __APPLE__ + { + EXPLICIT_SYMBOL(__ashldi3); + EXPLICIT_SYMBOL(__ashrdi3); + EXPLICIT_SYMBOL(__cmpdi2); + EXPLICIT_SYMBOL(__divdi3); + EXPLICIT_SYMBOL(__eprintf); + EXPLICIT_SYMBOL(__fixdfdi); + EXPLICIT_SYMBOL(__fixsfdi); + EXPLICIT_SYMBOL(__fixunsdfdi); + EXPLICIT_SYMBOL(__fixunssfdi); + EXPLICIT_SYMBOL(__floatdidf); + EXPLICIT_SYMBOL(__floatdisf); + EXPLICIT_SYMBOL(__lshrdi3); + EXPLICIT_SYMBOL(__moddi3); + EXPLICIT_SYMBOL(__udivdi3); + EXPLICIT_SYMBOL(__umoddi3); + } +#endif + +#ifdef __CYGWIN__ { -#include "DynamicLibrarySymbolDefs.def" + EXPLICIT_SYMBOL(_alloca); + EXPLICIT_SYMBOL(__main); } +#endif + +#undef EXPLICIT_SYMBOL // This macro returns the address of a well-known, explicit symbol #define EXPLICIT_SYMBOL(SYM) \ Removed: llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def?rev=92020&view=auto ============================================================================== --- llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def (original) +++ llvm/trunk/lib/System/DynamicLibrarySymbolDefs.def (removed) @@ -1,41 +0,0 @@ -//===-- DynamicLibrarySymbolDefs.def - Extra symbol definitions -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file enumerates the set of extra external symbol definitions needed for -// dynamic libraries. -// -//===----------------------------------------------------------------------===// -#ifndef EXPLICIT_SYMBOL -# error Must define EXPLICIT_SYMBOL to include this definitions file -#endif - -#ifdef __APPLE__ -EXPLICIT_SYMBOL(__ashldi3) -EXPLICIT_SYMBOL(__ashrdi3) -EXPLICIT_SYMBOL(__cmpdi2) -EXPLICIT_SYMBOL(__divdi3) -EXPLICIT_SYMBOL(__eprintf) -EXPLICIT_SYMBOL(__fixdfdi) -EXPLICIT_SYMBOL(__fixsfdi) -EXPLICIT_SYMBOL(__fixunsdfdi) -EXPLICIT_SYMBOL(__fixunssfdi) -EXPLICIT_SYMBOL(__floatdidf) -EXPLICIT_SYMBOL(__floatdisf) -EXPLICIT_SYMBOL(__lshrdi3) -EXPLICIT_SYMBOL(__moddi3) -EXPLICIT_SYMBOL(__udivdi3) -EXPLICIT_SYMBOL(__umoddi3) -#endif - -#ifdef __CYGWIN__ -EXPLICIT_SYMBOL(_alloca) -EXPLICIT_SYMBOL(__main) -#endif - -#undef EXPLICIT_SYMBOL From dgregor at apple.com Wed Dec 23 13:12:50 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 23 Dec 2009 19:12:50 -0000 Subject: [llvm-commits] [llvm] r92023 - /llvm/trunk/lib/System/DynamicLibrary.cpp Message-ID: <200912231912.nBNJConI019370@zion.cs.uiuc.edu> Author: dgregor Date: Wed Dec 23 13:12:50 2009 New Revision: 92023 URL: http://llvm.org/viewvc/llvm-project?rev=92023&view=rev Log: Alternative fix to make sure that the extern declarations used by DynamicLibrary::SearchForAddressOfSymbol refer to declarations in the global namespace. Modified: llvm/trunk/lib/System/DynamicLibrary.cpp Modified: llvm/trunk/lib/System/DynamicLibrary.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrary.cpp?rev=92023&r1=92022&r2=92023&view=diff ============================================================================== --- llvm/trunk/lib/System/DynamicLibrary.cpp (original) +++ llvm/trunk/lib/System/DynamicLibrary.cpp Wed Dec 23 13:12:50 2009 @@ -69,29 +69,7 @@ return false; } -void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { - // First check symbols added via AddSymbol(). - if (ExplicitSymbols) { - std::map::iterator I = - ExplicitSymbols->find(symbolName); - std::map::iterator E = ExplicitSymbols->end(); - - if (I != E) - return I->second; - } - - // Now search the libraries. - if (OpenedHandles) { - for (std::vector::iterator I = OpenedHandles->begin(), - E = OpenedHandles->end(); I != E; ++I) { - //lt_ptr ptr = lt_dlsym(*I, symbolName); - void *ptr = dlsym(*I, symbolName); - if (ptr) { - return ptr; - } - } - } - +static void *SearchForAddressOfSpecialSymbol(const char* symbolName) { #define EXPLICIT_SYMBOL(SYM) \ extern void *SYM; if (!strcmp(symbolName, #SYM)) return &SYM @@ -128,6 +106,34 @@ #endif #undef EXPLICIT_SYMBOL + return 0; +} + +void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { + // First check symbols added via AddSymbol(). + if (ExplicitSymbols) { + std::map::iterator I = + ExplicitSymbols->find(symbolName); + std::map::iterator E = ExplicitSymbols->end(); + + if (I != E) + return I->second; + } + + // Now search the libraries. + if (OpenedHandles) { + for (std::vector::iterator I = OpenedHandles->begin(), + E = OpenedHandles->end(); I != E; ++I) { + //lt_ptr ptr = lt_dlsym(*I, symbolName); + void *ptr = dlsym(*I, symbolName); + if (ptr) { + return ptr; + } + } + } + + if (void *Result = SearchForAddressOfSpecialSymbol(symbolName)) + return Result; // This macro returns the address of a well-known, explicit symbol #define EXPLICIT_SYMBOL(SYM) \ From greened at obbligato.org Wed Dec 23 13:15:13 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 19:15:13 -0000 Subject: [llvm-commits] [llvm] r92024 - /llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Message-ID: <200912231915.nBNJFDwi019456@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 13:15:13 2009 New Revision: 92024 URL: http://llvm.org/viewvc/llvm-project?rev=92024&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp?rev=92024&r1=92023&r2=92024&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp (original) +++ llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Wed Dec 23 13:15:13 2009 @@ -17,6 +17,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -40,31 +41,31 @@ } void printLine(const char *Desc, unsigned Val, unsigned Sum) { - errs() << " " << Val << " " << Desc << " responses (" + dbgs() << " " << Val << " " << Desc << " responses (" << Val*100/Sum << "%)\n"; } ~AliasAnalysisCounter() { unsigned AASum = No+May+Must; unsigned MRSum = NoMR+JustRef+JustMod+MR; if (AASum + MRSum) { // Print a report if any counted queries occurred... - errs() << "\n===== Alias Analysis Counter Report =====\n" + dbgs() << "\n===== Alias Analysis Counter Report =====\n" << " Analysis counted: " << Name << "\n" << " " << AASum << " Total Alias Queries Performed\n"; if (AASum) { printLine("no alias", No, AASum); printLine("may alias", May, AASum); printLine("must alias", Must, AASum); - errs() << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" + dbgs() << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; } - errs() << " " << MRSum << " Total Mod/Ref Queries Performed\n"; + dbgs() << " " << MRSum << " Total Mod/Ref Queries Performed\n"; if (MRSum) { printLine("no mod/ref", NoMR, MRSum); printLine("ref", JustRef, MRSum); printLine("mod", JustMod, MRSum); printLine("mod/ref", MR, MRSum); - errs() << " Mod/Ref Analysis Counter Summary: " <" << *CS.getInstruction(); + dbgs() << MRString << ": Ptr: "; + dbgs() << "[" << Size << "B] "; + WriteAsOperand(dbgs(), P, true, M); + dbgs() << "\t<->" << *CS.getInstruction(); } return R; } From greened at obbligato.org Wed Dec 23 13:21:19 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 19:21:19 -0000 Subject: [llvm-commits] [llvm] r92026 - /llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Message-ID: <200912231921.nBNJLJnu019679@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 13:21:19 2009 New Revision: 92026 URL: http://llvm.org/viewvc/llvm-project?rev=92026&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=92026&r1=92025&r2=92026&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original) +++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Wed Dec 23 13:21:19 2009 @@ -26,6 +26,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Assembly/Writer.h" #include "llvm/Target/TargetData.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" @@ -91,7 +92,7 @@ if (o2 < o1) std::swap(o1, o2); - errs() << " " << Msg << ":\t" + dbgs() << " " << Msg << ":\t" << o1 << ", " << o2 << "\n"; } @@ -101,9 +102,9 @@ PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, Module *M) { if (P) { - errs() << " " << Msg << ": Ptr: "; - WriteAsOperand(errs(), Ptr, true, M); - errs() << "\t<->" << *I << '\n'; + dbgs() << " " << Msg << ": Ptr: "; + WriteAsOperand(dbgs(), Ptr, true, M); + dbgs() << "\t<->" << *I << '\n'; } } @@ -135,7 +136,7 @@ if (PrintNoAlias || PrintMayAlias || PrintMustAlias || PrintNoModRef || PrintMod || PrintRef || PrintModRef) - errs() << "Function: " << F.getName() << ": " << Pointers.size() + dbgs() << "Function: " << F.getName() << ": " << Pointers.size() << " pointers, " << CallSites.size() << " call sites\n"; // iterate over the worklist, and run the full (n^2)/2 disambiguations @@ -161,7 +162,7 @@ PrintResults("MustAlias", PrintMustAlias, *I1, *I2, F.getParent()); ++MustAlias; break; default: - errs() << "Unknown alias query result!\n"; + dbgs() << "Unknown alias query result!\n"; } } } @@ -191,7 +192,7 @@ PrintModRefResults(" ModRef", PrintModRef, I, *V, F.getParent()); ++ModRef; break; default: - errs() << "Unknown alias query result!\n"; + dbgs() << "Unknown alias query result!\n"; } } } @@ -200,24 +201,24 @@ } static void PrintPercent(unsigned Num, unsigned Sum) { - errs() << "(" << Num*100ULL/Sum << "." + dbgs() << "(" << Num*100ULL/Sum << "." << ((Num*1000ULL/Sum) % 10) << "%)\n"; } bool AAEval::doFinalization(Module &M) { unsigned AliasSum = NoAlias + MayAlias + MustAlias; - errs() << "===== Alias Analysis Evaluator Report =====\n"; + dbgs() << "===== Alias Analysis Evaluator Report =====\n"; if (AliasSum == 0) { - errs() << " Alias Analysis Evaluator Summary: No pointers!\n"; + dbgs() << " Alias Analysis Evaluator Summary: No pointers!\n"; } else { - errs() << " " << AliasSum << " Total Alias Queries Performed\n"; - errs() << " " << NoAlias << " no alias responses "; + dbgs() << " " << AliasSum << " Total Alias Queries Performed\n"; + dbgs() << " " << NoAlias << " no alias responses "; PrintPercent(NoAlias, AliasSum); - errs() << " " << MayAlias << " may alias responses "; + dbgs() << " " << MayAlias << " may alias responses "; PrintPercent(MayAlias, AliasSum); - errs() << " " << MustAlias << " must alias responses "; + dbgs() << " " << MustAlias << " must alias responses "; PrintPercent(MustAlias, AliasSum); - errs() << " Alias Analysis Evaluator Pointer Alias Summary: " + dbgs() << " Alias Analysis Evaluator Pointer Alias Summary: " << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/" << MustAlias*100/AliasSum << "%\n"; } @@ -225,18 +226,18 @@ // Display the summary for mod/ref analysis unsigned ModRefSum = NoModRef + Mod + Ref + ModRef; if (ModRefSum == 0) { - errs() << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; + dbgs() << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; } else { - errs() << " " << ModRefSum << " Total ModRef Queries Performed\n"; - errs() << " " << NoModRef << " no mod/ref responses "; + dbgs() << " " << ModRefSum << " Total ModRef Queries Performed\n"; + dbgs() << " " << NoModRef << " no mod/ref responses "; PrintPercent(NoModRef, ModRefSum); - errs() << " " << Mod << " mod responses "; + dbgs() << " " << Mod << " mod responses "; PrintPercent(Mod, ModRefSum); - errs() << " " << Ref << " ref responses "; + dbgs() << " " << Ref << " ref responses "; PrintPercent(Ref, ModRefSum); - errs() << " " << ModRef << " mod & ref responses "; + dbgs() << " " << ModRef << " mod & ref responses "; PrintPercent(ModRef, ModRefSum); - errs() << " Alias Analysis Evaluator Mod/Ref Summary: " + dbgs() << " Alias Analysis Evaluator Mod/Ref Summary: " << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/" << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n"; } From greened at obbligato.org Wed Dec 23 13:27:59 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 19:27:59 -0000 Subject: [llvm-commits] [llvm] r92029 - /llvm/trunk/lib/Analysis/AliasSetTracker.cpp Message-ID: <200912231927.nBNJRxJu019935@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 13:27:59 2009 New Revision: 92029 URL: http://llvm.org/viewvc/llvm-project?rev=92029&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=92029&r1=92028&r2=92029&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original) +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Wed Dec 23 13:27:59 2009 @@ -19,6 +19,7 @@ #include "llvm/Type.h" #include "llvm/Target/TargetData.h" #include "llvm/Assembly/Writer.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/Format.h" @@ -549,8 +550,8 @@ OS << "\n"; } -void AliasSet::dump() const { print(errs()); } -void AliasSetTracker::dump() const { print(errs()); } +void AliasSet::dump() const { print(dbgs()); } +void AliasSetTracker::dump() const { print(dbgs()); } //===----------------------------------------------------------------------===// // ASTCallbackVH Class Implementation @@ -591,7 +592,7 @@ for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) Tracker->add(&*I); - Tracker->print(errs()); + Tracker->print(dbgs()); delete Tracker; return false; } From greened at obbligato.org Wed Dec 23 13:45:49 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 19:45:49 -0000 Subject: [llvm-commits] [llvm] r92032 - /llvm/trunk/lib/Analysis/DebugInfo.cpp Message-ID: <200912231945.nBNJjnhg020603@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 13:45:49 2009 New Revision: 92032 URL: http://llvm.org/viewvc/llvm-project?rev=92032&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=92032&r1=92031&r2=92032&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Dec 23 13:45:49 2009 @@ -22,6 +22,7 @@ #include "llvm/Module.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/DebugLoc.h" #include "llvm/Support/raw_ostream.h" @@ -475,16 +476,16 @@ /// dump - Print descriptor. void DIDescriptor::dump() const { - errs() << "[" << dwarf::TagString(getTag()) << "] "; - errs().write_hex((intptr_t) &*DbgNode) << ']'; + dbgs() << "[" << dwarf::TagString(getTag()) << "] "; + dbgs().write_hex((intptr_t) &*DbgNode) << ']'; } /// dump - Print compile unit. void DICompileUnit::dump() const { if (getLanguage()) - errs() << " [" << dwarf::LanguageString(getLanguage()) << "] "; + dbgs() << " [" << dwarf::LanguageString(getLanguage()) << "] "; - errs() << " [" << getDirectory() << "/" << getFilename() << " ]"; + dbgs() << " [" << getDirectory() << "/" << getFilename() << " ]"; } /// dump - Print type. @@ -493,14 +494,14 @@ StringRef Res = getName(); if (!Res.empty()) - errs() << " [" << Res << "] "; + dbgs() << " [" << Res << "] "; unsigned Tag = getTag(); - errs() << " [" << dwarf::TagString(Tag) << "] "; + dbgs() << " [" << dwarf::TagString(Tag) << "] "; // TODO : Print context getCompileUnit().dump(); - errs() << " [" + dbgs() << " [" << getLineNumber() << ", " << getSizeInBits() << ", " << getAlignInBits() << ", " @@ -508,12 +509,12 @@ << "] "; if (isPrivate()) - errs() << " [private] "; + dbgs() << " [private] "; else if (isProtected()) - errs() << " [protected] "; + dbgs() << " [protected] "; if (isForwardDecl()) - errs() << " [fwd] "; + dbgs() << " [fwd] "; if (isBasicType()) DIBasicType(DbgNode).dump(); @@ -522,21 +523,21 @@ else if (isCompositeType()) DICompositeType(DbgNode).dump(); else { - errs() << "Invalid DIType\n"; + dbgs() << "Invalid DIType\n"; return; } - errs() << "\n"; + dbgs() << "\n"; } /// dump - Print basic type. void DIBasicType::dump() const { - errs() << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; + dbgs() << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; } /// dump - Print derived type. void DIDerivedType::dump() const { - errs() << "\n\t Derived From: "; getTypeDerivedFrom().dump(); + dbgs() << "\n\t Derived From: "; getTypeDerivedFrom().dump(); } /// dump - Print composite type. @@ -544,73 +545,73 @@ DIArray A = getTypeArray(); if (A.isNull()) return; - errs() << " [" << A.getNumElements() << " elements]"; + dbgs() << " [" << A.getNumElements() << " elements]"; } /// dump - Print global. void DIGlobal::dump() const { StringRef Res = getName(); if (!Res.empty()) - errs() << " [" << Res << "] "; + dbgs() << " [" << Res << "] "; unsigned Tag = getTag(); - errs() << " [" << dwarf::TagString(Tag) << "] "; + dbgs() << " [" << dwarf::TagString(Tag) << "] "; // TODO : Print context getCompileUnit().dump(); - errs() << " [" << getLineNumber() << "] "; + dbgs() << " [" << getLineNumber() << "] "; if (isLocalToUnit()) - errs() << " [local] "; + dbgs() << " [local] "; if (isDefinition()) - errs() << " [def] "; + dbgs() << " [def] "; if (isGlobalVariable()) DIGlobalVariable(DbgNode).dump(); - errs() << "\n"; + dbgs() << "\n"; } /// dump - Print subprogram. void DISubprogram::dump() const { StringRef Res = getName(); if (!Res.empty()) - errs() << " [" << Res << "] "; + dbgs() << " [" << Res << "] "; unsigned Tag = getTag(); - errs() << " [" << dwarf::TagString(Tag) << "] "; + dbgs() << " [" << dwarf::TagString(Tag) << "] "; // TODO : Print context getCompileUnit().dump(); - errs() << " [" << getLineNumber() << "] "; + dbgs() << " [" << getLineNumber() << "] "; if (isLocalToUnit()) - errs() << " [local] "; + dbgs() << " [local] "; if (isDefinition()) - errs() << " [def] "; + dbgs() << " [def] "; - errs() << "\n"; + dbgs() << "\n"; } /// dump - Print global variable. void DIGlobalVariable::dump() const { - errs() << " ["; + dbgs() << " ["; getGlobal()->dump(); - errs() << "] "; + dbgs() << "] "; } /// dump - Print variable. void DIVariable::dump() const { StringRef Res = getName(); if (!Res.empty()) - errs() << " [" << Res << "] "; + dbgs() << " [" << Res << "] "; getCompileUnit().dump(); - errs() << " [" << getLineNumber() << "] "; + dbgs() << " [" << getLineNumber() << "] "; getType().dump(); - errs() << "\n"; + dbgs() << "\n"; // FIXME: Dump complex addresses } From greened at obbligato.org Wed Dec 23 13:51:44 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 19:51:44 -0000 Subject: [llvm-commits] [llvm] r92033 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp Message-ID: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 13:51:44 2009 New Revision: 92033 URL: http://llvm.org/viewvc/llvm-project?rev=92033&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=92033&r1=92032&r2=92033&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Wed Dec 23 13:51:44 2009 @@ -806,7 +806,7 @@ case Instruction::BitCast: return getNodeForConstantPointer(CE->getOperand(0)); default: - errs() << "Constant Expr not yet handled: " << *CE << "\n"; + dbgs() << "Constant Expr not yet handled: " << *CE << "\n"; llvm_unreachable(0); } } else { @@ -833,7 +833,7 @@ case Instruction::BitCast: return getNodeForConstantPointerTarget(CE->getOperand(0)); default: - errs() << "Constant Expr not yet handled: " << *CE << "\n"; + dbgs() << "Constant Expr not yet handled: " << *CE << "\n"; llvm_unreachable(0); } } else { @@ -1132,7 +1132,7 @@ return; default: // Is this something we aren't handling yet? - errs() << "Unknown instruction: " << I; + dbgs() << "Unknown instruction: " << I; llvm_unreachable(0); } } @@ -1402,7 +1402,7 @@ unsigned Pos = NewPos++; Translate[i] = Pos; NewGraphNodes.push_back(GraphNodes[i]); - DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n"); + DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n"); } // I believe this ends up being faster than making two vectors and splicing @@ -1412,7 +1412,7 @@ unsigned Pos = NewPos++; Translate[i] = Pos; NewGraphNodes.push_back(GraphNodes[i]); - DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n"); + DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n"); } } @@ -1421,7 +1421,7 @@ unsigned Pos = NewPos++; Translate[i] = Pos; NewGraphNodes.push_back(GraphNodes[i]); - DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n"); + DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n"); } } @@ -1493,7 +1493,7 @@ /// receive &D from E anyway. void Andersens::HVN() { - DEBUG(errs() << "Beginning HVN\n"); + DEBUG(dbgs() << "Beginning HVN\n"); // Build a predecessor graph. This is like our constraint graph with the // edges going in the opposite direction, and there are edges for all the // constraints, instead of just copy constraints. We also build implicit @@ -1564,7 +1564,7 @@ Node2DFS.clear(); Node2Deleted.clear(); Node2Visited.clear(); - DEBUG(errs() << "Finished HVN\n"); + DEBUG(dbgs() << "Finished HVN\n"); } @@ -1688,7 +1688,7 @@ /// and is equivalent to value numbering the collapsed constraint graph /// including evaluating unions. void Andersens::HU() { - DEBUG(errs() << "Beginning HU\n"); + DEBUG(dbgs() << "Beginning HU\n"); // Build a predecessor graph. This is like our constraint graph with the // edges going in the opposite direction, and there are edges for all the // constraints, instead of just copy constraints. We also build implicit @@ -1768,7 +1768,7 @@ } // PEClass nodes will be deleted by the deleting of N->PointsTo in our caller. Set2PEClass.clear(); - DEBUG(errs() << "Finished HU\n"); + DEBUG(dbgs() << "Finished HU\n"); } @@ -1946,12 +1946,12 @@ // to anything. if (LHSLabel == 0) { DEBUG(PrintNode(&GraphNodes[LHSNode])); - DEBUG(errs() << " is a non-pointer, ignoring constraint.\n"); + DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n"); continue; } if (RHSLabel == 0) { DEBUG(PrintNode(&GraphNodes[RHSNode])); - DEBUG(errs() << " is a non-pointer, ignoring constraint.\n"); + DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n"); continue; } // This constraint may be useless, and it may become useless as we translate @@ -1999,16 +1999,16 @@ if (i < FirstRefNode) { PrintNode(&GraphNodes[i]); } else if (i < FirstAdrNode) { - DEBUG(errs() << "REF("); + DEBUG(dbgs() << "REF("); PrintNode(&GraphNodes[i-FirstRefNode]); - DEBUG(errs() <<")"); + DEBUG(dbgs() <<")"); } else { - DEBUG(errs() << "ADR("); + DEBUG(dbgs() << "ADR("); PrintNode(&GraphNodes[i-FirstAdrNode]); - DEBUG(errs() <<")"); + DEBUG(dbgs() <<")"); } - DEBUG(errs() << " has pointer label " << GraphNodes[i].PointerEquivLabel + DEBUG(dbgs() << " has pointer label " << GraphNodes[i].PointerEquivLabel << " and SCC rep " << VSSCCRep[i] << " and is " << (GraphNodes[i].Direct ? "Direct" : "Not direct") << "\n"); @@ -2025,7 +2025,7 @@ /// operation are stored in SDT and are later used in SolveContraints() /// and UniteNodes(). void Andersens::HCD() { - DEBUG(errs() << "Starting HCD.\n"); + DEBUG(dbgs() << "Starting HCD.\n"); HCDSCCRep.resize(GraphNodes.size()); for (unsigned i = 0; i < GraphNodes.size(); ++i) { @@ -2074,7 +2074,7 @@ Node2Visited.clear(); Node2Deleted.clear(); HCDSCCRep.clear(); - DEBUG(errs() << "HCD complete.\n"); + DEBUG(dbgs() << "HCD complete.\n"); } // Component of HCD: @@ -2146,7 +2146,7 @@ /// Optimize the constraints by performing offline variable substitution and /// other optimizations. void Andersens::OptimizeConstraints() { - DEBUG(errs() << "Beginning constraint optimization\n"); + DEBUG(dbgs() << "Beginning constraint optimization\n"); SDTActive = false; @@ -2230,7 +2230,7 @@ // HCD complete. - DEBUG(errs() << "Finished constraint optimization\n"); + DEBUG(dbgs() << "Finished constraint optimization\n"); FirstRefNode = 0; FirstAdrNode = 0; } @@ -2238,7 +2238,7 @@ /// Unite pointer but not location equivalent variables, now that the constraint /// graph is built. void Andersens::UnitePointerEquivalences() { - DEBUG(errs() << "Uniting remaining pointer equivalences\n"); + DEBUG(dbgs() << "Uniting remaining pointer equivalences\n"); for (unsigned i = 0; i < GraphNodes.size(); ++i) { if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) { unsigned Label = GraphNodes[i].PointerEquivLabel; @@ -2247,7 +2247,7 @@ UniteNodes(i, PENLEClass2Node[Label]); } } - DEBUG(errs() << "Finished remaining pointer equivalences\n"); + DEBUG(dbgs() << "Finished remaining pointer equivalences\n"); PENLEClass2Node.clear(); } @@ -2403,7 +2403,7 @@ std::vector RSV; #endif while( !CurrWL->empty() ) { - DEBUG(errs() << "Starting iteration #" << ++NumIters << "\n"); + DEBUG(dbgs() << "Starting iteration #" << ++NumIters << "\n"); Node* CurrNode; unsigned CurrNodeIndex; @@ -2706,11 +2706,11 @@ SecondNode->OldPointsTo = NULL; NumUnified++; - DEBUG(errs() << "Unified Node "); + DEBUG(dbgs() << "Unified Node "); DEBUG(PrintNode(FirstNode)); - DEBUG(errs() << " and Node "); + DEBUG(dbgs() << " and Node "); DEBUG(PrintNode(SecondNode)); - DEBUG(errs() << "\n"); + DEBUG(dbgs() << "\n"); if (SDTActive) if (SDT[Second] >= 0) { @@ -2755,17 +2755,17 @@ void Andersens::PrintNode(const Node *N) const { if (N == &GraphNodes[UniversalSet]) { - errs() << ""; + dbgs() << ""; return; } else if (N == &GraphNodes[NullPtr]) { - errs() << ""; + dbgs() << ""; return; } else if (N == &GraphNodes[NullObject]) { - errs() << ""; + dbgs() << ""; return; } if (!N->getValue()) { - errs() << "artificial" << (intptr_t) N; + dbgs() << "artificial" << (intptr_t) N; return; } @@ -2774,85 +2774,85 @@ if (Function *F = dyn_cast(V)) { if (isa(F->getFunctionType()->getReturnType()) && N == &GraphNodes[getReturnNode(F)]) { - errs() << F->getName() << ":retval"; + dbgs() << F->getName() << ":retval"; return; } else if (F->getFunctionType()->isVarArg() && N == &GraphNodes[getVarargNode(F)]) { - errs() << F->getName() << ":vararg"; + dbgs() << F->getName() << ":vararg"; return; } } if (Instruction *I = dyn_cast(V)) - errs() << I->getParent()->getParent()->getName() << ":"; + dbgs() << I->getParent()->getParent()->getName() << ":"; else if (Argument *Arg = dyn_cast(V)) - errs() << Arg->getParent()->getName() << ":"; + dbgs() << Arg->getParent()->getName() << ":"; if (V->hasName()) - errs() << V->getName(); + dbgs() << V->getName(); else - errs() << "(unnamed)"; + dbgs() << "(unnamed)"; if (isa(V) || isa(V) || isMalloc(V)) if (N == &GraphNodes[getObject(V)]) - errs() << ""; + dbgs() << ""; } void Andersens::PrintConstraint(const Constraint &C) const { if (C.Type == Constraint::Store) { - errs() << "*"; + dbgs() << "*"; if (C.Offset != 0) - errs() << "("; + dbgs() << "("; } PrintNode(&GraphNodes[C.Dest]); if (C.Type == Constraint::Store && C.Offset != 0) - errs() << " + " << C.Offset << ")"; - errs() << " = "; + dbgs() << " + " << C.Offset << ")"; + dbgs() << " = "; if (C.Type == Constraint::Load) { - errs() << "*"; + dbgs() << "*"; if (C.Offset != 0) - errs() << "("; + dbgs() << "("; } else if (C.Type == Constraint::AddressOf) - errs() << "&"; + dbgs() << "&"; PrintNode(&GraphNodes[C.Src]); if (C.Offset != 0 && C.Type != Constraint::Store) - errs() << " + " << C.Offset; + dbgs() << " + " << C.Offset; if (C.Type == Constraint::Load && C.Offset != 0) - errs() << ")"; - errs() << "\n"; + dbgs() << ")"; + dbgs() << "\n"; } void Andersens::PrintConstraints() const { - errs() << "Constraints:\n"; + dbgs() << "Constraints:\n"; for (unsigned i = 0, e = Constraints.size(); i != e; ++i) PrintConstraint(Constraints[i]); } void Andersens::PrintPointsToGraph() const { - errs() << "Points-to graph:\n"; + dbgs() << "Points-to graph:\n"; for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) { const Node *N = &GraphNodes[i]; if (FindNode(i) != i) { PrintNode(N); - errs() << "\t--> same as "; + dbgs() << "\t--> same as "; PrintNode(&GraphNodes[FindNode(i)]); - errs() << "\n"; + dbgs() << "\n"; } else { - errs() << "[" << (N->PointsTo->count()) << "] "; + dbgs() << "[" << (N->PointsTo->count()) << "] "; PrintNode(N); - errs() << "\t--> "; + dbgs() << "\t--> "; bool first = true; for (SparseBitVector<>::iterator bi = N->PointsTo->begin(); bi != N->PointsTo->end(); ++bi) { if (!first) - errs() << ", "; + dbgs() << ", "; PrintNode(&GraphNodes[*bi]); first = false; } - errs() << "\n"; + dbgs() << "\n"; } } } From greened at obbligato.org Wed Dec 23 14:03:58 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 20:03:58 -0000 Subject: [llvm-commits] [llvm] r92034 - /llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Message-ID: <200912232003.nBNK3wRO021217@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 14:03:58 2009 New Revision: 92034 URL: http://llvm.org/viewvc/llvm-project?rev=92034&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=92034&r1=92033&r2=92034&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Wed Dec 23 14:03:58 2009 @@ -17,6 +17,7 @@ #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/Support/CallSite.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -181,7 +182,7 @@ I->second->print(OS); } void CallGraph::dump() const { - print(errs(), 0); + print(dbgs(), 0); } //===----------------------------------------------------------------------===// @@ -232,7 +233,7 @@ OS << "\n"; } -void CallGraphNode::dump() const { print(errs()); } +void CallGraphNode::dump() const { print(dbgs()); } /// removeCallEdgeFor - This method removes the edge in the node for the /// specified call site. Note that this method takes linear time, so it From greened at obbligato.org Wed Dec 23 14:10:59 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 20:10:59 -0000 Subject: [llvm-commits] [llvm] r92035 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200912232010.nBNKAxcs021470@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 14:10:59 2009 New Revision: 92035 URL: http://llvm.org/viewvc/llvm-project?rev=92035&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=92035&r1=92034&r2=92035&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Wed Dec 23 14:10:59 2009 @@ -59,7 +59,7 @@ // Print passes managed by this manager void dumpPassStructure(unsigned Offset) { - errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; + dbgs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { Pass *P = getContainedPass(Index); P->dumpPassStructure(Offset + 1); @@ -126,7 +126,7 @@ // The function pass(es) modified the IR, they may have clobbered the // callgraph. if (Changed && CallGraphUpToDate) { - DEBUG(errs() << "CGSCCPASSMGR: Pass Dirtied SCC: " + DEBUG(dbgs() << "CGSCCPASSMGR: Pass Dirtied SCC: " << P->getPassName() << '\n'); CallGraphUpToDate = false; } @@ -143,7 +143,7 @@ CallGraph &CG, bool CheckingMode) { DenseMap CallSites; - DEBUG(errs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size() + DEBUG(dbgs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size() << " nodes:\n"; for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) CurSCC[i]->dump(); @@ -277,11 +277,11 @@ } DEBUG(if (MadeChange) { - errs() << "CGSCCPASSMGR: Refreshed SCC is now:\n"; + dbgs() << "CGSCCPASSMGR: Refreshed SCC is now:\n"; for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) CurSCC[i]->dump(); } else { - errs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; + dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; } ); } From daniel at zuster.org Wed Dec 23 14:13:44 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 23 Dec 2009 20:13:44 -0000 Subject: [llvm-commits] [llvm] r92036 - /llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Message-ID: <200912232013.nBNKDiph021592@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Dec 23 14:13:44 2009 New Revision: 92036 URL: http://llvm.org/viewvc/llvm-project?rev=92036&view=rev Log: Remove an XFAIL. Modified: llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Modified: llvm/trunk/test/LLVMC/MultiplePluginPriorities.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/MultiplePluginPriorities.td?rev=92036&r1=92035&r2=92036&view=diff ============================================================================== --- llvm/trunk/test/LLVMC/MultiplePluginPriorities.td (original) +++ llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Wed Dec 23 14:13:44 2009 @@ -1,6 +1,5 @@ // Check that multiple plugin priorities are not allowed. // RUN: ignore tblgen -I %p/../../include --gen-llvmc %s |& grep "More than one 'PluginPriority' instance found" -// XFAIL: powerpc-apple-darwin include "llvm/CompilerDriver/Common.td" From greened at obbligato.org Wed Dec 23 14:20:46 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 20:20:46 -0000 Subject: [llvm-commits] [llvm] r92037 - /llvm/trunk/lib/Analysis/IVUsers.cpp Message-ID: <200912232020.nBNKKkPl021821@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 14:20:46 2009 New Revision: 92037 URL: http://llvm.org/viewvc/llvm-project?rev=92037&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/IVUsers.cpp Modified: llvm/trunk/lib/Analysis/IVUsers.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=92037&r1=92036&r2=92037&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IVUsers.cpp (original) +++ llvm/trunk/lib/Analysis/IVUsers.cpp Wed Dec 23 14:20:46 2009 @@ -128,7 +128,7 @@ if (!AddRecStride->properlyDominates(Header, DT)) return false; - DEBUG(errs() << "[" << L->getHeader()->getName() + DEBUG(dbgs() << "[" << L->getHeader()->getName() << "] Variable stride: " << *AddRec << "\n"); } @@ -233,13 +233,13 @@ if (LI->getLoopFor(User->getParent()) != L) { if (isa(User) || Processed.count(User) || !AddUsersIfInteresting(User)) { - DEBUG(errs() << "FOUND USER in other loop: " << *User << '\n' + DEBUG(dbgs() << "FOUND USER in other loop: " << *User << '\n' << " OF SCEV: " << *ISE << '\n'); AddUserToIVUsers = true; } } else if (Processed.count(User) || !AddUsersIfInteresting(User)) { - DEBUG(errs() << "FOUND USER: " << *User << '\n' + DEBUG(dbgs() << "FOUND USER: " << *User << '\n' << " OF SCEV: " << *ISE << '\n'); AddUserToIVUsers = true; } @@ -262,7 +262,7 @@ const SCEV *NewStart = SE->getMinusSCEV(Start, Stride); StrideUses->addUser(NewStart, User, I); StrideUses->Users.back().setIsUseOfPostIncrementedValue(true); - DEBUG(errs() << " USING POSTINC SCEV, START=" << *NewStart<< "\n"); + DEBUG(dbgs() << " USING POSTINC SCEV, START=" << *NewStart<< "\n"); } else { StrideUses->addUser(Start, User, I); } @@ -363,7 +363,7 @@ } void IVUsers::dump() const { - print(errs()); + print(dbgs()); } void IVUsers::releaseMemory() { From greened at obbligato.org Wed Dec 23 14:34:27 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 20:34:27 -0000 Subject: [llvm-commits] [llvm] r92039 - /llvm/trunk/lib/Analysis/InstCount.cpp Message-ID: <200912232034.nBNKYRMh022338@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 14:34:27 2009 New Revision: 92039 URL: http://llvm.org/viewvc/llvm-project?rev=92039&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/InstCount.cpp Modified: llvm/trunk/lib/Analysis/InstCount.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstCount.cpp?rev=92039&r1=92038&r2=92039&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstCount.cpp (original) +++ llvm/trunk/lib/Analysis/InstCount.cpp Wed Dec 23 14:34:27 2009 @@ -15,6 +15,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Pass.h" #include "llvm/Function.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/raw_ostream.h" @@ -45,7 +46,7 @@ #include "llvm/Instruction.def" void visitInstruction(Instruction &I) { - errs() << "Instruction Count does not know about " << I; + dbgs() << "Instruction Count does not know about " << I; llvm_unreachable(0); } public: From greened at obbligato.org Wed Dec 23 14:43:58 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 20:43:58 -0000 Subject: [llvm-commits] [llvm] r92040 - /llvm/trunk/lib/Analysis/LazyValueInfo.cpp Message-ID: <200912232043.nBNKhwp5022663@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 14:43:58 2009 New Revision: 92040 URL: http://llvm.org/viewvc/llvm-project?rev=92040&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=92040&r1=92039&r2=92040&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original) +++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Wed Dec 23 14:43:58 2009 @@ -342,7 +342,7 @@ // If we've already computed this block's value, return it. if (!BBLV.isUndefined()) { - DEBUG(errs() << " reuse BB '" << BB->getName() << "' val=" << BBLV <<'\n'); + DEBUG(dbgs() << " reuse BB '" << BB->getName() << "' val=" << BBLV <<'\n'); return BBLV; } @@ -365,7 +365,7 @@ // If we hit overdefined, exit early. The BlockVals entry is already set // to overdefined. if (Result.isOverdefined()) { - DEBUG(errs() << " compute BB '" << BB->getName() + DEBUG(dbgs() << " compute BB '" << BB->getName() << "' - overdefined because of pred.\n"); return Result; } @@ -394,7 +394,7 @@ } - DEBUG(errs() << " compute BB '" << BB->getName() + DEBUG(dbgs() << " compute BB '" << BB->getName() << "' - overdefined because inst def found.\n"); LVILatticeVal Result; @@ -471,12 +471,12 @@ if (Constant *VC = dyn_cast(V)) return LVILatticeVal::get(VC); - DEBUG(errs() << "LVI Getting block end value " << *V << " at '" + DEBUG(dbgs() << "LVI Getting block end value " << *V << " at '" << BB->getName() << "'\n"); LVILatticeVal Result = LVIQuery(V, ValueCache[V]).getBlockValue(BB); - DEBUG(errs() << " Result = " << Result << "\n"); + DEBUG(dbgs() << " Result = " << Result << "\n"); return Result; } @@ -486,12 +486,12 @@ if (Constant *VC = dyn_cast(V)) return LVILatticeVal::get(VC); - DEBUG(errs() << "LVI Getting edge value " << *V << " from '" + DEBUG(dbgs() << "LVI Getting edge value " << *V << " from '" << FromBB->getName() << "' to '" << ToBB->getName() << "'\n"); LVILatticeVal Result = LVIQuery(V, ValueCache[V]).getEdgeValue(FromBB, ToBB); - DEBUG(errs() << " Result = " << Result << "\n"); + DEBUG(dbgs() << " Result = " << Result << "\n"); return Result; } From greened at obbligato.org Wed Dec 23 14:52:42 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 20:52:42 -0000 Subject: [llvm-commits] [llvm] r92042 - /llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Message-ID: <200912232052.nBNKqgMJ023004@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 14:52:41 2009 New Revision: 92042 URL: http://llvm.org/viewvc/llvm-project?rev=92042&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=92042&r1=92041&r2=92042&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Wed Dec 23 14:52:41 2009 @@ -181,15 +181,15 @@ LoopDependenceAnalysis::analyseSubscript(const SCEV *A, const SCEV *B, Subscript *S) const { - DEBUG(errs() << " Testing subscript: " << *A << ", " << *B << "\n"); + DEBUG(dbgs() << " Testing subscript: " << *A << ", " << *B << "\n"); if (A == B) { - DEBUG(errs() << " -> [D] same SCEV\n"); + DEBUG(dbgs() << " -> [D] same SCEV\n"); return Dependent; } if (!isAffine(A) || !isAffine(B)) { - DEBUG(errs() << " -> [?] not affine\n"); + DEBUG(dbgs() << " -> [?] not affine\n"); return Unknown; } @@ -204,12 +204,12 @@ LoopDependenceAnalysis::DependenceResult LoopDependenceAnalysis::analysePair(DependencePair *P) const { - DEBUG(errs() << "Analysing:\n" << *P->A << "\n" << *P->B << "\n"); + DEBUG(dbgs() << "Analysing:\n" << *P->A << "\n" << *P->B << "\n"); // We only analyse loads and stores but no possible memory accesses by e.g. // free, call, or invoke instructions. if (!IsLoadOrStoreInst(P->A) || !IsLoadOrStoreInst(P->B)) { - DEBUG(errs() << "--> [?] no load/store\n"); + DEBUG(dbgs() << "--> [?] no load/store\n"); return Unknown; } @@ -219,12 +219,12 @@ switch (UnderlyingObjectsAlias(AA, aPtr, bPtr)) { case AliasAnalysis::MayAlias: // We can not analyse objects if we do not know about their aliasing. - DEBUG(errs() << "---> [?] may alias\n"); + DEBUG(dbgs() << "---> [?] may alias\n"); return Unknown; case AliasAnalysis::NoAlias: // If the objects noalias, they are distinct, accesses are independent. - DEBUG(errs() << "---> [I] no alias\n"); + DEBUG(dbgs() << "---> [I] no alias\n"); return Independent; case AliasAnalysis::MustAlias: From greened at obbligato.org Wed Dec 23 15:06:14 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 21:06:14 -0000 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp Message-ID: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 15:06:14 2009 New Revision: 92046 URL: http://llvm.org/viewvc/llvm-project?rev=92046&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=92046&r1=92045&r2=92046&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original) +++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Wed Dec 23 15:06:14 2009 @@ -14,6 +14,7 @@ #include "llvm/Analysis/PHITransAddr.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/InstructionSimplify.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -35,12 +36,12 @@ void PHITransAddr::dump() const { if (Addr == 0) { - errs() << "PHITransAddr: null\n"; + dbgs() << "PHITransAddr: null\n"; return; } - errs() << "PHITransAddr: " << *Addr << "\n"; + dbgs() << "PHITransAddr: " << *Addr << "\n"; for (unsigned i = 0, e = InstInputs.size(); i != e; ++i) - errs() << " Input #" << i << " is " << *InstInputs[i] << "\n"; + dbgs() << " Input #" << i << " is " << *InstInputs[i] << "\n"; } @@ -62,9 +63,9 @@ // If it isn't in the InstInputs list it is a subexpr incorporated into the // address. Sanity check that it is phi translatable. if (!CanPHITrans(I)) { - errs() << "Non phi translatable instruction found in PHITransAddr, either " + dbgs() << "Non phi translatable instruction found in PHITransAddr, either " "something is missing from InstInputs or CanPHITrans is wrong:\n"; - errs() << *I << '\n'; + dbgs() << *I << '\n'; return false; } @@ -88,9 +89,9 @@ return false; if (!Tmp.empty()) { - errs() << "PHITransAddr inconsistent, contains extra instructions:\n"; + dbgs() << "PHITransAddr inconsistent, contains extra instructions:\n"; for (unsigned i = 0, e = InstInputs.size(); i != e; ++i) - errs() << " InstInput #" << i << " is " << *InstInputs[i] << "\n"; + dbgs() << " InstInput #" << i << " is " << *InstInputs[i] << "\n"; return false; } From greened at obbligato.org Wed Dec 23 15:16:55 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 21:16:55 -0000 Subject: [llvm-commits] [llvm] r92048 - /llvm/trunk/lib/Analysis/PostDominators.cpp Message-ID: <200912232116.nBNLGtdU024055@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 15:16:54 2009 New Revision: 92048 URL: http://llvm.org/viewvc/llvm-project?rev=92048&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/PostDominators.cpp Modified: llvm/trunk/lib/Analysis/PostDominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=92048&r1=92047&r2=92048&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PostDominators.cpp (original) +++ llvm/trunk/lib/Analysis/PostDominators.cpp Wed Dec 23 15:16:54 2009 @@ -33,7 +33,7 @@ bool PostDominatorTree::runOnFunction(Function &F) { DT->recalculate(F); - DEBUG(DT->print(errs())); + DEBUG(DT->print(dbgs())); return false; } From greened at obbligato.org Wed Dec 23 15:27:29 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 21:27:29 -0000 Subject: [llvm-commits] [llvm] r92050 - /llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Message-ID: <200912232127.nBNLRTpE024457@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 15:27:29 2009 New Revision: 92050 URL: http://llvm.org/viewvc/llvm-project?rev=92050&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Modified: llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp?rev=92050&r1=92049&r2=92050&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileEstimatorPass.cpp Wed Dec 23 15:27:29 2009 @@ -87,11 +87,11 @@ } static void inline printEdgeError(ProfileInfo::Edge e, const char *M) { - DEBUG(errs() << "-- Edge " << e << " is not calculated, " << M << "\n"); + DEBUG(dbgs() << "-- Edge " << e << " is not calculated, " << M << "\n"); } void inline ProfileEstimatorPass::printEdgeWeight(Edge E) { - DEBUG(errs() << "-- Weight of Edge " << E << ":" + DEBUG(dbgs() << "-- Weight of Edge " << E << ":" << format("%20.20g", getEdgeWeight(E)) << "\n"); } @@ -179,7 +179,7 @@ // from weight. if (MinimalWeight.find(*ei) != MinimalWeight.end()) { incoming -= MinimalWeight[*ei]; - DEBUG(errs() << "Reserving " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n"); + DEBUG(dbgs() << "Reserving " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n"); } } else { incoming -= w; @@ -217,7 +217,7 @@ // Read necessary minimal weight. if (MinimalWeight.find(*ei) != MinimalWeight.end()) { EdgeInformation[BB->getParent()][*ei] += MinimalWeight[*ei]; - DEBUG(errs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n"); + DEBUG(dbgs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n"); } printEdgeWeight(*ei); @@ -232,7 +232,7 @@ MinimalWeight[e] = 0; } MinimalWeight[e] += w; - DEBUG(errs() << "Minimal Weight for " << e << ": " << format("%.20g",MinimalWeight[e]) << "\n"); + DEBUG(dbgs() << "Minimal Weight for " << e << ": " << format("%.20g",MinimalWeight[e]) << "\n"); Dest = Parent; } } @@ -268,7 +268,7 @@ // from block weight, this is readded later on. if (MinimalWeight.find(edge) != MinimalWeight.end()) { BBWeight -= MinimalWeight[edge]; - DEBUG(errs() << "Reserving " << format("%.20g",MinimalWeight[edge]) << " at " << edge << "\n"); + DEBUG(dbgs() << "Reserving " << format("%.20g",MinimalWeight[edge]) << " at " << edge << "\n"); } } } @@ -288,7 +288,7 @@ // Readd minial necessary weight. if (MinimalWeight.find(*ei) != MinimalWeight.end()) { EdgeInformation[BB->getParent()][*ei] += MinimalWeight[*ei]; - DEBUG(errs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n"); + DEBUG(dbgs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n"); } printEdgeWeight(*ei); } @@ -319,7 +319,7 @@ // Clear Minimal Edges. MinimalWeight.clear(); - DEBUG(errs() << "Working on function " << F.getNameStr() << "\n"); + DEBUG(dbgs() << "Working on function " << F.getNameStr() << "\n"); // Since the entry block is the first one and has no predecessors, the edge // (0,entry) is inserted with the starting weight of 1. @@ -366,7 +366,7 @@ if (Dest != *bbi) { // If there is no circle, just set edge weight to 0 EdgeInformation[&F][e] = 0; - DEBUG(errs() << "Assuming edge weight: "); + DEBUG(dbgs() << "Assuming edge weight: "); printEdgeWeight(e); found = true; } @@ -375,7 +375,7 @@ } if (!found) { cleanup = true; - DEBUG(errs() << "No assumption possible in Fuction "< Author: stoklund Date: Wed Dec 23 15:28:23 2009 New Revision: 92051 URL: http://llvm.org/viewvc/llvm-project?rev=92051&view=rev Log: Move repeated code to a new method. No functional change. Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=92051&r1=92050&r2=92051&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Dec 23 15:28:23 2009 @@ -87,6 +87,21 @@ int Offset, unsigned Base, bool BaseKill, int Opcode, ARMCC::CondCodes Pred, unsigned PredReg, unsigned Scratch, DebugLoc dl, SmallVector, 8> &Regs); + void MergeOpsUpdate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + int Offset, + unsigned Base, + bool BaseKill, + int Opcode, + ARMCC::CondCodes Pred, + unsigned PredReg, + unsigned Scratch, + DebugLoc dl, + SmallVector, 8> &Regs, + MemOpQueue &MemOps, + unsigned memOpsFrom, + unsigned memOpsTo, + SmallVector &Merges); void MergeLDR_STR(MachineBasicBlock &MBB, unsigned SIndex, unsigned Base, int Opcode, unsigned Size, ARMCC::CondCodes Pred, unsigned PredReg, @@ -248,6 +263,34 @@ return true; } +// MergeOpsUpdate - call MergeOps and update MemOps and merges accordingly on +// success. +void ARMLoadStoreOpt:: +MergeOpsUpdate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + int Offset, + unsigned Base, + bool BaseKill, + int Opcode, + ARMCC::CondCodes Pred, + unsigned PredReg, + unsigned Scratch, + DebugLoc dl, + SmallVector, 8> &Regs, + MemOpQueue &MemOps, + unsigned memOpsFrom, + unsigned memOpsTo, + SmallVector &Merges) { + if (!MergeOps(MBB, MBBI, Offset, Base, BaseKill, Opcode, + Pred, PredReg, Scratch, dl, Regs)) + return; + Merges.push_back(prior(MBBI)); + for (unsigned j = memOpsFrom; j < memOpsTo; ++j) { + MBB.erase(MemOps[j].MBBI); + MemOps[j].Merged = true; + } +} + /// MergeLDR_STR - Merge a number of load / store instructions into one or more /// load / store multiple instructions. void @@ -282,14 +325,8 @@ PRegNum = RegNum; } else { // Can't merge this in. Try merge the earlier ones first. - if (MergeOps(MBB, ++Loc, SOffset, Base, false, Opcode, Pred, PredReg, - Scratch, dl, Regs)) { - Merges.push_back(prior(Loc)); - for (unsigned j = SIndex; j < i; ++j) { - MBB.erase(MemOps[j].MBBI); - MemOps[j].Merged = true; - } - } + MergeOpsUpdate(MBB, ++Loc, SOffset, Base, false, Opcode, Pred, PredReg, + Scratch, dl, Regs, MemOps, SIndex, i, Merges); MergeLDR_STR(MBB, i, Base, Opcode, Size, Pred, PredReg, Scratch, MemOps, Merges); return; @@ -302,15 +339,8 @@ } bool BaseKill = Loc->findRegisterUseOperandIdx(Base, true) != -1; - if (MergeOps(MBB, ++Loc, SOffset, Base, BaseKill, Opcode, Pred, PredReg, - Scratch, dl, Regs)) { - Merges.push_back(prior(Loc)); - for (unsigned i = SIndex, e = MemOps.size(); i != e; ++i) { - MBB.erase(MemOps[i].MBBI); - MemOps[i].Merged = true; - } - } - + MergeOpsUpdate(MBB, ++Loc, SOffset, Base, BaseKill, Opcode, Pred, PredReg, + Scratch, dl, Regs, MemOps, SIndex, MemOps.size(), Merges); return; } From stoklund at 2pi.dk Wed Dec 23 15:28:31 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Dec 2009 21:28:31 -0000 Subject: [llvm-commits] [llvm] r92052 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <200912232128.nBNLSVba024523@zion.cs.uiuc.edu> Author: stoklund Date: Wed Dec 23 15:28:31 2009 New Revision: 92052 URL: http://llvm.org/viewvc/llvm-project?rev=92052&view=rev Log: Perform kill flag calculations in new method. No functional changes. Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=92052&r1=92051&r2=92052&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Dec 23 15:28:31 2009 @@ -97,7 +97,6 @@ unsigned PredReg, unsigned Scratch, DebugLoc dl, - SmallVector, 8> &Regs, MemOpQueue &MemOps, unsigned memOpsFrom, unsigned memOpsTo, @@ -276,18 +275,27 @@ unsigned PredReg, unsigned Scratch, DebugLoc dl, - SmallVector, 8> &Regs, MemOpQueue &MemOps, unsigned memOpsFrom, unsigned memOpsTo, SmallVector &Merges) { + // First calculate which of the registers should be killed by the merged + // instruction. + SmallVector, 8> Regs; + for (unsigned i = memOpsFrom; i < memOpsTo; ++i) { + const MachineOperand &MO = MemOps[i].MBBI->getOperand(0); + Regs.push_back(std::make_pair(MO.getReg(), MO.isKill())); + } + if (!MergeOps(MBB, MBBI, Offset, Base, BaseKill, Opcode, Pred, PredReg, Scratch, dl, Regs)) return; + + // Merge succeeded, update records. Merges.push_back(prior(MBBI)); - for (unsigned j = memOpsFrom; j < memOpsTo; ++j) { - MBB.erase(MemOps[j].MBBI); - MemOps[j].Merged = true; + for (unsigned i = memOpsFrom; i < memOpsTo; ++i) { + MBB.erase(MemOps[i].MBBI); + MemOps[i].Merged = true; } } @@ -307,26 +315,21 @@ DebugLoc dl = Loc->getDebugLoc(); unsigned PReg = Loc->getOperand(0).getReg(); unsigned PRegNum = ARMRegisterInfo::getRegisterNumbering(PReg); - bool isKill = Loc->getOperand(0).isKill(); - SmallVector, 8> Regs; - Regs.push_back(std::make_pair(PReg, isKill)); for (unsigned i = SIndex+1, e = MemOps.size(); i != e; ++i) { int NewOffset = MemOps[i].Offset; unsigned Reg = MemOps[i].MBBI->getOperand(0).getReg(); unsigned RegNum = ARMRegisterInfo::getRegisterNumbering(Reg); - isKill = MemOps[i].MBBI->getOperand(0).isKill(); // AM4 - register numbers in ascending order. // AM5 - consecutive register numbers in ascending order. if (NewOffset == Offset + (int)Size && ((isAM4 && RegNum > PRegNum) || RegNum == PRegNum+1)) { Offset += Size; - Regs.push_back(std::make_pair(Reg, isKill)); PRegNum = RegNum; } else { // Can't merge this in. Try merge the earlier ones first. MergeOpsUpdate(MBB, ++Loc, SOffset, Base, false, Opcode, Pred, PredReg, - Scratch, dl, Regs, MemOps, SIndex, i, Merges); + Scratch, dl, MemOps, SIndex, i, Merges); MergeLDR_STR(MBB, i, Base, Opcode, Size, Pred, PredReg, Scratch, MemOps, Merges); return; @@ -340,7 +343,7 @@ bool BaseKill = Loc->findRegisterUseOperandIdx(Base, true) != -1; MergeOpsUpdate(MBB, ++Loc, SOffset, Base, BaseKill, Opcode, Pred, PredReg, - Scratch, dl, Regs, MemOps, SIndex, MemOps.size(), Merges); + Scratch, dl, MemOps, SIndex, MemOps.size(), Merges); return; } From stoklund at 2pi.dk Wed Dec 23 15:28:37 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Dec 2009 21:28:37 -0000 Subject: [llvm-commits] [llvm] r92053 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <200912232128.nBNLSbr4024539@zion.cs.uiuc.edu> Author: stoklund Date: Wed Dec 23 15:28:37 2009 New Revision: 92053 URL: http://llvm.org/viewvc/llvm-project?rev=92053&view=rev Log: Make insert position available to MergeOpsUpdate. Rearrange arguments. No functional changes Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=92053&r1=92052&r2=92053&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Dec 23 15:28:37 2009 @@ -88,7 +88,10 @@ ARMCC::CondCodes Pred, unsigned PredReg, unsigned Scratch, DebugLoc dl, SmallVector, 8> &Regs); void MergeOpsUpdate(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MBBI, + MemOpQueue &MemOps, + unsigned memOpsBegin, + unsigned memOpsEnd, + unsigned insertAfter, int Offset, unsigned Base, bool BaseKill, @@ -97,9 +100,6 @@ unsigned PredReg, unsigned Scratch, DebugLoc dl, - MemOpQueue &MemOps, - unsigned memOpsFrom, - unsigned memOpsTo, SmallVector &Merges); void MergeLDR_STR(MachineBasicBlock &MBB, unsigned SIndex, unsigned Base, int Opcode, unsigned Size, @@ -266,7 +266,10 @@ // success. void ARMLoadStoreOpt:: MergeOpsUpdate(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MBBI, + MemOpQueue &memOps, + unsigned memOpsBegin, + unsigned memOpsEnd, + unsigned insertAfter, int Offset, unsigned Base, bool BaseKill, @@ -275,27 +278,27 @@ unsigned PredReg, unsigned Scratch, DebugLoc dl, - MemOpQueue &MemOps, - unsigned memOpsFrom, - unsigned memOpsTo, SmallVector &Merges) { // First calculate which of the registers should be killed by the merged // instruction. SmallVector, 8> Regs; - for (unsigned i = memOpsFrom; i < memOpsTo; ++i) { - const MachineOperand &MO = MemOps[i].MBBI->getOperand(0); + for (unsigned i = memOpsBegin; i < memOpsEnd; ++i) { + const MachineOperand &MO = memOps[i].MBBI->getOperand(0); Regs.push_back(std::make_pair(MO.getReg(), MO.isKill())); } - if (!MergeOps(MBB, MBBI, Offset, Base, BaseKill, Opcode, + // Try to do the merge. + MachineBasicBlock::iterator Loc = memOps[insertAfter].MBBI; + Loc++; + if (!MergeOps(MBB, Loc, Offset, Base, BaseKill, Opcode, Pred, PredReg, Scratch, dl, Regs)) return; // Merge succeeded, update records. - Merges.push_back(prior(MBBI)); - for (unsigned i = memOpsFrom; i < memOpsTo; ++i) { - MBB.erase(MemOps[i].MBBI); - MemOps[i].Merged = true; + Merges.push_back(prior(Loc)); + for (unsigned i = memOpsBegin; i < memOpsEnd; ++i) { + MBB.erase(memOps[i].MBBI); + memOps[i].Merged = true; } } @@ -310,7 +313,7 @@ bool isAM4 = isi32Load(Opcode) || isi32Store(Opcode); int Offset = MemOps[SIndex].Offset; int SOffset = Offset; - unsigned Pos = MemOps[SIndex].Position; + unsigned insertAfter = SIndex; MachineBasicBlock::iterator Loc = MemOps[SIndex].MBBI; DebugLoc dl = Loc->getDebugLoc(); unsigned PReg = Loc->getOperand(0).getReg(); @@ -328,22 +331,20 @@ PRegNum = RegNum; } else { // Can't merge this in. Try merge the earlier ones first. - MergeOpsUpdate(MBB, ++Loc, SOffset, Base, false, Opcode, Pred, PredReg, - Scratch, dl, MemOps, SIndex, i, Merges); + MergeOpsUpdate(MBB, MemOps, SIndex, i, insertAfter, SOffset, + Base, false, Opcode, Pred, PredReg, Scratch, dl, Merges); MergeLDR_STR(MBB, i, Base, Opcode, Size, Pred, PredReg, Scratch, MemOps, Merges); return; } - if (MemOps[i].Position > Pos) { - Pos = MemOps[i].Position; - Loc = MemOps[i].MBBI; - } + if (MemOps[i].Position > MemOps[insertAfter].Position) + insertAfter = i; } bool BaseKill = Loc->findRegisterUseOperandIdx(Base, true) != -1; - MergeOpsUpdate(MBB, ++Loc, SOffset, Base, BaseKill, Opcode, Pred, PredReg, - Scratch, dl, MemOps, SIndex, MemOps.size(), Merges); + MergeOpsUpdate(MBB, MemOps, SIndex, MemOps.size(), insertAfter, SOffset, + Base, BaseKill, Opcode, Pred, PredReg, Scratch, dl, Merges); return; } From stoklund at 2pi.dk Wed Dec 23 15:28:43 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Dec 2009 21:28:43 -0000 Subject: [llvm-commits] [llvm] r92054 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <200912232128.nBNLShT8024555@zion.cs.uiuc.edu> Author: stoklund Date: Wed Dec 23 15:28:42 2009 New Revision: 92054 URL: http://llvm.org/viewvc/llvm-project?rev=92054&view=rev Log: Handle undef operands properly. Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=92054&r1=92053&r2=92054&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Dec 23 15:28:42 2009 @@ -316,13 +316,17 @@ unsigned insertAfter = SIndex; MachineBasicBlock::iterator Loc = MemOps[SIndex].MBBI; DebugLoc dl = Loc->getDebugLoc(); - unsigned PReg = Loc->getOperand(0).getReg(); - unsigned PRegNum = ARMRegisterInfo::getRegisterNumbering(PReg); + const MachineOperand &PMO = Loc->getOperand(0); + unsigned PReg = PMO.getReg(); + unsigned PRegNum = PMO.isUndef() ? UINT_MAX + : ARMRegisterInfo::getRegisterNumbering(PReg); for (unsigned i = SIndex+1, e = MemOps.size(); i != e; ++i) { int NewOffset = MemOps[i].Offset; - unsigned Reg = MemOps[i].MBBI->getOperand(0).getReg(); - unsigned RegNum = ARMRegisterInfo::getRegisterNumbering(Reg); + const MachineOperand &MO = MemOps[i].MBBI->getOperand(0); + unsigned Reg = MO.getReg(); + unsigned RegNum = MO.isUndef() ? UINT_MAX + : ARMRegisterInfo::getRegisterNumbering(Reg); // AM4 - register numbers in ascending order. // AM5 - consecutive register numbers in ascending order. if (NewOffset == Offset + (int)Size && From stoklund at 2pi.dk Wed Dec 23 15:34:03 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 23 Dec 2009 21:34:03 -0000 Subject: [llvm-commits] [llvm] r92058 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <200912232134.nBNLY3L0024796@zion.cs.uiuc.edu> Author: stoklund Date: Wed Dec 23 15:34:03 2009 New Revision: 92058 URL: http://llvm.org/viewvc/llvm-project?rev=92058&view=rev Log: Move kill flags when the same register occurs more than once in a sequence. Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=92058&r1=92057&r2=92058&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Dec 23 15:34:03 2009 @@ -282,9 +282,22 @@ // First calculate which of the registers should be killed by the merged // instruction. SmallVector, 8> Regs; + const unsigned insertPos = memOps[insertAfter].Position; for (unsigned i = memOpsBegin; i < memOpsEnd; ++i) { const MachineOperand &MO = memOps[i].MBBI->getOperand(0); - Regs.push_back(std::make_pair(MO.getReg(), MO.isKill())); + unsigned Reg = MO.getReg(); + bool isKill = MO.isKill(); + + // If we are inserting the merged operation after an unmerged operation that + // uses the same register, make sure to transfer any kill flag. + for (unsigned j = memOpsEnd, e = memOps.size(); !isKill && j != e; ++j) + if (memOps[j].PositiongetOperand(0); + if (MOJ.getReg() == Reg && MOJ.isKill()) + isKill = true; + } + + Regs.push_back(std::make_pair(Reg, isKill)); } // Try to do the merge. @@ -297,6 +310,14 @@ // Merge succeeded, update records. Merges.push_back(prior(Loc)); for (unsigned i = memOpsBegin; i < memOpsEnd; ++i) { + // Remove kill flags from any unmerged memops that come before insertPos. + if (Regs[i-memOpsBegin].second) + for (unsigned j = memOpsEnd, e = memOps.size(); j != e; ++j) + if (memOps[j].PositiongetOperand(0); + if (MOJ.getReg() == Regs[i-memOpsBegin].first && MOJ.isKill()) + MOJ.setIsKill(false); + } MBB.erase(memOps[i].MBBI); memOps[i].Merged = true; } From greened at obbligato.org Wed Dec 23 15:48:19 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 21:48:19 -0000 Subject: [llvm-commits] [llvm] r92060 - /llvm/trunk/lib/Analysis/ProfileInfo.cpp Message-ID: <200912232148.nBNLmJhA025308@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 15:48:18 2009 New Revision: 92060 URL: http://llvm.org/viewvc/llvm-project?rev=92060&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfo.cpp?rev=92060&r1=92059&r2=92060&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfo.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfo.cpp Wed Dec 23 15:48:18 2009 @@ -163,7 +163,7 @@ template<> void ProfileInfoT:: setExecutionCount(const BasicBlock *BB, double w) { - DEBUG(errs() << "Creating Block " << BB->getName() + DEBUG(dbgs() << "Creating Block " << BB->getName() << " (weight: " << format("%.20g",w) << ")\n"); BlockInformation[BB->getParent()][BB] = w; } @@ -171,7 +171,7 @@ template<> void ProfileInfoT:: setExecutionCount(const MachineBasicBlock *MBB, double w) { - DEBUG(errs() << "Creating Block " << MBB->getBasicBlock()->getName() + DEBUG(dbgs() << "Creating Block " << MBB->getBasicBlock()->getName() << " (weight: " << format("%.20g",w) << ")\n"); BlockInformation[MBB->getParent()][MBB] = w; } @@ -180,7 +180,7 @@ void ProfileInfoT::addEdgeWeight(Edge e, double w) { double oldw = getEdgeWeight(e); assert (oldw != MissingValue && "Adding weight to Edge with no previous weight"); - DEBUG(errs() << "Adding to Edge " << e + DEBUG(dbgs() << "Adding to Edge " << e << " (new weight: " << format("%.20g",oldw + w) << ")\n"); EdgeInformation[getFunction(e)][e] = oldw + w; } @@ -190,7 +190,7 @@ addExecutionCount(const BasicBlock *BB, double w) { double oldw = getExecutionCount(BB); assert (oldw != MissingValue && "Adding weight to Block with no previous weight"); - DEBUG(errs() << "Adding to Block " << BB->getName() + DEBUG(dbgs() << "Adding to Block " << BB->getName() << " (new weight: " << format("%.20g",oldw + w) << ")\n"); BlockInformation[BB->getParent()][BB] = oldw + w; } @@ -201,7 +201,7 @@ BlockInformation.find(BB->getParent()); if (J == BlockInformation.end()) return; - DEBUG(errs() << "Deleting " << BB->getName() << "\n"); + DEBUG(dbgs() << "Deleting " << BB->getName() << "\n"); J->second.erase(BB); } @@ -211,7 +211,7 @@ EdgeInformation.find(getFunction(e)); if (J == EdgeInformation.end()) return; - DEBUG(errs() << "Deleting" << e << "\n"); + DEBUG(dbgs() << "Deleting" << e << "\n"); J->second.erase(e); } @@ -221,10 +221,10 @@ double w; if ((w = getEdgeWeight(newedge)) == MissingValue) { w = getEdgeWeight(oldedge); - DEBUG(errs() << "Replacing " << oldedge << " with " << newedge << "\n"); + DEBUG(dbgs() << "Replacing " << oldedge << " with " << newedge << "\n"); } else { w += getEdgeWeight(oldedge); - DEBUG(errs() << "Adding " << oldedge << " to " << newedge << "\n"); + DEBUG(dbgs() << "Adding " << oldedge << " to " << newedge << "\n"); } setEdgeWeight(newedge,w); removeEdge(oldedge); @@ -277,7 +277,7 @@ template<> void ProfileInfoT:: divertFlow(const Edge &oldedge, const Edge &newedge) { - DEBUG(errs() << "Diverting " << oldedge << " via " << newedge ); + DEBUG(dbgs() << "Diverting " << oldedge << " via " << newedge ); // First check if the old edge was taken, if not, just delete it... if (getEdgeWeight(oldedge) == 0) { @@ -291,7 +291,7 @@ const BasicBlock *BB = GetPath(newedge.second,oldedge.second,P,GetPathToExit | GetPathToDest); double w = getEdgeWeight (oldedge); - DEBUG(errs() << ", Weight: " << format("%.20g",w) << "\n"); + DEBUG(dbgs() << ", Weight: " << format("%.20g",w) << "\n"); do { const BasicBlock *Parent = P.find(BB)->second; Edge e = getEdge(Parent,BB); @@ -312,7 +312,7 @@ template<> void ProfileInfoT:: replaceAllUses(const BasicBlock *RmBB, const BasicBlock *DestBB) { - DEBUG(errs() << "Replacing " << RmBB->getName() + DEBUG(dbgs() << "Replacing " << RmBB->getName() << " with " << DestBB->getName() << "\n"); const Function *F = DestBB->getParent(); std::map::iterator J = @@ -413,7 +413,7 @@ EdgeInformation.find(F); if (J == EdgeInformation.end()) return; - DEBUG(errs() << "Splitting " << Old->getName() << " to " << New->getName() << "\n"); + DEBUG(dbgs() << "Splitting " << Old->getName() << " to " << New->getName() << "\n"); std::set Edges; for (EdgeWeights::iterator ewi = J->second.begin(), ewe = J->second.end(); @@ -444,7 +444,7 @@ EdgeInformation.find(F); if (J == EdgeInformation.end()) return; - DEBUG(errs() << "Splitting " << NumPreds << " Edges from " << BB->getName() + DEBUG(dbgs() << "Splitting " << NumPreds << " Edges from " << BB->getName() << " to " << NewBB->getName() << "\n"); // Collect weight that was redirected over NewBB. @@ -474,7 +474,7 @@ template<> void ProfileInfoT::transfer(const Function *Old, const Function *New) { - DEBUG(errs() << "Replacing Function " << Old->getName() << " with " + DEBUG(dbgs() << "Replacing Function " << Old->getName() << " with " << New->getName() << "\n"); std::map::iterator J = EdgeInformation.find(Old); @@ -552,7 +552,7 @@ } else { EdgeInformation[BB->getParent()][edgetocalc] = incount-outcount; } - DEBUG(errs() << "--Calc Edge Counter for " << edgetocalc << ": " + DEBUG(dbgs() << "--Calc Edge Counter for " << edgetocalc << ": " << format("%.20g", getEdgeWeight(edgetocalc)) << "\n"); removed = edgetocalc; return true; @@ -978,17 +978,17 @@ } if (FoundPath) continue; - errs() << "{"; + dbgs() << "{"; FI = Unvisited.begin(), FE = Unvisited.end(); while(FI != FE) { const BasicBlock *BB = *FI; ++FI; - errs() << BB->getName(); + dbgs() << BB->getName(); if (FI != FE) - errs() << ","; + dbgs() << ","; } - errs() << "}"; + dbgs() << "}"; - errs() << "ASSERT: could not repair function"; + dbgs() << "ASSERT: could not repair function"; assert(0 && "could not repair function"); } From greened at obbligato.org Wed Dec 23 15:58:29 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 21:58:29 -0000 Subject: [llvm-commits] [llvm] r92063 - /llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Message-ID: <200912232158.nBNLwTVx025782@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 15:58:29 2009 New Revision: 92063 URL: http://llvm.org/viewvc/llvm-project?rev=92063&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Modified: llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp?rev=92063&r1=92062&r2=92063&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Wed Dec 23 15:58:29 2009 @@ -131,7 +131,7 @@ // in double. EdgeInformation[getFunction(e)][e] += (double)weight; - DEBUG(errs() << "--Read Edge Counter for " << e + DEBUG(dbgs() << "--Read Edge Counter for " << e << " (# "<< (ReadCount-1) << "): " << (unsigned)getEdgeWeight(e) << "\n"); } else { @@ -151,7 +151,7 @@ ReadCount = 0; for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { if (F->isDeclaration()) continue; - DEBUG(errs()<<"Working on "<getNameStr()<<"\n"); + DEBUG(dbgs()<<"Working on "<getNameStr()<<"\n"); readEdge(getEdge(0,&F->getEntryBlock()), Counters); for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { TerminatorInst *TI = BB->getTerminator(); @@ -161,7 +161,7 @@ } } if (ReadCount != Counters.size()) { - errs() << "WARNING: profile information is inconsistent with " + dbgs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } NumEdgesRead = ReadCount; @@ -172,7 +172,7 @@ ReadCount = 0; for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { if (F->isDeclaration()) continue; - DEBUG(errs()<<"Working on "<getNameStr()<<"\n"); + DEBUG(dbgs()<<"Working on "<getNameStr()<<"\n"); readEdge(getEdge(0,&F->getEntryBlock()), Counters); for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { TerminatorInst *TI = BB->getTerminator(); @@ -198,10 +198,10 @@ } if (SpanningTree.size() == size) { - DEBUG(errs()<<"{"); + DEBUG(dbgs()<<"{"); for (std::set::iterator ei = SpanningTree.begin(), ee = SpanningTree.end(); ei != ee; ++ei) { - DEBUG(errs()<< *ei <<","); + DEBUG(dbgs()<< *ei <<","); } assert(0 && "No edge calculated!"); } @@ -209,7 +209,7 @@ } } if (ReadCount != Counters.size()) { - errs() << "WARNING: profile information is inconsistent with " + dbgs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } NumEdgesRead = ReadCount; @@ -230,7 +230,7 @@ BlockInformation[F][BB] = (double)Counters[ReadCount++]; } if (ReadCount != Counters.size()) { - errs() << "WARNING: profile information is inconsistent with " + dbgs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } } @@ -249,7 +249,7 @@ FunctionInformation[F] = (double)Counters[ReadCount++]; } if (ReadCount != Counters.size()) { - errs() << "WARNING: profile information is inconsistent with " + dbgs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } } From greened at obbligato.org Wed Dec 23 16:10:20 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 22:10:20 -0000 Subject: [llvm-commits] [llvm] r92066 - /llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp Message-ID: <200912232210.nBNMAKZr026337@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 16:10:20 2009 New Revision: 92066 URL: http://llvm.org/viewvc/llvm-project?rev=92066&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp Modified: llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp?rev=92066&r1=92065&r2=92066&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileVerifierPass.cpp Wed Dec 23 16:10:20 2009 @@ -102,7 +102,7 @@ typename ProfileInfoT::Edge E = PI->getEdge(*bbi,BB); double EdgeWeight = PI->getEdgeWeight(E); if (EdgeWeight == ProfileInfoT::MissingValue) { EdgeWeight = 0; } - errs() << "calculated in-edge " << E << ": " + dbgs() << "calculated in-edge " << E << ": " << format("%20.20g",EdgeWeight) << "\n"; inWeight += EdgeWeight; inCount++; @@ -117,13 +117,13 @@ typename ProfileInfoT::Edge E = PI->getEdge(BB,*bbi); double EdgeWeight = PI->getEdgeWeight(E); if (EdgeWeight == ProfileInfoT::MissingValue) { EdgeWeight = 0; } - errs() << "calculated out-edge " << E << ": " + dbgs() << "calculated out-edge " << E << ": " << format("%20.20g",EdgeWeight) << "\n"; outWeight += EdgeWeight; outCount++; } } - errs() << "Block " << BB->getNameStr() << " in " + dbgs() << "Block " << BB->getNameStr() << " in " << BB->getParent()->getNameStr() << ":" << "BBWeight=" << format("%20.20g",BBWeight) << "," << "inWeight=" << format("%20.20g",inWeight) << "," @@ -141,7 +141,7 @@ template void ProfileVerifierPassT::debugEntry (DetailedBlockInfo *DI) { - errs() << "TROUBLE: Block " << DI->BB->getNameStr() << " in " + dbgs() << "TROUBLE: Block " << DI->BB->getNameStr() << " in " << DI->BB->getParent()->getNameStr() << ":" << "BBWeight=" << format("%20.20g",DI->BBWeight) << "," << "inWeight=" << format("%20.20g",DI->inWeight) << "," @@ -191,20 +191,20 @@ } #define ASSERTMESSAGE(M) \ - { errs() << "ASSERT:" << (M) << "\n"; \ + { dbgs() << "ASSERT:" << (M) << "\n"; \ if (!DisableAssertions) assert(0 && (M)); } template double ProfileVerifierPassT::ReadOrAssert(typename ProfileInfoT::Edge E) { double EdgeWeight = PI->getEdgeWeight(E); if (EdgeWeight == ProfileInfoT::MissingValue) { - errs() << "Edge " << E << " in Function " + dbgs() << "Edge " << E << " in Function " << ProfileInfoT::getFunction(E)->getNameStr() << ": "; ASSERTMESSAGE("Edge has missing value"); return 0; } else { if (EdgeWeight < 0) { - errs() << "Edge " << E << " in Function " + dbgs() << "Edge " << E << " in Function " << ProfileInfoT::getFunction(E)->getNameStr() << ": "; ASSERTMESSAGE("Edge has negative value"); } @@ -218,7 +218,7 @@ DetailedBlockInfo *DI) { if (Error) { DEBUG(debugEntry(DI)); - errs() << "Block " << DI->BB->getNameStr() << " in Function " + dbgs() << "Block " << DI->BB->getNameStr() << " in Function " << DI->BB->getParent()->getNameStr() << ": "; ASSERTMESSAGE(Message); } From greened at obbligato.org Wed Dec 23 16:18:14 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 22:18:14 -0000 Subject: [llvm-commits] [llvm] r92067 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200912232218.nBNMIE30026665@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 16:18:14 2009 New Revision: 92067 URL: http://llvm.org/viewvc/llvm-project?rev=92067&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=92067&r1=92066&r2=92067&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Dec 23 16:18:14 2009 @@ -117,8 +117,8 @@ SCEV::~SCEV() {} void SCEV::dump() const { - print(errs()); - errs() << '\n'; + print(dbgs()); + dbgs() << '\n'; } bool SCEV::isZero() const { @@ -3627,10 +3627,10 @@ } default: #if 0 - errs() << "ComputeBackedgeTakenCount "; + dbgs() << "ComputeBackedgeTakenCount "; if (ExitCond->getOperand(0)->getType()->isUnsigned()) - errs() << "[unsigned] "; - errs() << *LHS << " " + dbgs() << "[unsigned] "; + dbgs() << *LHS << " " << Instruction::getOpcodeName(Instruction::ICmp) << " " << *RHS << "\n"; #endif @@ -3751,7 +3751,7 @@ if (!isa(Result)) break; // Couldn't decide for sure if (cast(Result)->getValue().isMinValue()) { #if 0 - errs() << "\n***\n*** Computed loop count " << *ItCst + dbgs() << "\n***\n*** Computed loop count " << *ItCst << "\n*** From global " << *GV << "*** BB: " << *L->getHeader() << "***\n"; #endif @@ -4317,7 +4317,7 @@ const SCEVConstant *R2 = dyn_cast(Roots.second); if (R1) { #if 0 - errs() << "HFTZ: " << *V << " - sol#1: " << *R1 + dbgs() << "HFTZ: " << *V << " - sol#1: " << *R1 << " sol#2: " << *R2 << "\n"; #endif // Pick the smallest positive root value. From clattner at apple.com Wed Dec 23 16:22:47 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:22:47 -0800 Subject: [llvm-commits] [llvm] r92024 - /llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp In-Reply-To: <200912231915.nBNJFDwi019456@zion.cs.uiuc.edu> References: <200912231915.nBNJFDwi019456@zion.cs.uiuc.edu> Message-ID: On Dec 23, 2009, at 11:15 AM, David Greene wrote: > Author: greened > Date: Wed Dec 23 13:15:13 2009 > New Revision: 92024 > > URL: http://llvm.org/viewvc/llvm-project?rev=92024&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. This should stay errs(), -count-aa is a pass that produces output on errs(). -Chris > > Modified: > llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp > > Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp?rev=92024&r1=92023&r2=92024&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp (original) > +++ llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Wed Dec 23 > 13:15:13 2009 > @@ -17,6 +17,7 @@ > #include "llvm/Analysis/AliasAnalysis.h" > #include "llvm/Assembly/Writer.h" > #include "llvm/Support/CommandLine.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/ErrorHandling.h" > #include "llvm/Support/raw_ostream.h" > using namespace llvm; > @@ -40,31 +41,31 @@ > } > > void printLine(const char *Desc, unsigned Val, unsigned Sum) { > - errs() << " " << Val << " " << Desc << " responses (" > + dbgs() << " " << Val << " " << Desc << " responses (" > << Val*100/Sum << "%)\n"; > } > ~AliasAnalysisCounter() { > unsigned AASum = No+May+Must; > unsigned MRSum = NoMR+JustRef+JustMod+MR; > if (AASum + MRSum) { // Print a report if any counted queries > occurred... > - errs() << "\n===== Alias Analysis Counter Report =====\n" > + dbgs() << "\n===== Alias Analysis Counter Report =====\n" > << " Analysis counted: " << Name << "\n" > << " " << AASum << " Total Alias Queries Performed\n"; > if (AASum) { > printLine("no alias", No, AASum); > printLine("may alias", May, AASum); > printLine("must alias", Must, AASum); > - errs() << " Alias Analysis Counter Summary: " << No*100/ > AASum << "%/" > + dbgs() << " Alias Analysis Counter Summary: " << No*100/ > AASum << "%/" > << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; > } > > - errs() << " " << MRSum << " Total Mod/Ref Queries > Performed\n"; > + dbgs() << " " << MRSum << " Total Mod/Ref Queries > Performed\n"; > if (MRSum) { > printLine("no mod/ref", NoMR, MRSum); > printLine("ref", JustRef, MRSum); > printLine("mod", JustMod, MRSum); > printLine("mod/ref", MR, MRSum); > - errs() << " Mod/Ref Analysis Counter Summary: " > < + dbgs() << " Mod/Ref Analysis Counter Summary: " > < << "%/" << JustRef*100/MRSum << "%/" << JustMod*100/ > MRSum > << "%/" << MR*100/MRSum <<"%\n\n"; > } > @@ -124,13 +125,13 @@ > } > > if (PrintAll || (PrintAllFailures && R == MayAlias)) { > - errs() << AliasString << ":\t"; > - errs() << "[" << V1Size << "B] "; > - WriteAsOperand(errs(), V1, true, M); > - errs() << ", "; > - errs() << "[" << V2Size << "B] "; > - WriteAsOperand(errs(), V2, true, M); > - errs() << "\n"; > + dbgs() << AliasString << ":\t"; > + dbgs() << "[" << V1Size << "B] "; > + WriteAsOperand(dbgs(), V1, true, M); > + dbgs() << ", "; > + dbgs() << "[" << V2Size << "B] "; > + WriteAsOperand(dbgs(), V2, true, M); > + dbgs() << "\n"; > } > > return R; > @@ -150,10 +151,10 @@ > } > > if (PrintAll || (PrintAllFailures && R == ModRef)) { > - errs() << MRString << ": Ptr: "; > - errs() << "[" << Size << "B] "; > - WriteAsOperand(errs(), P, true, M); > - errs() << "\t<->" << *CS.getInstruction(); > + dbgs() << MRString << ": Ptr: "; > + dbgs() << "[" << Size << "B] "; > + WriteAsOperand(dbgs(), P, true, M); > + dbgs() << "\t<->" << *CS.getInstruction(); > } > return R; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 23 16:23:07 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:23:07 -0800 Subject: [llvm-commits] [llvm] r92026 - /llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp In-Reply-To: <200912231921.nBNJLJnu019679@zion.cs.uiuc.edu> References: <200912231921.nBNJLJnu019679@zion.cs.uiuc.edu> Message-ID: On Dec 23, 2009, at 11:21 AM, David Greene wrote: > Author: greened > Date: Wed Dec 23 13:21:19 2009 > New Revision: 92026 > > URL: http://llvm.org/viewvc/llvm-project?rev=92026&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. This should stay errs() also, same reason as -count-aa. -Chris > > Modified: > llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp > > Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=92026&r1=92025&r2=92026&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original) > +++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Wed Dec 23 > 13:21:19 2009 > @@ -26,6 +26,7 @@ > #include "llvm/Analysis/AliasAnalysis.h" > #include "llvm/Assembly/Writer.h" > #include "llvm/Target/TargetData.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/InstIterator.h" > #include "llvm/Support/CommandLine.h" > #include "llvm/Support/raw_ostream.h" > @@ -91,7 +92,7 @@ > > if (o2 < o1) > std::swap(o1, o2); > - errs() << " " << Msg << ":\t" > + dbgs() << " " << Msg << ":\t" > << o1 << ", " > << o2 << "\n"; > } > @@ -101,9 +102,9 @@ > PrintModRefResults(const char *Msg, bool P, Instruction *I, Value > *Ptr, > Module *M) { > if (P) { > - errs() << " " << Msg << ": Ptr: "; > - WriteAsOperand(errs(), Ptr, true, M); > - errs() << "\t<->" << *I << '\n'; > + dbgs() << " " << Msg << ": Ptr: "; > + WriteAsOperand(dbgs(), Ptr, true, M); > + dbgs() << "\t<->" << *I << '\n'; > } > } > > @@ -135,7 +136,7 @@ > > if (PrintNoAlias || PrintMayAlias || PrintMustAlias || > PrintNoModRef || PrintMod || PrintRef || PrintModRef) > - errs() << "Function: " << F.getName() << ": " << Pointers.size() > + dbgs() << "Function: " << F.getName() << ": " << Pointers.size() > << " pointers, " << CallSites.size() << " call sites\n"; > > // iterate over the worklist, and run the full (n^2)/2 > disambiguations > @@ -161,7 +162,7 @@ > PrintResults("MustAlias", PrintMustAlias, *I1, *I2, > F.getParent()); > ++MustAlias; break; > default: > - errs() << "Unknown alias query result!\n"; > + dbgs() << "Unknown alias query result!\n"; > } > } > } > @@ -191,7 +192,7 @@ > PrintModRefResults(" ModRef", PrintModRef, I, *V, > F.getParent()); > ++ModRef; break; > default: > - errs() << "Unknown alias query result!\n"; > + dbgs() << "Unknown alias query result!\n"; > } > } > } > @@ -200,24 +201,24 @@ > } > > static void PrintPercent(unsigned Num, unsigned Sum) { > - errs() << "(" << Num*100ULL/Sum << "." > + dbgs() << "(" << Num*100ULL/Sum << "." > << ((Num*1000ULL/Sum) % 10) << "%)\n"; > } > > bool AAEval::doFinalization(Module &M) { > unsigned AliasSum = NoAlias + MayAlias + MustAlias; > - errs() << "===== Alias Analysis Evaluator Report =====\n"; > + dbgs() << "===== Alias Analysis Evaluator Report =====\n"; > if (AliasSum == 0) { > - errs() << " Alias Analysis Evaluator Summary: No pointers!\n"; > + dbgs() << " Alias Analysis Evaluator Summary: No pointers!\n"; > } else { > - errs() << " " << AliasSum << " Total Alias Queries Performed\n"; > - errs() << " " << NoAlias << " no alias responses "; > + dbgs() << " " << AliasSum << " Total Alias Queries Performed\n"; > + dbgs() << " " << NoAlias << " no alias responses "; > PrintPercent(NoAlias, AliasSum); > - errs() << " " << MayAlias << " may alias responses "; > + dbgs() << " " << MayAlias << " may alias responses "; > PrintPercent(MayAlias, AliasSum); > - errs() << " " << MustAlias << " must alias responses "; > + dbgs() << " " << MustAlias << " must alias responses "; > PrintPercent(MustAlias, AliasSum); > - errs() << " Alias Analysis Evaluator Pointer Alias Summary: " > + dbgs() << " Alias Analysis Evaluator Pointer Alias Summary: " > << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum > << "%/" > << MustAlias*100/AliasSum << "%\n"; > } > @@ -225,18 +226,18 @@ > // Display the summary for mod/ref analysis > unsigned ModRefSum = NoModRef + Mod + Ref + ModRef; > if (ModRefSum == 0) { > - errs() << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ > ref!\n"; > + dbgs() << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ > ref!\n"; > } else { > - errs() << " " << ModRefSum << " Total ModRef Queries Performed > \n"; > - errs() << " " << NoModRef << " no mod/ref responses "; > + dbgs() << " " << ModRefSum << " Total ModRef Queries Performed > \n"; > + dbgs() << " " << NoModRef << " no mod/ref responses "; > PrintPercent(NoModRef, ModRefSum); > - errs() << " " << Mod << " mod responses "; > + dbgs() << " " << Mod << " mod responses "; > PrintPercent(Mod, ModRefSum); > - errs() << " " << Ref << " ref responses "; > + dbgs() << " " << Ref << " ref responses "; > PrintPercent(Ref, ModRefSum); > - errs() << " " << ModRef << " mod & ref responses "; > + dbgs() << " " << ModRef << " mod & ref responses "; > PrintPercent(ModRef, ModRefSum); > - errs() << " Alias Analysis Evaluator Mod/Ref Summary: " > + dbgs() << " Alias Analysis Evaluator Mod/Ref Summary: " > << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum > << "%/" > << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "% > \n"; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 23 16:23:47 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:23:47 -0800 Subject: [llvm-commits] [llvm] r92029 - /llvm/trunk/lib/Analysis/AliasSetTracker.cpp In-Reply-To: <200912231927.nBNJRxJu019935@zion.cs.uiuc.edu> References: <200912231927.nBNJRxJu019935@zion.cs.uiuc.edu> Message-ID: On Dec 23, 2009, at 11:27 AM, David Greene wrote: > Author: greened > Date: Wed Dec 23 13:27:59 2009 > New Revision: 92029 > > URL: http://llvm.org/viewvc/llvm-project?rev=92029&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. The change to dump() is fine, the change to AliasSetPrinter is not. -Chris > > Modified: > llvm/trunk/lib/Analysis/AliasSetTracker.cpp > > Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=92029&r1=92028&r2=92029&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original) > +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Wed Dec 23 13:27:59 > 2009 > @@ -19,6 +19,7 @@ > #include "llvm/Type.h" > #include "llvm/Target/TargetData.h" > #include "llvm/Assembly/Writer.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/ErrorHandling.h" > #include "llvm/Support/InstIterator.h" > #include "llvm/Support/Format.h" > @@ -549,8 +550,8 @@ > OS << "\n"; > } > > -void AliasSet::dump() const { print(errs()); } > -void AliasSetTracker::dump() const { print(errs()); } > +void AliasSet::dump() const { print(dbgs()); } > +void AliasSetTracker::dump() const { print(dbgs()); } > > // > = > = > = > ----------------------------------------------------------------------= > ==// > // ASTCallbackVH Class Implementation > @@ -591,7 +592,7 @@ > > for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; > ++I) > Tracker->add(&*I); > - Tracker->print(errs()); > + Tracker->print(dbgs()); > delete Tracker; > return false; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 23 16:24:20 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:24:20 -0800 Subject: [llvm-commits] [llvm] r92033 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> References: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> Message-ID: <5FCE9711-957E-4A1C-BC0D-2A9A8B6C9DB5@apple.com> On Dec 23, 2009, at 11:51 AM, David Greene wrote: > Author: greened > Date: Wed Dec 23 13:51:44 2009 > New Revision: 92033 > > URL: http://llvm.org/viewvc/llvm-project?rev=92033&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. The calls before an llvm_unreachable() should not be transformed. -Chris > > Modified: > llvm/trunk/lib/Analysis/IPA/Andersens.cpp > > Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=92033&r1=92032&r2=92033&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) > +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Wed Dec 23 13:51:44 2009 > @@ -806,7 +806,7 @@ > case Instruction::BitCast: > return getNodeForConstantPointer(CE->getOperand(0)); > default: > - errs() << "Constant Expr not yet handled: " << *CE << "\n"; > + dbgs() << "Constant Expr not yet handled: " << *CE << "\n"; > llvm_unreachable(0); > } > } else { > @@ -833,7 +833,7 @@ > case Instruction::BitCast: > return getNodeForConstantPointerTarget(CE->getOperand(0)); > default: > - errs() << "Constant Expr not yet handled: " << *CE << "\n"; > + dbgs() << "Constant Expr not yet handled: " << *CE << "\n"; > llvm_unreachable(0); > } > } else { > @@ -1132,7 +1132,7 @@ > return; > default: > // Is this something we aren't handling yet? > - errs() << "Unknown instruction: " << I; > + dbgs() << "Unknown instruction: " << I; > llvm_unreachable(0); > } > } > @@ -1402,7 +1402,7 @@ > unsigned Pos = NewPos++; > Translate[i] = Pos; > NewGraphNodes.push_back(GraphNodes[i]); > - DEBUG(errs() << "Renumbering node " << i << " to node " << Pos > << "\n"); > + DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos > << "\n"); > } > > // I believe this ends up being faster than making two vectors and > splicing > @@ -1412,7 +1412,7 @@ > unsigned Pos = NewPos++; > Translate[i] = Pos; > NewGraphNodes.push_back(GraphNodes[i]); > - DEBUG(errs() << "Renumbering node " << i << " to node " << > Pos << "\n"); > + DEBUG(dbgs() << "Renumbering node " << i << " to node " << > Pos << "\n"); > } > } > > @@ -1421,7 +1421,7 @@ > unsigned Pos = NewPos++; > Translate[i] = Pos; > NewGraphNodes.push_back(GraphNodes[i]); > - DEBUG(errs() << "Renumbering node " << i << " to node " << > Pos << "\n"); > + DEBUG(dbgs() << "Renumbering node " << i << " to node " << > Pos << "\n"); > } > } > > @@ -1493,7 +1493,7 @@ > /// receive &D from E anyway. > > void Andersens::HVN() { > - DEBUG(errs() << "Beginning HVN\n"); > + DEBUG(dbgs() << "Beginning HVN\n"); > // Build a predecessor graph. This is like our constraint graph > with the > // edges going in the opposite direction, and there are edges for > all the > // constraints, instead of just copy constraints. We also build > implicit > @@ -1564,7 +1564,7 @@ > Node2DFS.clear(); > Node2Deleted.clear(); > Node2Visited.clear(); > - DEBUG(errs() << "Finished HVN\n"); > + DEBUG(dbgs() << "Finished HVN\n"); > > } > > @@ -1688,7 +1688,7 @@ > /// and is equivalent to value numbering the collapsed constraint > graph > /// including evaluating unions. > void Andersens::HU() { > - DEBUG(errs() << "Beginning HU\n"); > + DEBUG(dbgs() << "Beginning HU\n"); > // Build a predecessor graph. This is like our constraint graph > with the > // edges going in the opposite direction, and there are edges for > all the > // constraints, instead of just copy constraints. We also build > implicit > @@ -1768,7 +1768,7 @@ > } > // PEClass nodes will be deleted by the deleting of N->PointsTo in > our caller. > Set2PEClass.clear(); > - DEBUG(errs() << "Finished HU\n"); > + DEBUG(dbgs() << "Finished HU\n"); > } > > > @@ -1946,12 +1946,12 @@ > // to anything. > if (LHSLabel == 0) { > DEBUG(PrintNode(&GraphNodes[LHSNode])); > - DEBUG(errs() << " is a non-pointer, ignoring constraint.\n"); > + DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n"); > continue; > } > if (RHSLabel == 0) { > DEBUG(PrintNode(&GraphNodes[RHSNode])); > - DEBUG(errs() << " is a non-pointer, ignoring constraint.\n"); > + DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n"); > continue; > } > // This constraint may be useless, and it may become useless as > we translate > @@ -1999,16 +1999,16 @@ > if (i < FirstRefNode) { > PrintNode(&GraphNodes[i]); > } else if (i < FirstAdrNode) { > - DEBUG(errs() << "REF("); > + DEBUG(dbgs() << "REF("); > PrintNode(&GraphNodes[i-FirstRefNode]); > - DEBUG(errs() <<")"); > + DEBUG(dbgs() <<")"); > } else { > - DEBUG(errs() << "ADR("); > + DEBUG(dbgs() << "ADR("); > PrintNode(&GraphNodes[i-FirstAdrNode]); > - DEBUG(errs() <<")"); > + DEBUG(dbgs() <<")"); > } > > - DEBUG(errs() << " has pointer label " << > GraphNodes[i].PointerEquivLabel > + DEBUG(dbgs() << " has pointer label " << > GraphNodes[i].PointerEquivLabel > << " and SCC rep " << VSSCCRep[i] > << " and is " << (GraphNodes[i].Direct ? "Direct" : "Not > direct") > << "\n"); > @@ -2025,7 +2025,7 @@ > /// operation are stored in SDT and are later used in > SolveContraints() > /// and UniteNodes(). > void Andersens::HCD() { > - DEBUG(errs() << "Starting HCD.\n"); > + DEBUG(dbgs() << "Starting HCD.\n"); > HCDSCCRep.resize(GraphNodes.size()); > > for (unsigned i = 0; i < GraphNodes.size(); ++i) { > @@ -2074,7 +2074,7 @@ > Node2Visited.clear(); > Node2Deleted.clear(); > HCDSCCRep.clear(); > - DEBUG(errs() << "HCD complete.\n"); > + DEBUG(dbgs() << "HCD complete.\n"); > } > > // Component of HCD: > @@ -2146,7 +2146,7 @@ > /// Optimize the constraints by performing offline variable > substitution and > /// other optimizations. > void Andersens::OptimizeConstraints() { > - DEBUG(errs() << "Beginning constraint optimization\n"); > + DEBUG(dbgs() << "Beginning constraint optimization\n"); > > SDTActive = false; > > @@ -2230,7 +2230,7 @@ > > // HCD complete. > > - DEBUG(errs() << "Finished constraint optimization\n"); > + DEBUG(dbgs() << "Finished constraint optimization\n"); > FirstRefNode = 0; > FirstAdrNode = 0; > } > @@ -2238,7 +2238,7 @@ > /// Unite pointer but not location equivalent variables, now that > the constraint > /// graph is built. > void Andersens::UnitePointerEquivalences() { > - DEBUG(errs() << "Uniting remaining pointer equivalences\n"); > + DEBUG(dbgs() << "Uniting remaining pointer equivalences\n"); > for (unsigned i = 0; i < GraphNodes.size(); ++i) { > if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) { > unsigned Label = GraphNodes[i].PointerEquivLabel; > @@ -2247,7 +2247,7 @@ > UniteNodes(i, PENLEClass2Node[Label]); > } > } > - DEBUG(errs() << "Finished remaining pointer equivalences\n"); > + DEBUG(dbgs() << "Finished remaining pointer equivalences\n"); > PENLEClass2Node.clear(); > } > > @@ -2403,7 +2403,7 @@ > std::vector RSV; > #endif > while( !CurrWL->empty() ) { > - DEBUG(errs() << "Starting iteration #" << ++NumIters << "\n"); > + DEBUG(dbgs() << "Starting iteration #" << ++NumIters << "\n"); > > Node* CurrNode; > unsigned CurrNodeIndex; > @@ -2706,11 +2706,11 @@ > SecondNode->OldPointsTo = NULL; > > NumUnified++; > - DEBUG(errs() << "Unified Node "); > + DEBUG(dbgs() << "Unified Node "); > DEBUG(PrintNode(FirstNode)); > - DEBUG(errs() << " and Node "); > + DEBUG(dbgs() << " and Node "); > DEBUG(PrintNode(SecondNode)); > - DEBUG(errs() << "\n"); > + DEBUG(dbgs() << "\n"); > > if (SDTActive) > if (SDT[Second] >= 0) { > @@ -2755,17 +2755,17 @@ > > void Andersens::PrintNode(const Node *N) const { > if (N == &GraphNodes[UniversalSet]) { > - errs() << ""; > + dbgs() << ""; > return; > } else if (N == &GraphNodes[NullPtr]) { > - errs() << ""; > + dbgs() << ""; > return; > } else if (N == &GraphNodes[NullObject]) { > - errs() << ""; > + dbgs() << ""; > return; > } > if (!N->getValue()) { > - errs() << "artificial" << (intptr_t) N; > + dbgs() << "artificial" << (intptr_t) N; > return; > } > > @@ -2774,85 +2774,85 @@ > if (Function *F = dyn_cast(V)) { > if (isa(F->getFunctionType()->getReturnType()) && > N == &GraphNodes[getReturnNode(F)]) { > - errs() << F->getName() << ":retval"; > + dbgs() << F->getName() << ":retval"; > return; > } else if (F->getFunctionType()->isVarArg() && > N == &GraphNodes[getVarargNode(F)]) { > - errs() << F->getName() << ":vararg"; > + dbgs() << F->getName() << ":vararg"; > return; > } > } > > if (Instruction *I = dyn_cast(V)) > - errs() << I->getParent()->getParent()->getName() << ":"; > + dbgs() << I->getParent()->getParent()->getName() << ":"; > else if (Argument *Arg = dyn_cast(V)) > - errs() << Arg->getParent()->getName() << ":"; > + dbgs() << Arg->getParent()->getName() << ":"; > > if (V->hasName()) > - errs() << V->getName(); > + dbgs() << V->getName(); > else > - errs() << "(unnamed)"; > + dbgs() << "(unnamed)"; > > if (isa(V) || isa(V) || isMalloc(V)) > if (N == &GraphNodes[getObject(V)]) > - errs() << ""; > + dbgs() << ""; > } > void Andersens::PrintConstraint(const Constraint &C) const { > if (C.Type == Constraint::Store) { > - errs() << "*"; > + dbgs() << "*"; > if (C.Offset != 0) > - errs() << "("; > + dbgs() << "("; > } > PrintNode(&GraphNodes[C.Dest]); > if (C.Type == Constraint::Store && C.Offset != 0) > - errs() << " + " << C.Offset << ")"; > - errs() << " = "; > + dbgs() << " + " << C.Offset << ")"; > + dbgs() << " = "; > if (C.Type == Constraint::Load) { > - errs() << "*"; > + dbgs() << "*"; > if (C.Offset != 0) > - errs() << "("; > + dbgs() << "("; > } > else if (C.Type == Constraint::AddressOf) > - errs() << "&"; > + dbgs() << "&"; > PrintNode(&GraphNodes[C.Src]); > if (C.Offset != 0 && C.Type != Constraint::Store) > - errs() << " + " << C.Offset; > + dbgs() << " + " << C.Offset; > if (C.Type == Constraint::Load && C.Offset != 0) > - errs() << ")"; > - errs() << "\n"; > + dbgs() << ")"; > + dbgs() << "\n"; > } > > void Andersens::PrintConstraints() const { > - errs() << "Constraints:\n"; > + dbgs() << "Constraints:\n"; > > for (unsigned i = 0, e = Constraints.size(); i != e; ++i) > PrintConstraint(Constraints[i]); > } > > void Andersens::PrintPointsToGraph() const { > - errs() << "Points-to graph:\n"; > + dbgs() << "Points-to graph:\n"; > for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) { > const Node *N = &GraphNodes[i]; > if (FindNode(i) != i) { > PrintNode(N); > - errs() << "\t--> same as "; > + dbgs() << "\t--> same as "; > PrintNode(&GraphNodes[FindNode(i)]); > - errs() << "\n"; > + dbgs() << "\n"; > } else { > - errs() << "[" << (N->PointsTo->count()) << "] "; > + dbgs() << "[" << (N->PointsTo->count()) << "] "; > PrintNode(N); > - errs() << "\t--> "; > + dbgs() << "\t--> "; > > bool first = true; > for (SparseBitVector<>::iterator bi = N->PointsTo->begin(); > bi != N->PointsTo->end(); > ++bi) { > if (!first) > - errs() << ", "; > + dbgs() << ", "; > PrintNode(&GraphNodes[*bi]); > first = false; > } > - errs() << "\n"; > + dbgs() << "\n"; > } > } > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 23 16:25:43 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:25:43 -0800 Subject: [llvm-commits] [llvm] r92035 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <200912232010.nBNKAxcs021470@zion.cs.uiuc.edu> References: <200912232010.nBNKAxcs021470@zion.cs.uiuc.edu> Message-ID: <77546743-798D-4795-8403-7F02160BED7A@apple.com> On Dec 23, 2009, at 12:10 PM, David Greene wrote: > Author: greened > Date: Wed Dec 23 14:10:59 2009 > New Revision: 92035 > > URL: http://llvm.org/viewvc/llvm-project?rev=92035&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. The calls that are not in DEBUG should not be changed, this breaks - debug-pass=Structure. -Chris > > Modified: > llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp > > Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=92035&r1=92034&r2=92035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) > +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Wed Dec 23 > 14:10:59 2009 > @@ -59,7 +59,7 @@ > > // Print passes managed by this manager > void dumpPassStructure(unsigned Offset) { > - errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; > + dbgs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; > for (unsigned Index = 0; Index < getNumContainedPasses(); + > +Index) { > Pass *P = getContainedPass(Index); > P->dumpPassStructure(Offset + 1); > @@ -126,7 +126,7 @@ > // The function pass(es) modified the IR, they may have clobbered > the > // callgraph. > if (Changed && CallGraphUpToDate) { > - DEBUG(errs() << "CGSCCPASSMGR: Pass Dirtied SCC: " > + DEBUG(dbgs() << "CGSCCPASSMGR: Pass Dirtied SCC: " > << P->getPassName() << '\n'); > CallGraphUpToDate = false; > } > @@ -143,7 +143,7 @@ > CallGraph &CG, bool > CheckingMode) { > DenseMap CallSites; > > - DEBUG(errs() << "CGSCCPASSMGR: Refreshing SCC with " << > CurSCC.size() > + DEBUG(dbgs() << "CGSCCPASSMGR: Refreshing SCC with " << > CurSCC.size() > << " nodes:\n"; > for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) > CurSCC[i]->dump(); > @@ -277,11 +277,11 @@ > } > > DEBUG(if (MadeChange) { > - errs() << "CGSCCPASSMGR: Refreshed SCC is now:\n"; > + dbgs() << "CGSCCPASSMGR: Refreshed SCC is now:\n"; > for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) > CurSCC[i]->dump(); > } else { > - errs() << "CGSCCPASSMGR: SCC Refresh didn't change call > graph.\n"; > + dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call > graph.\n"; > } > ); > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 23 16:26:19 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:26:19 -0800 Subject: [llvm-commits] [llvm] r92039 - /llvm/trunk/lib/Analysis/InstCount.cpp In-Reply-To: <200912232034.nBNKYRMh022338@zion.cs.uiuc.edu> References: <200912232034.nBNKYRMh022338@zion.cs.uiuc.edu> Message-ID: <381DCAB3-E429-4482-9B11-5D04E5ED4AC3@apple.com> On Dec 23, 2009, at 12:34 PM, David Greene wrote: > Author: greened > Date: Wed Dec 23 14:34:27 2009 > New Revision: 92039 > > URL: http://llvm.org/viewvc/llvm-project?rev=92039&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. This should not be changed. -Chris > > Modified: > llvm/trunk/lib/Analysis/InstCount.cpp > > Modified: llvm/trunk/lib/Analysis/InstCount.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstCount.cpp?rev=92039&r1=92038&r2=92039&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/InstCount.cpp (original) > +++ llvm/trunk/lib/Analysis/InstCount.cpp Wed Dec 23 14:34:27 2009 > @@ -15,6 +15,7 @@ > #include "llvm/Analysis/Passes.h" > #include "llvm/Pass.h" > #include "llvm/Function.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/ErrorHandling.h" > #include "llvm/Support/InstVisitor.h" > #include "llvm/Support/raw_ostream.h" > @@ -45,7 +46,7 @@ > #include "llvm/Instruction.def" > > void visitInstruction(Instruction &I) { > - errs() << "Instruction Count does not know about " << I; > + dbgs() << "Instruction Count does not know about " << I; > llvm_unreachable(0); > } > public: > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 23 16:27:18 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:27:18 -0800 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> Message-ID: <6F1D6D3B-2898-4E2A-8D30-8A0466D9598E@apple.com> On Dec 23, 2009, at 1:06 PM, David Greene wrote: > Author: greened > Date: Wed Dec 23 15:06:14 2009 > New Revision: 92046 > > URL: http://llvm.org/viewvc/llvm-project?rev=92046&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. The change to dump() is fine, the others are not. -Chris > > Modified: > llvm/trunk/lib/Analysis/PHITransAddr.cpp > > Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=92046&r1=92045&r2=92046&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original) > +++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Wed Dec 23 15:06:14 2009 > @@ -14,6 +14,7 @@ > #include "llvm/Analysis/PHITransAddr.h" > #include "llvm/Analysis/Dominators.h" > #include "llvm/Analysis/InstructionSimplify.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/raw_ostream.h" > using namespace llvm; > > @@ -35,12 +36,12 @@ > > void PHITransAddr::dump() const { > if (Addr == 0) { > - errs() << "PHITransAddr: null\n"; > + dbgs() << "PHITransAddr: null\n"; > return; > } > - errs() << "PHITransAddr: " << *Addr << "\n"; > + dbgs() << "PHITransAddr: " << *Addr << "\n"; > for (unsigned i = 0, e = InstInputs.size(); i != e; ++i) > - errs() << " Input #" << i << " is " << *InstInputs[i] << "\n"; > + dbgs() << " Input #" << i << " is " << *InstInputs[i] << "\n"; > } > > > @@ -62,9 +63,9 @@ > // If it isn't in the InstInputs list it is a subexpr incorporated > into the > // address. Sanity check that it is phi translatable. > if (!CanPHITrans(I)) { > - errs() << "Non phi translatable instruction found in > PHITransAddr, either " > + dbgs() << "Non phi translatable instruction found in > PHITransAddr, either " > "something is missing from InstInputs or CanPHITrans > is wrong:\n"; > - errs() << *I << '\n'; > + dbgs() << *I << '\n'; > return false; > } > > @@ -88,9 +89,9 @@ > return false; > > if (!Tmp.empty()) { > - errs() << "PHITransAddr inconsistent, contains extra > instructions:\n"; > + dbgs() << "PHITransAddr inconsistent, contains extra > instructions:\n"; > for (unsigned i = 0, e = InstInputs.size(); i != e; ++i) > - errs() << " InstInput #" << i << " is " << *InstInputs[i] << > "\n"; > + dbgs() << " InstInput #" << i << " is " << *InstInputs[i] << > "\n"; > return false; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From greened at obbligato.org Wed Dec 23 16:28:01 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 22:28:01 -0000 Subject: [llvm-commits] [llvm] r92068 - /llvm/trunk/lib/Analysis/SparsePropagation.cpp Message-ID: <200912232228.nBNMS1Me027058@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 16:28:01 2009 New Revision: 92068 URL: http://llvm.org/viewvc/llvm-project?rev=92068&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp Modified: llvm/trunk/lib/Analysis/SparsePropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/SparsePropagation.cpp?rev=92068&r1=92067&r2=92068&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/SparsePropagation.cpp (original) +++ llvm/trunk/lib/Analysis/SparsePropagation.cpp Wed Dec 23 16:28:01 2009 @@ -88,7 +88,7 @@ /// MarkBlockExecutable - This method can be used by clients to mark all of /// the blocks that are known to be intrinsically live in the processed unit. void SparseSolver::MarkBlockExecutable(BasicBlock *BB) { - DEBUG(errs() << "Marking Block Executable: " << BB->getName() << "\n"); + DEBUG(dbgs() << "Marking Block Executable: " << BB->getName() << "\n"); BBExecutable.insert(BB); // Basic block is executable! BBWorkList.push_back(BB); // Add the block to the work list! } @@ -99,7 +99,7 @@ if (!KnownFeasibleEdges.insert(Edge(Source, Dest)).second) return; // This edge is already known to be executable! - DEBUG(errs() << "Marking Edge Executable: " << Source->getName() + DEBUG(dbgs() << "Marking Edge Executable: " << Source->getName() << " -> " << Dest->getName() << "\n"); if (BBExecutable.count(Dest)) { @@ -299,7 +299,7 @@ Instruction *I = InstWorkList.back(); InstWorkList.pop_back(); - DEBUG(errs() << "\nPopped off I-WL: " << *I << "\n"); + DEBUG(dbgs() << "\nPopped off I-WL: " << *I << "\n"); // "I" got into the work list because it made a transition. See if any // users are both live and in need of updating. @@ -316,7 +316,7 @@ BasicBlock *BB = BBWorkList.back(); BBWorkList.pop_back(); - DEBUG(errs() << "\nPopped off BBWL: " << *BB); + DEBUG(dbgs() << "\nPopped off BBWL: " << *BB); // Notify all instructions in this basic block that they are newly // executable. From clattner at apple.com Wed Dec 23 16:28:10 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:28:10 -0800 Subject: [llvm-commits] [llvm] r92006 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h In-Reply-To: <200912231239.00743.dag@cray.com> References: <200912231724.nBNHOMNN015604@zion.cs.uiuc.edu> <200912231214.14264.dag@cray.com> <200912231239.00743.dag@cray.com> Message-ID: <1403B6F7-1F8A-47D8-9A88-9A9E5FD3ACB8@apple.com> On Dec 23, 2009, at 10:39 AM, David Greene wrote: > On Wednesday 23 December 2009 12:20, Chris Lattner wrote: >> On Dec 23, 2009, at 10:14 AM, David Greene wrote: >>> On Wednesday 23 December 2009 11:52, Chris Lattner wrote: >>>> Please pull the dump() implementation out of line. >>> >>> How? LoopBase is a template. I could go through various >>> contortions >>> to produce a .ipp file with template implementation code and then >>> #include that everywhere LoopInfo.h is included, but is it worth it? >> >> Ugh, that's unfortunate. Lets just remove dump() from loopinfo, I >> don't think anyone uses it in practice anyway. > > LoopStrengthReduce.cpp. Change it to use print(dbgs()). > I don't want to go back to errs() for cases like this because it > will present > inconsistent debug output. And I don't want to remove dumps from > clients > that use them for debugging purposes. Please just remove it and change clients to use print(dbgs()); -Chris From clattner at apple.com Wed Dec 23 16:28:47 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:28:47 -0800 Subject: [llvm-commits] [llvm] r92060 - /llvm/trunk/lib/Analysis/ProfileInfo.cpp In-Reply-To: <200912232148.nBNLmJhA025308@zion.cs.uiuc.edu> References: <200912232148.nBNLmJhA025308@zion.cs.uiuc.edu> Message-ID: <05967831-EEEC-46E8-914A-0153826E27F5@apple.com> On Dec 23, 2009, at 1:48 PM, David Greene wrote: > Author: greened > Date: Wed Dec 23 15:48:18 2009 > New Revision: 92060 > > URL: http://llvm.org/viewvc/llvm-project?rev=92060&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. > The calls in DEBUG are fine to change, the rest is not. -Chris > Modified: > llvm/trunk/lib/Analysis/ProfileInfo.cpp > > Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfo.cpp?rev=92060&r1=92059&r2=92060&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/ProfileInfo.cpp (original) > +++ llvm/trunk/lib/Analysis/ProfileInfo.cpp Wed Dec 23 15:48:18 2009 > @@ -163,7 +163,7 @@ > template<> > void ProfileInfoT:: > setExecutionCount(const BasicBlock *BB, double w) { > - DEBUG(errs() << "Creating Block " << BB->getName() > + DEBUG(dbgs() << "Creating Block " << BB->getName() > << " (weight: " << format("%.20g",w) << ")\n"); > BlockInformation[BB->getParent()][BB] = w; > } > @@ -171,7 +171,7 @@ > template<> > void ProfileInfoT:: > setExecutionCount(const MachineBasicBlock *MBB, double w) { > - DEBUG(errs() << "Creating Block " << MBB->getBasicBlock()- > >getName() > + DEBUG(dbgs() << "Creating Block " << MBB->getBasicBlock()- > >getName() > << " (weight: " << format("%.20g",w) << ")\n"); > BlockInformation[MBB->getParent()][MBB] = w; > } > @@ -180,7 +180,7 @@ > void ProfileInfoT::addEdgeWeight(Edge e, double > w) { > double oldw = getEdgeWeight(e); > assert (oldw != MissingValue && "Adding weight to Edge with no > previous weight"); > - DEBUG(errs() << "Adding to Edge " << e > + DEBUG(dbgs() << "Adding to Edge " << e > << " (new weight: " << format("%.20g",oldw + w) << ") > \n"); > EdgeInformation[getFunction(e)][e] = oldw + w; > } > @@ -190,7 +190,7 @@ > addExecutionCount(const BasicBlock *BB, double w) { > double oldw = getExecutionCount(BB); > assert (oldw != MissingValue && "Adding weight to Block with no > previous weight"); > - DEBUG(errs() << "Adding to Block " << BB->getName() > + DEBUG(dbgs() << "Adding to Block " << BB->getName() > << " (new weight: " << format("%.20g",oldw + w) << ") > \n"); > BlockInformation[BB->getParent()][BB] = oldw + w; > } > @@ -201,7 +201,7 @@ > BlockInformation.find(BB->getParent()); > if (J == BlockInformation.end()) return; > > - DEBUG(errs() << "Deleting " << BB->getName() << "\n"); > + DEBUG(dbgs() << "Deleting " << BB->getName() << "\n"); > J->second.erase(BB); > } > > @@ -211,7 +211,7 @@ > EdgeInformation.find(getFunction(e)); > if (J == EdgeInformation.end()) return; > > - DEBUG(errs() << "Deleting" << e << "\n"); > + DEBUG(dbgs() << "Deleting" << e << "\n"); > J->second.erase(e); > } > > @@ -221,10 +221,10 @@ > double w; > if ((w = getEdgeWeight(newedge)) == MissingValue) { > w = getEdgeWeight(oldedge); > - DEBUG(errs() << "Replacing " << oldedge << " with " << newedge > << "\n"); > + DEBUG(dbgs() << "Replacing " << oldedge << " with " << newedge > << "\n"); > } else { > w += getEdgeWeight(oldedge); > - DEBUG(errs() << "Adding " << oldedge << " to " << newedge << > "\n"); > + DEBUG(dbgs() << "Adding " << oldedge << " to " << newedge << > "\n"); > } > setEdgeWeight(newedge,w); > removeEdge(oldedge); > @@ -277,7 +277,7 @@ > template<> > void ProfileInfoT:: > divertFlow(const Edge &oldedge, const Edge &newedge) { > - DEBUG(errs() << "Diverting " << oldedge << " via " << newedge ); > + DEBUG(dbgs() << "Diverting " << oldedge << " via " << newedge ); > > // First check if the old edge was taken, if not, just delete it... > if (getEdgeWeight(oldedge) == 0) { > @@ -291,7 +291,7 @@ > const BasicBlock *BB = > GetPath(newedge.second,oldedge.second,P,GetPathToExit | > GetPathToDest); > > double w = getEdgeWeight (oldedge); > - DEBUG(errs() << ", Weight: " << format("%.20g",w) << "\n"); > + DEBUG(dbgs() << ", Weight: " << format("%.20g",w) << "\n"); > do { > const BasicBlock *Parent = P.find(BB)->second; > Edge e = getEdge(Parent,BB); > @@ -312,7 +312,7 @@ > template<> > void ProfileInfoT:: > replaceAllUses(const BasicBlock *RmBB, const BasicBlock > *DestBB) { > - DEBUG(errs() << "Replacing " << RmBB->getName() > + DEBUG(dbgs() << "Replacing " << RmBB->getName() > << " with " << DestBB->getName() << "\n"); > const Function *F = DestBB->getParent(); > std::map::iterator J = > @@ -413,7 +413,7 @@ > EdgeInformation.find(F); > if (J == EdgeInformation.end()) return; > > - DEBUG(errs() << "Splitting " << Old->getName() << " to " << New- > >getName() << "\n"); > + DEBUG(dbgs() << "Splitting " << Old->getName() << " to " << New- > >getName() << "\n"); > > std::set Edges; > for (EdgeWeights::iterator ewi = J->second.begin(), ewe = J- > >second.end(); > @@ -444,7 +444,7 @@ > EdgeInformation.find(F); > if (J == EdgeInformation.end()) return; > > - DEBUG(errs() << "Splitting " << NumPreds << " Edges from " << BB- > >getName() > + DEBUG(dbgs() << "Splitting " << NumPreds << " Edges from " << BB- > >getName() > << " to " << NewBB->getName() << "\n"); > > // Collect weight that was redirected over NewBB. > @@ -474,7 +474,7 @@ > template<> > void ProfileInfoT::transfer(const Function *Old, > const Function > *New) { > - DEBUG(errs() << "Replacing Function " << Old->getName() << " with " > + DEBUG(dbgs() << "Replacing Function " << Old->getName() << " with " > << New->getName() << "\n"); > std::map::iterator J = > EdgeInformation.find(Old); > @@ -552,7 +552,7 @@ > } else { > EdgeInformation[BB->getParent()][edgetocalc] = incount-outcount; > } > - DEBUG(errs() << "--Calc Edge Counter for " << edgetocalc << ": " > + DEBUG(dbgs() << "--Calc Edge Counter for " << edgetocalc << ": " > << format("%.20g", getEdgeWeight(edgetocalc)) << > "\n"); > removed = edgetocalc; > return true; > @@ -978,17 +978,17 @@ > } > if (FoundPath) continue; > > - errs() << "{"; > + dbgs() << "{"; > FI = Unvisited.begin(), FE = Unvisited.end(); > while(FI != FE) { > const BasicBlock *BB = *FI; ++FI; > - errs() << BB->getName(); > + dbgs() << BB->getName(); > if (FI != FE) > - errs() << ","; > + dbgs() << ","; > } > - errs() << "}"; > + dbgs() << "}"; > > - errs() << "ASSERT: could not repair function"; > + dbgs() << "ASSERT: could not repair function"; > assert(0 && "could not repair function"); > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 23 16:29:07 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:29:07 -0800 Subject: [llvm-commits] [llvm] r92063 - /llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp In-Reply-To: <200912232158.nBNLwTVx025782@zion.cs.uiuc.edu> References: <200912232158.nBNLwTVx025782@zion.cs.uiuc.edu> Message-ID: <22410263-19EC-4931-9D02-0C390947A124@apple.com> On Dec 23, 2009, at 1:58 PM, David Greene wrote: > Author: greened > Date: Wed Dec 23 15:58:29 2009 > New Revision: 92063 > > URL: http://llvm.org/viewvc/llvm-project?rev=92063&view=rev > Log: > > Convert debug messages to use dbgs(). Generally this means > s/errs/dbgs/g except for certain special cases. The DEBUG calls are correct, the others are not. -Chris > > Modified: > llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp > > Modified: llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp?rev=92063&r1=92062&r2=92063&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp (original) > +++ llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Wed Dec 23 > 15:58:29 2009 > @@ -131,7 +131,7 @@ > // in double. > EdgeInformation[getFunction(e)][e] += (double)weight; > > - DEBUG(errs() << "--Read Edge Counter for " << e > + DEBUG(dbgs() << "--Read Edge Counter for " << e > << " (# "<< (ReadCount-1) << "): " > << (unsigned)getEdgeWeight(e) << "\n"); > } else { > @@ -151,7 +151,7 @@ > ReadCount = 0; > for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { > if (F->isDeclaration()) continue; > - DEBUG(errs()<<"Working on "<getNameStr()<<"\n"); > + DEBUG(dbgs()<<"Working on "<getNameStr()<<"\n"); > readEdge(getEdge(0,&F->getEntryBlock()), Counters); > for (Function::iterator BB = F->begin(), E = F->end(); BB != > E; ++BB) { > TerminatorInst *TI = BB->getTerminator(); > @@ -161,7 +161,7 @@ > } > } > if (ReadCount != Counters.size()) { > - errs() << "WARNING: profile information is inconsistent with " > + dbgs() << "WARNING: profile information is inconsistent with " > << "the current program!\n"; > } > NumEdgesRead = ReadCount; > @@ -172,7 +172,7 @@ > ReadCount = 0; > for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { > if (F->isDeclaration()) continue; > - DEBUG(errs()<<"Working on "<getNameStr()<<"\n"); > + DEBUG(dbgs()<<"Working on "<getNameStr()<<"\n"); > readEdge(getEdge(0,&F->getEntryBlock()), Counters); > for (Function::iterator BB = F->begin(), E = F->end(); BB != > E; ++BB) { > TerminatorInst *TI = BB->getTerminator(); > @@ -198,10 +198,10 @@ > } > > if (SpanningTree.size() == size) { > - DEBUG(errs()<<"{"); > + DEBUG(dbgs()<<"{"); > for (std::set::iterator ei = SpanningTree.begin(), > ee = SpanningTree.end(); ei != ee; ++ei) { > - DEBUG(errs()<< *ei <<","); > + DEBUG(dbgs()<< *ei <<","); > } > assert(0 && "No edge calculated!"); > } > @@ -209,7 +209,7 @@ > } > } > if (ReadCount != Counters.size()) { > - errs() << "WARNING: profile information is inconsistent with " > + dbgs() << "WARNING: profile information is inconsistent with " > << "the current program!\n"; > } > NumEdgesRead = ReadCount; > @@ -230,7 +230,7 @@ > BlockInformation[F][BB] = (double)Counters[ReadCount++]; > } > if (ReadCount != Counters.size()) { > - errs() << "WARNING: profile information is inconsistent with " > + dbgs() << "WARNING: profile information is inconsistent with " > << "the current program!\n"; > } > } > @@ -249,7 +249,7 @@ > FunctionInformation[F] = (double)Counters[ReadCount++]; > } > if (ReadCount != Counters.size()) { > - errs() << "WARNING: profile information is inconsistent with " > + dbgs() << "WARNING: profile information is inconsistent with " > << "the current program!\n"; > } > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From greened at obbligato.org Wed Dec 23 16:35:10 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 22:35:10 -0000 Subject: [llvm-commits] [llvm] r92071 - /llvm/trunk/lib/Analysis/Trace.cpp Message-ID: <200912232235.nBNMZArP027359@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 16:35:10 2009 New Revision: 92071 URL: http://llvm.org/viewvc/llvm-project?rev=92071&view=rev Log: Convert debug messages to use dbgs(). Generally this means s/errs/dbgs/g except for certain special cases. Modified: llvm/trunk/lib/Analysis/Trace.cpp Modified: llvm/trunk/lib/Analysis/Trace.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Trace.cpp?rev=92071&r1=92070&r2=92071&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/Trace.cpp (original) +++ llvm/trunk/lib/Analysis/Trace.cpp Wed Dec 23 16:35:10 2009 @@ -18,6 +18,7 @@ #include "llvm/Analysis/Trace.h" #include "llvm/Function.h" #include "llvm/Assembly/Writer.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -46,5 +47,5 @@ /// output stream. /// void Trace::dump() const { - print(errs()); + print(dbgs()); } From dag at cray.com Wed Dec 23 16:38:10 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 16:38:10 -0600 Subject: [llvm-commits] [llvm] r92035 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <77546743-798D-4795-8403-7F02160BED7A@apple.com> References: <200912232010.nBNKAxcs021470@zion.cs.uiuc.edu> <77546743-798D-4795-8403-7F02160BED7A@apple.com> Message-ID: <200912231638.10959.dag@cray.com> On Wednesday 23 December 2009 16:25, Chris Lattner wrote: > On Dec 23, 2009, at 12:10 PM, David Greene wrote: > > Author: greened > > Date: Wed Dec 23 14:10:59 2009 > > New Revision: 92035 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=92035&view=rev > > Log: > > > > Convert debug messages to use dbgs(). Generally this means > > s/errs/dbgs/g except for certain special cases. > > The calls that are not in DEBUG should not be changed, this breaks - > debug-pass=Structure. What do you mean by "breaks?" If I use -debug-pass, I probably do want to log that to the debug buffer if I specify a non-zero debug buffer size. -Dave From dag at cray.com Wed Dec 23 16:40:02 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 16:40:02 -0600 Subject: [llvm-commits] [llvm] r92024 - /llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp In-Reply-To: References: <200912231915.nBNJFDwi019456@zion.cs.uiuc.edu> Message-ID: <200912231640.02326.dag@cray.com> On Wednesday 23 December 2009 16:22, Chris Lattner wrote: > On Dec 23, 2009, at 11:15 AM, David Greene wrote: > > Author: greened > > Date: Wed Dec 23 13:15:13 2009 > > New Revision: 92024 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=92024&view=rev > > Log: > > > > Convert debug messages to use dbgs(). Generally this means > > s/errs/dbgs/g except for certain special cases. > > This should stay errs(), -count-aa is a pass that produces output on > errs(). Does -count-aa ever run in combination with other passes? It could be confusing to see its output reordered with respect to other debug output if buffering is enabled. I have no problem changing this back since I never use the count-aa stuff but I want to understand the use cases better. -Dave From dag at cray.com Wed Dec 23 16:41:38 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 16:41:38 -0600 Subject: [llvm-commits] [llvm] r92029 - /llvm/trunk/lib/Analysis/AliasSetTracker.cpp In-Reply-To: References: <200912231927.nBNJRxJu019935@zion.cs.uiuc.edu> Message-ID: <200912231641.39287.dag@cray.com> On Wednesday 23 December 2009 16:23, Chris Lattner wrote: > On Dec 23, 2009, at 11:27 AM, David Greene wrote: > > Author: greened > > Date: Wed Dec 23 13:27:59 2009 > > New Revision: 92029 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=92029&view=rev > > Log: > > > > Convert debug messages to use dbgs(). Generally this means > > s/errs/dbgs/g except for certain special cases. > > The change to dump() is fine, the change to AliasSetPrinter is not. Again, can you explain a little more? What's the use case for AliasSetPrinter? -Dave From dag at cray.com Wed Dec 23 16:43:02 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 16:43:02 -0600 Subject: [llvm-commits] [llvm] r92033 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: <5FCE9711-957E-4A1C-BC0D-2A9A8B6C9DB5@apple.com> References: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> <5FCE9711-957E-4A1C-BC0D-2A9A8B6C9DB5@apple.com> Message-ID: <200912231643.02285.dag@cray.com> On Wednesday 23 December 2009 16:24, Chris Lattner wrote: > On Dec 23, 2009, at 11:51 AM, David Greene wrote: > > Author: greened > > Date: Wed Dec 23 13:51:44 2009 > > New Revision: 92033 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=92033&view=rev > > Log: > > > > Convert debug messages to use dbgs(). Generally this means > > s/errs/dbgs/g except for certain special cases. > > The calls before an llvm_unreachable() should not be transformed. Why not? If I'm debugging a crash I certainly want to see the error message in the context of all the other debug output. I want to see it at the end of the debug output because that's the order it happened in. -Dave From dag at cray.com Wed Dec 23 16:44:33 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 16:44:33 -0600 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <6F1D6D3B-2898-4E2A-8D30-8A0466D9598E@apple.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <6F1D6D3B-2898-4E2A-8D30-8A0466D9598E@apple.com> Message-ID: <200912231644.34091.dag@cray.com> On Wednesday 23 December 2009 16:27, you wrote: > On Dec 23, 2009, at 1:06 PM, David Greene wrote: > > Author: greened > > Date: Wed Dec 23 15:06:14 2009 > > New Revision: 92046 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=92046&view=rev > > Log: > > > > Convert debug messages to use dbgs(). Generally this means > > s/errs/dbgs/g except for certain special cases. > > The change to dump() is fine, the others are not. Same question. Don't we want the failure messages in the context of other debug output? -Dave From greened at obbligato.org Wed Dec 23 16:49:57 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 22:49:57 -0000 Subject: [llvm-commits] [llvm] r92073 - in /llvm/trunk/lib/Analysis: AliasAnalysisCounter.cpp AliasAnalysisEvaluator.cpp AliasSetTracker.cpp Message-ID: <200912232249.nBNMnveT027967@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 16:49:57 2009 New Revision: 92073 URL: http://llvm.org/viewvc/llvm-project?rev=92073&view=rev Log: Change dbgs() back to errs() as Chris requested. Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp llvm/trunk/lib/Analysis/AliasSetTracker.cpp Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp?rev=92073&r1=92072&r2=92073&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp (original) +++ llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Wed Dec 23 16:49:57 2009 @@ -41,31 +41,31 @@ } void printLine(const char *Desc, unsigned Val, unsigned Sum) { - dbgs() << " " << Val << " " << Desc << " responses (" + errs() << " " << Val << " " << Desc << " responses (" << Val*100/Sum << "%)\n"; } ~AliasAnalysisCounter() { unsigned AASum = No+May+Must; unsigned MRSum = NoMR+JustRef+JustMod+MR; if (AASum + MRSum) { // Print a report if any counted queries occurred... - dbgs() << "\n===== Alias Analysis Counter Report =====\n" + errs() << "\n===== Alias Analysis Counter Report =====\n" << " Analysis counted: " << Name << "\n" << " " << AASum << " Total Alias Queries Performed\n"; if (AASum) { printLine("no alias", No, AASum); printLine("may alias", May, AASum); printLine("must alias", Must, AASum); - dbgs() << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" + errs() << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; } - dbgs() << " " << MRSum << " Total Mod/Ref Queries Performed\n"; + errs() << " " << MRSum << " Total Mod/Ref Queries Performed\n"; if (MRSum) { printLine("no mod/ref", NoMR, MRSum); printLine("ref", JustRef, MRSum); printLine("mod", JustMod, MRSum); printLine("mod/ref", MR, MRSum); - dbgs() << " Mod/Ref Analysis Counter Summary: " <" << *CS.getInstruction(); + errs() << MRString << ": Ptr: "; + errs() << "[" << Size << "B] "; + WriteAsOperand(errs(), P, true, M); + errs() << "\t<->" << *CS.getInstruction(); } return R; } Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=92073&r1=92072&r2=92073&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original) +++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Wed Dec 23 16:49:57 2009 @@ -92,7 +92,7 @@ if (o2 < o1) std::swap(o1, o2); - dbgs() << " " << Msg << ":\t" + errs() << " " << Msg << ":\t" << o1 << ", " << o2 << "\n"; } @@ -102,9 +102,9 @@ PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, Module *M) { if (P) { - dbgs() << " " << Msg << ": Ptr: "; - WriteAsOperand(dbgs(), Ptr, true, M); - dbgs() << "\t<->" << *I << '\n'; + errs() << " " << Msg << ": Ptr: "; + WriteAsOperand(errs(), Ptr, true, M); + errs() << "\t<->" << *I << '\n'; } } @@ -136,7 +136,7 @@ if (PrintNoAlias || PrintMayAlias || PrintMustAlias || PrintNoModRef || PrintMod || PrintRef || PrintModRef) - dbgs() << "Function: " << F.getName() << ": " << Pointers.size() + errs() << "Function: " << F.getName() << ": " << Pointers.size() << " pointers, " << CallSites.size() << " call sites\n"; // iterate over the worklist, and run the full (n^2)/2 disambiguations @@ -162,7 +162,7 @@ PrintResults("MustAlias", PrintMustAlias, *I1, *I2, F.getParent()); ++MustAlias; break; default: - dbgs() << "Unknown alias query result!\n"; + errs() << "Unknown alias query result!\n"; } } } @@ -192,7 +192,7 @@ PrintModRefResults(" ModRef", PrintModRef, I, *V, F.getParent()); ++ModRef; break; default: - dbgs() << "Unknown alias query result!\n"; + errs() << "Unknown alias query result!\n"; } } } @@ -201,24 +201,24 @@ } static void PrintPercent(unsigned Num, unsigned Sum) { - dbgs() << "(" << Num*100ULL/Sum << "." + errs() << "(" << Num*100ULL/Sum << "." << ((Num*1000ULL/Sum) % 10) << "%)\n"; } bool AAEval::doFinalization(Module &M) { unsigned AliasSum = NoAlias + MayAlias + MustAlias; - dbgs() << "===== Alias Analysis Evaluator Report =====\n"; + errs() << "===== Alias Analysis Evaluator Report =====\n"; if (AliasSum == 0) { - dbgs() << " Alias Analysis Evaluator Summary: No pointers!\n"; + errs() << " Alias Analysis Evaluator Summary: No pointers!\n"; } else { - dbgs() << " " << AliasSum << " Total Alias Queries Performed\n"; - dbgs() << " " << NoAlias << " no alias responses "; + errs() << " " << AliasSum << " Total Alias Queries Performed\n"; + errs() << " " << NoAlias << " no alias responses "; PrintPercent(NoAlias, AliasSum); - dbgs() << " " << MayAlias << " may alias responses "; + errs() << " " << MayAlias << " may alias responses "; PrintPercent(MayAlias, AliasSum); - dbgs() << " " << MustAlias << " must alias responses "; + errs() << " " << MustAlias << " must alias responses "; PrintPercent(MustAlias, AliasSum); - dbgs() << " Alias Analysis Evaluator Pointer Alias Summary: " + errs() << " Alias Analysis Evaluator Pointer Alias Summary: " << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/" << MustAlias*100/AliasSum << "%\n"; } @@ -226,18 +226,18 @@ // Display the summary for mod/ref analysis unsigned ModRefSum = NoModRef + Mod + Ref + ModRef; if (ModRefSum == 0) { - dbgs() << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; + errs() << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; } else { - dbgs() << " " << ModRefSum << " Total ModRef Queries Performed\n"; - dbgs() << " " << NoModRef << " no mod/ref responses "; + errs() << " " << ModRefSum << " Total ModRef Queries Performed\n"; + errs() << " " << NoModRef << " no mod/ref responses "; PrintPercent(NoModRef, ModRefSum); - dbgs() << " " << Mod << " mod responses "; + errs() << " " << Mod << " mod responses "; PrintPercent(Mod, ModRefSum); - dbgs() << " " << Ref << " ref responses "; + errs() << " " << Ref << " ref responses "; PrintPercent(Ref, ModRefSum); - dbgs() << " " << ModRef << " mod & ref responses "; + errs() << " " << ModRef << " mod & ref responses "; PrintPercent(ModRef, ModRefSum); - dbgs() << " Alias Analysis Evaluator Mod/Ref Summary: " + errs() << " Alias Analysis Evaluator Mod/Ref Summary: " << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/" << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n"; } Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=92073&r1=92072&r2=92073&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original) +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Wed Dec 23 16:49:57 2009 @@ -592,7 +592,7 @@ for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) Tracker->add(&*I); - Tracker->print(dbgs()); + Tracker->print(errs()); delete Tracker; return false; } From daniel at zuster.org Wed Dec 23 16:51:08 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 23 Dec 2009 22:51:08 -0000 Subject: [llvm-commits] [test-suite] r92074 - in /test-suite/trunk: autoconf/configure.ac configure Message-ID: <200912232251.nBNMp9cq028024@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Dec 23 16:51:08 2009 New Revision: 92074 URL: http://llvm.org/viewvc/llvm-project?rev=92074&view=rev Log: Default to looking for test-suite-externals in $LLVM_SRC/projects/test-suite-externals instead of looking in Vikram's home directory. - This change fixes some Makefile mode swizzling as well, I think because I am using the LLVM standard versions of auto*. Modified: test-suite/trunk/autoconf/configure.ac test-suite/trunk/configure Modified: test-suite/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/autoconf/configure.ac?rev=92074&r1=92073&r2=92074&view=diff ============================================================================== --- test-suite/trunk/autoconf/configure.ac (original) +++ test-suite/trunk/autoconf/configure.ac Wed Dec 23 16:51:08 2009 @@ -66,7 +66,7 @@ AC_ARG_WITH(externals, AS_HELP_STRING([--with-externals=DIR],Location of External Test code), AC_SUBST(LLVM_EXTERNALS,[$withval]), - AC_SUBST(LLVM_EXTERNALS,[/home/vadve/shared/benchmarks])) + AC_SUBST(LLVM_EXTERNALS,[$LLVM_SRC/projects/test-suite-externals])) dnl Configure the default locations of the external benchmarks EXTERNAL_BENCHMARK(spec95,${LLVM_EXTERNALS}/spec95/benchspec) Modified: test-suite/trunk/configure URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/configure?rev=92074&r1=92073&r2=92074&view=diff ============================================================================== --- test-suite/trunk/configure (original) +++ test-suite/trunk/configure Wed Dec 23 16:51:08 2009 @@ -2117,7 +2117,7 @@ withval=$with_externals; LLVM_EXTERNALS=$withval else - LLVM_EXTERNALS=/home/vadve/shared/benchmarks + LLVM_EXTERNALS=$LLVM_SRC/projects/test-suite-externals fi @@ -21966,75 +21966,75 @@ case $ac_file$ac_mode in "Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile Makefile ;; "Makefile.common":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.common` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.common Makefile.common ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile.common Makefile.common ;; "Makefile.nagfortran":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.nagfortran` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.nagfortran Makefile.nagfortran ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile.nagfortran Makefile.nagfortran ;; "Makefile.f2c":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.f2c` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.f2c Makefile.f2c ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile.f2c Makefile.f2c ;; "Makefile.programs":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.programs` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.programs Makefile.programs ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile.programs Makefile.programs ;; "Makefile.tests":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.tests` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.tests Makefile.tests ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile.tests Makefile.tests ;; "TEST.aa.Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.aa.Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.aa.Makefile TEST.aa.Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.aa.Makefile TEST.aa.Makefile ;; "TEST.aa.report":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.aa.report` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.aa.report TEST.aa.report ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.aa.report TEST.aa.report ;; "TEST.example.Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.example.Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.example.Makefile TEST.example.Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.example.Makefile TEST.example.Makefile ;; "TEST.nightly.Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.nightly.Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.nightly.Makefile TEST.nightly.Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.nightly.Makefile TEST.nightly.Makefile ;; "TEST.buildrepo.Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.buildrepo.Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.buildrepo.Makefile TEST.buildrepo.Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.buildrepo.Makefile TEST.buildrepo.Makefile ;; "TEST.jit.Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.jit.Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.jit.Makefile TEST.jit.Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.jit.Makefile TEST.jit.Makefile ;; "TEST.nightly.report":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.nightly.report` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.nightly.report TEST.nightly.report ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.nightly.report TEST.nightly.report ;; "TEST.jit.report":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.jit.report` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.jit.report TEST.jit.report ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.jit.report TEST.jit.report ;; "TEST.typesafe.Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.typesafe.Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.typesafe.Makefile TEST.typesafe.Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.typesafe.Makefile TEST.typesafe.Makefile ;; "TEST.vtl.Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname TEST.vtl.Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/TEST.vtl.Makefile TEST.vtl.Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/TEST.vtl.Makefile TEST.vtl.Makefile ;; "External/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/Makefile External/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/Makefile External/Makefile ;; "External/Makefile.external":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/Makefile.external` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/Makefile.external External/Makefile.external ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/Makefile.external External/Makefile.external ;; "External/Povray/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/Povray/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/Povray/Makefile External/Povray/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/Povray/Makefile External/Povray/Makefile ;; "External/SPEC/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile External/SPEC/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/Makefile External/SPEC/Makefile ;; "External/SPEC/Makefile.spec":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec External/SPEC/Makefile.spec ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/Makefile.spec External/SPEC/Makefile.spec ;; "External/SPEC/Makefile.spec.config":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec.config` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec.config External/SPEC/Makefile.spec.config ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/Makefile.spec.config External/SPEC/Makefile.spec.config ;; "External/SPEC/Makefile.spec2006":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec2006` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec2006 External/SPEC/Makefile.spec2006 ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/Makefile.spec2006 External/SPEC/Makefile.spec2006 ;; "External/SPEC/Makefile.spec2000":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec2000` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec2000 External/SPEC/Makefile.spec2000 ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/Makefile.spec2000 External/SPEC/Makefile.spec2000 ;; "External/SPEC/Makefile.spec95":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec95` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec95 External/SPEC/Makefile.spec95 ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/Makefile.spec95 External/SPEC/Makefile.spec95 ;; "External/SPEC/CFP2006/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CFP2006/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CFP2006/Makefile External/SPEC/CFP2006/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/CFP2006/Makefile External/SPEC/CFP2006/Makefile ;; "External/SPEC/CINT2006/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CINT2006/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CINT2006/Makefile External/SPEC/CINT2006/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/CINT2006/Makefile External/SPEC/CINT2006/Makefile ;; "External/SPEC/CFP2000/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CFP2000/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CFP2000/Makefile External/SPEC/CFP2000/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/CFP2000/Makefile External/SPEC/CFP2000/Makefile ;; "External/SPEC/CINT2000/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CINT2000/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CINT2000/Makefile External/SPEC/CINT2000/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/CINT2000/Makefile External/SPEC/CINT2000/Makefile ;; "External/SPEC/CFP95/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CFP95/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CFP95/Makefile External/SPEC/CFP95/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/CFP95/Makefile External/SPEC/CFP95/Makefile ;; "External/SPEC/CINT95/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CINT95/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CINT95/Makefile External/SPEC/CINT95/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/External/SPEC/CINT95/Makefile External/SPEC/CINT95/Makefile ;; "MultiSource/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname MultiSource/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/MultiSource/Makefile MultiSource/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/MultiSource/Makefile MultiSource/Makefile ;; "MultiSource/Makefile.multisrc":C) ${llvm_src}/autoconf/mkinstalldirs `dirname MultiSource/Makefile.multisrc` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/MultiSource/Makefile.multisrc MultiSource/Makefile.multisrc ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/MultiSource/Makefile.multisrc MultiSource/Makefile.multisrc ;; "SingleSource/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname SingleSource/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/SingleSource/Makefile SingleSource/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/SingleSource/Makefile SingleSource/Makefile ;; "SingleSource/Makefile.singlesrc":C) ${llvm_src}/autoconf/mkinstalldirs `dirname SingleSource/Makefile.singlesrc` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/SingleSource/Makefile.singlesrc SingleSource/Makefile.singlesrc ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/SingleSource/Makefile.singlesrc SingleSource/Makefile.singlesrc ;; esac done # for ac_tag From clattner at apple.com Wed Dec 23 16:53:46 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:53:46 -0800 Subject: [llvm-commits] [llvm] r92035 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp In-Reply-To: <200912231638.10959.dag@cray.com> References: <200912232010.nBNKAxcs021470@zion.cs.uiuc.edu> <77546743-798D-4795-8403-7F02160BED7A@apple.com> <200912231638.10959.dag@cray.com> Message-ID: On Dec 23, 2009, at 2:38 PM, David Greene wrote: > On Wednesday 23 December 2009 16:25, Chris Lattner wrote: >> On Dec 23, 2009, at 12:10 PM, David Greene wrote: >>> Author: greened >>> Date: Wed Dec 23 14:10:59 2009 >>> New Revision: 92035 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=92035&view=rev >>> Log: >>> >>> Convert debug messages to use dbgs(). Generally this means >>> s/errs/dbgs/g except for certain special cases. >> >> The calls that are not in DEBUG should not be changed, this breaks - >> debug-pass=Structure. > > What do you mean by "breaks?" If I use -debug-pass, I probably > do want to log that to the debug buffer if I specify a non-zero > debug buffer size. No, -debug-pass should print to stderr, and should not be buffered. -Chris From clattner at apple.com Wed Dec 23 16:54:49 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:54:49 -0800 Subject: [llvm-commits] [llvm] r92024 - /llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp In-Reply-To: <200912231640.02326.dag@cray.com> References: <200912231915.nBNJFDwi019456@zion.cs.uiuc.edu> <200912231640.02326.dag@cray.com> Message-ID: <3806BA3C-9B99-41A6-92B3-A4E0BF8E7D91@apple.com> On Dec 23, 2009, at 2:40 PM, David Greene wrote: > On Wednesday 23 December 2009 16:22, Chris Lattner wrote: >> On Dec 23, 2009, at 11:15 AM, David Greene wrote: >>> Author: greened >>> Date: Wed Dec 23 13:15:13 2009 >>> New Revision: 92024 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=92024&view=rev >>> Log: >>> >>> Convert debug messages to use dbgs(). Generally this means >>> s/errs/dbgs/g except for certain special cases. >> >> This should stay errs(), -count-aa is a pass that produces output on >> errs(). > > Does -count-aa ever run in combination with other passes? Yes. > It could be > confusing to see its output reordered with respect to other debug > output if buffering is enabled. You don't typically use it in combination with -debug, and normal passes don't write to stderr, so it is not confusing. > I have no problem changing this back since I never use the count-aa > stuff but I want to understand the use cases better. Thanks. It is briefly described here: http://llvm.org/docs/AliasAnalysis.html -Chris From clattner at apple.com Wed Dec 23 16:55:40 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:55:40 -0800 Subject: [llvm-commits] [llvm] r92029 - /llvm/trunk/lib/Analysis/AliasSetTracker.cpp In-Reply-To: <200912231641.39287.dag@cray.com> References: <200912231927.nBNJRxJu019935@zion.cs.uiuc.edu> <200912231641.39287.dag@cray.com> Message-ID: On Dec 23, 2009, at 2:41 PM, David Greene wrote: > On Wednesday 23 December 2009 16:23, Chris Lattner wrote: >> On Dec 23, 2009, at 11:27 AM, David Greene wrote: >>> Author: greened >>> Date: Wed Dec 23 13:27:59 2009 >>> New Revision: 92029 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=92029&view=rev >>> Log: >>> >>> Convert debug messages to use dbgs(). Generally this means >>> s/errs/dbgs/g except for certain special cases. >> >> The change to dump() is fine, the change to AliasSetPrinter is not. > > Again, can you explain a little more? What's the use case for > AliasSetPrinter? You run it, it prints stuff to stderr. Same idea as tools/opt/ AnalysisWrappers.cpp. -Chris From clattner at apple.com Wed Dec 23 16:56:21 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:56:21 -0800 Subject: [llvm-commits] [llvm] r92033 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: <200912231643.02285.dag@cray.com> References: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> <5FCE9711-957E-4A1C-BC0D-2A9A8B6C9DB5@apple.com> <200912231643.02285.dag@cray.com> Message-ID: On Dec 23, 2009, at 2:43 PM, David Greene wrote: > On Wednesday 23 December 2009 16:24, Chris Lattner wrote: >> On Dec 23, 2009, at 11:51 AM, David Greene wrote: >>> Author: greened >>> Date: Wed Dec 23 13:51:44 2009 >>> New Revision: 92033 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=92033&view=rev >>> Log: >>> >>> Convert debug messages to use dbgs(). Generally this means >>> s/errs/dbgs/g except for certain special cases. >> >> The calls before an llvm_unreachable() should not be transformed. > > Why not? If I'm debugging a crash I certainly want to see the error > message > in the context of all the other debug output. I want to see it at > the end > of the debug output because that's the order it happened in. This is effectively an assertion message, not -debug output. -Chris From clattner at apple.com Wed Dec 23 16:56:34 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 14:56:34 -0800 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <200912231644.34091.dag@cray.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <6F1D6D3B-2898-4E2A-8D30-8A0466D9598E@apple.com> <200912231644.34091.dag@cray.com> Message-ID: On Dec 23, 2009, at 2:44 PM, David Greene wrote: > On Wednesday 23 December 2009 16:27, you wrote: >> On Dec 23, 2009, at 1:06 PM, David Greene wrote: >>> Author: greened >>> Date: Wed Dec 23 15:06:14 2009 >>> New Revision: 92046 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=92046&view=rev >>> Log: >>> >>> Convert debug messages to use dbgs(). Generally this means >>> s/errs/dbgs/g except for certain special cases. >> >> The change to dump() is fine, the others are not. > > Same question. Don't we want the failure messages in the context of > other debug output? It has nothing to do with -debug. -Chris From greened at obbligato.org Wed Dec 23 16:58:39 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 22:58:39 -0000 Subject: [llvm-commits] [llvm] r92075 - in /llvm/trunk: include/llvm/Analysis/LoopInfo.h lib/Analysis/ScalarEvolution.cpp lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200912232258.nBNMwdYY028247@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 16:58:38 2009 New Revision: 92075 URL: http://llvm.org/viewvc/llvm-project?rev=92075&view=rev Log: Remove dump routine and the associated Debug.h from a header. Patch up other files to compensate. Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=92075&r1=92074&r2=92075&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Wed Dec 23 16:58:38 2009 @@ -37,7 +37,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" -#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include @@ -480,10 +479,6 @@ (*I)->print(OS, Depth+2); } - void dump() const { - print(dbgs()); - } - protected: friend class LoopInfoBase; explicit LoopBase(BlockT *BB) : ParentLoop(0) { Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=92075&r1=92074&r2=92075&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Dec 23 16:58:38 2009 @@ -75,6 +75,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ConstantRange.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/InstIterator.h" Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=92075&r1=92074&r2=92075&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Dec 23 16:58:38 2009 @@ -338,9 +338,9 @@ } void BasedUser::dump() const { - errs() << " Base=" << *Base; - errs() << " Imm=" << *Imm; - errs() << " Inst: " << *Inst; + dbgs() << " Base=" << *Base; + dbgs() << " Imm=" << *Imm; + dbgs() << " Inst: " << *Inst; } Value *BasedUser::InsertCodeForBaseAtPosition(const SCEV *NewBase, @@ -404,9 +404,9 @@ // Replace the use of the operand Value with the new Phi we just created. Inst->replaceUsesOfWith(OperandValToReplace, NewVal); - DEBUG(errs() << " Replacing with "); - DEBUG(WriteAsOperand(errs(), NewVal, /*PrintType=*/false)); - DEBUG(errs() << ", which has value " << *NewBase << " plus IMM " + DEBUG(dbgs() << " Replacing with "); + DEBUG(WriteAsOperand(dbgs(), NewVal, /*PrintType=*/false)); + DEBUG(dbgs() << ", which has value " << *NewBase << " plus IMM " << *Imm << "\n"); return; } @@ -464,9 +464,9 @@ Code = InsertCodeForBaseAtPosition(NewBase, PN->getType(), Rewriter, InsertPt, SE); - DEBUG(errs() << " Changing PHI use to "); - DEBUG(WriteAsOperand(errs(), Code, /*PrintType=*/false)); - DEBUG(errs() << ", which has value " << *NewBase << " plus IMM " + DEBUG(dbgs() << " Changing PHI use to "); + DEBUG(WriteAsOperand(dbgs(), Code, /*PrintType=*/false)); + DEBUG(dbgs() << ", which has value " << *NewBase << " plus IMM " << *Imm << "\n"); } @@ -1321,7 +1321,7 @@ const SCEV *CommonExprs, const Loop *L, SCEVExpander &PreheaderRewriter) { - DEBUG(errs() << " Fully reducing all users\n"); + DEBUG(dbgs() << " Fully reducing all users\n"); // Rewrite the UsersToProcess records, creating a separate PHI for each // unique Base value. @@ -1370,7 +1370,7 @@ Instruction *IVIncInsertPt, const Loop *L, SCEVExpander &PreheaderRewriter) { - DEBUG(errs() << " Inserting new PHI:\n"); + DEBUG(dbgs() << " Inserting new PHI:\n"); PHINode *Phi = InsertAffinePhi(SE->getUnknown(CommonBaseV), Stride, IVIncInsertPt, L, @@ -1383,9 +1383,9 @@ for (unsigned i = 0, e = UsersToProcess.size(); i != e; ++i) UsersToProcess[i].Phi = Phi; - DEBUG(errs() << " IV="); - DEBUG(WriteAsOperand(errs(), Phi, /*PrintType=*/false)); - DEBUG(errs() << "\n"); + DEBUG(dbgs() << " IV="); + DEBUG(WriteAsOperand(dbgs(), Phi, /*PrintType=*/false)); + DEBUG(dbgs() << "\n"); } /// PrepareToStrengthReduceFromSmallerStride - Prepare for the given users to @@ -1398,7 +1398,7 @@ Value *CommonBaseV, const IVExpr &ReuseIV, Instruction *PreInsertPt) { - DEBUG(errs() << " Rewriting in terms of existing IV of STRIDE " + DEBUG(dbgs() << " Rewriting in terms of existing IV of STRIDE " << *ReuseIV.Stride << " and BASE " << *ReuseIV.Base << "\n"); // All the users will share the reused IV. @@ -1507,7 +1507,7 @@ UsersToProcess, TLI); if (DoSink) { - DEBUG(errs() << " Sinking " << *Imm << " back down into uses\n"); + DEBUG(dbgs() << " Sinking " << *Imm << " back down into uses\n"); for (unsigned i = 0, e = UsersToProcess.size(); i != e; ++i) UsersToProcess[i].Imm = SE->getAddExpr(UsersToProcess[i].Imm, Imm); CommonExprs = NewCommon; @@ -1519,7 +1519,7 @@ // Now that we know what we need to do, insert the PHI node itself. // - DEBUG(errs() << "LSR: Examining IVs of TYPE " << *ReplacedTy << " of STRIDE " + DEBUG(dbgs() << "LSR: Examining IVs of TYPE " << *ReplacedTy << " of STRIDE " << *Stride << ":\n" << " Common base: " << *CommonExprs << "\n"); @@ -1583,10 +1583,10 @@ if (!Base->isZero()) { BaseV = PreheaderRewriter.expandCodeFor(Base, 0, PreInsertPt); - DEBUG(errs() << " INSERTING code for BASE = " << *Base << ":"); + DEBUG(dbgs() << " INSERTING code for BASE = " << *Base << ":"); if (BaseV->hasName()) - DEBUG(errs() << " Result value name = %" << BaseV->getName()); - DEBUG(errs() << "\n"); + DEBUG(dbgs() << " Result value name = %" << BaseV->getName()); + DEBUG(dbgs() << "\n"); // If BaseV is a non-zero constant, make sure that it gets inserted into // the preheader, instead of being forward substituted into the uses. We @@ -1607,15 +1607,15 @@ // FIXME: Use emitted users to emit other users. BasedUser &User = UsersToProcess.back(); - DEBUG(errs() << " Examining "); + DEBUG(dbgs() << " Examining "); if (User.isUseOfPostIncrementedValue) - DEBUG(errs() << "postinc"); + DEBUG(dbgs() << "postinc"); else - DEBUG(errs() << "preinc"); - DEBUG(errs() << " use "); - DEBUG(WriteAsOperand(errs(), UsersToProcess.back().OperandValToReplace, + DEBUG(dbgs() << "preinc"); + DEBUG(dbgs() << " use "); + DEBUG(WriteAsOperand(dbgs(), UsersToProcess.back().OperandValToReplace, /*PrintType=*/false)); - DEBUG(errs() << " in Inst: " << *User.Inst); + DEBUG(dbgs() << " in Inst: " << *User.Inst); // If this instruction wants to use the post-incremented value, move it // after the post-inc and use its value instead of the PHI. @@ -2029,8 +2029,8 @@ Cond = new ICmpInst(OldCond, Predicate, NewCmpLHS, NewCmpRHS, L->getHeader()->getName() + ".termcond"); - DEBUG(errs() << " Change compare stride in Inst " << *OldCond); - DEBUG(errs() << " to " << *Cond << '\n'); + DEBUG(dbgs() << " Change compare stride in Inst " << *OldCond); + DEBUG(dbgs() << " to " << *Cond << '\n'); // Remove the old compare instruction. The old indvar is probably dead too. DeadInsts.push_back(CondUse->getOperandValToReplace()); @@ -2489,7 +2489,7 @@ if (!UsePostInc) continue; - DEBUG(errs() << " Change loop exiting icmp to use postinc iv: " + DEBUG(dbgs() << " Change loop exiting icmp to use postinc iv: " << *Cond << '\n'); // It's possible for the setcc instruction to be anywhere in the loop, and @@ -2568,9 +2568,9 @@ } // Replace the increment with a decrement. - DEBUG(errs() << "LSR: Examining use "); - DEBUG(WriteAsOperand(errs(), CondOp0, /*PrintType=*/false)); - DEBUG(errs() << " in Inst: " << *Cond << '\n'); + DEBUG(dbgs() << "LSR: Examining use "); + DEBUG(WriteAsOperand(dbgs(), CondOp0, /*PrintType=*/false)); + DEBUG(dbgs() << " in Inst: " << *Cond << '\n'); BinaryOperator *Decr = BinaryOperator::Create(Instruction::Sub, Incr->getOperand(0), Incr->getOperand(1), "tmp", Incr); Incr->replaceAllUsesWith(Decr); @@ -2584,7 +2584,7 @@ unsigned InBlock = L->contains(PHIExpr->getIncomingBlock(0)) ? 1 : 0; Value *StartVal = PHIExpr->getIncomingValue(InBlock); Value *EndVal = Cond->getOperand(1); - DEBUG(errs() << " Optimize loop counting iv to count down [" + DEBUG(dbgs() << " Optimize loop counting iv to count down [" << *EndVal << " .. " << *StartVal << "]\n"); // FIXME: check for case where both are constant. @@ -2593,7 +2593,7 @@ EndVal, StartVal, "tmp", PreInsertPt); PHIExpr->setIncomingValue(InBlock, NewStartVal); Cond->setOperand(1, Zero); - DEBUG(errs() << " New icmp: " << *Cond << "\n"); + DEBUG(dbgs() << " New icmp: " << *Cond << "\n"); int64_t SInt = cast(Stride)->getValue()->getSExtValue(); const SCEV *NewStride = 0; @@ -2676,9 +2676,9 @@ return false; if (!IU->IVUsesByStride.empty()) { - DEBUG(errs() << "\nLSR on \"" << L->getHeader()->getParent()->getName() + DEBUG(dbgs() << "\nLSR on \"" << L->getHeader()->getParent()->getName() << "\" "; - L->dump()); + L->print(dbgs())); // Sort the StrideOrder so we process larger strides first. std::stable_sort(IU->StrideOrder.begin(), IU->StrideOrder.end(), From greened at obbligato.org Wed Dec 23 16:59:29 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 22:59:29 -0000 Subject: [llvm-commits] [llvm] r92076 - /llvm/trunk/lib/Analysis/ProfileInfo.cpp Message-ID: <200912232259.nBNMxToU028286@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 16:59:29 2009 New Revision: 92076 URL: http://llvm.org/viewvc/llvm-project?rev=92076&view=rev Log: Change dbgs() back to errs() for assert messages as Chris requested. Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfo.cpp?rev=92076&r1=92075&r2=92076&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfo.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfo.cpp Wed Dec 23 16:59:29 2009 @@ -978,7 +978,7 @@ } if (FoundPath) continue; - dbgs() << "{"; + errs() << "{"; FI = Unvisited.begin(), FE = Unvisited.end(); while(FI != FE) { const BasicBlock *BB = *FI; ++FI; @@ -986,9 +986,9 @@ if (FI != FE) dbgs() << ","; } - dbgs() << "}"; + errs() << "}"; - dbgs() << "ASSERT: could not repair function"; + errs() << "ASSERT: could not repair function"; assert(0 && "could not repair function"); } From greened at obbligato.org Wed Dec 23 17:00:51 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:00:51 -0000 Subject: [llvm-commits] [llvm] r92077 - /llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Message-ID: <200912232300.nBNN0pxx028335@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:00:50 2009 New Revision: 92077 URL: http://llvm.org/viewvc/llvm-project?rev=92077&view=rev Log: Change dbgs() back to errs() for assert messages as Chris requested. Modified: llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Modified: llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp?rev=92077&r1=92076&r2=92077&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Wed Dec 23 17:00:50 2009 @@ -161,7 +161,7 @@ } } if (ReadCount != Counters.size()) { - dbgs() << "WARNING: profile information is inconsistent with " + errs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } NumEdgesRead = ReadCount; @@ -209,7 +209,7 @@ } } if (ReadCount != Counters.size()) { - dbgs() << "WARNING: profile information is inconsistent with " + errs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } NumEdgesRead = ReadCount; @@ -230,7 +230,7 @@ BlockInformation[F][BB] = (double)Counters[ReadCount++]; } if (ReadCount != Counters.size()) { - dbgs() << "WARNING: profile information is inconsistent with " + errs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } } @@ -249,7 +249,7 @@ FunctionInformation[F] = (double)Counters[ReadCount++]; } if (ReadCount != Counters.size()) { - dbgs() << "WARNING: profile information is inconsistent with " + errs() << "WARNING: profile information is inconsistent with " << "the current program!\n"; } } From sabre at nondot.org Wed Dec 23 17:03:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Dec 2009 23:03:24 -0000 Subject: [llvm-commits] [llvm] r92079 - /llvm/trunk/lib/Support/MemoryBuffer.cpp Message-ID: <200912232303.nBNN3OAv028435@zion.cs.uiuc.edu> Author: lattner Date: Wed Dec 23 17:03:24 2009 New Revision: 92079 URL: http://llvm.org/viewvc/llvm-project?rev=92079&view=rev Log: sizeof(char) is always 1. Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=92079&r1=92078&r2=92079&view=diff ============================================================================== --- llvm/trunk/lib/Support/MemoryBuffer.cpp (original) +++ llvm/trunk/lib/Support/MemoryBuffer.cpp Wed Dec 23 17:03:24 2009 @@ -46,7 +46,7 @@ /// successfully. void MemoryBuffer::initCopyOf(const char *BufStart, const char *BufEnd) { size_t Size = BufEnd-BufStart; - BufferStart = (char *)malloc((Size+1) * sizeof(char)); + BufferStart = (char *)malloc(Size+1); BufferEnd = BufferStart+Size; memcpy(const_cast(BufferStart), BufStart, Size); *const_cast(BufferEnd) = 0; // Null terminate buffer. @@ -108,7 +108,7 @@ /// the MemoryBuffer object. MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size, StringRef BufferName) { - char *Buf = (char *)malloc((Size+1) * sizeof(char)); + char *Buf = (char *)malloc(Size+1); if (!Buf) return 0; Buf[Size] = 0; MemoryBufferMem *SB = new MemoryBufferMem(Buf, Buf+Size, BufferName); From dag at cray.com Wed Dec 23 17:03:42 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 17:03:42 -0600 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <6F1D6D3B-2898-4E2A-8D30-8A0466D9598E@apple.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <6F1D6D3B-2898-4E2A-8D30-8A0466D9598E@apple.com> Message-ID: <200912231703.43023.dag@cray.com> On Wednesday 23 December 2009 16:27, Chris Lattner wrote: > On Dec 23, 2009, at 1:06 PM, David Greene wrote: > > Author: greened > > Date: Wed Dec 23 15:06:14 2009 > > New Revision: 92046 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=92046&view=rev > > Log: > > > > Convert debug messages to use dbgs(). Generally this means > > s/errs/dbgs/g except for certain special cases. > > The change to dump() is fine, the others are not. I'll change it back but this has similar issues as other files. Do we want to see these messages out-of-line with respect to debug messages? I didn't make these changes willy-nilly. I thought about it and concluded it would be better to keep messages in-order. If we decide that's not important, that's probably fine (there may be some special cases) but we should be aware of what we're deciding. Remember, dbgs() == errs() except for a very exceptional case. -Dave From dag at cray.com Wed Dec 23 17:06:12 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 17:06:12 -0600 Subject: [llvm-commits] [llvm] r92033 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: References: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> <200912231643.02285.dag@cray.com> Message-ID: <200912231706.12872.dag@cray.com> On Wednesday 23 December 2009 16:56, Chris Lattner wrote: > > Why not? If I'm debugging a crash I certainly want to see the error > > message > > in the context of all the other debug output. I want to see it at > > the end > > of the debug output because that's the order it happened in. > > This is effectively an assertion message, not -debug output. Sure, but the assert happened for a reason which I as a developer am hoping will be explained a bit by the debug output. Hence I want to see the assert message in the context of the debug output. The whole point of dbgs() is to be able to do a post-mortem on a crash with a gigantic input and not spew gigabytes of data to the disk. So I want to know what triggered the crash as well as what led up to it. -Dave From dag at cray.com Wed Dec 23 17:07:28 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 17:07:28 -0600 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <200912231644.34091.dag@cray.com> Message-ID: <200912231707.28977.dag@cray.com> On Wednesday 23 December 2009 16:56, Chris Lattner wrote: > > Same question. Don't we want the failure messages in the context of > > other debug output? > > It has nothing to do with -debug. It has everything to do with -debug. Why does -debug exist except as a tool to do debugging? One of the things we often need to debug is crashes. So shouldn't the messages be presented in order? -Dave From clattner at apple.com Wed Dec 23 17:07:47 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 15:07:47 -0800 Subject: [llvm-commits] [llvm] r92075 - in /llvm/trunk: include/llvm/Analysis/LoopInfo.h lib/Analysis/ScalarEvolution.cpp lib/Transforms/Scalar/LoopStrengthReduce.cpp In-Reply-To: <200912232258.nBNMwdYY028247@zion.cs.uiuc.edu> References: <200912232258.nBNMwdYY028247@zion.cs.uiuc.edu> Message-ID: <581950B7-66EF-4F68-B606-00A9A7B1C93E@apple.com> On Dec 23, 2009, at 2:58 PM, David Greene wrote: > Author: greened > Date: Wed Dec 23 16:58:38 2009 > New Revision: 92075 > > URL: http://llvm.org/viewvc/llvm-project?rev=92075&view=rev > Log: > > Remove dump routine and the associated Debug.h from a header. Patch > up > other files to compensate. Looks great, thanks! -Chris > > Modified: > llvm/trunk/include/llvm/Analysis/LoopInfo.h > llvm/trunk/lib/Analysis/ScalarEvolution.cpp > llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp > > Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=92075&r1=92074&r2=92075&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) > +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Wed Dec 23 16:58:38 > 2009 > @@ -37,7 +37,6 @@ > #include "llvm/ADT/SmallVector.h" > #include "llvm/Analysis/Dominators.h" > #include "llvm/Support/CFG.h" > -#include "llvm/Support/Debug.h" > #include "llvm/Support/raw_ostream.h" > #include > > @@ -480,10 +479,6 @@ > (*I)->print(OS, Depth+2); > } > > - void dump() const { > - print(dbgs()); > - } > - > protected: > friend class LoopInfoBase; > explicit LoopBase(BlockT *BB) : ParentLoop(0) { > > Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=92075&r1=92074&r2=92075&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) > +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Dec 23 16:58:38 > 2009 > @@ -75,6 +75,7 @@ > #include "llvm/Target/TargetData.h" > #include "llvm/Support/CommandLine.h" > #include "llvm/Support/ConstantRange.h" > +#include "llvm/Support/Debug.h" > #include "llvm/Support/ErrorHandling.h" > #include "llvm/Support/GetElementPtrTypeIterator.h" > #include "llvm/Support/InstIterator.h" > > Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=92075&r1=92074&r2=92075&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Dec > 23 16:58:38 2009 > @@ -338,9 +338,9 @@ > } > > void BasedUser::dump() const { > - errs() << " Base=" << *Base; > - errs() << " Imm=" << *Imm; > - errs() << " Inst: " << *Inst; > + dbgs() << " Base=" << *Base; > + dbgs() << " Imm=" << *Imm; > + dbgs() << " Inst: " << *Inst; > } > > Value *BasedUser::InsertCodeForBaseAtPosition(const SCEV *NewBase, > @@ -404,9 +404,9 @@ > // Replace the use of the operand Value with the new Phi we just > created. > Inst->replaceUsesOfWith(OperandValToReplace, NewVal); > > - DEBUG(errs() << " Replacing with "); > - DEBUG(WriteAsOperand(errs(), NewVal, /*PrintType=*/false)); > - DEBUG(errs() << ", which has value " << *NewBase << " plus IMM " > + DEBUG(dbgs() << " Replacing with "); > + DEBUG(WriteAsOperand(dbgs(), NewVal, /*PrintType=*/false)); > + DEBUG(dbgs() << ", which has value " << *NewBase << " plus IMM " > << *Imm << "\n"); > return; > } > @@ -464,9 +464,9 @@ > Code = InsertCodeForBaseAtPosition(NewBase, PN->getType(), > Rewriter, InsertPt, SE); > > - DEBUG(errs() << " Changing PHI use to "); > - DEBUG(WriteAsOperand(errs(), Code, /*PrintType=*/false)); > - DEBUG(errs() << ", which has value " << *NewBase << " plus > IMM " > + DEBUG(dbgs() << " Changing PHI use to "); > + DEBUG(WriteAsOperand(dbgs(), Code, /*PrintType=*/false)); > + DEBUG(dbgs() << ", which has value " << *NewBase << " plus > IMM " > << *Imm << "\n"); > } > > @@ -1321,7 +1321,7 @@ > const SCEV *CommonExprs, > const Loop *L, > SCEVExpander > &PreheaderRewriter) { > - DEBUG(errs() << " Fully reducing all users\n"); > + DEBUG(dbgs() << " Fully reducing all users\n"); > > // Rewrite the UsersToProcess records, creating a separate PHI for > each > // unique Base value. > @@ -1370,7 +1370,7 @@ > Instruction *IVIncInsertPt, > const Loop *L, > SCEVExpander > &PreheaderRewriter) { > - DEBUG(errs() << " Inserting new PHI:\n"); > + DEBUG(dbgs() << " Inserting new PHI:\n"); > > PHINode *Phi = InsertAffinePhi(SE->getUnknown(CommonBaseV), > Stride, IVIncInsertPt, L, > @@ -1383,9 +1383,9 @@ > for (unsigned i = 0, e = UsersToProcess.size(); i != e; ++i) > UsersToProcess[i].Phi = Phi; > > - DEBUG(errs() << " IV="); > - DEBUG(WriteAsOperand(errs(), Phi, /*PrintType=*/false)); > - DEBUG(errs() << "\n"); > + DEBUG(dbgs() << " IV="); > + DEBUG(WriteAsOperand(dbgs(), Phi, /*PrintType=*/false)); > + DEBUG(dbgs() << "\n"); > } > > /// PrepareToStrengthReduceFromSmallerStride - Prepare for the given > users to > @@ -1398,7 +1398,7 @@ > Value *CommonBaseV, > const IVExpr &ReuseIV, > Instruction *PreInsertPt) { > - DEBUG(errs() << " Rewriting in terms of existing IV of STRIDE " > + DEBUG(dbgs() << " Rewriting in terms of existing IV of STRIDE " > << *ReuseIV.Stride << " and BASE " << *ReuseIV.Base > << "\n"); > > // All the users will share the reused IV. > @@ -1507,7 +1507,7 @@ > UsersToProcess, TLI); > > if (DoSink) { > - DEBUG(errs() << " Sinking " << *Imm << " back down into > uses\n"); > + DEBUG(dbgs() << " Sinking " << *Imm << " back down into > uses\n"); > for (unsigned i = 0, e = UsersToProcess.size(); i != e; ++i) > UsersToProcess[i].Imm = SE- > >getAddExpr(UsersToProcess[i].Imm, Imm); > CommonExprs = NewCommon; > @@ -1519,7 +1519,7 @@ > > // Now that we know what we need to do, insert the PHI node itself. > // > - DEBUG(errs() << "LSR: Examining IVs of TYPE " << *ReplacedTy << " > of STRIDE " > + DEBUG(dbgs() << "LSR: Examining IVs of TYPE " << *ReplacedTy << " > of STRIDE " > << *Stride << ":\n" > << " Common base: " << *CommonExprs << "\n"); > > @@ -1583,10 +1583,10 @@ > if (!Base->isZero()) { > BaseV = PreheaderRewriter.expandCodeFor(Base, 0, PreInsertPt); > > - DEBUG(errs() << " INSERTING code for BASE = " << *Base << > ":"); > + DEBUG(dbgs() << " INSERTING code for BASE = " << *Base << > ":"); > if (BaseV->hasName()) > - DEBUG(errs() << " Result value name = %" << BaseV- > >getName()); > - DEBUG(errs() << "\n"); > + DEBUG(dbgs() << " Result value name = %" << BaseV- > >getName()); > + DEBUG(dbgs() << "\n"); > > // If BaseV is a non-zero constant, make sure that it gets > inserted into > // the preheader, instead of being forward substituted into > the uses. We > @@ -1607,15 +1607,15 @@ > // FIXME: Use emitted users to emit other users. > BasedUser &User = UsersToProcess.back(); > > - DEBUG(errs() << " Examining "); > + DEBUG(dbgs() << " Examining "); > if (User.isUseOfPostIncrementedValue) > - DEBUG(errs() << "postinc"); > + DEBUG(dbgs() << "postinc"); > else > - DEBUG(errs() << "preinc"); > - DEBUG(errs() << " use "); > - DEBUG(WriteAsOperand(errs(), > UsersToProcess.back().OperandValToReplace, > + DEBUG(dbgs() << "preinc"); > + DEBUG(dbgs() << " use "); > + DEBUG(WriteAsOperand(dbgs(), > UsersToProcess.back().OperandValToReplace, > /*PrintType=*/false)); > - DEBUG(errs() << " in Inst: " << *User.Inst); > + DEBUG(dbgs() << " in Inst: " << *User.Inst); > > // If this instruction wants to use the post-incremented > value, move it > // after the post-inc and use its value instead of the PHI. > @@ -2029,8 +2029,8 @@ > Cond = new ICmpInst(OldCond, Predicate, NewCmpLHS, NewCmpRHS, > L->getHeader()->getName() + ".termcond"); > > - DEBUG(errs() << " Change compare stride in Inst " << > *OldCond); > - DEBUG(errs() << " to " << *Cond << '\n'); > + DEBUG(dbgs() << " Change compare stride in Inst " << > *OldCond); > + DEBUG(dbgs() << " to " << *Cond << '\n'); > > // Remove the old compare instruction. The old indvar is > probably dead too. > DeadInsts.push_back(CondUse->getOperandValToReplace()); > @@ -2489,7 +2489,7 @@ > if (!UsePostInc) > continue; > > - DEBUG(errs() << " Change loop exiting icmp to use postinc iv: " > + DEBUG(dbgs() << " Change loop exiting icmp to use postinc iv: " > << *Cond << '\n'); > > // It's possible for the setcc instruction to be anywhere in the > loop, and > @@ -2568,9 +2568,9 @@ > } > > // Replace the increment with a decrement. > - DEBUG(errs() << "LSR: Examining use "); > - DEBUG(WriteAsOperand(errs(), CondOp0, /*PrintType=*/false)); > - DEBUG(errs() << " in Inst: " << *Cond << '\n'); > + DEBUG(dbgs() << "LSR: Examining use "); > + DEBUG(WriteAsOperand(dbgs(), CondOp0, /*PrintType=*/false)); > + DEBUG(dbgs() << " in Inst: " << *Cond << '\n'); > BinaryOperator *Decr = BinaryOperator::Create(Instruction::Sub, > Incr->getOperand(0), Incr->getOperand(1), > "tmp", Incr); > Incr->replaceAllUsesWith(Decr); > @@ -2584,7 +2584,7 @@ > unsigned InBlock = L->contains(PHIExpr->getIncomingBlock(0)) ? 1 : > 0; > Value *StartVal = PHIExpr->getIncomingValue(InBlock); > Value *EndVal = Cond->getOperand(1); > - DEBUG(errs() << " Optimize loop counting iv to count down [" > + DEBUG(dbgs() << " Optimize loop counting iv to count down [" > << *EndVal << " .. " << *StartVal << "]\n"); > > // FIXME: check for case where both are constant. > @@ -2593,7 +2593,7 @@ > EndVal, StartVal, "tmp", > PreInsertPt); > PHIExpr->setIncomingValue(InBlock, NewStartVal); > Cond->setOperand(1, Zero); > - DEBUG(errs() << " New icmp: " << *Cond << "\n"); > + DEBUG(dbgs() << " New icmp: " << *Cond << "\n"); > > int64_t SInt = cast(Stride)->getValue()- > >getSExtValue(); > const SCEV *NewStride = 0; > @@ -2676,9 +2676,9 @@ > return false; > > if (!IU->IVUsesByStride.empty()) { > - DEBUG(errs() << "\nLSR on \"" << L->getHeader()->getParent()- > >getName() > + DEBUG(dbgs() << "\nLSR on \"" << L->getHeader()->getParent()- > >getName() > << "\" "; > - L->dump()); > + L->print(dbgs())); > > // Sort the StrideOrder so we process larger strides first. > std::stable_sort(IU->StrideOrder.begin(), IU->StrideOrder.end(), > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From greened at obbligato.org Wed Dec 23 17:09:40 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:09:40 -0000 Subject: [llvm-commits] [llvm] r92080 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Message-ID: <200912232309.nBNN9eXQ028686@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:09:39 2009 New Revision: 92080 URL: http://llvm.org/viewvc/llvm-project?rev=92080&view=rev Log: Change dbgs() back to errs() for assert messages as Chris requested. Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=92080&r1=92079&r2=92080&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Wed Dec 23 17:09:39 2009 @@ -59,7 +59,7 @@ // Print passes managed by this manager void dumpPassStructure(unsigned Offset) { - dbgs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; + errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n"; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { Pass *P = getContainedPass(Index); P->dumpPassStructure(Offset + 1); From clattner at apple.com Wed Dec 23 17:09:54 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 15:09:54 -0800 Subject: [llvm-commits] [llvm] r92033 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: <200912231706.12872.dag@cray.com> References: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> <200912231643.02285.dag@cray.com> <200912231706.12872.dag@cray.com> Message-ID: On Dec 23, 2009, at 3:06 PM, David Greene wrote: > On Wednesday 23 December 2009 16:56, Chris Lattner wrote: > >>> Why not? If I'm debugging a crash I certainly want to see the error >>> message >>> in the context of all the other debug output. I want to see it at >>> the end >>> of the debug output because that's the order it happened in. >> >> This is effectively an assertion message, not -debug output. > > Sure, but the assert happened for a reason which I as a developer am > hoping will be explained a bit by the debug output. Hence I want to > see the assert message in the context of the debug output. > > The whole point of dbgs() is to be able to do a post-mortem on a > crash with a gigantic input and not spew gigabytes of data to the > disk. So I want to know what triggered the crash as well as what > led up to it. There should be no difference between: errs() << "foo"; llvm_unreachable(0); and: assert(0 && "foo"); Now you just introduced one. -Chris From clattner at apple.com Wed Dec 23 17:10:18 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 15:10:18 -0800 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <200912231707.28977.dag@cray.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <200912231644.34091.dag@cray.com> <200912231707.28977.dag@cray.com> Message-ID: On Dec 23, 2009, at 3:07 PM, David Greene wrote: > On Wednesday 23 December 2009 16:56, Chris Lattner wrote: > >>> Same question. Don't we want the failure messages in the context of >>> other debug output? >> >> It has nothing to do with -debug. > > It has everything to do with -debug. Why does -debug exist except > as a > tool to do debugging? One of the things we often need to debug is > crashes. > So shouldn't the messages be presented in order? These messages have nothing to do with -debug. We want to get them when -debug is not enabled. -Chris From dag at cray.com Wed Dec 23 17:13:41 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 17:13:41 -0600 Subject: [llvm-commits] [llvm] r92033 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: References: <200912231951.nBNJpil1020827@zion.cs.uiuc.edu> <200912231706.12872.dag@cray.com> Message-ID: <200912231713.41659.dag@cray.com> On Wednesday 23 December 2009 17:09, Chris Lattner wrote: > > The whole point of dbgs() is to be able to do a post-mortem on a > > crash with a gigantic input and not spew gigabytes of data to the > > disk. So I want to know what triggered the crash as well as what > > led up to it. > > There should be no difference between: > > errs() << "foo"; > llvm_unreachable(0); > > and: > > assert(0 && "foo"); > > Now you just introduced one. But is "assert(0 && "foo");" reasonable code? I know it's standard LLVM practice but we shouldn't let ourselves be shackled to something just because it's always been that way. Not logging error messages the same way as debug messages reduces debuggability by reordering messages. I'll change it back but I still think it's a mistake. -Dave From greened at obbligato.org Wed Dec 23 17:14:42 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:14:42 -0000 Subject: [llvm-commits] [llvm] r92081 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp Message-ID: <200912232314.nBNNEgYs028859@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:14:41 2009 New Revision: 92081 URL: http://llvm.org/viewvc/llvm-project?rev=92081&view=rev Log: Change dbgs() back to errs() for assert messages as Chris requested. Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=92081&r1=92080&r2=92081&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Wed Dec 23 17:14:41 2009 @@ -806,7 +806,7 @@ case Instruction::BitCast: return getNodeForConstantPointer(CE->getOperand(0)); default: - dbgs() << "Constant Expr not yet handled: " << *CE << "\n"; + errs() << "Constant Expr not yet handled: " << *CE << "\n"; llvm_unreachable(0); } } else { @@ -833,7 +833,7 @@ case Instruction::BitCast: return getNodeForConstantPointerTarget(CE->getOperand(0)); default: - dbgs() << "Constant Expr not yet handled: " << *CE << "\n"; + errs() << "Constant Expr not yet handled: " << *CE << "\n"; llvm_unreachable(0); } } else { @@ -1132,7 +1132,7 @@ return; default: // Is this something we aren't handling yet? - dbgs() << "Unknown instruction: " << I; + errs() << "Unknown instruction: " << I; llvm_unreachable(0); } } From dag at cray.com Wed Dec 23 17:19:24 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 17:19:24 -0600 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <200912231707.28977.dag@cray.com> Message-ID: <200912231719.24530.dag@cray.com> On Wednesday 23 December 2009 17:10, Chris Lattner wrote: > These messages have nothing to do with -debug. We want to get them > when -debug is not enabled. Ah. This is something that got disrupted during the circular_raw_ostream discussion. I can certainly make dbgs() output to errs() if -debug is not enabled. That's what it does in our code. I thought I had done that but looking at Debug.cpp I obviously missed fixing that case. The intent was always that dbgs() == errs() if debugging is off. Would that satisfy your concerns? -Dave From greened at obbligato.org Wed Dec 23 17:19:44 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:19:44 -0000 Subject: [llvm-commits] [llvm] r92082 - /llvm/trunk/include/llvm/Support/Debug.h Message-ID: <200912232319.nBNNJi3h029029@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:19:43 2009 New Revision: 92082 URL: http://llvm.org/viewvc/llvm-project?rev=92082&view=rev Log: Fix a comment. Modified: llvm/trunk/include/llvm/Support/Debug.h Modified: llvm/trunk/include/llvm/Support/Debug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Debug.h?rev=92082&r1=92081&r2=92082&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Debug.h (original) +++ llvm/trunk/include/llvm/Support/Debug.h Wed Dec 23 17:19:43 2009 @@ -83,7 +83,7 @@ extern bool EnableDebugBuffering; /// dbgs() - This returns a reference to a raw_ostream for debugging -/// messages. If debugging is disabled it returns dbgs(). Use it +/// messages. If debugging is disabled it returns errs(). Use it /// like: dbgs() << "foo" << "bar"; raw_ostream &dbgs(); From wendling at apple.com Wed Dec 23 17:22:23 2009 From: wendling at apple.com (Bill Wendling) Date: Wed, 23 Dec 2009 15:22:23 -0800 Subject: [llvm-commits] Build Failure! Message-ID: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> This is a new build failure as of today. Does this look familiar to anyone? -bw llvm[2]: Compiling CommonProfiling.ll to CommonProfiling.bc for Debug build (bytecode) Intrinsic parameter #1 is wrong! i64 (i8*, i32)* @llvm.objectsize.i64 Intrinsic parameter #1 is wrong! i64 (i8*, i32)* @llvm.objectsize.i64 Intrinsic parameter #1 is wrong! i64 (i8*, i32)* @llvm.objectsize.i64 Intrinsic parameter #1 is wrong! i64 (i8*, i32)* @llvm.objectsize.i64 Intrinsic parameter #1 is wrong! i64 (i8*, i32)* @llvm.objectsize.i64 Intrinsic parameter #1 is wrong! i64 (i8*, i32)* @llvm.objectsize.i64 Broken module found, compilation aborted! 0 opt 0x000000010ac32369 PrintStackTrace(void*) + 57 1 opt 0x000000010ac329a5 SignalHandler(int) + 469 2 libSystem.B.dylib 0x00007fff814c7d5a _sigtramp + 26 3 libSystem.B.dylib 0x0000000100000001 _sigtramp + 2125693633 4 libSystem.B.dylib 0x00007fff81541119 raise + 25 5 libSystem.B.dylib 0x00007fff81561ddd abort + 90 6 opt 0x000000010abc99bf (anonymous namespace)::Verifier::abortIfBroken() + 239 7 opt 0x000000010abdbd6a (anonymous namespace)::Verifier::runOnFunction(llvm::Function&) + 140 8 opt 0x000000010ab93b13 llvm::FPPassManager::runOnFunction(llvm::Function&) + 387 9 opt 0x000000010ab8dd27 llvm::FPPassManager::runOnModule(llvm::Module&) + 127 10 opt 0x000000010ab93664 llvm::MPPassManager::runOnModule(llvm::Module&) + 588 11 opt 0x000000010ab9511c llvm::PassManagerImpl::run(llvm::Module&) + 156 12 opt 0x000000010ab951c7 llvm::PassManager::run(llvm::Module&) + 45 13 opt 0x000000010a683b3a main + 5786 14 opt 0x000000010a675060 start + 52 15 opt 0x0000000000000006 start + 4120424410 Stack dump: 0. Program arguments: /Volumes/Sandbox/llvm/llvm.obj/Debug/bin/opt /Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.ll -std-compile-opts -strip-debug -o /Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.bc 1. Running pass 'Function Pass Manager' on module '/Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.ll'. 2. Running pass 'Module Verifier' on function '@save_arguments' make[2]: *** [/Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.bc] Abort trap make[1]: *** [libprofile/.makeall] Error 2 make: *** [all] Error 1 From greened at obbligato.org Wed Dec 23 17:23:15 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:23:15 -0000 Subject: [llvm-commits] [llvm] r92083 - /llvm/trunk/lib/Support/Debug.cpp Message-ID: <200912232323.nBNNNFAd029239@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:23:15 2009 New Revision: 92083 URL: http://llvm.org/viewvc/llvm-project?rev=92083&view=rev Log: Clarify how dbgs() operates. Modified: llvm/trunk/lib/Support/Debug.cpp Modified: llvm/trunk/lib/Support/Debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Debug.cpp?rev=92083&r1=92082&r2=92083&view=diff ============================================================================== --- llvm/trunk/lib/Support/Debug.cpp (original) +++ llvm/trunk/lib/Support/Debug.cpp Wed Dec 23 17:23:15 2009 @@ -105,7 +105,7 @@ // force a debug dump. sys::AddSignalHandler(&debug_user_sig_handler, 0); // Otherwise we've already set the debug stream buffer size to - // zero, disabling buffering. + // zero, disabling buffering so it will output directly to errs(). } } thestrm; From dag at cray.com Wed Dec 23 17:23:46 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 17:23:46 -0600 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <200912231719.24530.dag@cray.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <200912231719.24530.dag@cray.com> Message-ID: <200912231723.47309.dag@cray.com> On Wednesday 23 December 2009 17:19, David Greene wrote: > The intent was always that dbgs() == errs() if debugging is off. And it is that way. When -debug is off the buffer size is zero and output goes straight to errs(). -Dave From dalej at apple.com Wed Dec 23 17:24:30 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Dec 2009 15:24:30 -0800 Subject: [llvm-commits] Build Failure! In-Reply-To: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> References: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> Message-ID: <1FFCD687-0309-46CC-B805-A8C1EF7C8E85@apple.com> Eric's the one who's been working on objectsize. On Dec 23, 2009, at 3:22 PMPST, Bill Wendling wrote: > This is a new build failure as of today. Does this look familiar to > anyone? > > -bw > > llvm[2]: Compiling CommonProfiling.ll to CommonProfiling.bc for > Debug build (bytecode) > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Broken module found, compilation aborted! > 0 opt 0x000000010ac32369 PrintStackTrace(void*) + 57 > 1 opt 0x000000010ac329a5 SignalHandler(int) + 469 > 2 libSystem.B.dylib 0x00007fff814c7d5a _sigtramp + 26 > 3 libSystem.B.dylib 0x0000000100000001 _sigtramp + 2125693633 > 4 libSystem.B.dylib 0x00007fff81541119 raise + 25 > 5 libSystem.B.dylib 0x00007fff81561ddd abort + 90 > 6 opt 0x000000010abc99bf (anonymous > namespace)::Verifier::abortIfBroken() + 239 > 7 opt 0x000000010abdbd6a (anonymous > namespace)::Verifier::runOnFunction(llvm::Function&) + 140 > 8 opt 0x000000010ab93b13 > llvm::FPPassManager::runOnFunction(llvm::Function&) + 387 > 9 opt 0x000000010ab8dd27 > llvm::FPPassManager::runOnModule(llvm::Module&) + 127 > 10 opt 0x000000010ab93664 > llvm::MPPassManager::runOnModule(llvm::Module&) + 588 > 11 opt 0x000000010ab9511c > llvm::PassManagerImpl::run(llvm::Module&) + 156 > 12 opt 0x000000010ab951c7 > llvm::PassManager::run(llvm::Module&) + 45 > 13 opt 0x000000010a683b3a main + 5786 > 14 opt 0x000000010a675060 start + 52 > 15 opt 0x0000000000000006 start + 4120424410 > Stack dump: > 0. Program arguments: /Volumes/Sandbox/llvm/llvm.obj/Debug/bin/opt / > Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/ > CommonProfiling.ll -std-compile-opts -strip-debug -o /Volumes/ > Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.bc > 1. Running pass 'Function Pass Manager' on module '/Volumes/Sandbox/ > llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.ll'. > 2. Running pass 'Module Verifier' on function '@save_arguments' > make[2]: *** [/Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/ > Debug/CommonProfiling.bc] Abort trap > make[1]: *** [libprofile/.makeall] Error 2 > make: *** [all] Error 1 > From sabre at nondot.org Wed Dec 23 17:24:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Dec 2009 23:24:51 -0000 Subject: [llvm-commits] [llvm] r92084 - /llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Message-ID: <200912232324.nBNNOqDI029319@zion.cs.uiuc.edu> Author: lattner Date: Wed Dec 23 17:24:51 2009 New Revision: 92084 URL: http://llvm.org/viewvc/llvm-project?rev=92084&view=rev Log: reorder to follow a normal fall-through style, no functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=92084&r1=92083&r2=92084&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Wed Dec 23 17:24:51 2009 @@ -905,12 +905,11 @@ if (uint64_t Len = GetStringLength(Src)) return ConstantInt::get(CI->getType(), Len-1); - // Handle strlen(p) != 0. - if (!IsOnlyUsedInZeroEqualityComparison(CI)) return 0; - // strlen(x) != 0 --> *x != 0 // strlen(x) == 0 --> *x == 0 - return B.CreateZExt(B.CreateLoad(Src, "strlenfirst"), CI->getType()); + if (IsOnlyUsedInZeroEqualityComparison(CI)) + return B.CreateZExt(B.CreateLoad(Src, "strlenfirst"), CI->getType()); + return 0; } }; From echristo at apple.com Wed Dec 23 17:25:12 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 23 Dec 2009 15:25:12 -0800 Subject: [llvm-commits] Build Failure! In-Reply-To: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> References: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> Message-ID: <55FB594A-E25C-4890-B6EE-2F1596FA2F28@apple.com> On Dec 23, 2009, at 3:22 PM, Bill Wendling wrote: > This is a new build failure as of today. Does this look familiar to anyone? Yes, you need to rebuild llvm without llvm-gcc first and then rebuild. I changed an intrinsic. -eric From dag at cray.com Wed Dec 23 17:25:57 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 17:25:57 -0600 Subject: [llvm-commits] Build Failure! In-Reply-To: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> References: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> Message-ID: <200912231725.58205.dag@cray.com> On Wednesday 23 December 2009 17:22, Bill Wendling wrote: > This is a new build failure as of today. Does this look familiar to anyone? I saw it earlier today but it went away a couple hours ago for me. -Dave From greened at obbligato.org Wed Dec 23 17:27:16 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:27:16 -0000 Subject: [llvm-commits] [llvm] r92085 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp Message-ID: <200912232327.nBNNRGdG029412@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:27:15 2009 New Revision: 92085 URL: http://llvm.org/viewvc/llvm-project?rev=92085&view=rev Log: Change dbgs() back to errs() as Chris requested. Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=92085&r1=92084&r2=92085&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original) +++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Wed Dec 23 17:27:15 2009 @@ -63,9 +63,9 @@ // If it isn't in the InstInputs list it is a subexpr incorporated into the // address. Sanity check that it is phi translatable. if (!CanPHITrans(I)) { - dbgs() << "Non phi translatable instruction found in PHITransAddr, either " + errs() << "Non phi translatable instruction found in PHITransAddr, either " "something is missing from InstInputs or CanPHITrans is wrong:\n"; - dbgs() << *I << '\n'; + errs() << *I << '\n'; return false; } @@ -89,9 +89,9 @@ return false; if (!Tmp.empty()) { - dbgs() << "PHITransAddr inconsistent, contains extra instructions:\n"; + errs() << "PHITransAddr inconsistent, contains extra instructions:\n"; for (unsigned i = 0, e = InstInputs.size(); i != e; ++i) - dbgs() << " InstInput #" << i << " is " << *InstInputs[i] << "\n"; + errs() << " InstInput #" << i << " is " << *InstInputs[i] << "\n"; return false; } From wendling at apple.com Wed Dec 23 17:28:13 2009 From: wendling at apple.com (Bill Wendling) Date: Wed, 23 Dec 2009 15:28:13 -0800 Subject: [llvm-commits] Build Failure! In-Reply-To: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> References: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> Message-ID: <34A6A9F2-3332-4C49-B3DF-33E96E5154F9@apple.com> My mistake. I needed to update llvm-gcc as well. Sorry for the noise. -bw On Dec 23, 2009, at 3:22 PM, Bill Wendling wrote: > This is a new build failure as of today. Does this look familiar to anyone? > > -bw > > llvm[2]: Compiling CommonProfiling.ll to CommonProfiling.bc for Debug build (bytecode) > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Intrinsic parameter #1 is wrong! > i64 (i8*, i32)* @llvm.objectsize.i64 > Broken module found, compilation aborted! > 0 opt 0x000000010ac32369 PrintStackTrace(void*) + 57 > 1 opt 0x000000010ac329a5 SignalHandler(int) + 469 > 2 libSystem.B.dylib 0x00007fff814c7d5a _sigtramp + 26 > 3 libSystem.B.dylib 0x0000000100000001 _sigtramp + 2125693633 > 4 libSystem.B.dylib 0x00007fff81541119 raise + 25 > 5 libSystem.B.dylib 0x00007fff81561ddd abort + 90 > 6 opt 0x000000010abc99bf (anonymous namespace)::Verifier::abortIfBroken() + 239 > 7 opt 0x000000010abdbd6a (anonymous namespace)::Verifier::runOnFunction(llvm::Function&) + 140 > 8 opt 0x000000010ab93b13 llvm::FPPassManager::runOnFunction(llvm::Function&) + 387 > 9 opt 0x000000010ab8dd27 llvm::FPPassManager::runOnModule(llvm::Module&) + 127 > 10 opt 0x000000010ab93664 llvm::MPPassManager::runOnModule(llvm::Module&) + 588 > 11 opt 0x000000010ab9511c llvm::PassManagerImpl::run(llvm::Module&) + 156 > 12 opt 0x000000010ab951c7 llvm::PassManager::run(llvm::Module&) + 45 > 13 opt 0x000000010a683b3a main + 5786 > 14 opt 0x000000010a675060 start + 52 > 15 opt 0x0000000000000006 start + 4120424410 > Stack dump: > 0. Program arguments: /Volumes/Sandbox/llvm/llvm.obj/Debug/bin/opt /Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.ll -std-compile-opts -strip-debug -o /Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.bc > 1. Running pass 'Function Pass Manager' on module '/Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.ll'. > 2. Running pass 'Module Verifier' on function '@save_arguments' > make[2]: *** [/Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.bc] Abort trap > make[1]: *** [libprofile/.makeall] Error 2 > make: *** [all] Error 1 > From greened at obbligato.org Wed Dec 23 17:29:28 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:29:28 -0000 Subject: [llvm-commits] [llvm] r92086 - /llvm/trunk/lib/Analysis/InstCount.cpp Message-ID: <200912232329.nBNNTSwW029477@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:29:28 2009 New Revision: 92086 URL: http://llvm.org/viewvc/llvm-project?rev=92086&view=rev Log: Change dbgs() back to errs() as Chris requested. Modified: llvm/trunk/lib/Analysis/InstCount.cpp Modified: llvm/trunk/lib/Analysis/InstCount.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstCount.cpp?rev=92086&r1=92085&r2=92086&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstCount.cpp (original) +++ llvm/trunk/lib/Analysis/InstCount.cpp Wed Dec 23 17:29:28 2009 @@ -46,7 +46,7 @@ #include "llvm/Instruction.def" void visitInstruction(Instruction &I) { - dbgs() << "Instruction Count does not know about " << I; + errs() << "Instruction Count does not know about " << I; llvm_unreachable(0); } public: From greened at obbligato.org Wed Dec 23 17:38:28 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:38:28 -0000 Subject: [llvm-commits] [llvm] r92088 - /llvm/trunk/lib/AsmParser/LLParser.cpp Message-ID: <200912232338.nBNNcSoQ029837@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:38:28 2009 New Revision: 92088 URL: http://llvm.org/viewvc/llvm-project?rev=92088&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/AsmParser/LLParser.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=92088&r1=92087&r2=92088&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Dec 23 17:38:28 2009 @@ -1213,7 +1213,7 @@ PATypeHolder Ty(ty); #if 0 - errs() << "Type '" << Ty->getDescription() + dbgs() << "Type '" << Ty->getDescription() << "' newly formed. Resolving upreferences.\n" << UpRefs.size() << " upreferences active!\n"; #endif @@ -1231,7 +1231,7 @@ UpRefs[i].LastContainedTy) != Ty->subtype_end(); #if 0 - errs() << " UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " + dbgs() << " UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " << UpRefs[i].LastContainedTy->getDescription() << ") = " << (ContainsType ? "true" : "false") << " level=" << UpRefs[i].NestingLevel << "\n"; @@ -1248,7 +1248,7 @@ continue; #if 0 - errs() << " * Resolving upreference for " << UpRefs[i].UpRefTy << "\n"; + dbgs() << " * Resolving upreference for " << UpRefs[i].UpRefTy << "\n"; #endif if (!TypeToResolve) TypeToResolve = UpRefs[i].UpRefTy; From greened at obbligato.org Wed Dec 23 17:47:54 2009 From: greened at obbligato.org (David Greene) Date: Wed, 23 Dec 2009 23:47:54 -0000 Subject: [llvm-commits] [llvm] r92091 - /llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Message-ID: <200912232347.nBNNlsYa030225@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 17:47:53 2009 New Revision: 92091 URL: http://llvm.org/viewvc/llvm-project?rev=92091&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=92091&r1=92090&r2=92091&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Wed Dec 23 17:47:53 2009 @@ -353,7 +353,7 @@ assert (!HasFinalPtr(E) && "Pointer already registered."); #ifdef DEBUG_BACKPATCH - errs() << "RegisterPtr: " << PtrId << " => " << Ptr << "\n"; + dbgs() << "RegisterPtr: " << PtrId << " => " << Ptr << "\n"; #endif SetPtr(E,Ptr); @@ -373,7 +373,7 @@ PtrRef = GetFinalPtr(E); #ifdef DEBUG_BACKPATCH - errs() << "ReadUintPtr: " << PtrId + dbgs() << "ReadUintPtr: " << PtrId << " <-- " << (void*) GetFinalPtr(E) << '\n'; #endif } @@ -382,7 +382,7 @@ "Client forbids backpatching for this pointer."); #ifdef DEBUG_BACKPATCH - errs() << "ReadUintPtr: " << PtrId << " (NO PTR YET)\n"; + dbgs() << "ReadUintPtr: " << PtrId << " (NO PTR YET)\n"; #endif // Register backpatch. Check the freelist for a BPNode. From greened at obbligato.org Wed Dec 23 18:06:27 2009 From: greened at obbligato.org (David Greene) Date: Thu, 24 Dec 2009 00:06:27 -0000 Subject: [llvm-commits] [llvm] r92092 - /llvm/trunk/lib/Bitcode/Writer/Serialize.cpp Message-ID: <200912240006.nBO06RHq031013@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 18:06:26 2009 New Revision: 92092 URL: http://llvm.org/viewvc/llvm-project?rev=92092&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/Bitcode/Writer/Serialize.cpp Modified: llvm/trunk/lib/Bitcode/Writer/Serialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/Serialize.cpp?rev=92092&r1=92091&r2=92092&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/Serialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/Serialize.cpp Wed Dec 23 18:06:26 2009 @@ -83,7 +83,7 @@ if (I == PtrMap.end()) { unsigned id = PtrMap.size()+1; #ifdef DEBUG_BACKPATCH - errs() << "Registered PTR: " << ptr << " => " << id << "\n"; + dbgs() << "Registered PTR: " << ptr << " => " << id << "\n"; #endif PtrMap[ptr] = id; return id; From greened at obbligato.org Wed Dec 23 18:14:25 2009 From: greened at obbligato.org (David Greene) Date: Thu, 24 Dec 2009 00:14:25 -0000 Subject: [llvm-commits] [llvm] r92093 - /llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp Message-ID: <200912240014.nBO0EPsh031354@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 18:14:25 2009 New Revision: 92093 URL: http://llvm.org/viewvc/llvm-project?rev=92093&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp Modified: llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp?rev=92093&r1=92092&r2=92093&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp (original) +++ llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp Wed Dec 23 18:14:25 2009 @@ -127,11 +127,11 @@ CriticalPathSet |= CPSet; } - DEBUG(errs() << "AntiDep Critical-Path Registers:"); + DEBUG(dbgs() << "AntiDep Critical-Path Registers:"); DEBUG(for (int r = CriticalPathSet.find_first(); r != -1; r = CriticalPathSet.find_next(r)) - errs() << " " << TRI->getName(r)); - DEBUG(errs() << '\n'); + dbgs() << " " << TRI->getName(r)); + DEBUG(dbgs() << '\n'); } AggressiveAntiDepBreaker::~AggressiveAntiDepBreaker() { @@ -218,9 +218,9 @@ PrescanInstruction(MI, Count, PassthruRegs); ScanInstruction(MI, Count); - DEBUG(errs() << "Observe: "); + DEBUG(dbgs() << "Observe: "); DEBUG(MI->dump()); - DEBUG(errs() << "\tRegs:"); + DEBUG(dbgs() << "\tRegs:"); unsigned *DefIndices = State->GetDefIndices(); for (unsigned Reg = 0; Reg != TRI->getNumRegs(); ++Reg) { @@ -232,14 +232,14 @@ // schedule region). if (State->IsLive(Reg)) { DEBUG(if (State->GetGroup(Reg) != 0) - errs() << " " << TRI->getName(Reg) << "=g" << + dbgs() << " " << TRI->getName(Reg) << "=g" << State->GetGroup(Reg) << "->g0(region live-out)"); State->UnionGroups(Reg, 0); } else if ((DefIndices[Reg] < InsertPosIndex) && (DefIndices[Reg] >= Count)) { DefIndices[Reg] = Count; } } - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); } bool AggressiveAntiDepBreaker::IsImplicitDefUse(MachineInstr *MI, @@ -333,8 +333,8 @@ RegRefs.erase(Reg); State->LeaveGroup(Reg); DEBUG(if (header != NULL) { - errs() << header << TRI->getName(Reg); header = NULL; }); - DEBUG(errs() << "->g" << State->GetGroup(Reg) << tag); + dbgs() << header << TRI->getName(Reg); header = NULL; }); + DEBUG(dbgs() << "->g" << State->GetGroup(Reg) << tag); } // Repeat for subregisters. for (const unsigned *Subreg = TRI->getSubRegisters(Reg); @@ -346,13 +346,13 @@ RegRefs.erase(SubregReg); State->LeaveGroup(SubregReg); DEBUG(if (header != NULL) { - errs() << header << TRI->getName(Reg); header = NULL; }); - DEBUG(errs() << " " << TRI->getName(SubregReg) << "->g" << + dbgs() << header << TRI->getName(Reg); header = NULL; }); + DEBUG(dbgs() << " " << TRI->getName(SubregReg) << "->g" << State->GetGroup(SubregReg) << tag); } } - DEBUG(if ((header == NULL) && (footer != NULL)) errs() << footer); + DEBUG(if ((header == NULL) && (footer != NULL)) dbgs() << footer); } void AggressiveAntiDepBreaker::PrescanInstruction(MachineInstr *MI, unsigned Count, @@ -375,20 +375,20 @@ HandleLastUse(Reg, Count + 1, "", "\tDead Def: ", "\n"); } - DEBUG(errs() << "\tDef Groups:"); + DEBUG(dbgs() << "\tDef Groups:"); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); if (!MO.isReg() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) continue; - DEBUG(errs() << " " << TRI->getName(Reg) << "=g" << State->GetGroup(Reg)); + DEBUG(dbgs() << " " << TRI->getName(Reg) << "=g" << State->GetGroup(Reg)); // If MI's defs have a special allocation requirement, don't allow // any def registers to be changed. Also assume all registers // defined in a call must not be changed (ABI). if (MI->getDesc().isCall() || MI->getDesc().hasExtraDefRegAllocReq()) { - DEBUG(if (State->GetGroup(Reg) != 0) errs() << "->g0(alloc-req)"); + DEBUG(if (State->GetGroup(Reg) != 0) dbgs() << "->g0(alloc-req)"); State->UnionGroups(Reg, 0); } @@ -398,7 +398,7 @@ unsigned AliasReg = *Alias; if (State->IsLive(AliasReg)) { State->UnionGroups(Reg, AliasReg); - DEBUG(errs() << "->g" << State->GetGroup(Reg) << "(via " << + DEBUG(dbgs() << "->g" << State->GetGroup(Reg) << "(via " << TRI->getName(AliasReg) << ")"); } } @@ -411,7 +411,7 @@ RegRefs.insert(std::make_pair(Reg, RR)); } - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); // Scan the register defs for this instruction and update // live-ranges. @@ -437,7 +437,7 @@ void AggressiveAntiDepBreaker::ScanInstruction(MachineInstr *MI, unsigned Count) { - DEBUG(errs() << "\tUse Groups:"); + DEBUG(dbgs() << "\tUse Groups:"); std::multimap& RegRefs = State->GetRegRefs(); @@ -449,7 +449,7 @@ unsigned Reg = MO.getReg(); if (Reg == 0) continue; - DEBUG(errs() << " " << TRI->getName(Reg) << "=g" << + DEBUG(dbgs() << " " << TRI->getName(Reg) << "=g" << State->GetGroup(Reg)); // It wasn't previously live but now it is, this is a kill. Forget @@ -461,7 +461,7 @@ // any use registers to be changed. Also assume all registers // used in a call must not be changed (ABI). if (MI->getDesc().isCall() || MI->getDesc().hasExtraSrcRegAllocReq()) { - DEBUG(if (State->GetGroup(Reg) != 0) errs() << "->g0(alloc-req)"); + DEBUG(if (State->GetGroup(Reg) != 0) dbgs() << "->g0(alloc-req)"); State->UnionGroups(Reg, 0); } @@ -473,12 +473,12 @@ RegRefs.insert(std::make_pair(Reg, RR)); } - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); // Form a group of all defs and uses of a KILL instruction to ensure // that all registers are renamed as a group. if (MI->getOpcode() == TargetInstrInfo::KILL) { - DEBUG(errs() << "\tKill Group:"); + DEBUG(dbgs() << "\tKill Group:"); unsigned FirstReg = 0; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { @@ -488,15 +488,15 @@ if (Reg == 0) continue; if (FirstReg != 0) { - DEBUG(errs() << "=" << TRI->getName(Reg)); + DEBUG(dbgs() << "=" << TRI->getName(Reg)); State->UnionGroups(FirstReg, Reg); } else { - DEBUG(errs() << " " << TRI->getName(Reg)); + DEBUG(dbgs() << " " << TRI->getName(Reg)); FirstReg = Reg; } } - DEBUG(errs() << "->g" << State->GetGroup(FirstReg) << '\n'); + DEBUG(dbgs() << "->g" << State->GetGroup(FirstReg) << '\n'); } } @@ -525,7 +525,7 @@ BV &= RCBV; } - DEBUG(errs() << " " << RC->getName()); + DEBUG(dbgs() << " " << RC->getName()); } return BV; @@ -552,7 +552,7 @@ // Find the "superest" register in the group. At the same time, // collect the BitVector of registers that can be used to rename // each register. - DEBUG(errs() << "\tRename Candidates for Group g" << AntiDepGroupIndex << ":\n"); + DEBUG(dbgs() << "\tRename Candidates for Group g" << AntiDepGroupIndex << ":\n"); std::map RenameRegisterMap; unsigned SuperReg = 0; for (unsigned i = 0, e = Regs.size(); i != e; ++i) { @@ -562,15 +562,15 @@ // If Reg has any references, then collect possible rename regs if (RegRefs.count(Reg) > 0) { - DEBUG(errs() << "\t\t" << TRI->getName(Reg) << ":"); + DEBUG(dbgs() << "\t\t" << TRI->getName(Reg) << ":"); BitVector BV = GetRenameRegisters(Reg); RenameRegisterMap.insert(std::pair(Reg, BV)); - DEBUG(errs() << " ::"); + DEBUG(dbgs() << " ::"); DEBUG(for (int r = BV.find_first(); r != -1; r = BV.find_next(r)) - errs() << " " << TRI->getName(r)); - DEBUG(errs() << "\n"); + dbgs() << " " << TRI->getName(r)); + DEBUG(dbgs() << "\n"); } } @@ -591,7 +591,7 @@ if (renamecnt++ % DebugDiv != DebugMod) return false; - errs() << "*** Performing rename " << TRI->getName(SuperReg) << + dbgs() << "*** Performing rename " << TRI->getName(SuperReg) << " for debug ***\n"; } #endif @@ -606,11 +606,11 @@ const TargetRegisterClass::iterator RB = SuperRC->allocation_order_begin(MF); const TargetRegisterClass::iterator RE = SuperRC->allocation_order_end(MF); if (RB == RE) { - DEBUG(errs() << "\tEmpty Super Regclass!!\n"); + DEBUG(dbgs() << "\tEmpty Super Regclass!!\n"); return false; } - DEBUG(errs() << "\tFind Registers:"); + DEBUG(dbgs() << "\tFind Registers:"); if (RenameOrder.count(SuperRC) == 0) RenameOrder.insert(RenameOrderType::value_type(SuperRC, RE)); @@ -625,7 +625,7 @@ // Don't replace a register with itself. if (NewSuperReg == SuperReg) continue; - DEBUG(errs() << " [" << TRI->getName(NewSuperReg) << ':'); + DEBUG(dbgs() << " [" << TRI->getName(NewSuperReg) << ':'); RenameMap.clear(); // For each referenced group register (which must be a SuperReg or @@ -642,12 +642,12 @@ NewReg = TRI->getSubReg(NewSuperReg, NewSubRegIdx); } - DEBUG(errs() << " " << TRI->getName(NewReg)); + DEBUG(dbgs() << " " << TRI->getName(NewReg)); // Check if Reg can be renamed to NewReg. BitVector BV = RenameRegisterMap[Reg]; if (!BV.test(NewReg)) { - DEBUG(errs() << "(no rename)"); + DEBUG(dbgs() << "(no rename)"); goto next_super_reg; } @@ -656,7 +656,7 @@ // must also check all aliases of NewReg, because we can't define a // register when any sub or super is already live. if (State->IsLive(NewReg) || (KillIndices[Reg] > DefIndices[NewReg])) { - DEBUG(errs() << "(live)"); + DEBUG(dbgs() << "(live)"); goto next_super_reg; } else { bool found = false; @@ -664,7 +664,7 @@ *Alias; ++Alias) { unsigned AliasReg = *Alias; if (State->IsLive(AliasReg) || (KillIndices[Reg] > DefIndices[AliasReg])) { - DEBUG(errs() << "(alias " << TRI->getName(AliasReg) << " live)"); + DEBUG(dbgs() << "(alias " << TRI->getName(AliasReg) << " live)"); found = true; break; } @@ -681,14 +681,14 @@ // renamed, as recorded in RenameMap. RenameOrder.erase(SuperRC); RenameOrder.insert(RenameOrderType::value_type(SuperRC, R)); - DEBUG(errs() << "]\n"); + DEBUG(dbgs() << "]\n"); return true; next_super_reg: - DEBUG(errs() << ']'); + DEBUG(dbgs() << ']'); } while (R != EndR); - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); // No registers are free and available! return false; @@ -740,13 +740,13 @@ } #ifndef NDEBUG - DEBUG(errs() << "\n===== Aggressive anti-dependency breaking\n"); - DEBUG(errs() << "Available regs:"); + DEBUG(dbgs() << "\n===== Aggressive anti-dependency breaking\n"); + DEBUG(dbgs() << "Available regs:"); for (unsigned Reg = 0; Reg < TRI->getNumRegs(); ++Reg) { if (!State->IsLive(Reg)) - DEBUG(errs() << " " << TRI->getName(Reg)); + DEBUG(dbgs() << " " << TRI->getName(Reg)); } - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); #endif // Attempt to break anti-dependence edges. Walk the instructions @@ -758,7 +758,7 @@ I != E; --Count) { MachineInstr *MI = --I; - DEBUG(errs() << "Anti: "); + DEBUG(dbgs() << "Anti: "); DEBUG(MI->dump()); std::set PassthruRegs; @@ -795,30 +795,30 @@ (Edge->getKind() != SDep::Output)) continue; unsigned AntiDepReg = Edge->getReg(); - DEBUG(errs() << "\tAntidep reg: " << TRI->getName(AntiDepReg)); + DEBUG(dbgs() << "\tAntidep reg: " << TRI->getName(AntiDepReg)); assert(AntiDepReg != 0 && "Anti-dependence on reg0?"); if (!AllocatableSet.test(AntiDepReg)) { // Don't break anti-dependencies on non-allocatable registers. - DEBUG(errs() << " (non-allocatable)\n"); + DEBUG(dbgs() << " (non-allocatable)\n"); continue; } else if ((ExcludeRegs != NULL) && ExcludeRegs->test(AntiDepReg)) { // Don't break anti-dependencies for critical path registers // if not on the critical path - DEBUG(errs() << " (not critical-path)\n"); + DEBUG(dbgs() << " (not critical-path)\n"); continue; } else if (PassthruRegs.count(AntiDepReg) != 0) { // If the anti-dep register liveness "passes-thru", then // don't try to change it. It will be changed along with // the use if required to break an earlier antidep. - DEBUG(errs() << " (passthru)\n"); + DEBUG(dbgs() << " (passthru)\n"); continue; } else { // No anti-dep breaking for implicit deps MachineOperand *AntiDepOp = MI->findRegisterDefOperand(AntiDepReg); assert(AntiDepOp != NULL && "Can't find index for defined register operand"); if ((AntiDepOp == NULL) || AntiDepOp->isImplicit()) { - DEBUG(errs() << " (implicit)\n"); + DEBUG(dbgs() << " (implicit)\n"); continue; } @@ -844,13 +844,13 @@ PE = PathSU->Preds.end(); P != PE; ++P) { if ((P->getSUnit() == NextSU) && (P->getKind() != SDep::Anti) && (P->getKind() != SDep::Output)) { - DEBUG(errs() << " (real dependency)\n"); + DEBUG(dbgs() << " (real dependency)\n"); AntiDepReg = 0; break; } else if ((P->getSUnit() != NextSU) && (P->getKind() == SDep::Data) && (P->getReg() == AntiDepReg)) { - DEBUG(errs() << " (other dependency)\n"); + DEBUG(dbgs() << " (other dependency)\n"); AntiDepReg = 0; break; } @@ -865,16 +865,16 @@ // Determine AntiDepReg's register group. const unsigned GroupIndex = State->GetGroup(AntiDepReg); if (GroupIndex == 0) { - DEBUG(errs() << " (zero group)\n"); + DEBUG(dbgs() << " (zero group)\n"); continue; } - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); // Look for a suitable register to use to break the anti-dependence. std::map RenameMap; if (FindSuitableFreeRegisters(GroupIndex, RenameOrder, RenameMap)) { - DEBUG(errs() << "\tBreaking anti-dependence edge on " + DEBUG(dbgs() << "\tBreaking anti-dependence edge on " << TRI->getName(AntiDepReg) << ":"); // Handle each group register... @@ -883,7 +883,7 @@ unsigned CurrReg = S->first; unsigned NewReg = S->second; - DEBUG(errs() << " " << TRI->getName(CurrReg) << "->" << + DEBUG(dbgs() << " " << TRI->getName(CurrReg) << "->" << TRI->getName(NewReg) << "(" << RegRefs.count(CurrReg) << " refs)"); @@ -917,7 +917,7 @@ } ++Broken; - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); } } } From greened at obbligato.org Wed Dec 23 18:27:56 2009 From: greened at obbligato.org (David Greene) Date: Thu, 24 Dec 2009 00:27:56 -0000 Subject: [llvm-commits] [llvm] r92094 - /llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Message-ID: <200912240027.nBO0RuZo031797@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 18:27:55 2009 New Revision: 92094 URL: http://llvm.org/viewvc/llvm-project?rev=92094&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=92094&r1=92093&r2=92094&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Wed Dec 23 18:27:55 2009 @@ -16,6 +16,7 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" using namespace llvm; @@ -93,7 +94,7 @@ << '\n'; } } -void DIEAbbrev::dump() { print(errs()); } +void DIEAbbrev::dump() { print(dbgs()); } #endif //===----------------------------------------------------------------------===// @@ -164,14 +165,14 @@ } void DIE::dump() { - print(errs()); + print(dbgs()); } #endif #ifndef NDEBUG void DIEValue::dump() { - print(errs()); + print(dbgs()); } #endif From greened at obbligato.org Wed Dec 23 18:31:35 2009 From: greened at obbligato.org (David Greene) Date: Thu, 24 Dec 2009 00:31:35 -0000 Subject: [llvm-commits] [llvm] r92096 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200912240031.nBO0VZY8031947@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 18:31:35 2009 New Revision: 92096 URL: http://llvm.org/viewvc/llvm-project?rev=92096&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=92096&r1=92095&r2=92096&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Dec 23 18:31:35 2009 @@ -239,7 +239,7 @@ #ifndef NDEBUG void DbgScope::dump() const { - raw_ostream &err = errs(); + raw_ostream &err = dbgs(); err.indent(IndentLevel); MDNode *N = Desc.getNode(); N->dump(); From greened at obbligato.org Wed Dec 23 18:34:21 2009 From: greened at obbligato.org (David Greene) Date: Thu, 24 Dec 2009 00:34:21 -0000 Subject: [llvm-commits] [llvm] r92097 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp Message-ID: <200912240034.nBO0YL3I032049@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 18:34:21 2009 New Revision: 92097 URL: http://llvm.org/viewvc/llvm-project?rev=92097&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=92097&r1=92096&r2=92097&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Wed Dec 23 18:34:21 2009 @@ -98,7 +98,7 @@ /// function, updating the CFG. void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) { assert(MBB->pred_empty() && "MBB must be dead!"); - DEBUG(errs() << "\nRemoving MBB: " << *MBB); + DEBUG(dbgs() << "\nRemoving MBB: " << *MBB); MachineFunction *MF = MBB->getParent(); // drop all successors. @@ -636,7 +636,7 @@ SameTails[commonTailIndex].getTailStartPos(); MachineBasicBlock *MBB = SameTails[commonTailIndex].getBlock(); - DEBUG(errs() << "\nSplitting BB#" << MBB->getNumber() << ", size " + DEBUG(dbgs() << "\nSplitting BB#" << MBB->getNumber() << ", size " << maxCommonTailLength); MachineBasicBlock *newMBB = SplitMBBAt(*MBB, BBI); @@ -666,18 +666,18 @@ // this many instructions in common. unsigned minCommonTailLength = TailMergeSize; - DEBUG(errs() << "\nTryTailMergeBlocks: "; + DEBUG(dbgs() << "\nTryTailMergeBlocks: "; for (unsigned i = 0, e = MergePotentials.size(); i != e; ++i) - errs() << "BB#" << MergePotentials[i].getBlock()->getNumber() + dbgs() << "BB#" << MergePotentials[i].getBlock()->getNumber() << (i == e-1 ? "" : ", "); - errs() << "\n"; + dbgs() << "\n"; if (SuccBB) { - errs() << " with successor BB#" << SuccBB->getNumber() << '\n'; + dbgs() << " with successor BB#" << SuccBB->getNumber() << '\n'; if (PredBB) - errs() << " which has fall-through from BB#" + dbgs() << " which has fall-through from BB#" << PredBB->getNumber() << "\n"; } - errs() << "Looking for common tails of at least " + dbgs() << "Looking for common tails of at least " << minCommonTailLength << " instruction" << (minCommonTailLength == 1 ? "" : "s") << '\n'; ); @@ -748,19 +748,19 @@ MachineBasicBlock *MBB = SameTails[commonTailIndex].getBlock(); // MBB is common tail. Adjust all other BB's to jump to this one. // Traversal must be forwards so erases work. - DEBUG(errs() << "\nUsing common tail in BB#" << MBB->getNumber() + DEBUG(dbgs() << "\nUsing common tail in BB#" << MBB->getNumber() << " for "); for (unsigned int i=0, e = SameTails.size(); i != e; ++i) { if (commonTailIndex == i) continue; - DEBUG(errs() << "BB#" << SameTails[i].getBlock()->getNumber() + DEBUG(dbgs() << "BB#" << SameTails[i].getBlock()->getNumber() << (i == e-1 ? "" : ", ")); // Hack the end off BB i, making it jump to BB commonTailIndex instead. ReplaceTailWithBranchTo(SameTails[i].getTailStartPos(), MBB); // BB i is no longer a predecessor of SuccBB; remove it from the worklist. MergePotentials.erase(SameTails[i].getMPIter()); } - DEBUG(errs() << "\n"); + DEBUG(dbgs() << "\n"); // We leave commonTailIndex in the worklist in case there are other blocks // that match it with a smaller number of instructions. MadeChange = true; @@ -999,7 +999,7 @@ if (PriorCond.empty() && !PriorTBB && MBB->pred_size() == 1 && PrevBB.succ_size() == 1 && !MBB->hasAddressTaken()) { - DEBUG(errs() << "\nMerging into block: " << PrevBB + DEBUG(dbgs() << "\nMerging into block: " << PrevBB << "From MBB: " << *MBB); PrevBB.splice(PrevBB.end(), MBB, MBB->begin(), MBB->end()); PrevBB.removeSuccessor(PrevBB.succ_begin());; @@ -1084,7 +1084,7 @@ // Reverse the branch so we will fall through on the previous true cond. SmallVector NewPriorCond(PriorCond); if (!TII->ReverseBranchCondition(NewPriorCond)) { - DEBUG(errs() << "\nMoving MBB: " << *MBB + DEBUG(dbgs() << "\nMoving MBB: " << *MBB << "To make fallthrough to: " << *PriorTBB << "\n"); TII->RemoveBranch(PrevBB); From clattner at apple.com Wed Dec 23 18:37:25 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 16:37:25 -0800 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <200912231723.47309.dag@cray.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <200912231719.24530.dag@cray.com> <200912231723.47309.dag@cray.com> Message-ID: <640EE88D-2840-4D67-83C2-C815E04FA9E5@apple.com> On Dec 23, 2009, at 3:23 PM, David Greene wrote: > On Wednesday 23 December 2009 17:19, David Greene wrote: > >> The intent was always that dbgs() == errs() if debugging is off. > > And it is that way. When -debug is off the buffer size is zero and > output goes straight to errs(). Ah, great point! I withdraw my objection to using dbgs() before llvm_unreachable(). Thanks David, -Chris From sabre at nondot.org Wed Dec 23 18:37:38 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Dec 2009 00:37:38 -0000 Subject: [llvm-commits] [llvm] r92098 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h lib/Transforms/Scalar/SimplifyLibCalls.cpp test/CodeGen/X86/memcmp.ll test/Transforms/SimplifyLibCalls/memcmp.ll Message-ID: <200912240037.nBO0bc3a032176@zion.cs.uiuc.edu> Author: lattner Date: Wed Dec 23 18:37:38 2009 New Revision: 92098 URL: http://llvm.org/viewvc/llvm-project?rev=92098&view=rev Log: move an optimization for memcmp out of simplifylibcalls and into SDISel. This optimization was causing simplifylibcalls to introduce type-unsafe nastiness. This is the first step, I'll be expanding the memcmp optimizations shortly, covering things that we really really wouldn't want simplifylibcalls to do. Added: llvm/trunk/test/CodeGen/X86/memcmp.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/test/Transforms/SimplifyLibCalls/memcmp.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=92098&r1=92097&r2=92098&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Dec 23 18:37:38 2009 @@ -17,6 +17,7 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Constants.h" #include "llvm/CallingConv.h" #include "llvm/DerivedTypes.h" @@ -5075,6 +5076,105 @@ } } +/// IsOnlyUsedInZeroEqualityComparison - Return true if it only matters that the +/// value is equal or not-equal to zero. +static bool IsOnlyUsedInZeroEqualityComparison(Value *V) { + for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); + UI != E; ++UI) { + if (ICmpInst *IC = dyn_cast(*UI)) + if (IC->isEquality()) + if (Constant *C = dyn_cast(IC->getOperand(1))) + if (C->isNullValue()) + continue; + // Unknown instruction. + return false; + } + return true; +} + +static SDValue getMemCmpLoad(Value *PtrVal, unsigned Size, + SelectionDAGBuilder &Builder) { + MVT LoadVT; + const Type *LoadTy; + if (Size == 2) { + LoadVT = MVT::i16; + LoadTy = Type::getInt16Ty(PtrVal->getContext()); + } else { + LoadVT = MVT::i32; + LoadTy = Type::getInt32Ty(PtrVal->getContext()); + } + + // Check to see if this load can be trivially constant folded, e.g. if the + // input is from a string literal. + if (Constant *LoadInput = dyn_cast(PtrVal)) { + // Cast pointer to the type we really want to load. + LoadInput = ConstantExpr::getBitCast(LoadInput, + PointerType::getUnqual(LoadTy)); + + if (Constant *LoadCst = ConstantFoldLoadFromConstPtr(LoadInput, Builder.TD)) + return Builder.getValue(LoadCst); + } + + // Otherwise, we have to emit the load. If the pointer is to unfoldable but + // still constant memory, the input chain can be the entry node. + SDValue Root; + bool ConstantMemory = false; + + // Do not serialize (non-volatile) loads of constant memory with anything. + if (Builder.AA->pointsToConstantMemory(PtrVal)) { + Root = Builder.DAG.getEntryNode(); + ConstantMemory = true; + } else { + // Do not serialize non-volatile loads against each other. + Root = Builder.DAG.getRoot(); + } + + SDValue Ptr = Builder.getValue(PtrVal); + SDValue LoadVal = Builder.DAG.getLoad(LoadVT, Builder.getCurDebugLoc(), Root, + Ptr, PtrVal /*SrcValue*/, 0/*SVOffset*/, + false /*volatile*/, 1 /* align=1 */); + + if (!ConstantMemory) + Builder.PendingLoads.push_back(LoadVal.getValue(1)); + return LoadVal; +} + + +/// visitMemCmpCall - See if we can lower a call to memcmp in an optimized form. +/// If so, return true and lower it, otherwise return false and it will be +/// lowered like a normal call. +bool SelectionDAGBuilder::visitMemCmpCall(CallInst &I) { + // Verify that the prototype makes sense. int memcmp(void*,void*,size_t) + if (I.getNumOperands() != 4) + return false; + + Value *LHS = I.getOperand(1), *RHS = I.getOperand(2); + if (!isa(LHS->getType()) || !isa(RHS->getType()) || + !isa(I.getOperand(3)->getType()) || + !isa(I.getType())) + return false; + + ConstantInt *Size = dyn_cast(I.getOperand(3)); + + // memcmp(S1,S2,2) != 0 -> (*(short*)LHS != *(short*)RHS) != 0 + // memcmp(S1,S2,4) != 0 -> (*(int*)LHS != *(int*)RHS) != 0 + if (Size && (Size->getValue() == 2 || Size->getValue() == 4) && + IsOnlyUsedInZeroEqualityComparison(&I)) { + SDValue LHSVal = getMemCmpLoad(LHS, Size->getZExtValue(), *this); + SDValue RHSVal = getMemCmpLoad(RHS, Size->getZExtValue(), *this); + + SDValue Res = DAG.getSetCC(getCurDebugLoc(), MVT::i1, LHSVal, RHSVal, + ISD::SETNE); + EVT CallVT = TLI.getValueType(I.getType(), true); + setValue(&I, DAG.getZExtOrTrunc(Res, getCurDebugLoc(), CallVT)); + return true; + } + + + return false; +} + + void SelectionDAGBuilder::visitCall(CallInst &I) { const char *RenameFn = 0; if (Function *F = I.getCalledFunction()) { @@ -5148,6 +5248,9 @@ Tmp.getValueType(), Tmp)); return; } + } else if (Name == "memcmp") { + if (visitMemCmpCall(I)) + return; } } } else if (isa(I.getOperand(0))) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=92098&r1=92097&r2=92098&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Wed Dec 23 18:37:38 2009 @@ -91,11 +91,13 @@ DenseMap NodeMap; +public: /// PendingLoads - Loads are not emitted to the program immediately. We bunch /// them up and then emit token factor nodes when possible. This allows us to /// get simple disambiguation between loads without worrying about alias /// analysis. SmallVector PendingLoads; +private: /// PendingExports - CopyToReg nodes that copy values to virtual registers /// for export to other blocks need to be emitted before any terminator @@ -461,6 +463,8 @@ void visitStore(StoreInst &I); void visitPHI(PHINode &I) { } // PHI nodes are handled specially. void visitCall(CallInst &I); + bool visitMemCmpCall(CallInst &I); + void visitInlineAsm(CallSite CS); const char *visitIntrinsicCall(CallInst &I, unsigned Intrinsic); void visitTargetIntrinsic(CallInst &I, unsigned Intrinsic); Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=92098&r1=92097&r2=92098&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Wed Dec 23 18:37:38 2009 @@ -1011,19 +1011,6 @@ return B.CreateSExt(B.CreateSub(LHSV, RHSV, "chardiff"), CI->getType()); } - // memcmp(S1,S2,2) != 0 -> (*(short*)LHS ^ *(short*)RHS) != 0 - // memcmp(S1,S2,4) != 0 -> (*(int*)LHS ^ *(int*)RHS) != 0 - if ((Len == 2 || Len == 4) && IsOnlyUsedInZeroEqualityComparison(CI)) { - const Type *PTy = PointerType::getUnqual(Len == 2 ? - Type::getInt16Ty(*Context) : Type::getInt32Ty(*Context)); - LHS = B.CreateBitCast(LHS, PTy, "tmp"); - RHS = B.CreateBitCast(RHS, PTy, "tmp"); - LoadInst *LHSV = B.CreateLoad(LHS, "lhsv"); - LoadInst *RHSV = B.CreateLoad(RHS, "rhsv"); - LHSV->setAlignment(1); RHSV->setAlignment(1); // Unaligned loads. - return B.CreateZExt(B.CreateXor(LHSV, RHSV, "shortdiff"), CI->getType()); - } - // Constant folding: memcmp(x, y, l) -> cnst (all arguments are constant) std::string LHSStr, RHSStr; if (GetConstantStringInfo(LHS, LHSStr) && Added: llvm/trunk/test/CodeGen/X86/memcmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/memcmp.ll?rev=92098&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/memcmp.ll (added) +++ llvm/trunk/test/CodeGen/X86/memcmp.ll Wed Dec 23 18:37:38 2009 @@ -0,0 +1,76 @@ +; RUN: llc %s -o - -march=x86-64 | FileCheck %s + +; This tests codegen time inlining/optimization of memcmp +; rdar://6480398 + + at .str = private constant [6 x i8] c"fooxx\00", align 1 ; <[6 x i8]*> [#uses=1] + +declare i32 @memcmp(...) + +define void @memcmp2(i8* %X, i8* %Y, i32* nocapture %P) nounwind { +entry: + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 2) nounwind ; [#uses=1] + %1 = icmp eq i32 %0, 0 ; [#uses=1] + br i1 %1, label %return, label %bb + +bb: ; preds = %entry + store i32 4, i32* %P, align 4 + ret void + +return: ; preds = %entry + ret void +; CHECK: memcmp2: +; CHECK: movw (%rsi), %ax +; CHECK: cmpw %ax, (%rdi) +} + +define void @memcmp2a(i8* %X, i32* nocapture %P) nounwind { +entry: + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 1), i32 2) nounwind ; [#uses=1] + %1 = icmp eq i32 %0, 0 ; [#uses=1] + br i1 %1, label %return, label %bb + +bb: ; preds = %entry + store i32 4, i32* %P, align 4 + ret void + +return: ; preds = %entry + ret void +; CHECK: memcmp2a: +; CHECK: cmpw $28527, (%rdi) +} + + +define void @memcmp4(i8* %X, i8* %Y, i32* nocapture %P) nounwind { +entry: + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 4) nounwind ; [#uses=1] + %1 = icmp eq i32 %0, 0 ; [#uses=1] + br i1 %1, label %return, label %bb + +bb: ; preds = %entry + store i32 4, i32* %P, align 4 + ret void + +return: ; preds = %entry + ret void +; CHECK: memcmp4: +; CHECK: movl (%rsi), %eax +; CHECK: cmpl %eax, (%rdi) +} + +define void @memcmp4a(i8* %X, i32* nocapture %P) nounwind { +entry: + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 1), i32 4) nounwind ; [#uses=1] + %1 = icmp eq i32 %0, 0 ; [#uses=1] + br i1 %1, label %return, label %bb + +bb: ; preds = %entry + store i32 4, i32* %P, align 4 + ret void + +return: ; preds = %entry + ret void +; CHECK: memcmp4a: +; CHECK: cmpl $2021158767, (%rdi) +} + Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/memcmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/memcmp.ll?rev=92098&r1=92097&r2=92098&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/memcmp.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/memcmp.ll Wed Dec 23 18:37:38 2009 @@ -14,9 +14,6 @@ volatile store i32 %B, i32* %IP %C = call i32 @memcmp( i8* %P, i8* %Q, i32 1 ) ; [#uses=1] volatile store i32 %C, i32* %IP - %D = call i32 @memcmp( i8* %P, i8* %Q, i32 2 ) ; [#uses=1] - %E = icmp eq i32 %D, 0 ; [#uses=1] - volatile store i1 %E, i1* %BP %F = call i32 @memcmp(i8* getelementptr ([4 x i8]* @hel, i32 0, i32 0), i8* getelementptr ([8 x i8]* @hello_u, i32 0, i32 0), i32 3) From greened at obbligato.org Wed Dec 23 18:39:02 2009 From: greened at obbligato.org (David Greene) Date: Thu, 24 Dec 2009 00:39:02 -0000 Subject: [llvm-commits] [llvm] r92099 - /llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Message-ID: <200912240039.nBO0d2Cd032240@zion.cs.uiuc.edu> Author: greened Date: Wed Dec 23 18:39:02 2009 New Revision: 92099 URL: http://llvm.org/viewvc/llvm-project?rev=92099&view=rev Log: Change errs() to dbgs(). Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=92099&r1=92098&r2=92099&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Wed Dec 23 18:39:02 2009 @@ -37,7 +37,7 @@ bool CalculateSpillWeights::runOnMachineFunction(MachineFunction &fn) { - DEBUG(errs() << "********** Compute Spill Weights **********\n" + DEBUG(dbgs() << "********** Compute Spill Weights **********\n" << "********** Function: " << fn.getFunction()->getName() << '\n'); From dag at cray.com Wed Dec 23 18:41:55 2009 From: dag at cray.com (David Greene) Date: Wed, 23 Dec 2009 18:41:55 -0600 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <640EE88D-2840-4D67-83C2-C815E04FA9E5@apple.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <200912231723.47309.dag@cray.com> <640EE88D-2840-4D67-83C2-C815E04FA9E5@apple.com> Message-ID: <200912231841.55614.dag@cray.com> On Wednesday 23 December 2009 18:37, Chris Lattner wrote: > On Dec 23, 2009, at 3:23 PM, David Greene wrote: > > On Wednesday 23 December 2009 17:19, David Greene wrote: > >> The intent was always that dbgs() == errs() if debugging is off. > > > > And it is that way. When -debug is off the buffer size is zero and > > output goes straight to errs(). > > Ah, great point! I withdraw my objection to using dbgs() before > llvm_unreachable(). Thanks David, Ok, I will look at changing some things back. I'm on vacation until the new year, however. Gotta beat the giant snowstorm headed this way so I'm outta the office as of now. But I might play around with some LLVM stuff on my own dime over the next couple of weeks. :) -Dave From clattner at apple.com Wed Dec 23 18:42:58 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Dec 2009 16:42:58 -0800 Subject: [llvm-commits] [llvm] r92046 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp In-Reply-To: <200912231841.55614.dag@cray.com> References: <200912232106.nBNL6EEk023567@zion.cs.uiuc.edu> <200912231723.47309.dag@cray.com> <640EE88D-2840-4D67-83C2-C815E04FA9E5@apple.com> <200912231841.55614.dag@cray.com> Message-ID: On Dec 23, 2009, at 4:41 PM, David Greene wrote: > On Wednesday 23 December 2009 18:37, Chris Lattner wrote: >> On Dec 23, 2009, at 3:23 PM, David Greene wrote: >>> On Wednesday 23 December 2009 17:19, David Greene wrote: >>>> The intent was always that dbgs() == errs() if debugging is off. >>> >>> And it is that way. When -debug is off the buffer size is zero and >>> output goes straight to errs(). >> >> Ah, great point! I withdraw my objection to using dbgs() before >> llvm_unreachable(). Thanks David, > > Ok, I will look at changing some things back. I'm on vacation until > the new year, however. Gotta beat the giant snowstorm headed this > way so I'm outta the office as of now. Sure no problem, take care David! > But I might play around with some LLVM stuff on my own dime over the > next couple of weeks. :) Hacking on compilers is fun! -Chris From sabre at nondot.org Wed Dec 23 19:07:17 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Dec 2009 01:07:17 -0000 Subject: [llvm-commits] [llvm] r92107 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/memcmp.ll Message-ID: <200912240107.nBO17I9i000785@zion.cs.uiuc.edu> Author: lattner Date: Wed Dec 23 19:07:17 2009 New Revision: 92107 URL: http://llvm.org/viewvc/llvm-project?rev=92107&view=rev Log: handle equality memcmp of 8 bytes on x86-64 with two unaligned loads and a compare. On other targets we end up with a call to memcmp because we don't want 16 individual byte loads. We should be able to use movups as well, but we're failing to select the generated icmp. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/test/CodeGen/X86/memcmp.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=92107&r1=92106&r2=92107&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Dec 23 19:07:17 2009 @@ -5092,17 +5092,8 @@ return true; } -static SDValue getMemCmpLoad(Value *PtrVal, unsigned Size, +static SDValue getMemCmpLoad(Value *PtrVal, MVT LoadVT, const Type *LoadTy, SelectionDAGBuilder &Builder) { - MVT LoadVT; - const Type *LoadTy; - if (Size == 2) { - LoadVT = MVT::i16; - LoadTy = Type::getInt16Ty(PtrVal->getContext()); - } else { - LoadVT = MVT::i32; - LoadTy = Type::getInt32Ty(PtrVal->getContext()); - } // Check to see if this load can be trivially constant folded, e.g. if the // input is from a string literal. @@ -5158,16 +5149,61 @@ // memcmp(S1,S2,2) != 0 -> (*(short*)LHS != *(short*)RHS) != 0 // memcmp(S1,S2,4) != 0 -> (*(int*)LHS != *(int*)RHS) != 0 - if (Size && (Size->getValue() == 2 || Size->getValue() == 4) && - IsOnlyUsedInZeroEqualityComparison(&I)) { - SDValue LHSVal = getMemCmpLoad(LHS, Size->getZExtValue(), *this); - SDValue RHSVal = getMemCmpLoad(RHS, Size->getZExtValue(), *this); + if (Size && IsOnlyUsedInZeroEqualityComparison(&I)) { + bool ActuallyDoIt = true; + MVT LoadVT; + const Type *LoadTy; + switch (Size->getZExtValue()) { + default: + LoadVT = MVT::Other; + LoadTy = 0; + ActuallyDoIt = false; + break; + case 2: + LoadVT = MVT::i16; + LoadTy = Type::getInt16Ty(Size->getContext()); + break; + case 4: + LoadVT = MVT::i32; + LoadTy = Type::getInt32Ty(Size->getContext()); + break; + case 8: + LoadVT = MVT::i64; + LoadTy = Type::getInt64Ty(Size->getContext()); + break; + /* + case 16: + LoadVT = MVT::v4i32; + LoadTy = Type::getInt32Ty(Size->getContext()); + LoadTy = VectorType::get(LoadTy, 4); + break; + */ + } + + // This turns into unaligned loads. We only do this if the target natively + // supports the MVT we'll be loading or if it is small enough (<= 4) that + // we'll only produce a small number of byte loads. + + // Require that we can find a legal MVT, and only do this if the target + // supports unaligned loads of that type. Expanding into byte loads would + // bloat the code. + if (ActuallyDoIt && Size->getZExtValue() > 4) { + // TODO: Handle 5 byte compare as 4-byte + 1 byte. + // TODO: Handle 8 byte compare on x86-32 as two 32-bit loads. + if (!TLI.isTypeLegal(LoadVT) ||!TLI.allowsUnalignedMemoryAccesses(LoadVT)) + ActuallyDoIt = false; + } - SDValue Res = DAG.getSetCC(getCurDebugLoc(), MVT::i1, LHSVal, RHSVal, - ISD::SETNE); - EVT CallVT = TLI.getValueType(I.getType(), true); - setValue(&I, DAG.getZExtOrTrunc(Res, getCurDebugLoc(), CallVT)); - return true; + if (ActuallyDoIt) { + SDValue LHSVal = getMemCmpLoad(LHS, LoadVT, LoadTy, *this); + SDValue RHSVal = getMemCmpLoad(RHS, LoadVT, LoadTy, *this); + + SDValue Res = DAG.getSetCC(getCurDebugLoc(), MVT::i1, LHSVal, RHSVal, + ISD::SETNE); + EVT CallVT = TLI.getValueType(I.getType(), true); + setValue(&I, DAG.getZExtOrTrunc(Res, getCurDebugLoc(), CallVT)); + return true; + } } Modified: llvm/trunk/test/CodeGen/X86/memcmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/memcmp.ll?rev=92107&r1=92106&r2=92107&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/memcmp.ll (original) +++ llvm/trunk/test/CodeGen/X86/memcmp.ll Wed Dec 23 19:07:17 2009 @@ -3,7 +3,7 @@ ; This tests codegen time inlining/optimization of memcmp ; rdar://6480398 - at .str = private constant [6 x i8] c"fooxx\00", align 1 ; <[6 x i8]*> [#uses=1] + at .str = private constant [23 x i8] c"fooooooooooooooooooooo\00", align 1 ; <[23 x i8]*> [#uses=1] declare i32 @memcmp(...) @@ -26,7 +26,7 @@ define void @memcmp2a(i8* %X, i32* nocapture %P) nounwind { entry: - %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 1), i32 2) nounwind ; [#uses=1] + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 1), i32 2) nounwind ; [#uses=1] %1 = icmp eq i32 %0, 0 ; [#uses=1] br i1 %1, label %return, label %bb @@ -60,7 +60,7 @@ define void @memcmp4a(i8* %X, i32* nocapture %P) nounwind { entry: - %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 1), i32 4) nounwind ; [#uses=1] + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 1), i32 4) nounwind ; [#uses=1] %1 = icmp eq i32 %0, 0 ; [#uses=1] br i1 %1, label %return, label %bb @@ -71,6 +71,40 @@ return: ; preds = %entry ret void ; CHECK: memcmp4a: -; CHECK: cmpl $2021158767, (%rdi) +; CHECK: cmpl $1869573999, (%rdi) +} + +define void @memcmp8(i8* %X, i8* %Y, i32* nocapture %P) nounwind { +entry: + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 8) nounwind ; [#uses=1] + %1 = icmp eq i32 %0, 0 ; [#uses=1] + br i1 %1, label %return, label %bb + +bb: ; preds = %entry + store i32 4, i32* %P, align 4 + ret void + +return: ; preds = %entry + ret void +; CHECK: memcmp8: +; CHECK: movq (%rsi), %rax +; CHECK: cmpq %rax, (%rdi) +} + +define void @memcmp8a(i8* %X, i32* nocapture %P) nounwind { +entry: + %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 0), i32 8) nounwind ; [#uses=1] + %1 = icmp eq i32 %0, 0 ; [#uses=1] + br i1 %1, label %return, label %bb + +bb: ; preds = %entry + store i32 4, i32* %P, align 4 + ret void + +return: ; preds = %entry + ret void +; CHECK: memcmp8a: +; CHECK: movabsq $8029759185026510694, %rax +; CHECK: cmpq %rax, (%rdi) } From dalej at apple.com Wed Dec 23 19:08:33 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 24 Dec 2009 01:08:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r92108 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200912240108.nBO18Xev000833@zion.cs.uiuc.edu> Author: johannes Date: Wed Dec 23 19:08:32 2009 New Revision: 92108 URL: http://llvm.org/viewvc/llvm-project?rev=92108&view=rev Log: In some cases gcc builds a MODIFY_EXPR whose RHS is smaller than its LHS. Extend RHS in this case; all the bits of LHS must be stored into, otherwise they may be used uninitialized later. 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=92108&r1=92107&r2=92108&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Dec 23 19:08:32 2009 @@ -2939,9 +2939,13 @@ if (ValTy->isSingleValueType()) { // Non-bitfield, scalar value. Just emit a store. Value *RHS = Emit(rhs, 0); - // Convert RHS to the right type if we can, otherwise convert the pointer. + // Convert RHS to the right type if we can. If LHS is bigger than RHS + // we must convert; all the bits of LHS must be stored into. Otherwise + // convert the pointer. const PointerType *PT = cast(LV.Ptr->getType()); - if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType())) + if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType()) || + (PT->getElementType()->getPrimitiveSizeInBits() > + RHS->getType()->getPrimitiveSizeInBits())) RHS = CastToAnyType(RHS, RHSSigned, PT->getElementType(), LHSSigned); else LV.Ptr = BitCastToType(LV.Ptr, RHS->getType()->getPointerTo()); From dalej at apple.com Wed Dec 23 19:10:44 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 24 Dec 2009 01:10:44 -0000 Subject: [llvm-commits] [llvm] r92110 - /llvm/trunk/test/FrontendC++/2009-12-23-MissingSext.cpp Message-ID: <200912240110.nBO1Aiv4000932@zion.cs.uiuc.edu> Author: johannes Date: Wed Dec 23 19:10:43 2009 New Revision: 92110 URL: http://llvm.org/viewvc/llvm-project?rev=92110&view=rev Log: Testcase for llvm-gcc checkin 92108. Added: llvm/trunk/test/FrontendC++/2009-12-23-MissingSext.cpp Added: llvm/trunk/test/FrontendC++/2009-12-23-MissingSext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2009-12-23-MissingSext.cpp?rev=92110&view=auto ============================================================================== --- llvm/trunk/test/FrontendC++/2009-12-23-MissingSext.cpp (added) +++ llvm/trunk/test/FrontendC++/2009-12-23-MissingSext.cpp Wed Dec 23 19:10:43 2009 @@ -0,0 +1,16 @@ +// RUN: %llvmgxx %s -S -o - | FileCheck %s +// The store of p.y into the temporary was not +// getting extended to 32 bits, so uninitialized +// bits of the temporary were used. 7366161. +struct foo { + char x:8; + signed int y:24; +}; +int bar(struct foo p, int x) { +// CHECK: bar +// CHECK: sext +// CHECK: sext + x = (p.y > x ? x : p.y); + return x; +// CHECK: return +} From rjmccall at apple.com Thu Dec 24 02:52:06 2009 From: rjmccall at apple.com (John McCall) Date: Thu, 24 Dec 2009 08:52:06 -0000 Subject: [llvm-commits] [llvm] r92124 - /llvm/trunk/lib/Support/APInt.cpp Message-ID: <200912240852.nBO8q6HK023472@zion.cs.uiuc.edu> Author: rjmccall Date: Thu Dec 24 02:52:06 2009 New Revision: 92124 URL: http://llvm.org/viewvc/llvm-project?rev=92124&view=rev Log: Set Remainder before Quotient in case Quotient and LHS alias. The new order should be immune to such problems. Modified: llvm/trunk/lib/Support/APInt.cpp Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=92124&r1=92123&r2=92124&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Thu Dec 24 02:52:06 2009 @@ -2012,8 +2012,8 @@ } if (lhsWords < rhsWords || LHS.ult(RHS)) { - Quotient = 0; // X / Y ===> 0, iff X < Y Remainder = LHS; // X % Y ===> X, iff X < Y + Quotient = 0; // X / Y ===> 0, iff X < Y return; } From jlerouge at apple.com Thu Dec 24 02:55:21 2009 From: jlerouge at apple.com (Julien Lerouge) Date: Thu, 24 Dec 2009 08:55:21 -0000 Subject: [llvm-commits] [test-suite] r92125 - /test-suite/trunk/External/SPEC/CFP2000/177.mesa/Makefile Message-ID: <200912240855.nBO8tLFi024123@zion.cs.uiuc.edu> Author: jlerouge Date: Thu Dec 24 02:55:20 2009 New Revision: 92125 URL: http://llvm.org/viewvc/llvm-project?rev=92125&view=rev Log: Set correct command line if SMALL_PROBLEM_SIZE is set. Modified: test-suite/trunk/External/SPEC/CFP2000/177.mesa/Makefile Modified: test-suite/trunk/External/SPEC/CFP2000/177.mesa/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CFP2000/177.mesa/Makefile?rev=92125&r1=92124&r2=92125&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CFP2000/177.mesa/Makefile (original) +++ test-suite/trunk/External/SPEC/CFP2000/177.mesa/Makefile Thu Dec 24 02:55:20 2009 @@ -4,8 +4,12 @@ ifdef LARGE_PROBLEM_SIZE RUN_OPTIONS := -frames 500 else +ifdef SMALL_PROBLEM_SIZE +RUN_OPTIONS := -frames 10 +else RUN_OPTIONS := -frames 100 endif +endif RUN_OPTIONS += -meshfile mesa.in -ppmfile mesa.ppm CPPFLAGS = From rjmccall at apple.com Thu Dec 24 02:56:26 2009 From: rjmccall at apple.com (John McCall) Date: Thu, 24 Dec 2009 08:56:26 -0000 Subject: [llvm-commits] [llvm] r92126 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/Support/APFloat.cpp unittests/ADT/APFloatTest.cpp Message-ID: <200912240856.nBO8uQre024209@zion.cs.uiuc.edu> Author: rjmccall Date: Thu Dec 24 02:56:26 2009 New Revision: 92126 URL: http://llvm.org/viewvc/llvm-project?rev=92126&view=rev Log: Add accessors for the largest-magnitude, smallest-magnitude, and smallest-normalized-magnitude values in a given FP semantics. Provide an APFloat-to-string conversion which I am quite ready to admit could be much more efficient. Modified: llvm/trunk/include/llvm/ADT/APFloat.h llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/unittests/ADT/APFloatTest.cpp Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=92126&r1=92125&r2=92126&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Thu Dec 24 02:56:26 2009 @@ -191,6 +191,7 @@ static APFloat getInf(const fltSemantics &Sem, bool Negative = false) { return APFloat(Sem, fcInfinity, Negative); } + /// getNaN - Factory for QNaN values. /// /// \param Negative - True iff the NaN generated should be negative. @@ -201,6 +202,26 @@ return APFloat(Sem, fcNaN, Negative, type); } + /// getLargest - Returns the largest finite number in the given + /// semantics. + /// + /// \param Negative - True iff the number should be negative + static APFloat getLargest(const fltSemantics &Sem, bool Negative = false); + + /// getSmallest - Returns the smallest (by magnitude) finite number + /// in the given semantics. Might be denormalized, which implies a + /// relative loss of precision. + /// + /// \param Negative - True iff the number should be negative + static APFloat getSmallest(const fltSemantics &Sem, bool Negative = false); + + /// getSmallestNormalized - Returns the smallest (by magnitude) + /// normalized finite number in the given semantics. + /// + /// \param Negative - True iff the number should be negative + static APFloat getSmallestNormalized(const fltSemantics &Sem, + bool Negative = false); + /// Profile - Used to insert APFloat objects, or objects that contain /// APFloat objects, into FoldingSets. void Profile(FoldingSetNodeID& NID) const; @@ -277,6 +298,29 @@ /* Return an arbitrary integer value usable for hashing. */ uint32_t getHashValue() const; + /// Converts this value into a decimal string. + /// + /// \param FormatPrecision The maximum number of digits of + /// precision to output. If there are fewer digits available, + /// zero padding will not be used unless the value is + /// integral and small enough to be expressed in + /// FormatPrecision digits. + /// \param FormatMaxPadding The maximum number of zeros to + /// consider inserting before falling back to scientific + /// notation. 0 means to always use scientific notation. + /// + /// Number Precision MaxPadding Result + /// ------ --------- ---------- ------ + /// 1.01E+4 5 2 10100 + /// 1.01E+4 4 2 1.01E+4 + /// 1.01E+4 5 1 1.01E+4 + /// 1.01E-2 5 2 0.0101 + /// 1.01E-2 4 2 1.01E-2 + /// 1.01E-2 4 1 1.01E-2 + void toString(SmallVectorImpl &Str, + unsigned FormatPrecision = 8, + unsigned FormatMaxPadding = 3); + private: /* Trivial queries. */ Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=92126&r1=92125&r2=92126&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Dec 24 02:56:26 2009 @@ -3139,6 +3139,60 @@ llvm_unreachable(0); } +APFloat APFloat::getLargest(const fltSemantics &Sem, bool Negative) { + APFloat Val(Sem, fcNormal, Negative); + + // We want (in interchange format): + // sign = {Negative} + // exponent = 1..10 + // significand = 1..1 + + Val.exponent = Sem.maxExponent; // unbiased + + // 1-initialize all bits.... + Val.zeroSignificand(); + integerPart *significand = Val.significandParts(); + unsigned N = partCountForBits(Sem.precision); + for (unsigned i = 0; i != N; ++i) + significand[i] = ~((integerPart) 0); + + // ...and then clear the top bits for internal consistency. + significand[N-1] + &= (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)) - 1; + + return Val; +} + +APFloat APFloat::getSmallest(const fltSemantics &Sem, bool Negative) { + APFloat Val(Sem, fcNormal, Negative); + + // We want (in interchange format): + // sign = {Negative} + // exponent = 0..0 + // significand = 0..01 + + Val.exponent = Sem.minExponent; // unbiased + Val.zeroSignificand(); + Val.significandParts()[0] = 1; + return Val; +} + +APFloat APFloat::getSmallestNormalized(const fltSemantics &Sem, bool Negative) { + APFloat Val(Sem, fcNormal, Negative); + + // We want (in interchange format): + // sign = {Negative} + // exponent = 0..0 + // significand = 10..0 + + Val.exponent = Sem.minExponent; + Val.zeroSignificand(); + Val.significandParts()[partCountForBits(Sem.precision)-1] + |= (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)); + + return Val; +} + APFloat::APFloat(const APInt& api, bool isIEEE) { initFromAPInt(api, isIEEE); @@ -3155,3 +3209,250 @@ APInt api = APInt(64, 0); initFromAPInt(api.doubleToBits(d)); } + +namespace { + static void append(SmallVectorImpl &Buffer, + unsigned N, const char *Str) { + unsigned Start = Buffer.size(); + Buffer.set_size(Start + N); + memcpy(&Buffer[Start], Str, N); + } + + template + void append(SmallVectorImpl &Buffer, const char (&Str)[N]) { + append(Buffer, N, Str); + } + + void AdjustToPrecision(SmallVectorImpl &buffer, + int &exp, unsigned FormatPrecision) { + unsigned N = buffer.size(); + if (N <= FormatPrecision) return; + + // The most significant figures are the last ones in the buffer. + unsigned FirstSignificant = N - FormatPrecision; + + // Round. + // FIXME: this probably shouldn't use 'round half up'. + + // Rounding down is just a truncation, except we also want to drop + // trailing zeros from the new result. + if (buffer[FirstSignificant - 1] < '5') { + while (buffer[FirstSignificant] == '0') + FirstSignificant++; + + exp += FirstSignificant; + buffer.erase(&buffer[0], &buffer[FirstSignificant]); + return; + } + + // Rounding up requires a decimal add-with-carry. If we continue + // the carry, the newly-introduced zeros will just be truncated. + for (unsigned I = FirstSignificant; I != N; ++I) { + if (buffer[I] == '9') { + FirstSignificant++; + } else { + buffer[I]++; + break; + } + } + + // If we carried through, we have exactly one digit of precision. + if (FirstSignificant == N) { + exp += FirstSignificant; + buffer.clear(); + buffer.push_back('1'); + return; + } + + exp += FirstSignificant; + buffer.erase(&buffer[0], &buffer[FirstSignificant]); + } +} + +void APFloat::toString(SmallVectorImpl &Str, + unsigned FormatPrecision, + unsigned FormatMaxPadding) { + switch (category) { + case fcInfinity: + if (isNegative()) + return append(Str, "-Inf"); + else + return append(Str, "+Inf"); + + case fcNaN: return append(Str, "NaN"); + + case fcZero: + if (isNegative()) + Str.push_back('-'); + + if (!FormatMaxPadding) + append(Str, "0.0E+0"); + else + Str.push_back('0'); + return; + + case fcNormal: + break; + } + + if (isNegative()) + Str.push_back('-'); + + // Decompose the number into an APInt and an exponent. + int exp = exponent - ((int) semantics->precision - 1); + APInt significand(semantics->precision, + partCountForBits(semantics->precision), + significandParts()); + + // Ignore trailing binary zeros. + int trailingZeros = significand.countTrailingZeros(); + exp += trailingZeros; + significand = significand.lshr(trailingZeros); + + // Change the exponent from 2^e to 10^e. + if (exp == 0) { + // Nothing to do. + } else if (exp > 0) { + // Just shift left. + significand.zext(semantics->precision + exp); + significand <<= exp; + exp = 0; + } else { /* exp < 0 */ + int texp = -exp; + + // We transform this using the identity: + // (N)(2^-e) == (N)(5^e)(10^-e) + // This means we have to multiply N (the significand) by 5^e. + // To avoid overflow, we have to operate on numbers large + // enough to store N * 5^e: + // log2(N * 5^e) == log2(N) + e * log2(5) + // <= semantics->precision + e * 2.5 + // (log_2(5) ~ 2.321928) + unsigned precision = semantics->precision + 5 * texp / 2; + + // Multiply significand by 5^e. + // N * 5^0101 == N * 5^(1*1) * 5^(0*2) * 5^(1*4) * 5^(0*8) + significand.zext(precision); + APInt five_to_the_i(precision, 5); + while (true) { + if (texp & 1) significand *= five_to_the_i; + + texp >>= 1; + if (!texp) break; + five_to_the_i *= five_to_the_i; + } + } + + llvm::SmallVector buffer; + + // Fill the buffer. + unsigned precision = significand.getBitWidth(); + APInt ten(precision, 10); + APInt digit(precision, 0); + + bool inTrail = true; + while (significand != 0) { + // digit <- significand % 10 + // significand <- significand / 10 + APInt::udivrem(significand, ten, significand, digit); + + unsigned d = digit.getZExtValue(); + + // Drop trailing zeros. + if (inTrail && !d) exp++; + else { + buffer.push_back((char) ('0' + d)); + inTrail = false; + } + } + + assert(!buffer.empty() && "no characters in buffer!"); + + // Drop down to FormatPrecision. + // TODO: don't do more precise calculations above than are required. + AdjustToPrecision(buffer, exp, FormatPrecision); + + unsigned NDigits = buffer.size(); + + // Check whether we should a non-scientific format. + bool FormatScientific; + if (!FormatMaxPadding) + FormatScientific = true; + else { + unsigned Padding; + if (exp >= 0) { + // 765e3 == 765000 + // ^^^ + Padding = (unsigned) exp; + } else { + unsigned Margin = (unsigned) -exp; + if (Margin < NDigits) { + // 765e-2 == 7.65 + Padding = 0; + } else { + // 765e-5 == 0.00765 + // ^ ^^ + Padding = Margin + 1 - NDigits; + } + } + + FormatScientific = (Padding > FormatMaxPadding || + Padding + NDigits > FormatPrecision); + } + + // Scientific formatting is pretty straightforward. + if (FormatScientific) { + exp += (NDigits - 1); + + Str.push_back(buffer[NDigits-1]); + Str.push_back('.'); + if (NDigits == 1) + Str.push_back('0'); + else + for (unsigned I = 1; I != NDigits; ++I) + Str.push_back(buffer[NDigits-1-I]); + Str.push_back('E'); + + Str.push_back(exp >= 0 ? '+' : '-'); + if (exp < 0) exp = -exp; + SmallVector expbuf; + do { + expbuf.push_back((char) ('0' + (exp % 10))); + exp /= 10; + } while (exp); + for (unsigned I = 0, E = expbuf.size(); I != E; ++I) + Str.push_back(expbuf[E-1-I]); + return; + } + + // Non-scientific, positive exponents. + if (exp >= 0) { + for (unsigned I = 0; I != NDigits; ++I) + Str.push_back(buffer[NDigits-1-I]); + for (unsigned I = 0; I != (unsigned) exp; ++I) + Str.push_back('0'); + return; + } + + // Non-scientific, negative exponents. + + // The number of digits to the left of the decimal point. + int NWholeDigits = exp + (int) NDigits; + + unsigned I = 0; + if (NWholeDigits > 0) { + for (; I != (unsigned) NWholeDigits; ++I) + Str.push_back(buffer[NDigits-I-1]); + Str.push_back('.'); + } else { + unsigned NZeros = 1 + (unsigned) -NWholeDigits; + + Str.push_back('0'); + Str.push_back('.'); + for (unsigned Z = 1; Z != NZeros; ++Z) + Str.push_back('0'); + } + + for (; I != NDigits; ++I) + Str.push_back(buffer[NDigits-I-1]); +} Modified: llvm/trunk/unittests/ADT/APFloatTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APFloatTest.cpp?rev=92126&r1=92125&r2=92126&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/APFloatTest.cpp (original) +++ llvm/trunk/unittests/ADT/APFloatTest.cpp Thu Dec 24 02:56:26 2009 @@ -8,10 +8,12 @@ //===----------------------------------------------------------------------===// #include +#include #include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" using namespace llvm; @@ -21,6 +23,13 @@ return F.convertToDouble(); } +static std::string convertToString(double d, unsigned Prec, unsigned Pad) { + llvm::SmallVector Buffer; + llvm::APFloat F(d); + F.toString(Buffer, Prec, Pad); + return std::string(Buffer.data(), Buffer.size()); +} + namespace { TEST(APFloatTest, Zero) { @@ -313,6 +322,17 @@ EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828")); } +TEST(APFloatTest, toString) { + ASSERT_EQ("10", convertToString(10.0, 6, 3)); + ASSERT_EQ("1.0E+1", convertToString(10.0, 6, 0)); + ASSERT_EQ("10100", convertToString(1.01E+4, 5, 2)); + ASSERT_EQ("1.01E+4", convertToString(1.01E+4, 4, 2)); + ASSERT_EQ("1.01E+4", convertToString(1.01E+4, 5, 1)); + ASSERT_EQ("0.0101", convertToString(1.01E-2, 5, 2)); + ASSERT_EQ("1.01E-2", convertToString(1.01E-2, 4, 2)); + ASSERT_EQ("1.01E-2", convertToString(1.01E-2, 5, 1)); +} + #ifdef GTEST_HAS_DEATH_TEST TEST(APFloatTest, SemanticsDeath) { EXPECT_DEATH(APFloat(APFloat::IEEEsingle, 0.0f).convertToDouble(), "Float semantics are not IEEEdouble"); From rjmccall at apple.com Thu Dec 24 06:16:56 2009 From: rjmccall at apple.com (John McCall) Date: Thu, 24 Dec 2009 12:16:56 -0000 Subject: [llvm-commits] [llvm] r92130 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200912241216.nBOCGvAu008655@zion.cs.uiuc.edu> Author: rjmccall Date: Thu Dec 24 06:16:56 2009 New Revision: 92130 URL: http://llvm.org/viewvc/llvm-project?rev=92130&view=rev Log: Substantially optimize APFloat::toString() by doing a single large divide to cut the significand down to the desired precision *before* entering the core divmod loop. Makes the overall algorithm logarithmic in the exponent. There's still a lot of room for improvement here, but this gets the performance back down to acceptable-for-diagnostics levels, even for long doubles. negligible, even on long doubles. Modified: llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=92130&r1=92129&r2=92130&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Dec 24 06:16:56 2009 @@ -3223,6 +3223,41 @@ append(Buffer, N, Str); } + /// Removes data from the given significand until it is no more + /// precise than is required for the desired precision. + void AdjustToPrecision(APInt &significand, + int &exp, unsigned FormatPrecision) { + unsigned bits = significand.getActiveBits(); + + // 196/59 is a very slight overestimate of lg_2(10). + unsigned bitsRequired = (FormatPrecision * 196 + 58) / 59; + + if (bits <= bitsRequired) return; + + unsigned tensRemovable = (bits - bitsRequired) * 59 / 196; + if (!tensRemovable) return; + + exp += tensRemovable; + + APInt divisor(significand.getBitWidth(), 1); + APInt powten(significand.getBitWidth(), 10); + while (true) { + if (tensRemovable & 1) + divisor *= powten; + tensRemovable >>= 1; + if (!tensRemovable) break; + powten *= powten; + } + + significand = significand.udiv(divisor); + + // Truncate the significand down to its active bit count, but + // don't try to drop below 32. + unsigned newPrecision = std::min(32U, significand.getActiveBits()); + significand.trunc(newPrecision); + } + + void AdjustToPrecision(SmallVectorImpl &buffer, int &exp, unsigned FormatPrecision) { unsigned N = buffer.size(); @@ -3343,6 +3378,8 @@ } } + AdjustToPrecision(significand, exp, FormatPrecision); + llvm::SmallVector buffer; // Fill the buffer. From daniel_dunbar at apple.com Thu Dec 24 11:48:25 2009 From: daniel_dunbar at apple.com (Daniel Dunbar) Date: Thu, 24 Dec 2009 09:48:25 -0800 Subject: [llvm-commits] Build Failure! In-Reply-To: <34A6A9F2-3332-4C49-B3DF-33E96E5154F9@apple.com> References: <50815A81-86B5-4C91-A204-832AF3A72353@apple.com> <34A6A9F2-3332-4C49-B3DF-33E96E5154F9@apple.com> Message-ID: <75BD7D4C-2056-4D37-A654-ED441E19981E@apple.com> Yeah, this is annoying but unavoidable with the current build set up. I personally rewrote my build scripts to do -- make NO_RUNTIME_LIBS=1 # do most of the build ... make llvm-gcc ... make # finish it off -- - Daniel On Dec 23, 2009, at 3:28 PM, Bill Wendling wrote: > My mistake. I needed to update llvm-gcc as well. Sorry for the noise. > > -bw > > On Dec 23, 2009, at 3:22 PM, Bill Wendling wrote: > >> This is a new build failure as of today. Does this look familiar to anyone? >> >> -bw >> >> llvm[2]: Compiling CommonProfiling.ll to CommonProfiling.bc for Debug build (bytecode) >> Intrinsic parameter #1 is wrong! >> i64 (i8*, i32)* @llvm.objectsize.i64 >> Intrinsic parameter #1 is wrong! >> i64 (i8*, i32)* @llvm.objectsize.i64 >> Intrinsic parameter #1 is wrong! >> i64 (i8*, i32)* @llvm.objectsize.i64 >> Intrinsic parameter #1 is wrong! >> i64 (i8*, i32)* @llvm.objectsize.i64 >> Intrinsic parameter #1 is wrong! >> i64 (i8*, i32)* @llvm.objectsize.i64 >> Intrinsic parameter #1 is wrong! >> i64 (i8*, i32)* @llvm.objectsize.i64 >> Broken module found, compilation aborted! >> 0 opt 0x000000010ac32369 PrintStackTrace(void*) + 57 >> 1 opt 0x000000010ac329a5 SignalHandler(int) + 469 >> 2 libSystem.B.dylib 0x00007fff814c7d5a _sigtramp + 26 >> 3 libSystem.B.dylib 0x0000000100000001 _sigtramp + 2125693633 >> 4 libSystem.B.dylib 0x00007fff81541119 raise + 25 >> 5 libSystem.B.dylib 0x00007fff81561ddd abort + 90 >> 6 opt 0x000000010abc99bf (anonymous namespace)::Verifier::abortIfBroken() + 239 >> 7 opt 0x000000010abdbd6a (anonymous namespace)::Verifier::runOnFunction(llvm::Function&) + 140 >> 8 opt 0x000000010ab93b13 llvm::FPPassManager::runOnFunction(llvm::Function&) + 387 >> 9 opt 0x000000010ab8dd27 llvm::FPPassManager::runOnModule(llvm::Module&) + 127 >> 10 opt 0x000000010ab93664 llvm::MPPassManager::runOnModule(llvm::Module&) + 588 >> 11 opt 0x000000010ab9511c llvm::PassManagerImpl::run(llvm::Module&) + 156 >> 12 opt 0x000000010ab951c7 llvm::PassManager::run(llvm::Module&) + 45 >> 13 opt 0x000000010a683b3a main + 5786 >> 14 opt 0x000000010a675060 start + 52 >> 15 opt 0x0000000000000006 start + 4120424410 >> Stack dump: >> 0. Program arguments: /Volumes/Sandbox/llvm/llvm.obj/Debug/bin/opt /Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.ll -std-compile-opts -strip-debug -o /Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.bc >> 1. Running pass 'Function Pass Manager' on module '/Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.ll'. >> 2. Running pass 'Module Verifier' on function '@save_arguments' >> make[2]: *** [/Volumes/Sandbox/llvm/llvm.obj/runtime/libprofile/Debug/CommonProfiling.bc] Abort trap >> make[1]: *** [libprofile/.makeall] Error 2 >> make: *** [all] Error 1 >> > From daniel at zuster.org Thu Dec 24 11:49:28 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 24 Dec 2009 17:49:28 -0000 Subject: [llvm-commits] [llvm] r92133 - /llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Message-ID: <200912241749.nBOHnTZF020302@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Dec 24 11:49:28 2009 New Revision: 92133 URL: http://llvm.org/viewvc/llvm-project?rev=92133&view=rev Log: Don't emit trailing semicolon. Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=92133&r1=92132&r2=92133&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Thu Dec 24 11:49:28 2009 @@ -2551,7 +2551,7 @@ EmitCaseConstructHandler(Case, Indent2, IncDecWeight, false, OptDescs, O); O.indent(Indent2) << "return ret;\n"; - O.indent(Indent1) << "};\n\n};\n\n"; + O.indent(Indent1) << "}\n\n};\n\n"; } /// EmitEdgeClasses - Emit Edge* classes that represent graph edges. From dgregor at apple.com Thu Dec 24 15:11:45 2009 From: dgregor at apple.com (Douglas Gregor) Date: Thu, 24 Dec 2009 21:11:45 -0000 Subject: [llvm-commits] [llvm] r92144 - /llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp Message-ID: <200912242111.nBOLBjoE027424@zion.cs.uiuc.edu> Author: dgregor Date: Thu Dec 24 15:11:45 2009 New Revision: 92144 URL: http://llvm.org/viewvc/llvm-project?rev=92144&view=rev Log: Define the new operator<< for sets into namespace std, so that argument-dependent lookup can find it. This is another case where an LLVM bug (not making operator<< visible) was masked by a GCC bug (looking in the global namespace when it shouldn't). Modified: llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp Modified: llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp?rev=92144&r1=92143&r2=92144&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp (original) +++ llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp Thu Dec 24 15:11:45 2009 @@ -13,6 +13,8 @@ #include using namespace llvm; +namespace std { + std::ostream &operator<<(std::ostream &OS, const std::set &S) { OS << "{"; @@ -26,6 +28,8 @@ return OS; } +} + namespace { class FixedDeltaAlgorithm : public DeltaAlgorithm { From dgregor at apple.com Thu Dec 24 15:15:37 2009 From: dgregor at apple.com (Douglas Gregor) Date: Thu, 24 Dec 2009 21:15:37 -0000 Subject: [llvm-commits] [llvm] r92146 - /llvm/trunk/unittests/ADT/StringRefTest.cpp Message-ID: <200912242115.nBOLFb5O027573@zion.cs.uiuc.edu> Author: dgregor Date: Thu Dec 24 15:15:37 2009 New Revision: 92146 URL: http://llvm.org/viewvc/llvm-project?rev=92146&view=rev Log: Move the two definitions of operator<< into namespace llvm, so they will be found by argument-dependent lookup. As with the previous commit, GCC is allowing ill-formed code. Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=92146&r1=92145&r2=92146&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/StringRefTest.cpp (original) +++ llvm/trunk/unittests/ADT/StringRefTest.cpp Thu Dec 24 15:15:37 2009 @@ -13,7 +13,7 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; -namespace { +namespace llvm { std::ostream &operator<<(std::ostream &OS, const StringRef &S) { OS << S; @@ -26,6 +26,9 @@ return OS; } +} + +namespace { TEST(StringRefTest, Construction) { EXPECT_EQ("", StringRef()); EXPECT_EQ("hello", StringRef("hello")); From rjmccall at apple.com Thu Dec 24 17:18:09 2009 From: rjmccall at apple.com (John McCall) Date: Thu, 24 Dec 2009 23:18:09 -0000 Subject: [llvm-commits] [llvm] r92150 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/Support/APFloat.cpp unittests/ADT/APFloatTest.cpp Message-ID: <200912242318.nBONI9ug031911@zion.cs.uiuc.edu> Author: rjmccall Date: Thu Dec 24 17:18:09 2009 New Revision: 92150 URL: http://llvm.org/viewvc/llvm-project?rev=92150&view=rev Log: Implement support for converting to string at "natural precision", and fix some major bugs in long-precision conversion. Modified: llvm/trunk/include/llvm/ADT/APFloat.h llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/unittests/ADT/APFloatTest.cpp Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=92150&r1=92149&r2=92150&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Thu Dec 24 17:18:09 2009 @@ -304,7 +304,8 @@ /// precision to output. If there are fewer digits available, /// zero padding will not be used unless the value is /// integral and small enough to be expressed in - /// FormatPrecision digits. + /// FormatPrecision digits. 0 means to use the natural + /// precision of the number. /// \param FormatMaxPadding The maximum number of zeros to /// consider inserting before falling back to scientific /// notation. 0 means to always use scientific notation. @@ -315,10 +316,10 @@ /// 1.01E+4 4 2 1.01E+4 /// 1.01E+4 5 1 1.01E+4 /// 1.01E-2 5 2 0.0101 - /// 1.01E-2 4 2 1.01E-2 + /// 1.01E-2 4 2 0.0101 /// 1.01E-2 4 1 1.01E-2 void toString(SmallVectorImpl &Str, - unsigned FormatPrecision = 8, + unsigned FormatPrecision = 0, unsigned FormatMaxPadding = 3); private: Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=92150&r1=92149&r2=92150&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Dec 24 17:18:09 2009 @@ -3253,7 +3253,7 @@ // Truncate the significand down to its active bit count, but // don't try to drop below 32. - unsigned newPrecision = std::min(32U, significand.getActiveBits()); + unsigned newPrecision = std::max(32U, significand.getActiveBits()); significand.trunc(newPrecision); } @@ -3339,6 +3339,16 @@ partCountForBits(semantics->precision), significandParts()); + // Set FormatPrecision if zero. We want to do this before we + // truncate trailing zeros, as those are part of the precision. + if (!FormatPrecision) { + // It's an interesting question whether to use the nominal + // precision or the active precision here for denormals. + + // FormatPrecision = ceil(significandBits / lg_2(10)) + FormatPrecision = (semantics->precision * 59 + 195) / 196; + } + // Ignore trailing binary zeros. int trailingZeros = significand.countTrailingZeros(); exp += trailingZeros; @@ -3361,9 +3371,10 @@ // To avoid overflow, we have to operate on numbers large // enough to store N * 5^e: // log2(N * 5^e) == log2(N) + e * log2(5) - // <= semantics->precision + e * 2.5 - // (log_2(5) ~ 2.321928) - unsigned precision = semantics->precision + 5 * texp / 2; + // <= semantics->precision + e * 137 / 59 + // (log_2(5) ~ 2.321928 < 2.322034 ~ 137/59) + + unsigned precision = semantics->precision + 137 * texp / 59; // Multiply significand by 5^e. // N * 5^0101 == N * 5^(1*1) * 5^(0*2) * 5^(1*4) * 5^(0*8) @@ -3411,30 +3422,29 @@ unsigned NDigits = buffer.size(); - // Check whether we should a non-scientific format. + // Check whether we should use scientific notation. bool FormatScientific; if (!FormatMaxPadding) FormatScientific = true; else { - unsigned Padding; if (exp >= 0) { - // 765e3 == 765000 - // ^^^ - Padding = (unsigned) exp; + // 765e3 --> 765000 + // ^^^ + // But we shouldn't make the number look more precise than it is. + FormatScientific = ((unsigned) exp > FormatMaxPadding || + NDigits + (unsigned) exp > FormatPrecision); } else { - unsigned Margin = (unsigned) -exp; - if (Margin < NDigits) { + // Power of the most significant digit. + int MSD = exp + (int) (NDigits - 1); + if (MSD >= 0) { // 765e-2 == 7.65 - Padding = 0; + FormatScientific = false; } else { // 765e-5 == 0.00765 // ^ ^^ - Padding = Margin + 1 - NDigits; + FormatScientific = ((unsigned) -MSD) > FormatMaxPadding; } } - - FormatScientific = (Padding > FormatMaxPadding || - Padding + NDigits > FormatPrecision); } // Scientific formatting is pretty straightforward. Modified: llvm/trunk/unittests/ADT/APFloatTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APFloatTest.cpp?rev=92150&r1=92149&r2=92150&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/APFloatTest.cpp (original) +++ llvm/trunk/unittests/ADT/APFloatTest.cpp Thu Dec 24 17:18:09 2009 @@ -329,8 +329,10 @@ ASSERT_EQ("1.01E+4", convertToString(1.01E+4, 4, 2)); ASSERT_EQ("1.01E+4", convertToString(1.01E+4, 5, 1)); ASSERT_EQ("0.0101", convertToString(1.01E-2, 5, 2)); - ASSERT_EQ("1.01E-2", convertToString(1.01E-2, 4, 2)); + ASSERT_EQ("0.0101", convertToString(1.01E-2, 4, 2)); ASSERT_EQ("1.01E-2", convertToString(1.01E-2, 5, 1)); + ASSERT_EQ("0.7853981633974483", convertToString(0.78539816339744830961, 0, 3)); + ASSERT_EQ("4.940656458412465E-324", convertToString(4.9406564584124654e-324, 0, 3)); } #ifdef GTEST_HAS_DEATH_TEST From isanbard at gmail.com Fri Dec 25 07:35:41 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Dec 2009 13:35:41 -0000 Subject: [llvm-commits] [llvm] r92155 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Message-ID: <200912251335.nBPDZg4C011755@zion.cs.uiuc.edu> Author: void Date: Fri Dec 25 07:35:40 2009 New Revision: 92155 URL: http://llvm.org/viewvc/llvm-project?rev=92155&view=rev Log: Use the 'MadeChange' variable instead of returning 'false' all of the time. Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=92155&r1=92154&r2=92155&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Fri Dec 25 07:35:40 2009 @@ -321,8 +321,7 @@ getOperandNum(x.SDTCisVTSmallerThanOp_Info.OtherOperandNum, N,NumResults); // It must be integer. - bool MadeChange = false; - MadeChange |= OtherNode->UpdateNodeType(MVT::iAny, TP); + bool MadeChange = OtherNode->UpdateNodeType(MVT::iAny, TP); // This code only handles nodes that have one type set. Assert here so // that we can change this if we ever need to deal with multiple value @@ -330,7 +329,7 @@ assert(OtherNode->getExtTypes().size() == 1 && "Node has too many types!"); if (OtherNode->hasTypeSet() && OtherNode->getTypeNum(0) <= VT) OtherNode->UpdateNodeType(MVT::Other, TP); // Throw an error. - return false; + return MadeChange; } case SDTCisOpSmallerThanOp: { TreePatternNode *BigOperand = From isanbard at gmail.com Fri Dec 25 07:37:27 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Dec 2009 13:37:27 -0000 Subject: [llvm-commits] [llvm] r92156 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <200912251337.nBPDbR17011838@zion.cs.uiuc.edu> Author: void Date: Fri Dec 25 07:37:27 2009 New Revision: 92156 URL: http://llvm.org/viewvc/llvm-project?rev=92156&view=rev Log: Remove dead store. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=92156&r1=92155&r2=92156&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Dec 25 07:37:27 2009 @@ -1905,7 +1905,6 @@ if (Newline) O << '\n'; O.PadToColumn(MAI->getCommentColumn()); O << MAI->getCommentString() << " Reload Reuse"; - Newline = true; } } } From isanbard at gmail.com Fri Dec 25 07:39:58 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Dec 2009 13:39:58 -0000 Subject: [llvm-commits] [llvm] r92157 - /llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Message-ID: <200912251339.nBPDdwTZ011955@zion.cs.uiuc.edu> Author: void Date: Fri Dec 25 07:39:58 2009 New Revision: 92157 URL: http://llvm.org/viewvc/llvm-project?rev=92157&view=rev Log: Remove dead store. Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=92157&r1=92156&r2=92157&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original) +++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Fri Dec 25 07:39:58 2009 @@ -233,7 +233,6 @@ !BotHasFallthrough && HasFallthrough(L->getBottomBlock())) { ++NumIntraElim; - BotHasFallthrough = true; } return Changed; From isanbard at gmail.com Fri Dec 25 07:44:36 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Dec 2009 13:44:36 -0000 Subject: [llvm-commits] [llvm] r92158 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200912251344.nBPDia6C012103@zion.cs.uiuc.edu> Author: void Date: Fri Dec 25 07:44:36 2009 New Revision: 92158 URL: http://llvm.org/viewvc/llvm-project?rev=92158&view=rev Log: Remove dead store from copy-pasto. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=92158&r1=92157&r2=92158&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Dec 25 07:44:36 2009 @@ -1177,7 +1177,7 @@ } if (!debugLoc.isUnknown() && MF) { - if (!HaveSemi) OS << ";"; HaveSemi = true; + if (!HaveSemi) OS << ";"; // TODO: print InlinedAtLoc information From isanbard at gmail.com Fri Dec 25 07:45:50 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Dec 2009 13:45:50 -0000 Subject: [llvm-commits] [llvm] r92159 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200912251345.nBPDjoHg012189@zion.cs.uiuc.edu> Author: void Date: Fri Dec 25 07:45:50 2009 New Revision: 92159 URL: http://llvm.org/viewvc/llvm-project?rev=92159&view=rev Log: Remove dead store. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=92159&r1=92158&r2=92159&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Dec 25 07:45:50 2009 @@ -1159,7 +1159,7 @@ // Briefly indicate whether any call clobbers were omitted. if (OmittedAnyCallClobbers) { - if (FirstOp) FirstOp = false; else OS << ","; + if (!FirstOp) OS << ","; OS << " ..."; } From isanbard at gmail.com Fri Dec 25 07:50:18 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 25 Dec 2009 13:50:18 -0000 Subject: [llvm-commits] [llvm] r92160 - /llvm/trunk/lib/VMCore/PassManager.cpp Message-ID: <200912251350.nBPDoI32012357@zion.cs.uiuc.edu> Author: void Date: Fri Dec 25 07:50:18 2009 New Revision: 92160 URL: http://llvm.org/viewvc/llvm-project?rev=92160&view=rev Log: Avoid assigning to Changed when it won't be used after the return. Modified: llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=92160&r1=92159&r2=92160&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Fri Dec 25 07:50:18 2009 @@ -1133,7 +1133,7 @@ removeDeadPasses(BP, I->getName(), ON_BASICBLOCK_MSG); } - return Changed |= doFinalization(F); + return doFinalization(F) || Changed; } // Implement doInitialization and doFinalization @@ -1355,7 +1355,7 @@ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) runOnFunction(*I); - return Changed |= doFinalization(M); + return doFinalization(M) || Changed; } bool FPPassManager::doInitialization(Module &M) { From eli.friedman at gmail.com Sat Dec 26 14:08:31 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Sat, 26 Dec 2009 20:08:31 -0000 Subject: [llvm-commits] [llvm] r92167 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td Message-ID: <200912262008.nBQK8VkC023925@zion.cs.uiuc.edu> Author: efriedma Date: Sat Dec 26 14:08:30 2009 New Revision: 92167 URL: http://llvm.org/viewvc/llvm-project?rev=92167&view=rev Log: PR5886: Make sure IMUL32m is marked as setting EFLAGS, so scheduling doesn't do illegal stuff around it. No testcase because the issue is very fragile. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=92167&r1=92166&r2=92167&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Sat Dec 26 14:08:30 2009 @@ -1128,7 +1128,7 @@ let Defs = [AX,DX,EFLAGS], Uses = [AX] in def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src), "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16] -let Defs = [EAX,EDX], Uses = [EAX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src), "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32] } From daniel at zuster.org Sat Dec 26 16:58:25 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 26 Dec 2009 22:58:25 -0000 Subject: [llvm-commits] [llvm] r92168 - in /llvm/trunk/utils/lit: ./ ExampleTests.ObjDir/ ExampleTests/ ExampleTests/Clang/ ExampleTests/LLVM.InTree/test/ ExampleTests/LLVM.InTree/test/Bar/ ExampleTests/LLVM.OutOfTree/ ExampleTests/LLVM.OutOfTree/obj/test/ ExampleTests/LLVM.OutOfTree/obj/test/Foo/ ExampleTests/LLVM.OutOfTree/src/test/ ExampleTests/LLVM.OutOfTree/src/test/Foo/ ExampleTests/ShExternal/ ExampleTests/ShInternal/ ExampleTests/TclTest/ lit/ lit/ExampleTests.ObjDir/ lit/ExampleTests/ lit/ExampleTests/Clang/ lit/Exampl... Message-ID: <200912262258.nBQMwRMS029176@zion.cs.uiuc.edu> Author: ddunbar Date: Sat Dec 26 16:58:23 2009 New Revision: 92168 URL: http://llvm.org/viewvc/llvm-project?rev=92168&view=rev Log: lit: Sink code into a 'lit' package. Added: llvm/trunk/utils/lit/lit/ llvm/trunk/utils/lit/lit/ExampleTests/ llvm/trunk/utils/lit/lit/ExampleTests.ObjDir/ llvm/trunk/utils/lit/lit/ExampleTests.ObjDir/lit.site.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg llvm/trunk/utils/lit/lit/ExampleTests/Clang/ llvm/trunk/utils/lit/lit/ExampleTests/Clang/fsyntax-only.c - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c llvm/trunk/utils/lit/lit/ExampleTests/Clang/lit.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/ llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg llvm/trunk/utils/lit/lit/ExampleTests/ShExternal/ llvm/trunk/utils/lit/lit/ExampleTests/ShExternal/lit.local.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg llvm/trunk/utils/lit/lit/ExampleTests/ShInternal/ llvm/trunk/utils/lit/lit/ExampleTests/ShInternal/lit.local.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg llvm/trunk/utils/lit/lit/ExampleTests/TclTest/ llvm/trunk/utils/lit/lit/ExampleTests/TclTest/lit.local.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg llvm/trunk/utils/lit/lit/ExampleTests/TclTest/stderr-pipe.ll - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll llvm/trunk/utils/lit/lit/ExampleTests/TclTest/tcl-redir-1.ll - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll llvm/trunk/utils/lit/lit/ExampleTests/fail.c - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/fail.c llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/lit.cfg llvm/trunk/utils/lit/lit/ExampleTests/pass.c - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/pass.c llvm/trunk/utils/lit/lit/ExampleTests/xfail.c - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/xfail.c llvm/trunk/utils/lit/lit/ExampleTests/xpass.c - copied, changed from r92167, llvm/trunk/utils/lit/ExampleTests/xpass.c llvm/trunk/utils/lit/lit/LitConfig.py - copied, changed from r92167, llvm/trunk/utils/lit/LitConfig.py llvm/trunk/utils/lit/lit/LitFormats.py - copied, changed from r92167, llvm/trunk/utils/lit/LitFormats.py llvm/trunk/utils/lit/lit/ProgressBar.py - copied, changed from r92167, llvm/trunk/utils/lit/ProgressBar.py llvm/trunk/utils/lit/lit/ShCommands.py - copied, changed from r92167, llvm/trunk/utils/lit/ShCommands.py llvm/trunk/utils/lit/lit/ShUtil.py - copied, changed from r92167, llvm/trunk/utils/lit/ShUtil.py llvm/trunk/utils/lit/lit/TclUtil.py - copied, changed from r92167, llvm/trunk/utils/lit/TclUtil.py llvm/trunk/utils/lit/lit/Test.py - copied, changed from r92167, llvm/trunk/utils/lit/Test.py llvm/trunk/utils/lit/lit/TestFormats.py - copied, changed from r92167, llvm/trunk/utils/lit/TestFormats.py llvm/trunk/utils/lit/lit/TestRunner.py - copied, changed from r92167, llvm/trunk/utils/lit/TestRunner.py llvm/trunk/utils/lit/lit/TestingConfig.py - copied, changed from r92167, llvm/trunk/utils/lit/TestingConfig.py llvm/trunk/utils/lit/lit/Util.py - copied, changed from r92167, llvm/trunk/utils/lit/Util.py llvm/trunk/utils/lit/lit/__init__.py llvm/trunk/utils/lit/lit/lit.py - copied, changed from r92167, llvm/trunk/utils/lit/lit.py Removed: llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll llvm/trunk/utils/lit/ExampleTests/fail.c llvm/trunk/utils/lit/ExampleTests/lit.cfg llvm/trunk/utils/lit/ExampleTests/pass.c llvm/trunk/utils/lit/ExampleTests/xfail.c llvm/trunk/utils/lit/ExampleTests/xpass.c llvm/trunk/utils/lit/LitConfig.py llvm/trunk/utils/lit/LitFormats.py llvm/trunk/utils/lit/ProgressBar.py llvm/trunk/utils/lit/ShCommands.py llvm/trunk/utils/lit/ShUtil.py llvm/trunk/utils/lit/TclUtil.py llvm/trunk/utils/lit/Test.py llvm/trunk/utils/lit/TestFormats.py llvm/trunk/utils/lit/TestRunner.py llvm/trunk/utils/lit/TestingConfig.py llvm/trunk/utils/lit/Util.py Modified: llvm/trunk/utils/lit/lit.py Removed: llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg (removed) @@ -1,15 +0,0 @@ -# -*- Python -*- - -# Site specific configuration file. -# -# Typically this will be generated by the build system to automatically set -# certain configuration variables which cannot be autodetected, so that 'lit' -# can easily be used on the command line. - -import os - -# Preserve the obj_root, for use by the main lit.cfg. -config.example_obj_root = os.path.dirname(__file__) - -lit.load_config(config, os.path.join(config.test_source_root, - 'lit.cfg')) Removed: llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c (original) +++ llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c (removed) @@ -1,4 +0,0 @@ -// RUN: clang -fsyntax-only -Xclang -verify %s - -int f0(void) {} // expected-warning {{control reaches end of non-void function}} - Removed: llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg (removed) @@ -1,80 +0,0 @@ -# -*- Python -*- - -# Configuration file for the 'lit' test runner. - -# name: The name of this test suite. -config.name = 'Clang' - -# testFormat: The test format to use to interpret tests. -# -# For now we require '&&' between commands, until they get globally killed and -# the test runner updated. -config.test_format = lit.formats.ShTest(execute_external = True) - -# suffixes: A list of file extensions to treat as test files. -config.suffixes = ['.c', '.cpp', '.m', '.mm'] - -# target_triple: Used by ShTest and TclTest formats for XFAIL checks. -config.target_triple = 'foo' - -### - -# Discover the 'clang' and 'clangcc' to use. - -import os - -def inferClang(PATH): - # Determine which clang to use. - clang = os.getenv('CLANG') - - # If the user set clang in the environment, definitely use that and don't - # try to validate. - if clang: - return clang - - # Otherwise look in the path. - clang = lit.util.which('clang', PATH) - - if not clang: - lit.fatal("couldn't find 'clang' program, try setting " - "CLANG in your environment") - - return clang - -def inferClangCC(clang, PATH): - clangcc = os.getenv('CLANGCC') - - # If the user set clang in the environment, definitely use that and don't - # try to validate. - if clangcc: - return clangcc - - # Otherwise try adding -cc since we expect to be looking in a build - # directory. - if clang.endswith('.exe'): - clangccName = clang[:-4] + '-cc.exe' - else: - clangccName = clang + '-cc' - clangcc = lit.util.which(clangccName, PATH) - if not clangcc: - # Otherwise ask clang. - res = lit.util.capture([clang, '-print-prog-name=clang-cc']) - res = res.strip() - if res and os.path.exists(res): - clangcc = res - - if not clangcc: - lit.fatal("couldn't find 'clang-cc' program, try setting " - "CLANGCC in your environment") - - return clangcc - -clang = inferClang(config.environment['PATH']) -if not lit.quiet: - lit.note('using clang: %r' % clang) -config.substitutions.append( (' clang ', ' ' + clang + ' ') ) - -clang_cc = inferClangCC(clang, config.environment['PATH']) -if not lit.quiet: - lit.note('using clang-cc: %r' % clang_cc) -config.substitutions.append( (' clang-cc ', ' ' + clang_cc + ' ') ) Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll (removed) @@ -1,3 +0,0 @@ -; RUN: true -; XFAIL: * -; XTARGET: darwin Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp (removed) @@ -1,6 +0,0 @@ -load_lib llvm.exp - -if { [llvm_supports_target X86] } { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll}]] -} - Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg (removed) @@ -1,151 +0,0 @@ -# -*- Python -*- - -# Configuration file for the 'lit' test runner. - -import os - -# name: The name of this test suite. -config.name = 'LLVM' - -# testFormat: The test format to use to interpret tests. -config.test_format = lit.formats.TclTest() - -# suffixes: A list of file extensions to treat as test files, this is actually -# set by on_clone(). -config.suffixes = [] - -# test_source_root: The root path where tests are located. -config.test_source_root = os.path.dirname(__file__) - -# test_exec_root: The root path where tests should be run. -llvm_obj_root = getattr(config, 'llvm_obj_root', None) -if llvm_obj_root is not None: - config.test_exec_root = os.path.join(llvm_obj_root, 'test') - -### - -import os - -# Check that the object root is known. -if config.test_exec_root is None: - # Otherwise, we haven't loaded the site specific configuration (the user is - # probably trying to run on a test file directly, and either the site - # configuration hasn't been created by the build system, or we are in an - # out-of-tree build situation). - - # Try to detect the situation where we are using an out-of-tree build by - # looking for 'llvm-config'. - # - # FIXME: I debated (i.e., wrote and threw away) adding logic to - # automagically generate the lit.site.cfg if we are in some kind of fresh - # build situation. This means knowing how to invoke the build system - # though, and I decided it was too much magic. - - llvm_config = lit.util.which('llvm-config', config.environment['PATH']) - if not llvm_config: - lit.fatal('No site specific configuration available!') - - # Get the source and object roots. - llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip() - llvm_obj_root = lit.util.capture(['llvm-config', '--obj-root']).strip() - - # Validate that we got a tree which points to here. - this_src_root = os.path.dirname(config.test_source_root) - if os.path.realpath(llvm_src_root) != os.path.realpath(this_src_root): - lit.fatal('No site specific configuration available!') - - # Check that the site specific configuration exists. - site_cfg = os.path.join(llvm_obj_root, 'test', 'lit.site.cfg') - if not os.path.exists(site_cfg): - lit.fatal('No site specific configuration available!') - - # Okay, that worked. Notify the user of the automagic, and reconfigure. - lit.note('using out-of-tree build at %r' % llvm_obj_root) - lit.load_config(config, site_cfg) - raise SystemExit - -### - -# Load site data from DejaGNU's site.exp. -import re -site_exp = {} -# FIXME: Implement lit.site.cfg. -for line in open(os.path.join(config.llvm_obj_root, 'test', 'site.exp')): - m = re.match('set ([^ ]+) "([^"]*)"', line) - if m: - site_exp[m.group(1)] = m.group(2) - -# Add substitutions. -for sub in ['prcontext', 'llvmgcc', 'llvmgxx', 'compile_cxx', 'compile_c', - 'link', 'shlibext', 'ocamlopt', 'llvmdsymutil', 'llvmlibsdir', - 'bugpoint_topts']: - if sub in ('llvmgcc', 'llvmgxx'): - config.substitutions.append(('%' + sub, - site_exp[sub] + ' -emit-llvm -w')) - else: - config.substitutions.append(('%' + sub, site_exp[sub])) - -excludes = [] - -# Provide target_triple for use in XFAIL and XTARGET. -config.target_triple = site_exp['target_triplet'] - -# Provide llvm_supports_target for use in local configs. -targets = set(site_exp["TARGETS_TO_BUILD"].split()) -def llvm_supports_target(name): - return name in targets - -langs = set(site_exp['llvmgcc_langs'].split(',')) -def llvm_gcc_supports(name): - return name in langs - -# Provide on_clone hook for reading 'dg.exp'. -import os -simpleLibData = re.compile(r"""load_lib llvm.exp - -RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\]""", - re.MULTILINE) -conditionalLibData = re.compile(r"""load_lib llvm.exp - -if.*\[ ?(llvm[^ ]*) ([^ ]*) ?\].*{ - *RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\] -\}""", re.MULTILINE) -def on_clone(parent, cfg, for_path): - def addSuffixes(match): - if match[0] == '{' and match[-1] == '}': - cfg.suffixes = ['.' + s for s in match[1:-1].split(',')] - else: - cfg.suffixes = ['.' + match] - - libPath = os.path.join(os.path.dirname(for_path), - 'dg.exp') - if not os.path.exists(libPath): - cfg.unsupported = True - return - - # Reset unsupported, in case we inherited it. - cfg.unsupported = False - lib = open(libPath).read().strip() - - # Check for a simple library. - m = simpleLibData.match(lib) - if m: - addSuffixes(m.group(1)) - return - - # Check for a conditional test set. - m = conditionalLibData.match(lib) - if m: - funcname,arg,match = m.groups() - addSuffixes(match) - - func = globals().get(funcname) - if not func: - lit.error('unsupported predicate %r' % funcname) - elif not func(arg): - cfg.unsupported = True - return - # Otherwise, give up. - lit.error('unable to understand %r:\n%s' % (libPath, lib)) - -config.on_clone = on_clone Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg (removed) @@ -1,10 +0,0 @@ -# -*- Python -*- - -## Autogenerated by Makefile ## -# Do not edit! - -# Preserve some key paths for use by main LLVM test suite config. -config.llvm_obj_root = os.path.dirname(os.path.dirname(__file__)) - -# Let the main config do the real work. -lit.load_config(config, os.path.join(config.llvm_obj_root, 'test/lit.cfg')) Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp (removed) @@ -1,30 +0,0 @@ -## these variables are automatically generated by make ## -# Do not edit here. If you wish to override these values -# edit the last section -set target_triplet "x86_64-apple-darwin10" -set TARGETS_TO_BUILD "X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend" -set llvmgcc_langs "c,c++,objc,obj-c++" -set llvmgcc_version "4.2.1" -set prcontext "/usr/bin/tclsh8.4 /Volumes/Data/ddunbar/llvm/test/Scripts/prcontext.tcl" -set llvmtoolsdir "/Users/ddunbar/llvm.obj.64/Debug/bin" -set llvmlibsdir "/Users/ddunbar/llvm.obj.64/Debug/lib" -set srcroot "/Volumes/Data/ddunbar/llvm" -set objroot "/Volumes/Data/ddunbar/llvm.obj.64" -set srcdir "/Volumes/Data/ddunbar/llvm/test" -set objdir "/Volumes/Data/ddunbar/llvm.obj.64/test" -set gccpath "/usr/bin/gcc -arch x86_64" -set gxxpath "/usr/bin/g++ -arch x86_64" -set compile_c " /usr/bin/gcc -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -c " -set compile_cxx " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -c " -set link " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -g -L/Users/ddunbar/llvm.obj.64/Debug/lib -L/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib " -set llvmgcc "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 " -set llvmgxx "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 " -set llvmgccmajvers "4" -set bugpoint_topts "-gcc-tool-args -m64" -set shlibext ".dylib" -set ocamlopt "/sw/bin/ocamlopt -cc \"g++ -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT\" -I /Users/ddunbar/llvm.obj.64/Debug/lib/ocaml" -set valgrind "" -set grep "/usr/bin/grep" -set gas "/usr/bin/as" -set llvmdsymutil "dsymutil" -## All variables above are generated by configure. Do Not Edit ## Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg (removed) @@ -1 +0,0 @@ -config.excludes = ['src'] Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg?rev=92167&view=auto ============================================================================== (empty) Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg (removed) @@ -1,11 +0,0 @@ -# -*- Python -*- - -## Autogenerated by Makefile ## -# Do not edit! - -# Preserve some key paths for use by main LLVM test suite config. -config.llvm_obj_root = os.path.dirname(os.path.dirname(__file__)) - -# Let the main config do the real work. -lit.load_config(config, os.path.join(config.llvm_obj_root, - '../src/test/lit.cfg')) Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp (removed) @@ -1,30 +0,0 @@ -## these variables are automatically generated by make ## -# Do not edit here. If you wish to override these values -# edit the last section -set target_triplet "x86_64-apple-darwin10" -set TARGETS_TO_BUILD "X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend" -set llvmgcc_langs "c,c++,objc,obj-c++" -set llvmgcc_version "4.2.1" -set prcontext "/usr/bin/tclsh8.4 /Volumes/Data/ddunbar/llvm/test/Scripts/prcontext.tcl" -set llvmtoolsdir "/Users/ddunbar/llvm.obj.64/Debug/bin" -set llvmlibsdir "/Users/ddunbar/llvm.obj.64/Debug/lib" -set srcroot "/Volumes/Data/ddunbar/llvm" -set objroot "/Volumes/Data/ddunbar/llvm.obj.64" -set srcdir "/Volumes/Data/ddunbar/llvm/test" -set objdir "/Volumes/Data/ddunbar/llvm.obj.64/test" -set gccpath "/usr/bin/gcc -arch x86_64" -set gxxpath "/usr/bin/g++ -arch x86_64" -set compile_c " /usr/bin/gcc -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -c " -set compile_cxx " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -c " -set link " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -g -L/Users/ddunbar/llvm.obj.64/Debug/lib -L/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib " -set llvmgcc "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 " -set llvmgxx "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 " -set llvmgccmajvers "4" -set bugpoint_topts "-gcc-tool-args -m64" -set shlibext ".dylib" -set ocamlopt "/sw/bin/ocamlopt -cc \"g++ -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT\" -I /Users/ddunbar/llvm.obj.64/Debug/lib/ocaml" -set valgrind "" -set grep "/usr/bin/grep" -set gas "/usr/bin/as" -set llvmdsymutil "dsymutil" -## All variables above are generated by configure. Do Not Edit ## Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt (removed) @@ -1 +0,0 @@ -hi Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp (removed) @@ -1,6 +0,0 @@ -load_lib llvm.exp - -if { [llvm_supports_target X86] } { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll}]] -} - Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll (removed) @@ -1 +0,0 @@ -; RUN: grep "hi" %S/data.txt \ No newline at end of file Removed: llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg (removed) @@ -1,151 +0,0 @@ -# -*- Python -*- - -# Configuration file for the 'lit' test runner. - -import os - -# name: The name of this test suite. -config.name = 'LLVM' - -# testFormat: The test format to use to interpret tests. -config.test_format = lit.formats.TclTest() - -# suffixes: A list of file extensions to treat as test files, this is actually -# set by on_clone(). -config.suffixes = [] - -# test_source_root: The root path where tests are located. -config.test_source_root = os.path.dirname(__file__) - -# test_exec_root: The root path where tests should be run. -llvm_obj_root = getattr(config, 'llvm_obj_root', None) -if llvm_obj_root is not None: - config.test_exec_root = os.path.join(llvm_obj_root, 'test') - -### - -import os - -# Check that the object root is known. -if config.test_exec_root is None: - # Otherwise, we haven't loaded the site specific configuration (the user is - # probably trying to run on a test file directly, and either the site - # configuration hasn't been created by the build system, or we are in an - # out-of-tree build situation). - - # Try to detect the situation where we are using an out-of-tree build by - # looking for 'llvm-config'. - # - # FIXME: I debated (i.e., wrote and threw away) adding logic to - # automagically generate the lit.site.cfg if we are in some kind of fresh - # build situation. This means knowing how to invoke the build system - # though, and I decided it was too much magic. - - llvm_config = lit.util.which('llvm-config', config.environment['PATH']) - if not llvm_config: - lit.fatal('No site specific configuration available!') - - # Get the source and object roots. - llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip() - llvm_obj_root = lit.util.capture(['llvm-config', '--obj-root']).strip() - - # Validate that we got a tree which points to here. - this_src_root = os.path.dirname(config.test_source_root) - if os.path.realpath(llvm_src_root) != os.path.realpath(this_src_root): - lit.fatal('No site specific configuration available!') - - # Check that the site specific configuration exists. - site_cfg = os.path.join(llvm_obj_root, 'test', 'lit.site.cfg') - if not os.path.exists(site_cfg): - lit.fatal('No site specific configuration available!') - - # Okay, that worked. Notify the user of the automagic, and reconfigure. - lit.note('using out-of-tree build at %r' % llvm_obj_root) - lit.load_config(config, site_cfg) - raise SystemExit - -### - -# Load site data from DejaGNU's site.exp. -import re -site_exp = {} -# FIXME: Implement lit.site.cfg. -for line in open(os.path.join(config.llvm_obj_root, 'test', 'site.exp')): - m = re.match('set ([^ ]+) "([^"]*)"', line) - if m: - site_exp[m.group(1)] = m.group(2) - -# Add substitutions. -for sub in ['prcontext', 'llvmgcc', 'llvmgxx', 'compile_cxx', 'compile_c', - 'link', 'shlibext', 'ocamlopt', 'llvmdsymutil', 'llvmlibsdir', - 'bugpoint_topts']: - if sub in ('llvmgcc', 'llvmgxx'): - config.substitutions.append(('%' + sub, - site_exp[sub] + ' -emit-llvm -w')) - else: - config.substitutions.append(('%' + sub, site_exp[sub])) - -excludes = [] - -# Provide target_triple for use in XFAIL and XTARGET. -config.target_triple = site_exp['target_triplet'] - -# Provide llvm_supports_target for use in local configs. -targets = set(site_exp["TARGETS_TO_BUILD"].split()) -def llvm_supports_target(name): - return name in targets - -langs = set(site_exp['llvmgcc_langs'].split(',')) -def llvm_gcc_supports(name): - return name in langs - -# Provide on_clone hook for reading 'dg.exp'. -import os -simpleLibData = re.compile(r"""load_lib llvm.exp - -RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\]""", - re.MULTILINE) -conditionalLibData = re.compile(r"""load_lib llvm.exp - -if.*\[ ?(llvm[^ ]*) ([^ ]*) ?\].*{ - *RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\] -\}""", re.MULTILINE) -def on_clone(parent, cfg, for_path): - def addSuffixes(match): - if match[0] == '{' and match[-1] == '}': - cfg.suffixes = ['.' + s for s in match[1:-1].split(',')] - else: - cfg.suffixes = ['.' + match] - - libPath = os.path.join(os.path.dirname(for_path), - 'dg.exp') - if not os.path.exists(libPath): - cfg.unsupported = True - return - - # Reset unsupported, in case we inherited it. - cfg.unsupported = False - lib = open(libPath).read().strip() - - # Check for a simple library. - m = simpleLibData.match(lib) - if m: - addSuffixes(m.group(1)) - return - - # Check for a conditional test set. - m = conditionalLibData.match(lib) - if m: - funcname,arg,match = m.groups() - addSuffixes(match) - - func = globals().get(funcname) - if not func: - lit.error('unsupported predicate %r' % funcname) - elif not func(arg): - cfg.unsupported = True - return - # Otherwise, give up. - lit.error('unable to understand %r:\n%s' % (libPath, lib)) - -config.on_clone = on_clone Removed: llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg (removed) @@ -1,6 +0,0 @@ -# -*- Python -*- - -config.test_format = lit.formats.ShTest(execute_external = True) - -config.suffixes = ['.c'] - Removed: llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg (removed) @@ -1,6 +0,0 @@ -# -*- Python -*- - -config.test_format = lit.formats.ShTest(execute_external = False) - -config.suffixes = ['.c'] - Removed: llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg (removed) @@ -1,5 +0,0 @@ -# -*- Python -*- - -config.test_format = lit.formats.TclTest() - -config.suffixes = ['.ll'] Removed: llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll (original) +++ llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll (removed) @@ -1 +0,0 @@ -; RUN: gcc -### > /dev/null |& grep {gcc version} Removed: llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll (original) +++ llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll (removed) @@ -1,7 +0,0 @@ -; RUN: echo 'hi' > %t.1 | echo 'hello' > %t.2 -; RUN: not grep 'hi' %t.1 -; RUN: grep 'hello' %t.2 - - - - Removed: llvm/trunk/utils/lit/ExampleTests/fail.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/fail.c?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/fail.c (original) +++ llvm/trunk/utils/lit/ExampleTests/fail.c (removed) @@ -1,2 +0,0 @@ -// RUN: echo 'I am some stdout' -// RUN: false Removed: llvm/trunk/utils/lit/ExampleTests/lit.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/lit.cfg?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/lit.cfg (original) +++ llvm/trunk/utils/lit/ExampleTests/lit.cfg (removed) @@ -1,23 +0,0 @@ -# -*- Python -*- - -# Configuration file for the 'lit' test runner. - -# name: The name of this test suite. -config.name = 'Examples' - -# suffixes: A list of file extensions to treat as test files. -config.suffixes = ['.c', '.cpp', '.m', '.mm', '.ll'] - -# testFormat: The test format to use to interpret tests. -config.test_format = lit.formats.ShTest() - -# test_source_root: The path where tests are located (default is the test suite -# root). -config.test_source_root = None - -# test_exec_root: The path where tests are located (default is the test suite -# root). -config.test_exec_root = None - -# target_triple: Used by ShTest and TclTest formats for XFAIL checks. -config.target_triple = 'foo' Removed: llvm/trunk/utils/lit/ExampleTests/pass.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/pass.c?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/pass.c (original) +++ llvm/trunk/utils/lit/ExampleTests/pass.c (removed) @@ -1 +0,0 @@ -// RUN: true Removed: llvm/trunk/utils/lit/ExampleTests/xfail.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/xfail.c?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/xfail.c (original) +++ llvm/trunk/utils/lit/ExampleTests/xfail.c (removed) @@ -1,2 +0,0 @@ -// RUN: false -// XFAIL: * Removed: llvm/trunk/utils/lit/ExampleTests/xpass.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ExampleTests/xpass.c?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ExampleTests/xpass.c (original) +++ llvm/trunk/utils/lit/ExampleTests/xpass.c (removed) @@ -1,2 +0,0 @@ -// RUN: true -// XFAIL Removed: llvm/trunk/utils/lit/LitConfig.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/LitConfig.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/LitConfig.py (original) +++ llvm/trunk/utils/lit/LitConfig.py (removed) @@ -1,95 +0,0 @@ -class LitConfig: - """LitConfig - Configuration data for a 'lit' test runner instance, shared - across all tests. - - The LitConfig object is also used to communicate with client configuration - files, it is always passed in as the global variable 'lit' so that - configuration files can access common functionality and internal components - easily. - """ - - # Provide access to built-in formats. - import LitFormats as formats - - # Provide access to built-in utility functions. - import Util as util - - def __init__(self, progname, path, quiet, - useValgrind, valgrindArgs, - useTclAsSh, - noExecute, debug, isWindows, - params): - # The name of the test runner. - self.progname = progname - # The items to add to the PATH environment variable. - self.path = list(map(str, path)) - self.quiet = bool(quiet) - self.useValgrind = bool(useValgrind) - self.valgrindArgs = list(valgrindArgs) - self.useTclAsSh = bool(useTclAsSh) - self.noExecute = noExecute - self.debug = debug - self.isWindows = bool(isWindows) - self.params = dict(params) - self.bashPath = None - - self.numErrors = 0 - self.numWarnings = 0 - - def load_config(self, config, path): - """load_config(config, path) - Load a config object from an alternate - path.""" - from TestingConfig import TestingConfig - return TestingConfig.frompath(path, config.parent, self, - mustExist = True, - config = config) - - def getBashPath(self): - """getBashPath - Get the path to 'bash'""" - import os, Util - - if self.bashPath is not None: - return self.bashPath - - self.bashPath = Util.which('bash', os.pathsep.join(self.path)) - if self.bashPath is None: - # Check some known paths. - for path in ('/bin/bash', '/usr/bin/bash'): - if os.path.exists(path): - self.bashPath = path - break - - if self.bashPath is None: - self.warning("Unable to find 'bash', running Tcl tests internally.") - self.bashPath = '' - - return self.bashPath - - def _write_message(self, kind, message): - import inspect, os, sys - - # Get the file/line where this message was generated. - f = inspect.currentframe() - # Step out of _write_message, and then out of wrapper. - f = f.f_back.f_back - file,line,_,_,_ = inspect.getframeinfo(f) - location = '%s:%d' % (os.path.basename(file), line) - - print >>sys.stderr, '%s: %s: %s: %s' % (self.progname, location, - kind, message) - - def note(self, message): - self._write_message('note', message) - - def warning(self, message): - self._write_message('warning', message) - self.numWarnings += 1 - - def error(self, message): - self._write_message('error', message) - self.numErrors += 1 - - def fatal(self, message): - import sys - self._write_message('fatal', message) - sys.exit(2) Removed: llvm/trunk/utils/lit/LitFormats.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/LitFormats.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/LitFormats.py (original) +++ llvm/trunk/utils/lit/LitFormats.py (removed) @@ -1,3 +0,0 @@ -from TestFormats import GoogleTest, ShTest, TclTest -from TestFormats import SyntaxCheckTest, OneCommandPerFileTest - Removed: llvm/trunk/utils/lit/ProgressBar.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ProgressBar.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ProgressBar.py (original) +++ llvm/trunk/utils/lit/ProgressBar.py (removed) @@ -1,267 +0,0 @@ -#!/usr/bin/env python - -# Source: http://code.activestate.com/recipes/475116/, with -# modifications by Daniel Dunbar. - -import sys, re, time - -class TerminalController: - """ - A class that can be used to portably generate formatted output to - a terminal. - - `TerminalController` defines a set of instance variables whose - values are initialized to the control sequence necessary to - perform a given action. These can be simply included in normal - output to the terminal: - - >>> term = TerminalController() - >>> print 'This is '+term.GREEN+'green'+term.NORMAL - - Alternatively, the `render()` method can used, which replaces - '${action}' with the string required to perform 'action': - - >>> term = TerminalController() - >>> print term.render('This is ${GREEN}green${NORMAL}') - - If the terminal doesn't support a given action, then the value of - the corresponding instance variable will be set to ''. As a - result, the above code will still work on terminals that do not - support color, except that their output will not be colored. - Also, this means that you can test whether the terminal supports a - given action by simply testing the truth value of the - corresponding instance variable: - - >>> term = TerminalController() - >>> if term.CLEAR_SCREEN: - ... print 'This terminal supports clearning the screen.' - - Finally, if the width and height of the terminal are known, then - they will be stored in the `COLS` and `LINES` attributes. - """ - # Cursor movement: - BOL = '' #: Move the cursor to the beginning of the line - UP = '' #: Move the cursor up one line - DOWN = '' #: Move the cursor down one line - LEFT = '' #: Move the cursor left one char - RIGHT = '' #: Move the cursor right one char - - # Deletion: - CLEAR_SCREEN = '' #: Clear the screen and move to home position - CLEAR_EOL = '' #: Clear to the end of the line. - CLEAR_BOL = '' #: Clear to the beginning of the line. - CLEAR_EOS = '' #: Clear to the end of the screen - - # Output modes: - BOLD = '' #: Turn on bold mode - BLINK = '' #: Turn on blink mode - DIM = '' #: Turn on half-bright mode - REVERSE = '' #: Turn on reverse-video mode - NORMAL = '' #: Turn off all modes - - # Cursor display: - HIDE_CURSOR = '' #: Make the cursor invisible - SHOW_CURSOR = '' #: Make the cursor visible - - # Terminal size: - COLS = None #: Width of the terminal (None for unknown) - LINES = None #: Height of the terminal (None for unknown) - - # Foreground colors: - BLACK = BLUE = GREEN = CYAN = RED = MAGENTA = YELLOW = WHITE = '' - - # Background colors: - BG_BLACK = BG_BLUE = BG_GREEN = BG_CYAN = '' - BG_RED = BG_MAGENTA = BG_YELLOW = BG_WHITE = '' - - _STRING_CAPABILITIES = """ - BOL=cr UP=cuu1 DOWN=cud1 LEFT=cub1 RIGHT=cuf1 - CLEAR_SCREEN=clear CLEAR_EOL=el CLEAR_BOL=el1 CLEAR_EOS=ed BOLD=bold - BLINK=blink DIM=dim REVERSE=rev UNDERLINE=smul NORMAL=sgr0 - HIDE_CURSOR=cinvis SHOW_CURSOR=cnorm""".split() - _COLORS = """BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE""".split() - _ANSICOLORS = "BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE".split() - - def __init__(self, term_stream=sys.stdout): - """ - Create a `TerminalController` and initialize its attributes - with appropriate values for the current terminal. - `term_stream` is the stream that will be used for terminal - output; if this stream is not a tty, then the terminal is - assumed to be a dumb terminal (i.e., have no capabilities). - """ - # Curses isn't available on all platforms - try: import curses - except: return - - # If the stream isn't a tty, then assume it has no capabilities. - if not term_stream.isatty(): return - - # Check the terminal type. If we fail, then assume that the - # terminal has no capabilities. - try: curses.setupterm() - except: return - - # Look up numeric capabilities. - self.COLS = curses.tigetnum('cols') - self.LINES = curses.tigetnum('lines') - - # Look up string capabilities. - for capability in self._STRING_CAPABILITIES: - (attrib, cap_name) = capability.split('=') - setattr(self, attrib, self._tigetstr(cap_name) or '') - - # Colors - set_fg = self._tigetstr('setf') - if set_fg: - for i,color in zip(range(len(self._COLORS)), self._COLORS): - setattr(self, color, curses.tparm(set_fg, i) or '') - set_fg_ansi = self._tigetstr('setaf') - if set_fg_ansi: - for i,color in zip(range(len(self._ANSICOLORS)), self._ANSICOLORS): - setattr(self, color, curses.tparm(set_fg_ansi, i) or '') - set_bg = self._tigetstr('setb') - if set_bg: - for i,color in zip(range(len(self._COLORS)), self._COLORS): - setattr(self, 'BG_'+color, curses.tparm(set_bg, i) or '') - set_bg_ansi = self._tigetstr('setab') - if set_bg_ansi: - for i,color in zip(range(len(self._ANSICOLORS)), self._ANSICOLORS): - setattr(self, 'BG_'+color, curses.tparm(set_bg_ansi, i) or '') - - def _tigetstr(self, cap_name): - # String capabilities can include "delays" of the form "$<2>". - # For any modern terminal, we should be able to just ignore - # these, so strip them out. - import curses - cap = curses.tigetstr(cap_name) or '' - return re.sub(r'\$<\d+>[/*]?', '', cap) - - def render(self, template): - """ - Replace each $-substitutions in the given template string with - the corresponding terminal control string (if it's defined) or - '' (if it's not). - """ - return re.sub(r'\$\$|\${\w+}', self._render_sub, template) - - def _render_sub(self, match): - s = match.group() - if s == '$$': return s - else: return getattr(self, s[2:-1]) - -####################################################################### -# Example use case: progress bar -####################################################################### - -class SimpleProgressBar: - """ - A simple progress bar which doesn't need any terminal support. - - This prints out a progress bar like: - 'Header: 0 .. 10.. 20.. ...' - """ - - def __init__(self, header): - self.header = header - self.atIndex = None - - def update(self, percent, message): - if self.atIndex is None: - sys.stdout.write(self.header) - self.atIndex = 0 - - next = int(percent*50) - if next == self.atIndex: - return - - for i in range(self.atIndex, next): - idx = i % 5 - if idx == 0: - sys.stdout.write('%-2d' % (i*2)) - elif idx == 1: - pass # Skip second char - elif idx < 4: - sys.stdout.write('.') - else: - sys.stdout.write(' ') - sys.stdout.flush() - self.atIndex = next - - def clear(self): - if self.atIndex is not None: - sys.stdout.write('\n') - sys.stdout.flush() - self.atIndex = None - -class ProgressBar: - """ - A 3-line progress bar, which looks like:: - - Header - 20% [===========----------------------------------] - progress message - - The progress bar is colored, if the terminal supports color - output; and adjusts to the width of the terminal. - """ - BAR = '%s${GREEN}[${BOLD}%s%s${NORMAL}${GREEN}]${NORMAL}%s\n' - HEADER = '${BOLD}${CYAN}%s${NORMAL}\n\n' - - def __init__(self, term, header, useETA=True): - self.term = term - if not (self.term.CLEAR_EOL and self.term.UP and self.term.BOL): - raise ValueError("Terminal isn't capable enough -- you " - "should use a simpler progress dispaly.") - self.width = self.term.COLS or 75 - self.bar = term.render(self.BAR) - self.header = self.term.render(self.HEADER % header.center(self.width)) - self.cleared = 1 #: true if we haven't drawn the bar yet. - self.useETA = useETA - if self.useETA: - self.startTime = time.time() - self.update(0, '') - - def update(self, percent, message): - if self.cleared: - sys.stdout.write(self.header) - self.cleared = 0 - prefix = '%3d%% ' % (percent*100,) - suffix = '' - if self.useETA: - elapsed = time.time() - self.startTime - if percent > .0001 and elapsed > 1: - total = elapsed / percent - eta = int(total - elapsed) - h = eta//3600. - m = (eta//60) % 60 - s = eta % 60 - suffix = ' ETA: %02d:%02d:%02d'%(h,m,s) - barWidth = self.width - len(prefix) - len(suffix) - 2 - n = int(barWidth*percent) - if len(message) < self.width: - message = message + ' '*(self.width - len(message)) - else: - message = '... ' + message[-(self.width-4):] - sys.stdout.write( - self.term.BOL + self.term.UP + self.term.CLEAR_EOL + - (self.bar % (prefix, '='*n, '-'*(barWidth-n), suffix)) + - self.term.CLEAR_EOL + message) - - def clear(self): - if not self.cleared: - sys.stdout.write(self.term.BOL + self.term.CLEAR_EOL + - self.term.UP + self.term.CLEAR_EOL + - self.term.UP + self.term.CLEAR_EOL) - self.cleared = 1 - -def test(): - import time - tc = TerminalController() - p = ProgressBar(tc, 'Tests') - for i in range(101): - p.update(i/100., str(i)) - time.sleep(.3) - -if __name__=='__main__': - test() Removed: llvm/trunk/utils/lit/ShCommands.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ShCommands.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ShCommands.py (original) +++ llvm/trunk/utils/lit/ShCommands.py (removed) @@ -1,85 +0,0 @@ -class Command: - def __init__(self, args, redirects): - self.args = list(args) - self.redirects = list(redirects) - - def __repr__(self): - return 'Command(%r, %r)' % (self.args, self.redirects) - - def __cmp__(self, other): - if not isinstance(other, Command): - return -1 - - return cmp((self.args, self.redirects), - (other.args, other.redirects)) - - def toShell(self, file): - for arg in self.args: - if "'" not in arg: - quoted = "'%s'" % arg - elif '"' not in arg and '$' not in arg: - quoted = '"%s"' % arg - else: - raise NotImplementedError,'Unable to quote %r' % arg - print >>file, quoted, - - # For debugging / validation. - import ShUtil - dequoted = list(ShUtil.ShLexer(quoted).lex()) - if dequoted != [arg]: - raise NotImplementedError,'Unable to quote %r' % arg - - for r in self.redirects: - if len(r[0]) == 1: - print >>file, "%s '%s'" % (r[0][0], r[1]), - else: - print >>file, "%s%s '%s'" % (r[0][1], r[0][0], r[1]), - -class Pipeline: - def __init__(self, commands, negate=False, pipe_err=False): - self.commands = commands - self.negate = negate - self.pipe_err = pipe_err - - def __repr__(self): - return 'Pipeline(%r, %r, %r)' % (self.commands, self.negate, - self.pipe_err) - - def __cmp__(self, other): - if not isinstance(other, Pipeline): - return -1 - - return cmp((self.commands, self.negate, self.pipe_err), - (other.commands, other.negate, self.pipe_err)) - - def toShell(self, file, pipefail=False): - if pipefail != self.pipe_err: - raise ValueError,'Inconsistent "pipefail" attribute!' - if self.negate: - print >>file, '!', - for cmd in self.commands: - cmd.toShell(file) - if cmd is not self.commands[-1]: - print >>file, '|\n ', - -class Seq: - def __init__(self, lhs, op, rhs): - assert op in (';', '&', '||', '&&') - self.op = op - self.lhs = lhs - self.rhs = rhs - - def __repr__(self): - return 'Seq(%r, %r, %r)' % (self.lhs, self.op, self.rhs) - - def __cmp__(self, other): - if not isinstance(other, Seq): - return -1 - - return cmp((self.lhs, self.op, self.rhs), - (other.lhs, other.op, other.rhs)) - - def toShell(self, file, pipefail=False): - self.lhs.toShell(file, pipefail) - print >>file, ' %s\n' % self.op - self.rhs.toShell(file, pipefail) Removed: llvm/trunk/utils/lit/ShUtil.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/ShUtil.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/ShUtil.py (original) +++ llvm/trunk/utils/lit/ShUtil.py (removed) @@ -1,346 +0,0 @@ -import itertools - -import Util -from ShCommands import Command, Pipeline, Seq - -class ShLexer: - def __init__(self, data, win32Escapes = False): - self.data = data - self.pos = 0 - self.end = len(data) - self.win32Escapes = win32Escapes - - def eat(self): - c = self.data[self.pos] - self.pos += 1 - return c - - def look(self): - return self.data[self.pos] - - def maybe_eat(self, c): - """ - maybe_eat(c) - Consume the character c if it is the next character, - returning True if a character was consumed. """ - if self.data[self.pos] == c: - self.pos += 1 - return True - return False - - def lex_arg_fast(self, c): - # Get the leading whitespace free section. - chunk = self.data[self.pos - 1:].split(None, 1)[0] - - # If it has special characters, the fast path failed. - if ('|' in chunk or '&' in chunk or - '<' in chunk or '>' in chunk or - "'" in chunk or '"' in chunk or - '\\' in chunk): - return None - - self.pos = self.pos - 1 + len(chunk) - return chunk - - def lex_arg_slow(self, c): - if c in "'\"": - str = self.lex_arg_quoted(c) - else: - str = c - while self.pos != self.end: - c = self.look() - if c.isspace() or c in "|&": - break - elif c in '><': - # This is an annoying case; we treat '2>' as a single token so - # we don't have to track whitespace tokens. - - # If the parse string isn't an integer, do the usual thing. - if not str.isdigit(): - break - - # Otherwise, lex the operator and convert to a redirection - # token. - num = int(str) - tok = self.lex_one_token() - assert isinstance(tok, tuple) and len(tok) == 1 - return (tok[0], num) - elif c == '"': - self.eat() - str += self.lex_arg_quoted('"') - elif not self.win32Escapes and c == '\\': - # Outside of a string, '\\' escapes everything. - self.eat() - if self.pos == self.end: - Util.warning("escape at end of quoted argument in: %r" % - self.data) - return str - str += self.eat() - else: - str += self.eat() - return str - - def lex_arg_quoted(self, delim): - str = '' - while self.pos != self.end: - c = self.eat() - if c == delim: - return str - elif c == '\\' and delim == '"': - # Inside a '"' quoted string, '\\' only escapes the quote - # character and backslash, otherwise it is preserved. - if self.pos == self.end: - Util.warning("escape at end of quoted argument in: %r" % - self.data) - return str - c = self.eat() - if c == '"': # - str += '"' - elif c == '\\': - str += '\\' - else: - str += '\\' + c - else: - str += c - Util.warning("missing quote character in %r" % self.data) - return str - - def lex_arg_checked(self, c): - pos = self.pos - res = self.lex_arg_fast(c) - end = self.pos - - self.pos = pos - reference = self.lex_arg_slow(c) - if res is not None: - if res != reference: - raise ValueError,"Fast path failure: %r != %r" % (res, reference) - if self.pos != end: - raise ValueError,"Fast path failure: %r != %r" % (self.pos, end) - return reference - - def lex_arg(self, c): - return self.lex_arg_fast(c) or self.lex_arg_slow(c) - - def lex_one_token(self): - """ - lex_one_token - Lex a single 'sh' token. """ - - c = self.eat() - if c in ';!': - return (c,) - if c == '|': - if self.maybe_eat('|'): - return ('||',) - return (c,) - if c == '&': - if self.maybe_eat('&'): - return ('&&',) - if self.maybe_eat('>'): - return ('&>',) - return (c,) - if c == '>': - if self.maybe_eat('&'): - return ('>&',) - if self.maybe_eat('>'): - return ('>>',) - return (c,) - if c == '<': - if self.maybe_eat('&'): - return ('<&',) - if self.maybe_eat('>'): - return ('<<',) - return (c,) - - return self.lex_arg(c) - - def lex(self): - while self.pos != self.end: - if self.look().isspace(): - self.eat() - else: - yield self.lex_one_token() - -### - -class ShParser: - def __init__(self, data, win32Escapes = False): - self.data = data - self.tokens = ShLexer(data, win32Escapes = win32Escapes).lex() - - def lex(self): - try: - return self.tokens.next() - except StopIteration: - return None - - def look(self): - next = self.lex() - if next is not None: - self.tokens = itertools.chain([next], self.tokens) - return next - - def parse_command(self): - tok = self.lex() - if not tok: - raise ValueError,"empty command!" - if isinstance(tok, tuple): - raise ValueError,"syntax error near unexpected token %r" % tok[0] - - args = [tok] - redirects = [] - while 1: - tok = self.look() - - # EOF? - if tok is None: - break - - # If this is an argument, just add it to the current command. - if isinstance(tok, str): - args.append(self.lex()) - continue - - # Otherwise see if it is a terminator. - assert isinstance(tok, tuple) - if tok[0] in ('|',';','&','||','&&'): - break - - # Otherwise it must be a redirection. - op = self.lex() - arg = self.lex() - if not arg: - raise ValueError,"syntax error near token %r" % op[0] - redirects.append((op, arg)) - - return Command(args, redirects) - - def parse_pipeline(self): - negate = False - if self.look() == ('!',): - self.lex() - negate = True - - commands = [self.parse_command()] - while self.look() == ('|',): - self.lex() - commands.append(self.parse_command()) - return Pipeline(commands, negate) - - def parse(self): - lhs = self.parse_pipeline() - - while self.look(): - operator = self.lex() - assert isinstance(operator, tuple) and len(operator) == 1 - - if not self.look(): - raise ValueError, "missing argument to operator %r" % operator[0] - - # FIXME: Operator precedence!! - lhs = Seq(lhs, operator[0], self.parse_pipeline()) - - return lhs - -### - -import unittest - -class TestShLexer(unittest.TestCase): - def lex(self, str, *args, **kwargs): - return list(ShLexer(str, *args, **kwargs).lex()) - - def test_basic(self): - self.assertEqual(self.lex('a|b>c&d',), 'c', ('&',), 'd', - ('<',), 'e']) - - def test_redirection_tokens(self): - self.assertEqual(self.lex('a2>c'), - ['a2', ('>',), 'c']) - self.assertEqual(self.lex('a 2>c'), - ['a', ('>',2), 'c']) - - def test_quoting(self): - self.assertEqual(self.lex(""" 'a' """), - ['a']) - self.assertEqual(self.lex(""" "hello\\"world" """), - ['hello"world']) - self.assertEqual(self.lex(""" "hello\\'world" """), - ["hello\\'world"]) - self.assertEqual(self.lex(""" "hello\\\\world" """), - ["hello\\world"]) - self.assertEqual(self.lex(""" he"llo wo"rld """), - ["hello world"]) - self.assertEqual(self.lex(""" a\\ b a\\\\b """), - ["a b", "a\\b"]) - self.assertEqual(self.lex(""" "" "" """), - ["", ""]) - self.assertEqual(self.lex(""" a\\ b """, win32Escapes = True), - ['a\\', 'b']) - -class TestShParse(unittest.TestCase): - def parse(self, str): - return ShParser(str).parse() - - def test_basic(self): - self.assertEqual(self.parse('echo hello'), - Pipeline([Command(['echo', 'hello'], [])], False)) - self.assertEqual(self.parse('echo ""'), - Pipeline([Command(['echo', ''], [])], False)) - - def test_redirection(self): - self.assertEqual(self.parse('echo hello > c'), - Pipeline([Command(['echo', 'hello'], - [((('>'),), 'c')])], False)) - self.assertEqual(self.parse('echo hello > c >> d'), - Pipeline([Command(['echo', 'hello'], [(('>',), 'c'), - (('>>',), 'd')])], False)) - self.assertEqual(self.parse('a 2>&1'), - Pipeline([Command(['a'], [(('>&',2), '1')])], False)) - - def test_pipeline(self): - self.assertEqual(self.parse('a | b'), - Pipeline([Command(['a'], []), - Command(['b'], [])], - False)) - - self.assertEqual(self.parse('a | b | c'), - Pipeline([Command(['a'], []), - Command(['b'], []), - Command(['c'], [])], - False)) - - self.assertEqual(self.parse('! a'), - Pipeline([Command(['a'], [])], - True)) - - def test_list(self): - self.assertEqual(self.parse('a ; b'), - Seq(Pipeline([Command(['a'], [])], False), - ';', - Pipeline([Command(['b'], [])], False))) - - self.assertEqual(self.parse('a & b'), - Seq(Pipeline([Command(['a'], [])], False), - '&', - Pipeline([Command(['b'], [])], False))) - - self.assertEqual(self.parse('a && b'), - Seq(Pipeline([Command(['a'], [])], False), - '&&', - Pipeline([Command(['b'], [])], False))) - - self.assertEqual(self.parse('a || b'), - Seq(Pipeline([Command(['a'], [])], False), - '||', - Pipeline([Command(['b'], [])], False))) - - self.assertEqual(self.parse('a && b || c'), - Seq(Seq(Pipeline([Command(['a'], [])], False), - '&&', - Pipeline([Command(['b'], [])], False)), - '||', - Pipeline([Command(['c'], [])], False))) - -if __name__ == '__main__': - unittest.main() Removed: llvm/trunk/utils/lit/TclUtil.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TclUtil.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/TclUtil.py (original) +++ llvm/trunk/utils/lit/TclUtil.py (removed) @@ -1,322 +0,0 @@ -import itertools - -from ShCommands import Command, Pipeline - -def tcl_preprocess(data): - # Tcl has a preprocessing step to replace escaped newlines. - i = data.find('\\\n') - if i == -1: - return data - - # Replace '\\\n' and subsequent whitespace by a single space. - n = len(data) - str = data[:i] - i += 2 - while i < n and data[i] in ' \t': - i += 1 - return str + ' ' + data[i:] - -class TclLexer: - """TclLexer - Lex a string into "words", following the Tcl syntax.""" - - def __init__(self, data): - self.data = tcl_preprocess(data) - self.pos = 0 - self.end = len(self.data) - - def at_end(self): - return self.pos == self.end - - def eat(self): - c = self.data[self.pos] - self.pos += 1 - return c - - def look(self): - return self.data[self.pos] - - def maybe_eat(self, c): - """ - maybe_eat(c) - Consume the character c if it is the next character, - returning True if a character was consumed. """ - if self.data[self.pos] == c: - self.pos += 1 - return True - return False - - def escape(self, c): - if c == 'a': - return '\x07' - elif c == 'b': - return '\x08' - elif c == 'f': - return '\x0c' - elif c == 'n': - return '\n' - elif c == 'r': - return '\r' - elif c == 't': - return '\t' - elif c == 'v': - return '\x0b' - elif c in 'uxo': - raise ValueError,'Invalid quoted character %r' % c - else: - return c - - def lex_braced(self): - # Lex until whitespace or end of string, the opening brace has already - # been consumed. - - str = '' - while 1: - if self.at_end(): - raise ValueError,"Unterminated '{' quoted word" - - c = self.eat() - if c == '}': - break - elif c == '{': - str += '{' + self.lex_braced() + '}' - elif c == '\\' and self.look() in '{}': - str += self.eat() - else: - str += c - - return str - - def lex_quoted(self): - str = '' - - while 1: - if self.at_end(): - raise ValueError,"Unterminated '\"' quoted word" - - c = self.eat() - if c == '"': - break - elif c == '\\': - if self.at_end(): - raise ValueError,'Missing quoted character' - - str += self.escape(self.eat()) - else: - str += c - - return str - - def lex_unquoted(self, process_all=False): - # Lex until whitespace or end of string. - str = '' - while not self.at_end(): - if not process_all: - if self.look().isspace() or self.look() == ';': - break - - c = self.eat() - if c == '\\': - if self.at_end(): - raise ValueError,'Missing quoted character' - - str += self.escape(self.eat()) - elif c == '[': - raise NotImplementedError, ('Command substitution is ' - 'not supported') - elif c == '$' and not self.at_end() and (self.look().isalpha() or - self.look() == '{'): - raise NotImplementedError, ('Variable substitution is ' - 'not supported') - else: - str += c - - return str - - def lex_one_token(self): - if self.maybe_eat('"'): - return self.lex_quoted() - elif self.maybe_eat('{'): - # Check for argument substitution. - if not self.maybe_eat('*'): - return self.lex_braced() - - if not self.maybe_eat('}'): - return '*' + self.lex_braced() - - if self.at_end() or self.look().isspace(): - return '*' - - raise NotImplementedError, "Argument substitution is unsupported" - else: - return self.lex_unquoted() - - def lex(self): - while not self.at_end(): - c = self.look() - if c in ' \t': - self.eat() - elif c in ';\n': - self.eat() - yield (';',) - else: - yield self.lex_one_token() - -class TclExecCommand: - kRedirectPrefixes1 = ('<', '>') - kRedirectPrefixes2 = ('<@', '<<', '2>', '>&', '>>', '>@') - kRedirectPrefixes3 = ('2>@', '2>>', '>>&', '>&@') - kRedirectPrefixes4 = ('2>@1',) - - def __init__(self, args): - self.args = iter(args) - - def lex(self): - try: - return self.args.next() - except StopIteration: - return None - - def look(self): - next = self.lex() - if next is not None: - self.args = itertools.chain([next], self.args) - return next - - def parse_redirect(self, tok, length): - if len(tok) == length: - arg = self.lex() - if arg is None: - raise ValueError,'Missing argument to %r redirection' % tok - else: - tok,arg = tok[:length],tok[length:] - - if tok[0] == '2': - op = (tok[1:],2) - else: - op = (tok,) - return (op, arg) - - def parse_pipeline(self): - if self.look() is None: - raise ValueError,"Expected at least one argument to exec" - - commands = [Command([],[])] - while 1: - arg = self.lex() - if arg is None: - break - elif arg == '|': - commands.append(Command([],[])) - elif arg == '|&': - # Write this as a redirect of stderr; it must come first because - # stdout may have already been redirected. - commands[-1].redirects.insert(0, (('>&',2),'1')) - commands.append(Command([],[])) - elif arg[:4] in TclExecCommand.kRedirectPrefixes4: - commands[-1].redirects.append(self.parse_redirect(arg, 4)) - elif arg[:3] in TclExecCommand.kRedirectPrefixes3: - commands[-1].redirects.append(self.parse_redirect(arg, 3)) - elif arg[:2] in TclExecCommand.kRedirectPrefixes2: - commands[-1].redirects.append(self.parse_redirect(arg, 2)) - elif arg[:1] in TclExecCommand.kRedirectPrefixes1: - commands[-1].redirects.append(self.parse_redirect(arg, 1)) - else: - commands[-1].args.append(arg) - - return Pipeline(commands, False, pipe_err=True) - - def parse(self): - ignoreStderr = False - keepNewline = False - - # Parse arguments. - while 1: - next = self.look() - if not isinstance(next, str) or next[0] != '-': - break - - if next == '--': - self.lex() - break - elif next == '-ignorestderr': - ignoreStderr = True - elif next == '-keepnewline': - keepNewline = True - else: - raise ValueError,"Invalid exec argument %r" % next - - return (ignoreStderr, keepNewline, self.parse_pipeline()) - -### - -import unittest - -class TestTclLexer(unittest.TestCase): - def lex(self, str, *args, **kwargs): - return list(TclLexer(str, *args, **kwargs).lex()) - - def test_preprocess(self): - self.assertEqual(tcl_preprocess('a b'), 'a b') - self.assertEqual(tcl_preprocess('a\\\nb c'), 'a b c') - - def test_unquoted(self): - self.assertEqual(self.lex('a b c'), - ['a', 'b', 'c']) - self.assertEqual(self.lex(r'a\nb\tc\ '), - ['a\nb\tc ']) - self.assertEqual(self.lex(r'a \\\$b c $\\'), - ['a', r'\$b', 'c', '$\\']) - - def test_braced(self): - self.assertEqual(self.lex('a {b c} {}'), - ['a', 'b c', '']) - self.assertEqual(self.lex(r'a {b {c\n}}'), - ['a', 'b {c\\n}']) - self.assertEqual(self.lex(r'a {b\{}'), - ['a', 'b{']) - self.assertEqual(self.lex(r'{*}'), ['*']) - self.assertEqual(self.lex(r'{*} a'), ['*', 'a']) - self.assertEqual(self.lex(r'{*} a'), ['*', 'a']) - self.assertEqual(self.lex('{a\\\n b}'), - ['a b']) - - def test_quoted(self): - self.assertEqual(self.lex('a "b c"'), - ['a', 'b c']) - - def test_terminators(self): - self.assertEqual(self.lex('a\nb'), - ['a', (';',), 'b']) - self.assertEqual(self.lex('a;b'), - ['a', (';',), 'b']) - self.assertEqual(self.lex('a ; b'), - ['a', (';',), 'b']) - -class TestTclExecCommand(unittest.TestCase): - def parse(self, str): - return TclExecCommand(list(TclLexer(str).lex())).parse() - - def test_basic(self): - self.assertEqual(self.parse('echo hello'), - (False, False, - Pipeline([Command(['echo', 'hello'], [])], - False, True))) - self.assertEqual(self.parse('echo hello | grep hello'), - (False, False, - Pipeline([Command(['echo', 'hello'], []), - Command(['grep', 'hello'], [])], - False, True))) - - def test_redirect(self): - self.assertEqual(self.parse('echo hello > a >b >>c 2> d |& e'), - (False, False, - Pipeline([Command(['echo', 'hello'], - [(('>&',2),'1'), - (('>',),'a'), - (('>',),'b'), - (('>>',),'c'), - (('>',2),'d')]), - Command(['e'], [])], - False, True))) - -if __name__ == '__main__': - unittest.main() Removed: llvm/trunk/utils/lit/Test.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/Test.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/Test.py (original) +++ llvm/trunk/utils/lit/Test.py (removed) @@ -1,79 +0,0 @@ -import os - -# Test results. - -class TestResult: - def __init__(self, name, isFailure): - self.name = name - self.isFailure = isFailure - -PASS = TestResult('PASS', False) -XFAIL = TestResult('XFAIL', False) -FAIL = TestResult('FAIL', True) -XPASS = TestResult('XPASS', True) -UNRESOLVED = TestResult('UNRESOLVED', True) -UNSUPPORTED = TestResult('UNSUPPORTED', False) - -# Test classes. - -class TestFormat: - """TestFormat - Test information provider.""" - - def __init__(self, name): - self.name = name - -class TestSuite: - """TestSuite - Information on a group of tests. - - A test suite groups together a set of logically related tests. - """ - - def __init__(self, name, source_root, exec_root, config): - self.name = name - self.source_root = source_root - self.exec_root = exec_root - # The test suite configuration. - self.config = config - - def getSourcePath(self, components): - return os.path.join(self.source_root, *components) - - def getExecPath(self, components): - return os.path.join(self.exec_root, *components) - -class Test: - """Test - Information on a single test instance.""" - - def __init__(self, suite, path_in_suite, config): - self.suite = suite - self.path_in_suite = path_in_suite - self.config = config - # The test result code, once complete. - self.result = None - # Any additional output from the test, once complete. - self.output = None - # The wall time to execute this test, if timing and once complete. - self.elapsed = None - # The repeat index of this test, or None. - self.index = None - - def copyWithIndex(self, index): - import copy - res = copy.copy(self) - res.index = index - return res - - def setResult(self, result, output, elapsed): - assert self.result is None, "Test result already set!" - self.result = result - self.output = output - self.elapsed = elapsed - - def getFullName(self): - return self.suite.config.name + '::' + '/'.join(self.path_in_suite) - - def getSourcePath(self): - return self.suite.getSourcePath(self.path_in_suite) - - def getExecPath(self): - return self.suite.getExecPath(self.path_in_suite) Removed: llvm/trunk/utils/lit/TestFormats.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestFormats.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/TestFormats.py (original) +++ llvm/trunk/utils/lit/TestFormats.py (removed) @@ -1,189 +0,0 @@ -import os - -import Test -import TestRunner -import Util - -class GoogleTest(object): - def __init__(self, test_sub_dir, test_suffix): - self.test_sub_dir = str(test_sub_dir) - self.test_suffix = str(test_suffix) - - def getGTestTests(self, path, litConfig): - """getGTestTests(path) - [name] - - Return the tests available in gtest executable.""" - - try: - lines = Util.capture([path, '--gtest_list_tests']).split('\n') - except: - litConfig.error("unable to discover google-tests in %r" % path) - raise StopIteration - - nested_tests = [] - for ln in lines: - if not ln.strip(): - continue - - prefix = '' - index = 0 - while ln[index*2:index*2+2] == ' ': - index += 1 - while len(nested_tests) > index: - nested_tests.pop() - - ln = ln[index*2:] - if ln.endswith('.'): - nested_tests.append(ln) - else: - yield ''.join(nested_tests) + ln - - def getTestsInDirectory(self, testSuite, path_in_suite, - litConfig, localConfig): - source_path = testSuite.getSourcePath(path_in_suite) - for filename in os.listdir(source_path): - # Check for the one subdirectory (build directory) tests will be in. - if filename != self.test_sub_dir: - continue - - filepath = os.path.join(source_path, filename) - for subfilename in os.listdir(filepath): - if subfilename.endswith(self.test_suffix): - execpath = os.path.join(filepath, subfilename) - - # Discover the tests in this executable. - for name in self.getGTestTests(execpath, litConfig): - testPath = path_in_suite + (filename, subfilename, name) - yield Test.Test(testSuite, testPath, localConfig) - - def execute(self, test, litConfig): - testPath,testName = os.path.split(test.getSourcePath()) - while not os.path.exists(testPath): - # Handle GTest parametrized and typed tests, whose name includes - # some '/'s. - testPath, namePrefix = os.path.split(testPath) - testName = os.path.join(namePrefix, testName) - - cmd = [testPath, '--gtest_filter=' + testName] - out, err, exitCode = TestRunner.executeCommand(cmd) - - if not exitCode: - return Test.PASS,'' - - return Test.FAIL, out + err - -### - -class FileBasedTest(object): - def getTestsInDirectory(self, testSuite, path_in_suite, - litConfig, localConfig): - source_path = testSuite.getSourcePath(path_in_suite) - for filename in os.listdir(source_path): - filepath = os.path.join(source_path, filename) - if not os.path.isdir(filepath): - base,ext = os.path.splitext(filename) - if ext in localConfig.suffixes: - yield Test.Test(testSuite, path_in_suite + (filename,), - localConfig) - -class ShTest(FileBasedTest): - def __init__(self, execute_external = False): - self.execute_external = execute_external - - def execute(self, test, litConfig): - return TestRunner.executeShTest(test, litConfig, - self.execute_external) - -class TclTest(FileBasedTest): - def execute(self, test, litConfig): - return TestRunner.executeTclTest(test, litConfig) - -### - -import re -import tempfile - -class OneCommandPerFileTest: - # FIXME: Refactor into generic test for running some command on a directory - # of inputs. - - def __init__(self, command, dir, recursive=False, - pattern=".*", useTempInput=False): - if isinstance(command, str): - self.command = [command] - else: - self.command = list(command) - self.dir = str(dir) - self.recursive = bool(recursive) - self.pattern = re.compile(pattern) - self.useTempInput = useTempInput - - def getTestsInDirectory(self, testSuite, path_in_suite, - litConfig, localConfig): - for dirname,subdirs,filenames in os.walk(self.dir): - if not self.recursive: - subdirs[:] = [] - - subdirs[:] = [d for d in subdirs - if (d != '.svn' and - d not in localConfig.excludes)] - - for filename in filenames: - if (not self.pattern.match(filename) or - filename in localConfig.excludes): - continue - - path = os.path.join(dirname,filename) - suffix = path[len(self.dir):] - if suffix.startswith(os.sep): - suffix = suffix[1:] - test = Test.Test(testSuite, - path_in_suite + tuple(suffix.split(os.sep)), - localConfig) - # FIXME: Hack? - test.source_path = path - yield test - - def createTempInput(self, tmp, test): - abstract - - def execute(self, test, litConfig): - if test.config.unsupported: - return (Test.UNSUPPORTED, 'Test is unsupported') - - cmd = list(self.command) - - # If using temp input, create a temporary file and hand it to the - # subclass. - if self.useTempInput: - tmp = tempfile.NamedTemporaryFile(suffix='.cpp') - self.createTempInput(tmp, test) - tmp.flush() - cmd.append(tmp.name) - else: - cmd.append(test.source_path) - - out, err, exitCode = TestRunner.executeCommand(cmd) - - diags = out + err - if not exitCode and not diags.strip(): - return Test.PASS,'' - - # Try to include some useful information. - report = """Command: %s\n""" % ' '.join(["'%s'" % a - for a in cmd]) - if self.useTempInput: - report += """Temporary File: %s\n""" % tmp.name - report += "--\n%s--\n""" % open(tmp.name).read() - report += """Output:\n--\n%s--""" % diags - - return Test.FAIL, report - -class SyntaxCheckTest(OneCommandPerFileTest): - def __init__(self, compiler, dir, extra_cxx_args=[], *args, **kwargs): - cmd = [compiler, '-x', 'c++', '-fsyntax-only'] + extra_cxx_args - OneCommandPerFileTest.__init__(self, cmd, dir, - useTempInput=1, *args, **kwargs) - - def createTempInput(self, tmp, test): - print >>tmp, '#include "%s"' % test.source_path Removed: llvm/trunk/utils/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestRunner.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/TestRunner.py (removed) @@ -1,517 +0,0 @@ -import os, signal, subprocess, sys -import StringIO - -import ShUtil -import Test -import Util - -import platform -import tempfile - -class InternalShellError(Exception): - def __init__(self, command, message): - self.command = command - self.message = message - -# Don't use close_fds on Windows. -kUseCloseFDs = platform.system() != 'Windows' - -# Use temporary files to replace /dev/null on Windows. -kAvoidDevNull = platform.system() == 'Windows' - -def executeCommand(command, cwd=None, env=None): - p = subprocess.Popen(command, cwd=cwd, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - env=env) - out,err = p.communicate() - exitCode = p.wait() - - # Detect Ctrl-C in subprocess. - if exitCode == -signal.SIGINT: - raise KeyboardInterrupt - - return out, err, exitCode - -def executeShCmd(cmd, cfg, cwd, results): - if isinstance(cmd, ShUtil.Seq): - if cmd.op == ';': - res = executeShCmd(cmd.lhs, cfg, cwd, results) - return executeShCmd(cmd.rhs, cfg, cwd, results) - - if cmd.op == '&': - raise NotImplementedError,"unsupported test command: '&'" - - if cmd.op == '||': - res = executeShCmd(cmd.lhs, cfg, cwd, results) - if res != 0: - res = executeShCmd(cmd.rhs, cfg, cwd, results) - return res - if cmd.op == '&&': - res = executeShCmd(cmd.lhs, cfg, cwd, results) - if res is None: - return res - - if res == 0: - res = executeShCmd(cmd.rhs, cfg, cwd, results) - return res - - raise ValueError,'Unknown shell command: %r' % cmd.op - - assert isinstance(cmd, ShUtil.Pipeline) - procs = [] - input = subprocess.PIPE - stderrTempFiles = [] - # To avoid deadlock, we use a single stderr stream for piped - # output. This is null until we have seen some output using - # stderr. - for i,j in enumerate(cmd.commands): - # Apply the redirections, we use (N,) as a sentinal to indicate stdin, - # stdout, stderr for N equal to 0, 1, or 2 respectively. Redirects to or - # from a file are represented with a list [file, mode, file-object] - # where file-object is initially None. - redirects = [(0,), (1,), (2,)] - for r in j.redirects: - if r[0] == ('>',2): - redirects[2] = [r[1], 'w', None] - elif r[0] == ('>>',2): - redirects[2] = [r[1], 'a', None] - elif r[0] == ('>&',2) and r[1] in '012': - redirects[2] = redirects[int(r[1])] - elif r[0] == ('>&',) or r[0] == ('&>',): - redirects[1] = redirects[2] = [r[1], 'w', None] - elif r[0] == ('>',): - redirects[1] = [r[1], 'w', None] - elif r[0] == ('>>',): - redirects[1] = [r[1], 'a', None] - elif r[0] == ('<',): - redirects[0] = [r[1], 'r', None] - else: - raise NotImplementedError,"Unsupported redirect: %r" % (r,) - - # Map from the final redirections to something subprocess can handle. - final_redirects = [] - for index,r in enumerate(redirects): - if r == (0,): - result = input - elif r == (1,): - if index == 0: - raise NotImplementedError,"Unsupported redirect for stdin" - elif index == 1: - result = subprocess.PIPE - else: - result = subprocess.STDOUT - elif r == (2,): - if index != 2: - raise NotImplementedError,"Unsupported redirect on stdout" - result = subprocess.PIPE - else: - if r[2] is None: - if kAvoidDevNull and r[0] == '/dev/null': - r[2] = tempfile.TemporaryFile(mode=r[1]) - else: - r[2] = open(r[0], r[1]) - # Workaround a Win32 and/or subprocess bug when appending. - if r[1] == 'a': - r[2].seek(0, 2) - result = r[2] - final_redirects.append(result) - - stdin, stdout, stderr = final_redirects - - # If stderr wants to come from stdout, but stdout isn't a pipe, then put - # stderr on a pipe and treat it as stdout. - if (stderr == subprocess.STDOUT and stdout != subprocess.PIPE): - stderr = subprocess.PIPE - stderrIsStdout = True - else: - stderrIsStdout = False - - # Don't allow stderr on a PIPE except for the last - # process, this could deadlock. - # - # FIXME: This is slow, but so is deadlock. - if stderr == subprocess.PIPE and j != cmd.commands[-1]: - stderr = tempfile.TemporaryFile(mode='w+b') - stderrTempFiles.append((i, stderr)) - - # Resolve the executable path ourselves. - args = list(j.args) - args[0] = Util.which(args[0], cfg.environment['PATH']) - if not args[0]: - raise InternalShellError(j, '%r: command not found' % j.args[0]) - - procs.append(subprocess.Popen(args, cwd=cwd, - stdin = stdin, - stdout = stdout, - stderr = stderr, - env = cfg.environment, - close_fds = kUseCloseFDs)) - - # Immediately close stdin for any process taking stdin from us. - if stdin == subprocess.PIPE: - procs[-1].stdin.close() - procs[-1].stdin = None - - # Update the current stdin source. - if stdout == subprocess.PIPE: - input = procs[-1].stdout - elif stderrIsStdout: - input = procs[-1].stderr - else: - input = subprocess.PIPE - - # FIXME: There is probably still deadlock potential here. Yawn. - procData = [None] * len(procs) - procData[-1] = procs[-1].communicate() - - for i in range(len(procs) - 1): - if procs[i].stdout is not None: - out = procs[i].stdout.read() - else: - out = '' - if procs[i].stderr is not None: - err = procs[i].stderr.read() - else: - err = '' - procData[i] = (out,err) - - # Read stderr out of the temp files. - for i,f in stderrTempFiles: - f.seek(0, 0) - procData[i] = (procData[i][0], f.read()) - - exitCode = None - for i,(out,err) in enumerate(procData): - res = procs[i].wait() - # Detect Ctrl-C in subprocess. - if res == -signal.SIGINT: - raise KeyboardInterrupt - - results.append((cmd.commands[i], out, err, res)) - if cmd.pipe_err: - # Python treats the exit code as a signed char. - if res < 0: - exitCode = min(exitCode, res) - else: - exitCode = max(exitCode, res) - else: - exitCode = res - - if cmd.negate: - exitCode = not exitCode - - return exitCode - -def executeScriptInternal(test, litConfig, tmpBase, commands, cwd): - ln = ' &&\n'.join(commands) - try: - cmd = ShUtil.ShParser(ln, litConfig.isWindows).parse() - except: - return (Test.FAIL, "shell parser error on: %r" % ln) - - results = [] - try: - exitCode = executeShCmd(cmd, test.config, cwd, results) - except InternalShellError,e: - out = '' - err = e.message - exitCode = 255 - - out = err = '' - for i,(cmd, cmd_out,cmd_err,res) in enumerate(results): - out += 'Command %d: %s\n' % (i, ' '.join('"%s"' % s for s in cmd.args)) - out += 'Command %d Result: %r\n' % (i, res) - out += 'Command %d Output:\n%s\n\n' % (i, cmd_out) - out += 'Command %d Stderr:\n%s\n\n' % (i, cmd_err) - - return out, err, exitCode - -def executeTclScriptInternal(test, litConfig, tmpBase, commands, cwd): - import TclUtil - cmds = [] - for ln in commands: - # Given the unfortunate way LLVM's test are written, the line gets - # backslash substitution done twice. - ln = TclUtil.TclLexer(ln).lex_unquoted(process_all = True) - - try: - tokens = list(TclUtil.TclLexer(ln).lex()) - except: - return (Test.FAIL, "Tcl lexer error on: %r" % ln) - - # Validate there are no control tokens. - for t in tokens: - if not isinstance(t, str): - return (Test.FAIL, - "Invalid test line: %r containing %r" % (ln, t)) - - try: - cmds.append(TclUtil.TclExecCommand(tokens).parse_pipeline()) - except: - return (Test.FAIL, "Tcl 'exec' parse error on: %r" % ln) - - cmd = cmds[0] - for c in cmds[1:]: - cmd = ShUtil.Seq(cmd, '&&', c) - - # FIXME: This is lame, we shouldn't need bash. See PR5240. - bashPath = litConfig.getBashPath() - if litConfig.useTclAsSh and bashPath: - script = tmpBase + '.script' - - # Write script file - f = open(script,'w') - print >>f, 'set -o pipefail' - cmd.toShell(f, pipefail = True) - f.close() - - if 0: - print >>sys.stdout, cmd - print >>sys.stdout, open(script).read() - print >>sys.stdout - return '', '', 0 - - command = [litConfig.getBashPath(), script] - out,err,exitCode = executeCommand(command, cwd=cwd, - env=test.config.environment) - - # Tcl commands fail on standard error output. - if err: - exitCode = 1 - out = 'Command has output on stderr!\n\n' + out - - return out,err,exitCode - else: - results = [] - try: - exitCode = executeShCmd(cmd, test.config, cwd, results) - except InternalShellError,e: - results.append((e.command, '', e.message + '\n', 255)) - exitCode = 255 - - out = err = '' - - # Tcl commands fail on standard error output. - if [True for _,_,err,res in results if err]: - exitCode = 1 - out += 'Command has output on stderr!\n\n' - - for i,(cmd, cmd_out, cmd_err, res) in enumerate(results): - out += 'Command %d: %s\n' % (i, ' '.join('"%s"' % s for s in cmd.args)) - out += 'Command %d Result: %r\n' % (i, res) - out += 'Command %d Output:\n%s\n\n' % (i, cmd_out) - out += 'Command %d Stderr:\n%s\n\n' % (i, cmd_err) - - return out, err, exitCode - -def executeScript(test, litConfig, tmpBase, commands, cwd): - script = tmpBase + '.script' - if litConfig.isWindows: - script += '.bat' - - # Write script file - f = open(script,'w') - if litConfig.isWindows: - f.write('\nif %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands)) - else: - f.write(' &&\n'.join(commands)) - f.write('\n') - f.close() - - if litConfig.isWindows: - command = ['cmd','/c', script] - else: - command = ['/bin/sh', script] - if litConfig.useValgrind: - # FIXME: Running valgrind on sh is overkill. We probably could just - # run on clang with no real loss. - valgrindArgs = ['valgrind', '-q', - '--tool=memcheck', '--trace-children=yes', - '--error-exitcode=123'] - valgrindArgs.extend(litConfig.valgrindArgs) - - command = valgrindArgs + command - - return executeCommand(command, cwd=cwd, env=test.config.environment) - -def isExpectedFail(xfails, xtargets, target_triple): - # Check if any xfail matches this target. - for item in xfails: - if item == '*' or item in target_triple: - break - else: - return False - - # If so, see if it is expected to pass on this target. - # - # FIXME: Rename XTARGET to something that makes sense, like XPASS. - for item in xtargets: - if item == '*' or item in target_triple: - return False - - return True - -def parseIntegratedTestScript(test): - """parseIntegratedTestScript - Scan an LLVM/Clang style integrated test - script and extract the lines to 'RUN' as well as 'XFAIL' and 'XTARGET' - information. The RUN lines also will have variable substitution performed. - """ - - # Get the temporary location, this is always relative to the test suite - # root, not test source root. - # - # FIXME: This should not be here? - sourcepath = test.getSourcePath() - execpath = test.getExecPath() - execdir,execbase = os.path.split(execpath) - tmpBase = os.path.join(execdir, 'Output', execbase) - if test.index is not None: - tmpBase += '_%d' % test.index - - # We use #_MARKER_# to hide %% while we do the other substitutions. - substitutions = [('%%', '#_MARKER_#')] - substitutions.extend(test.config.substitutions) - substitutions.extend([('%s', sourcepath), - ('%S', os.path.dirname(sourcepath)), - ('%p', os.path.dirname(sourcepath)), - ('%t', tmpBase + '.tmp'), - # FIXME: Remove this once we kill DejaGNU. - ('%abs_tmp', tmpBase + '.tmp'), - ('#_MARKER_#', '%')]) - - # Collect the test lines from the script. - script = [] - xfails = [] - xtargets = [] - for ln in open(sourcepath): - if 'RUN:' in ln: - # Isolate the command to run. - index = ln.index('RUN:') - ln = ln[index+4:] - - # Trim trailing whitespace. - ln = ln.rstrip() - - # Collapse lines with trailing '\\'. - if script and script[-1][-1] == '\\': - script[-1] = script[-1][:-1] + ln - else: - script.append(ln) - elif 'XFAIL:' in ln: - items = ln[ln.index('XFAIL:') + 6:].split(',') - xfails.extend([s.strip() for s in items]) - elif 'XTARGET:' in ln: - items = ln[ln.index('XTARGET:') + 8:].split(',') - xtargets.extend([s.strip() for s in items]) - elif 'END.' in ln: - # Check for END. lines. - if ln[ln.index('END.'):].strip() == 'END.': - break - - # Apply substitutions to the script. - def processLine(ln): - # Apply substitutions - for a,b in substitutions: - ln = ln.replace(a,b) - - # Strip the trailing newline and any extra whitespace. - return ln.strip() - script = map(processLine, script) - - # Verify the script contains a run line. - if not script: - return (Test.UNRESOLVED, "Test has no run line!") - - if script[-1][-1] == '\\': - return (Test.UNRESOLVED, "Test has unterminated run lines (with '\\')") - - isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple) - return script,isXFail,tmpBase,execdir - -def formatTestOutput(status, out, err, exitCode, script): - output = StringIO.StringIO() - print >>output, "Script:" - print >>output, "--" - print >>output, '\n'.join(script) - print >>output, "--" - print >>output, "Exit Code: %r" % exitCode - print >>output, "Command Output (stdout):" - print >>output, "--" - output.write(out) - print >>output, "--" - print >>output, "Command Output (stderr):" - print >>output, "--" - output.write(err) - print >>output, "--" - return (status, output.getvalue()) - -def executeTclTest(test, litConfig): - if test.config.unsupported: - return (Test.UNSUPPORTED, 'Test is unsupported') - - res = parseIntegratedTestScript(test) - if len(res) == 2: - return res - - script, isXFail, tmpBase, execdir = res - - if litConfig.noExecute: - return (Test.PASS, '') - - # Create the output directory if it does not already exist. - Util.mkdir_p(os.path.dirname(tmpBase)) - - res = executeTclScriptInternal(test, litConfig, tmpBase, script, execdir) - if len(res) == 2: - return res - - out,err,exitCode = res - if isXFail: - ok = exitCode != 0 - status = (Test.XPASS, Test.XFAIL)[ok] - else: - ok = exitCode == 0 - status = (Test.FAIL, Test.PASS)[ok] - - if ok: - return (status,'') - - return formatTestOutput(status, out, err, exitCode, script) - -def executeShTest(test, litConfig, useExternalSh): - if test.config.unsupported: - return (Test.UNSUPPORTED, 'Test is unsupported') - - res = parseIntegratedTestScript(test) - if len(res) == 2: - return res - - script, isXFail, tmpBase, execdir = res - - if litConfig.noExecute: - return (Test.PASS, '') - - # Create the output directory if it does not already exist. - Util.mkdir_p(os.path.dirname(tmpBase)) - - if useExternalSh: - res = executeScript(test, litConfig, tmpBase, script, execdir) - else: - res = executeScriptInternal(test, litConfig, tmpBase, script, execdir) - if len(res) == 2: - return res - - out,err,exitCode = res - if isXFail: - ok = exitCode != 0 - status = (Test.XPASS, Test.XFAIL)[ok] - else: - ok = exitCode == 0 - status = (Test.FAIL, Test.PASS)[ok] - - if ok: - return (status,'') - - return formatTestOutput(status, out, err, exitCode, script) Removed: llvm/trunk/utils/lit/TestingConfig.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestingConfig.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/TestingConfig.py (original) +++ llvm/trunk/utils/lit/TestingConfig.py (removed) @@ -1,97 +0,0 @@ -import os - -class TestingConfig: - """" - TestingConfig - Information on the tests inside a suite. - """ - - @staticmethod - def frompath(path, parent, litConfig, mustExist, config = None): - if config is None: - # Set the environment based on the command line arguments. - environment = { - 'PATH' : os.pathsep.join(litConfig.path + - [os.environ.get('PATH','')]), - 'PATHEXT' : os.environ.get('PATHEXT',''), - 'SYSTEMROOT' : os.environ.get('SYSTEMROOT',''), - 'LLVM_DISABLE_CRT_DEBUG' : '1', - } - - config = TestingConfig(parent, - name = '', - suffixes = set(), - test_format = None, - environment = environment, - substitutions = [], - unsupported = False, - on_clone = None, - test_exec_root = None, - test_source_root = None, - excludes = []) - - if os.path.exists(path): - # FIXME: Improve detection and error reporting of errors in the - # config file. - f = open(path) - cfg_globals = dict(globals()) - cfg_globals['config'] = config - cfg_globals['lit'] = litConfig - cfg_globals['__file__'] = path - try: - exec f in cfg_globals - except SystemExit,status: - # We allow normal system exit inside a config file to just - # return control without error. - if status.args: - raise - f.close() - elif mustExist: - litConfig.fatal('unable to load config from %r ' % path) - - config.finish(litConfig) - return config - - def __init__(self, parent, name, suffixes, test_format, - environment, substitutions, unsupported, on_clone, - test_exec_root, test_source_root, excludes): - self.parent = parent - self.name = str(name) - self.suffixes = set(suffixes) - self.test_format = test_format - self.environment = dict(environment) - self.substitutions = list(substitutions) - self.unsupported = unsupported - self.on_clone = on_clone - self.test_exec_root = test_exec_root - self.test_source_root = test_source_root - self.excludes = set(excludes) - - def clone(self, path): - # FIXME: Chain implementations? - # - # FIXME: Allow extra parameters? - cfg = TestingConfig(self, self.name, self.suffixes, self.test_format, - self.environment, self.substitutions, - self.unsupported, self.on_clone, - self.test_exec_root, self.test_source_root, - self.excludes) - if cfg.on_clone: - cfg.on_clone(self, cfg, path) - return cfg - - def finish(self, litConfig): - """finish() - Finish this config object, after loading is complete.""" - - self.name = str(self.name) - self.suffixes = set(self.suffixes) - self.environment = dict(self.environment) - self.substitutions = list(self.substitutions) - if self.test_exec_root is not None: - # FIXME: This should really only be suite in test suite config - # files. Should we distinguish them? - self.test_exec_root = str(self.test_exec_root) - if self.test_source_root is not None: - # FIXME: This should really only be suite in test suite config - # files. Should we distinguish them? - self.test_source_root = str(self.test_source_root) - self.excludes = set(self.excludes) Removed: llvm/trunk/utils/lit/Util.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/Util.py?rev=92167&view=auto ============================================================================== --- llvm/trunk/utils/lit/Util.py (original) +++ llvm/trunk/utils/lit/Util.py (removed) @@ -1,124 +0,0 @@ -import os, sys - -def detectCPUs(): - """ - Detects the number of CPUs on a system. Cribbed from pp. - """ - # Linux, Unix and MacOS: - if hasattr(os, "sysconf"): - if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"): - # Linux & Unix: - ncpus = os.sysconf("SC_NPROCESSORS_ONLN") - if isinstance(ncpus, int) and ncpus > 0: - return ncpus - else: # OSX: - return int(os.popen2("sysctl -n hw.ncpu")[1].read()) - # Windows: - if os.environ.has_key("NUMBER_OF_PROCESSORS"): - ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]) - if ncpus > 0: - return ncpus - return 1 # Default - -def mkdir_p(path): - """mkdir_p(path) - Make the "path" directory, if it does not exist; this - will also make directories for any missing parent directories.""" - import errno - - if not path or os.path.exists(path): - return - - parent = os.path.dirname(path) - if parent != path: - mkdir_p(parent) - - try: - os.mkdir(path) - except OSError,e: - # Ignore EEXIST, which may occur during a race condition. - if e.errno != errno.EEXIST: - raise - -def capture(args): - import subprocess - """capture(command) - Run the given command (or argv list) in a shell and - return the standard output.""" - p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out,_ = p.communicate() - return out - -def which(command, paths = None): - """which(command, [paths]) - Look up the given command in the paths string - (or the PATH environment variable, if unspecified).""" - - if paths is None: - paths = os.environ.get('PATH','') - - # Check for absolute match first. - if os.path.exists(command): - return command - - # Would be nice if Python had a lib function for this. - if not paths: - paths = os.defpath - - # Get suffixes to search. - pathext = os.environ.get('PATHEXT', '').split(os.pathsep) - - # Search the paths... - for path in paths.split(os.pathsep): - for ext in pathext: - p = os.path.join(path, command + ext) - if os.path.exists(p): - return p - - return None - -def printHistogram(items, title = 'Items'): - import itertools, math - - items.sort(key = lambda (_,v): v) - - maxValue = max([v for _,v in items]) - - # Select first "nice" bar height that produces more than 10 bars. - power = int(math.ceil(math.log(maxValue, 10))) - for inc in itertools.cycle((5, 2, 2.5, 1)): - barH = inc * 10**power - N = int(math.ceil(maxValue / barH)) - if N > 10: - break - elif inc == 1: - power -= 1 - - histo = [set() for i in range(N)] - for name,v in items: - bin = min(int(N * v/maxValue), N-1) - histo[bin].add(name) - - barW = 40 - hr = '-' * (barW + 34) - print '\nSlowest %s:' % title - print hr - for name,value in items[-20:]: - print '%.2fs: %s' % (value, name) - print '\n%s Times:' % title - print hr - pDigits = int(math.ceil(math.log(maxValue, 10))) - pfDigits = max(0, 3-pDigits) - if pfDigits: - pDigits += pfDigits + 1 - cDigits = int(math.ceil(math.log(len(items), 10))) - print "[%s] :: [%s] :: [%s]" % ('Range'.center((pDigits+1)*2 + 3), - 'Percentage'.center(barW), - 'Count'.center(cDigits*2 + 1)) - print hr - for i,row in enumerate(histo): - pct = float(len(row)) / len(items) - w = int(barW * pct) - print "[%*.*fs,%*.*fs)" % (pDigits, pfDigits, i*barH, - pDigits, pfDigits, (i+1)*barH), - print ":: [%s%s] :: [%*d/%*d]" % ('*'*w, ' '*(barW-w), - cDigits, len(row), - cDigits, len(items)) - Modified: llvm/trunk/utils/lit/lit.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit.py?rev=92168&r1=92167&r2=92168&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit.py (original) +++ llvm/trunk/utils/lit/lit.py Sat Dec 26 16:58:23 2009 @@ -1,576 +1,5 @@ #!/usr/bin/env python -""" -lit - LLVM Integrated Tester. - -See lit.pod for more information. -""" - -import math, os, platform, random, re, sys, time, threading, traceback - -import ProgressBar -import TestRunner -import Util - -from TestingConfig import TestingConfig -import LitConfig -import Test - -# Configuration files to look for when discovering test suites. These can be -# overridden with --config-prefix. -# -# FIXME: Rename to 'config.lit', 'site.lit', and 'local.lit' ? -gConfigName = 'lit.cfg' -gSiteConfigName = 'lit.site.cfg' - -kLocalConfigName = 'lit.local.cfg' - -class TestingProgressDisplay: - def __init__(self, opts, numTests, progressBar=None): - self.opts = opts - self.numTests = numTests - self.current = None - self.lock = threading.Lock() - self.progressBar = progressBar - self.completed = 0 - - def update(self, test): - # Avoid locking overhead in quiet mode - if self.opts.quiet and not test.result.isFailure: - self.completed += 1 - return - - # Output lock. - self.lock.acquire() - try: - self.handleUpdate(test) - finally: - self.lock.release() - - def finish(self): - if self.progressBar: - self.progressBar.clear() - elif self.opts.quiet: - pass - elif self.opts.succinct: - sys.stdout.write('\n') - - def handleUpdate(self, test): - self.completed += 1 - if self.progressBar: - self.progressBar.update(float(self.completed)/self.numTests, - test.getFullName()) - - if self.opts.succinct and not test.result.isFailure: - return - - if self.progressBar: - self.progressBar.clear() - - print '%s: %s (%d of %d)' % (test.result.name, test.getFullName(), - self.completed, self.numTests) - - if test.result.isFailure and self.opts.showOutput: - print "%s TEST '%s' FAILED %s" % ('*'*20, test.getFullName(), - '*'*20) - print test.output - print "*" * 20 - - sys.stdout.flush() - -class TestProvider: - def __init__(self, tests, maxTime): - self.maxTime = maxTime - self.iter = iter(tests) - self.lock = threading.Lock() - self.startTime = time.time() - - def get(self): - # Check if we have run out of time. - if self.maxTime is not None: - if time.time() - self.startTime > self.maxTime: - return None - - # Otherwise take the next test. - self.lock.acquire() - try: - item = self.iter.next() - except StopIteration: - item = None - self.lock.release() - return item - -class Tester(threading.Thread): - def __init__(self, litConfig, provider, display): - threading.Thread.__init__(self) - self.litConfig = litConfig - self.provider = provider - self.display = display - - def run(self): - while 1: - item = self.provider.get() - if item is None: - break - self.runTest(item) - - def runTest(self, test): - result = None - startTime = time.time() - try: - result, output = test.config.test_format.execute(test, - self.litConfig) - except KeyboardInterrupt: - # This is a sad hack. Unfortunately subprocess goes - # bonkers with ctrl-c and we start forking merrily. - print '\nCtrl-C detected, goodbye.' - os.kill(0,9) - except: - if self.litConfig.debug: - raise - result = Test.UNRESOLVED - output = 'Exception during script execution:\n' - output += traceback.format_exc() - output += '\n' - elapsed = time.time() - startTime - - test.setResult(result, output, elapsed) - self.display.update(test) - -def dirContainsTestSuite(path): - cfgpath = os.path.join(path, gSiteConfigName) - if os.path.exists(cfgpath): - return cfgpath - cfgpath = os.path.join(path, gConfigName) - if os.path.exists(cfgpath): - return cfgpath - -def getTestSuite(item, litConfig, cache): - """getTestSuite(item, litConfig, cache) -> (suite, relative_path) - - Find the test suite containing @arg item. - - @retval (None, ...) - Indicates no test suite contains @arg item. - @retval (suite, relative_path) - The suite that @arg item is in, and its - relative path inside that suite. - """ - def search1(path): - # Check for a site config or a lit config. - cfgpath = dirContainsTestSuite(path) - - # If we didn't find a config file, keep looking. - if not cfgpath: - parent,base = os.path.split(path) - if parent == path: - return (None, ()) - - ts, relative = search(parent) - return (ts, relative + (base,)) - - # We found a config file, load it. - if litConfig.debug: - litConfig.note('loading suite config %r' % cfgpath) - - cfg = TestingConfig.frompath(cfgpath, None, litConfig, mustExist = True) - source_root = os.path.realpath(cfg.test_source_root or path) - exec_root = os.path.realpath(cfg.test_exec_root or path) - return Test.TestSuite(cfg.name, source_root, exec_root, cfg), () - - def search(path): - # Check for an already instantiated test suite. - res = cache.get(path) - if res is None: - cache[path] = res = search1(path) - return res - - # Canonicalize the path. - item = os.path.realpath(item) - - # Skip files and virtual components. - components = [] - while not os.path.isdir(item): - parent,base = os.path.split(item) - if parent == item: - return (None, ()) - components.append(base) - item = parent - components.reverse() - - ts, relative = search(item) - return ts, tuple(relative + tuple(components)) - -def getLocalConfig(ts, path_in_suite, litConfig, cache): - def search1(path_in_suite): - # Get the parent config. - if not path_in_suite: - parent = ts.config - else: - parent = search(path_in_suite[:-1]) - - # Load the local configuration. - source_path = ts.getSourcePath(path_in_suite) - cfgpath = os.path.join(source_path, kLocalConfigName) - if litConfig.debug: - litConfig.note('loading local config %r' % cfgpath) - return TestingConfig.frompath(cfgpath, parent, litConfig, - mustExist = False, - config = parent.clone(cfgpath)) - - def search(path_in_suite): - key = (ts, path_in_suite) - res = cache.get(key) - if res is None: - cache[key] = res = search1(path_in_suite) - return res - - return search(path_in_suite) - -def getTests(path, litConfig, testSuiteCache, localConfigCache): - # Find the test suite for this input and its relative path. - ts,path_in_suite = getTestSuite(path, litConfig, testSuiteCache) - if ts is None: - litConfig.warning('unable to find test suite for %r' % path) - return (),() - - if litConfig.debug: - litConfig.note('resolved input %r to %r::%r' % (path, ts.name, - path_in_suite)) - - return ts, getTestsInSuite(ts, path_in_suite, litConfig, - testSuiteCache, localConfigCache) - -def getTestsInSuite(ts, path_in_suite, litConfig, - testSuiteCache, localConfigCache): - # Check that the source path exists (errors here are reported by the - # caller). - source_path = ts.getSourcePath(path_in_suite) - if not os.path.exists(source_path): - return - - # Check if the user named a test directly. - if not os.path.isdir(source_path): - lc = getLocalConfig(ts, path_in_suite[:-1], litConfig, localConfigCache) - yield Test.Test(ts, path_in_suite, lc) - return - - # Otherwise we have a directory to search for tests, start by getting the - # local configuration. - lc = getLocalConfig(ts, path_in_suite, litConfig, localConfigCache) - - # Search for tests. - for res in lc.test_format.getTestsInDirectory(ts, path_in_suite, - litConfig, lc): - yield res - - # Search subdirectories. - for filename in os.listdir(source_path): - # FIXME: This doesn't belong here? - if filename in ('Output', '.svn') or filename in lc.excludes: - continue - - # Ignore non-directories. - file_sourcepath = os.path.join(source_path, filename) - if not os.path.isdir(file_sourcepath): - continue - - # Check for nested test suites, first in the execpath in case there is a - # site configuration and then in the source path. - file_execpath = ts.getExecPath(path_in_suite + (filename,)) - if dirContainsTestSuite(file_execpath): - sub_ts, subiter = getTests(file_execpath, litConfig, - testSuiteCache, localConfigCache) - elif dirContainsTestSuite(file_sourcepath): - sub_ts, subiter = getTests(file_sourcepath, litConfig, - testSuiteCache, localConfigCache) - else: - # Otherwise, continue loading from inside this test suite. - subiter = getTestsInSuite(ts, path_in_suite + (filename,), - litConfig, testSuiteCache, - localConfigCache) - sub_ts = None - - N = 0 - for res in subiter: - N += 1 - yield res - if sub_ts and not N: - litConfig.warning('test suite %r contained no tests' % sub_ts.name) - -def runTests(numThreads, litConfig, provider, display): - # If only using one testing thread, don't use threads at all; this lets us - # profile, among other things. - if numThreads == 1: - t = Tester(litConfig, provider, display) - t.run() - return - - # Otherwise spin up the testing threads and wait for them to finish. - testers = [Tester(litConfig, provider, display) - for i in range(numThreads)] - for t in testers: - t.start() - try: - for t in testers: - t.join() - except KeyboardInterrupt: - sys.exit(2) - -def main(): - global options - from optparse import OptionParser, OptionGroup - parser = OptionParser("usage: %prog [options] {file-or-path}") - - parser.add_option("-j", "--threads", dest="numThreads", metavar="N", - help="Number of testing threads", - type=int, action="store", default=None) - parser.add_option("", "--config-prefix", dest="configPrefix", - metavar="NAME", help="Prefix for 'lit' config files", - action="store", default=None) - parser.add_option("", "--param", dest="userParameters", - metavar="NAME=VAL", - help="Add 'NAME' = 'VAL' to the user defined parameters", - type=str, action="append", default=[]) - - group = OptionGroup(parser, "Output Format") - # FIXME: I find these names very confusing, although I like the - # functionality. - group.add_option("-q", "--quiet", dest="quiet", - help="Suppress no error output", - action="store_true", default=False) - group.add_option("-s", "--succinct", dest="succinct", - help="Reduce amount of output", - action="store_true", default=False) - group.add_option("-v", "--verbose", dest="showOutput", - help="Show all test output", - action="store_true", default=False) - group.add_option("", "--no-progress-bar", dest="useProgressBar", - help="Do not use curses based progress bar", - action="store_false", default=True) - parser.add_option_group(group) - - group = OptionGroup(parser, "Test Execution") - group.add_option("", "--path", dest="path", - help="Additional paths to add to testing environment", - action="append", type=str, default=[]) - group.add_option("", "--vg", dest="useValgrind", - help="Run tests under valgrind", - action="store_true", default=False) - group.add_option("", "--vg-arg", dest="valgrindArgs", metavar="ARG", - help="Specify an extra argument for valgrind", - type=str, action="append", default=[]) - group.add_option("", "--time-tests", dest="timeTests", - help="Track elapsed wall time for each test", - action="store_true", default=False) - group.add_option("", "--no-execute", dest="noExecute", - help="Don't execute any tests (assume PASS)", - action="store_true", default=False) - parser.add_option_group(group) - - group = OptionGroup(parser, "Test Selection") - group.add_option("", "--max-tests", dest="maxTests", metavar="N", - help="Maximum number of tests to run", - action="store", type=int, default=None) - group.add_option("", "--max-time", dest="maxTime", metavar="N", - help="Maximum time to spend testing (in seconds)", - action="store", type=float, default=None) - group.add_option("", "--shuffle", dest="shuffle", - help="Run tests in random order", - action="store_true", default=False) - parser.add_option_group(group) - - group = OptionGroup(parser, "Debug and Experimental Options") - group.add_option("", "--debug", dest="debug", - help="Enable debugging (for 'lit' development)", - action="store_true", default=False) - group.add_option("", "--show-suites", dest="showSuites", - help="Show discovered test suites", - action="store_true", default=False) - group.add_option("", "--no-tcl-as-sh", dest="useTclAsSh", - help="Don't run Tcl scripts using 'sh'", - action="store_false", default=True) - group.add_option("", "--repeat", dest="repeatTests", metavar="N", - help="Repeat tests N times (for timing)", - action="store", default=None, type=int) - parser.add_option_group(group) - - (opts, args) = parser.parse_args() - - if not args: - parser.error('No inputs specified') - - if opts.configPrefix is not None: - global gConfigName, gSiteConfigName - gConfigName = '%s.cfg' % opts.configPrefix - gSiteConfigName = '%s.site.cfg' % opts.configPrefix - - if opts.numThreads is None: - opts.numThreads = Util.detectCPUs() - - inputs = args - - # Create the user defined parameters. - userParams = {} - for entry in opts.userParameters: - if '=' not in entry: - name,val = entry,'' - else: - name,val = entry.split('=', 1) - userParams[name] = val - - # Create the global config object. - litConfig = LitConfig.LitConfig(progname = os.path.basename(sys.argv[0]), - path = opts.path, - quiet = opts.quiet, - useValgrind = opts.useValgrind, - valgrindArgs = opts.valgrindArgs, - useTclAsSh = opts.useTclAsSh, - noExecute = opts.noExecute, - debug = opts.debug, - isWindows = (platform.system()=='Windows'), - params = userParams) - - # Load the tests from the inputs. - tests = [] - testSuiteCache = {} - localConfigCache = {} - for input in inputs: - prev = len(tests) - tests.extend(getTests(input, litConfig, - testSuiteCache, localConfigCache)[1]) - if prev == len(tests): - litConfig.warning('input %r contained no tests' % input) - - # If there were any errors during test discovery, exit now. - if litConfig.numErrors: - print >>sys.stderr, '%d errors, exiting.' % litConfig.numErrors - sys.exit(2) - - if opts.showSuites: - suitesAndTests = dict([(ts,[]) - for ts,_ in testSuiteCache.values() - if ts]) - for t in tests: - suitesAndTests[t.suite].append(t) - - print '-- Test Suites --' - suitesAndTests = suitesAndTests.items() - suitesAndTests.sort(key = lambda (ts,_): ts.name) - for ts,ts_tests in suitesAndTests: - print ' %s - %d tests' %(ts.name, len(ts_tests)) - print ' Source Root: %s' % ts.source_root - print ' Exec Root : %s' % ts.exec_root - - # Select and order the tests. - numTotalTests = len(tests) - if opts.shuffle: - random.shuffle(tests) - else: - tests.sort(key = lambda t: t.getFullName()) - if opts.maxTests is not None: - tests = tests[:opts.maxTests] - - extra = '' - if len(tests) != numTotalTests: - extra = ' of %d' % numTotalTests - header = '-- Testing: %d%s tests, %d threads --'%(len(tests),extra, - opts.numThreads) - - if opts.repeatTests: - tests = [t.copyWithIndex(i) - for t in tests - for i in range(opts.repeatTests)] - - progressBar = None - if not opts.quiet: - if opts.succinct and opts.useProgressBar: - try: - tc = ProgressBar.TerminalController() - progressBar = ProgressBar.ProgressBar(tc, header) - except ValueError: - print header - progressBar = ProgressBar.SimpleProgressBar('Testing: ') - else: - print header - - # Don't create more threads than tests. - opts.numThreads = min(len(tests), opts.numThreads) - - startTime = time.time() - display = TestingProgressDisplay(opts, len(tests), progressBar) - provider = TestProvider(tests, opts.maxTime) - runTests(opts.numThreads, litConfig, provider, display) - display.finish() - - if not opts.quiet: - print 'Testing Time: %.2fs'%(time.time() - startTime) - - # Update results for any tests which weren't run. - for t in tests: - if t.result is None: - t.setResult(Test.UNRESOLVED, '', 0.0) - - # List test results organized by kind. - hasFailures = False - byCode = {} - for t in tests: - if t.result not in byCode: - byCode[t.result] = [] - byCode[t.result].append(t) - if t.result.isFailure: - hasFailures = True - - # FIXME: Show unresolved and (optionally) unsupported tests. - for title,code in (('Unexpected Passing Tests', Test.XPASS), - ('Failing Tests', Test.FAIL)): - elts = byCode.get(code) - if not elts: - continue - print '*'*20 - print '%s (%d):' % (title, len(elts)) - for t in elts: - print ' %s' % t.getFullName() - print - - if opts.timeTests: - # Collate, in case we repeated tests. - times = {} - for t in tests: - key = t.getFullName() - times[key] = times.get(key, 0.) + t.elapsed - - byTime = list(times.items()) - byTime.sort(key = lambda (name,elapsed): elapsed) - if byTime: - Util.printHistogram(byTime, title='Tests') - - for name,code in (('Expected Passes ', Test.PASS), - ('Expected Failures ', Test.XFAIL), - ('Unsupported Tests ', Test.UNSUPPORTED), - ('Unresolved Tests ', Test.UNRESOLVED), - ('Unexpected Passes ', Test.XPASS), - ('Unexpected Failures', Test.FAIL),): - if opts.quiet and not code.isFailure: - continue - N = len(byCode.get(code,[])) - if N: - print ' %s: %d' % (name,N) - - # If we encountered any additional errors, exit abnormally. - if litConfig.numErrors: - print >>sys.stderr, '\n%d error(s), exiting.' % litConfig.numErrors - sys.exit(2) - - # Warn about warnings. - if litConfig.numWarnings: - print >>sys.stderr, '\n%d warning(s) in tests.' % litConfig.numWarnings - - if hasFailures: - sys.exit(1) - sys.exit(0) - if __name__=='__main__': - # Bump the GIL check interval, its more important to get any one thread to a - # blocking operation (hopefully exec) than to try and unblock other threads. - import sys - sys.setcheckinterval(1000) - main() + import lit + lit.main() Copied: llvm/trunk/utils/lit/lit/ExampleTests.ObjDir/lit.site.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests.ObjDir/lit.site.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests.ObjDir/lit.site.cfg&p1=llvm/trunk/utils/lit/ExampleTests.ObjDir/lit.site.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/Clang/fsyntax-only.c (from r92167, llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/Clang/fsyntax-only.c?p2=llvm/trunk/utils/lit/lit/ExampleTests/Clang/fsyntax-only.c&p1=llvm/trunk/utils/lit/ExampleTests/Clang/fsyntax-only.c&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/Clang/lit.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/Clang/lit.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/Clang/lit.cfg&p1=llvm/trunk/utils/lit/ExampleTests/Clang/lit.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/bar-test.ll&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/Bar/dg.exp&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.cfg&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.InTree/test/site.exp&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/lit.local.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/Foo/lit.local.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/data.txt&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/dg.exp&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg&p1=llvm/trunk/utils/lit/ExampleTests/LLVM.OutOfTree/src/test/lit.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/ShExternal/lit.local.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/ShExternal/lit.local.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/ShExternal/lit.local.cfg&p1=llvm/trunk/utils/lit/ExampleTests/ShExternal/lit.local.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/ShInternal/lit.local.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/ShInternal/lit.local.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/ShInternal/lit.local.cfg&p1=llvm/trunk/utils/lit/ExampleTests/ShInternal/lit.local.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/TclTest/lit.local.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/TclTest/lit.local.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/TclTest/lit.local.cfg&p1=llvm/trunk/utils/lit/ExampleTests/TclTest/lit.local.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/TclTest/stderr-pipe.ll (from r92167, llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/TclTest/stderr-pipe.ll?p2=llvm/trunk/utils/lit/lit/ExampleTests/TclTest/stderr-pipe.ll&p1=llvm/trunk/utils/lit/ExampleTests/TclTest/stderr-pipe.ll&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/TclTest/tcl-redir-1.ll (from r92167, llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/TclTest/tcl-redir-1.ll?p2=llvm/trunk/utils/lit/lit/ExampleTests/TclTest/tcl-redir-1.ll&p1=llvm/trunk/utils/lit/ExampleTests/TclTest/tcl-redir-1.ll&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/fail.c (from r92167, llvm/trunk/utils/lit/ExampleTests/fail.c) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/fail.c?p2=llvm/trunk/utils/lit/lit/ExampleTests/fail.c&p1=llvm/trunk/utils/lit/ExampleTests/fail.c&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg (from r92167, llvm/trunk/utils/lit/ExampleTests/lit.cfg) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg?p2=llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg&p1=llvm/trunk/utils/lit/ExampleTests/lit.cfg&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/pass.c (from r92167, llvm/trunk/utils/lit/ExampleTests/pass.c) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/pass.c?p2=llvm/trunk/utils/lit/lit/ExampleTests/pass.c&p1=llvm/trunk/utils/lit/ExampleTests/pass.c&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/xfail.c (from r92167, llvm/trunk/utils/lit/ExampleTests/xfail.c) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/xfail.c?p2=llvm/trunk/utils/lit/lit/ExampleTests/xfail.c&p1=llvm/trunk/utils/lit/ExampleTests/xfail.c&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ExampleTests/xpass.c (from r92167, llvm/trunk/utils/lit/ExampleTests/xpass.c) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/xpass.c?p2=llvm/trunk/utils/lit/lit/ExampleTests/xpass.c&p1=llvm/trunk/utils/lit/ExampleTests/xpass.c&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/LitConfig.py (from r92167, llvm/trunk/utils/lit/LitConfig.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/LitConfig.py?p2=llvm/trunk/utils/lit/lit/LitConfig.py&p1=llvm/trunk/utils/lit/LitConfig.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/LitFormats.py (from r92167, llvm/trunk/utils/lit/LitFormats.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/LitFormats.py?p2=llvm/trunk/utils/lit/lit/LitFormats.py&p1=llvm/trunk/utils/lit/LitFormats.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ProgressBar.py (from r92167, llvm/trunk/utils/lit/ProgressBar.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ProgressBar.py?p2=llvm/trunk/utils/lit/lit/ProgressBar.py&p1=llvm/trunk/utils/lit/ProgressBar.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ShCommands.py (from r92167, llvm/trunk/utils/lit/ShCommands.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ShCommands.py?p2=llvm/trunk/utils/lit/lit/ShCommands.py&p1=llvm/trunk/utils/lit/ShCommands.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/ShUtil.py (from r92167, llvm/trunk/utils/lit/ShUtil.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ShUtil.py?p2=llvm/trunk/utils/lit/lit/ShUtil.py&p1=llvm/trunk/utils/lit/ShUtil.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/TclUtil.py (from r92167, llvm/trunk/utils/lit/TclUtil.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TclUtil.py?p2=llvm/trunk/utils/lit/lit/TclUtil.py&p1=llvm/trunk/utils/lit/TclUtil.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/Test.py (from r92167, llvm/trunk/utils/lit/Test.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Test.py?p2=llvm/trunk/utils/lit/lit/Test.py&p1=llvm/trunk/utils/lit/Test.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/TestFormats.py (from r92167, llvm/trunk/utils/lit/TestFormats.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestFormats.py?p2=llvm/trunk/utils/lit/lit/TestFormats.py&p1=llvm/trunk/utils/lit/TestFormats.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/TestRunner.py (from r92167, llvm/trunk/utils/lit/TestRunner.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?p2=llvm/trunk/utils/lit/lit/TestRunner.py&p1=llvm/trunk/utils/lit/TestRunner.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/TestingConfig.py (from r92167, llvm/trunk/utils/lit/TestingConfig.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?p2=llvm/trunk/utils/lit/lit/TestingConfig.py&p1=llvm/trunk/utils/lit/TestingConfig.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Copied: llvm/trunk/utils/lit/lit/Util.py (from r92167, llvm/trunk/utils/lit/Util.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Util.py?p2=llvm/trunk/utils/lit/lit/Util.py&p1=llvm/trunk/utils/lit/Util.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== (empty) Added: llvm/trunk/utils/lit/lit/__init__.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/__init__.py?rev=92168&view=auto ============================================================================== --- llvm/trunk/utils/lit/lit/__init__.py (added) +++ llvm/trunk/utils/lit/lit/__init__.py Sat Dec 26 16:58:23 2009 @@ -0,0 +1,10 @@ +"""'lit' Testing Tool""" + +from lit import main + +__author__ = 'Daniel Dunbar' +__email__ = 'daniel at zuster.org' +__versioninfo__ = (0, 1, 0) +__version__ = '.'.join(map(str, __versioninfo__)) + +__all__ = [] Copied: llvm/trunk/utils/lit/lit/lit.py (from r92167, llvm/trunk/utils/lit/lit.py) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/lit.py?p2=llvm/trunk/utils/lit/lit/lit.py&p1=llvm/trunk/utils/lit/lit.py&r1=92167&r2=92168&rev=92168&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit.py (original) +++ llvm/trunk/utils/lit/lit/lit.py Sat Dec 26 16:58:23 2009 @@ -316,6 +316,13 @@ sys.exit(2) def main(): + # Bump the GIL check interval, its more important to get any one thread to a + # blocking operation (hopefully exec) than to try and unblock other threads. + # + # FIXME: This is a hack. + import sys + sys.setcheckinterval(1000) + global options from optparse import OptionParser, OptionGroup parser = OptionParser("usage: %prog [options] {file-or-path}") @@ -569,8 +576,4 @@ sys.exit(0) if __name__=='__main__': - # Bump the GIL check interval, its more important to get any one thread to a - # blocking operation (hopefully exec) than to try and unblock other threads. - import sys - sys.setcheckinterval(1000) main() From daniel at zuster.org Sat Dec 26 16:58:40 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 26 Dec 2009 22:58:40 -0000 Subject: [llvm-commits] [llvm] r92169 - /llvm/trunk/utils/lit/setup.py Message-ID: <200912262258.nBQMweHW029192@zion.cs.uiuc.edu> Author: ddunbar Date: Sat Dec 26 16:58:39 2009 New Revision: 92169 URL: http://llvm.org/viewvc/llvm-project?rev=92169&view=rev Log: lit: Add setuptools support. Added: llvm/trunk/utils/lit/setup.py Added: llvm/trunk/utils/lit/setup.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/setup.py?rev=92169&view=auto ============================================================================== --- llvm/trunk/utils/lit/setup.py (added) +++ llvm/trunk/utils/lit/setup.py Sat Dec 26 16:58:39 2009 @@ -0,0 +1,69 @@ +import lit + +# FIXME: Support distutils? +from setuptools import setup, find_packages +setup( + name = "Lit", + version = lit.__version__, + + author = lit.__author__, + author_email = lit.__email__, + url = 'http://llvm.org', + license = 'BSD', + + description = "A Software Testing Tool", + keywords = 'test C++ automatic discovery', + long_description = """\ +Lit ++++ + +About +===== + +Lit is a portable tool for executing LLVM and Clang style test suites, +summarizing their results, and providing indication of failures. Lit is designed +to be a lightweight testing tool with as simple a user interface as possible. + + +Features +======== + + * Portable! + * Flexible test discovery. + * Parallel test execution. + * Support for multiple test formats and test suite designs. + + +Documentation +============= + +The offical Lit documentation is in the man page, available online in the `LLVM +Command Guide http://llvm.org/cmds/lit.html`_. + + +Source +====== + +The Lit source is available as part of LLVM, in the `LLVM SVN repository + Author: void Date: Sun Dec 27 19:00:12 2009 New Revision: 92178 URL: http://llvm.org/viewvc/llvm-project?rev=92178&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp?rev=92178&r1=92177&r2=92178&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Sun Dec 27 19:00:12 2009 @@ -464,7 +464,6 @@ void DAGTypeLegalizer::SplitRes_UNDEF(SDNode *N, SDValue &Lo, SDValue &Hi) { EVT LoVT, HiVT; - DebugLoc dl = N->getDebugLoc(); GetSplitDestVTs(N->getValueType(0), LoVT, HiVT); Lo = DAG.getUNDEF(LoVT); Hi = DAG.getUNDEF(HiVT); From isanbard at gmail.com Sun Dec 27 19:01:15 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:01:15 -0000 Subject: [llvm-commits] [llvm] r92179 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Message-ID: <200912280101.nBS11FhO017585@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:01:14 2009 New Revision: 92179 URL: http://llvm.org/viewvc/llvm-project?rev=92179&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=92179&r1=92178&r2=92179&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sun Dec 27 19:01:14 2009 @@ -899,8 +899,6 @@ MachineBasicBlock* MBB, int& SS, SmallPtrSet& RefsInMBB) { - MachineBasicBlock::iterator Pt = MBB->begin(); - // Go top down if RefsInMBB is empty. if (RefsInMBB.empty()) return 0; From isanbard at gmail.com Sun Dec 27 19:02:21 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:02:21 -0000 Subject: [llvm-commits] [llvm] r92180 - /llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Message-ID: <200912280102.nBS12LDp017624@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:02:21 2009 New Revision: 92180 URL: http://llvm.org/viewvc/llvm-project?rev=92180&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=92180&r1=92179&r2=92180&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Sun Dec 27 19:02:21 2009 @@ -548,9 +548,6 @@ /// the CFG. void FastISel::FastEmitBranch(MachineBasicBlock *MSucc) { - MachineFunction::iterator NextMBB = - llvm::next(MachineFunction::iterator(MBB)); - if (MBB->isLayoutSuccessor(MSucc)) { // The unconditional fall-through case, which needs no instructions. } else { From isanbard at gmail.com Sun Dec 27 19:20:29 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:20:29 -0000 Subject: [llvm-commits] [llvm] r92181 - in /llvm/trunk: include/llvm/Support/Compiler.h lib/Target/ARM/AsmParser/ARMAsmParser.cpp Message-ID: <200912280120.nBS1KTeJ018367@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:20:29 2009 New Revision: 92181 URL: http://llvm.org/viewvc/llvm-project?rev=92181&view=rev Log: Add an "ATTRIBUTE_UNUSED" macro (and use it). It's for variables which are mainly used in debugging and/or assert situations. It should make the compiler and the static analyzer stop nagging us about them. Modified: llvm/trunk/include/llvm/Support/Compiler.h llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Modified: llvm/trunk/include/llvm/Support/Compiler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=92181&r1=92180&r2=92181&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Compiler.h (original) +++ llvm/trunk/include/llvm/Support/Compiler.h Sun Dec 27 19:20:29 2009 @@ -29,6 +29,12 @@ #define ATTRIBUTE_USED #endif +#if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +#define ATTRIBUTE_UNUSED __attribute__((__unused__)) +#else +#define ATTRIBUTE_UNUSED +#endif + #ifdef __GNUC__ // aka 'ATTRIBUTE_CONST' but following LLVM Conventions. #define ATTRIBUTE_READNONE __attribute__((__const__)) #else Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=92181&r1=92180&r2=92181&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Sun Dec 27 19:20:29 2009 @@ -15,6 +15,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetAsmParser.h" @@ -666,7 +667,7 @@ const AsmToken &Tok = getLexer().getTok(); if (Tok.isNot(AsmToken::Identifier) && Tok.isNot(AsmToken::String)) return Error(L, "unexpected token in .syntax directive"); - StringRef SymbolName = getLexer().getTok().getIdentifier(); + StringRef ATTRIBUTE_UNUSED SymbolName = getLexer().getTok().getIdentifier(); getLexer().Lex(); // Consume the identifier token. if (getLexer().isNot(AsmToken::EndOfStatement)) From isanbard at gmail.com Sun Dec 27 19:31:11 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:31:11 -0000 Subject: [llvm-commits] [llvm] r92182 - /llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Message-ID: <200912280131.nBS1VCG5018705@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:31:11 2009 New Revision: 92182 URL: http://llvm.org/viewvc/llvm-project?rev=92182&view=rev Log: Remove dead store. The initial value was never used, but always overridden. Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=92182&r1=92181&r2=92182&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Sun Dec 27 19:31:11 2009 @@ -1157,11 +1157,6 @@ // Handy pointer type EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); - // Accumulate how many bytes are to be pushed on the stack, including the - // linkage area, and parameter passing area. According to the SPU ABI, - // we minimally need space for [LR] and [SP] - unsigned NumStackBytes = SPUFrameInfo::minStackSize(); - // Set up a copy of the stack pointer for use loading and storing any // arguments that may not fit in the registers available for argument // passing. @@ -1224,8 +1219,12 @@ } } - // Update number of stack bytes actually used, insert a call sequence start - NumStackBytes = (ArgOffset - SPUFrameInfo::minStackSize()); + // Accumulate how many bytes are to be pushed on the stack, including the + // linkage area, and parameter passing area. According to the SPU ABI, + // we minimally need space for [LR] and [SP]. + unsigned NumStackBytes = ArgOffset - SPUFrameInfo::minStackSize(); + + // Insert a call sequence start Chain = DAG.getCALLSEQ_START(Chain, DAG.getIntPtrConstant(NumStackBytes, true)); From isanbard at gmail.com Sun Dec 27 19:34:58 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:34:58 -0000 Subject: [llvm-commits] [llvm] r92183 - /llvm/trunk/tools/llvm-mc/AsmParser.cpp Message-ID: <200912280134.nBS1YwNB018838@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:34:57 2009 New Revision: 92183 URL: http://llvm.org/viewvc/llvm-project?rev=92183&view=rev Log: Mark some debug variables as 'unused' to quiet compiler and analyzer. Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=92183&r1=92182&r2=92183&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Sun Dec 27 19:34:57 2009 @@ -22,6 +22,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetAsmParser.h" @@ -963,7 +964,7 @@ if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { const MCExpr *Value; - SMLoc StartLoc = Lexer.getLoc(); + SMLoc ATTRIBUTE_UNUSED StartLoc = Lexer.getLoc(); if (ParseExpression(Value)) return true; @@ -1631,7 +1632,7 @@ if (Lexer.isNot(AsmToken::String)) return TokError("unexpected token in '.file' directive"); - StringRef FileName = Lexer.getTok().getString(); + StringRef ATTRIBUTE_UNUSED FileName = Lexer.getTok().getString(); Lexer.Lex(); if (Lexer.isNot(AsmToken::EndOfStatement)) From isanbard at gmail.com Sun Dec 27 19:36:03 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:36:03 -0000 Subject: [llvm-commits] [llvm] r92184 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Message-ID: <200912280136.nBS1a362018882@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:36:02 2009 New Revision: 92184 URL: http://llvm.org/viewvc/llvm-project?rev=92184&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=92184&r1=92183&r2=92184&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Sun Dec 27 19:36:02 2009 @@ -2587,7 +2587,6 @@ MemOp2RegOpTable.find((unsigned*)MI->getOpcode()); if (I == MemOp2RegOpTable.end()) return false; - DebugLoc dl = MI->getDebugLoc(); unsigned Opc = I->second.first; unsigned Index = I->second.second & 0xf; bool FoldedLoad = I->second.second & (1 << 4); From isanbard at gmail.com Sun Dec 27 19:41:12 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:41:12 -0000 Subject: [llvm-commits] [llvm] r92185 - /llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp Message-ID: <200912280141.nBS1fCHM019039@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:41:12 2009 New Revision: 92185 URL: http://llvm.org/viewvc/llvm-project?rev=92185&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp?rev=92185&r1=92184&r2=92185&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp Sun Dec 27 19:41:12 2009 @@ -84,7 +84,6 @@ SDNode *BlackfinDAGToDAGISel::Select(SDValue Op) { SDNode *N = Op.getNode(); - DebugLoc dl = N->getDebugLoc(); if (N->isMachineOpcode()) return NULL; // Already selected. From isanbard at gmail.com Sun Dec 27 19:42:12 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:42:12 -0000 Subject: [llvm-commits] [llvm] r92186 - /llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Message-ID: <200912280142.nBS1gC2e019078@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:42:12 2009 New Revision: 92186 URL: http://llvm.org/viewvc/llvm-project?rev=92186&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=92186&r1=92185&r2=92186&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Sun Dec 27 19:42:12 2009 @@ -556,8 +556,7 @@ void MSILWriter::printPHICopy(const BasicBlock* Src, const BasicBlock* Dst) { - for (BasicBlock::const_iterator I = Dst->begin(), E = Dst->end(); - isa(I); ++I) { + for (BasicBlock::const_iterator I = Dst->begin(); isa(I); ++I) { const PHINode* Phi = cast(I); const Value* Val = Phi->getIncomingValueForBlock(Src); if (isa(Val)) continue; From isanbard at gmail.com Sun Dec 27 19:44:39 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:44:39 -0000 Subject: [llvm-commits] [llvm] r92187 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200912280144.nBS1idIL019162@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:44:39 2009 New Revision: 92187 URL: http://llvm.org/viewvc/llvm-project?rev=92187&view=rev Log: Remove dead store. Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=92187&r1=92186&r2=92187&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Sun Dec 27 19:44:39 2009 @@ -860,7 +860,7 @@ // Remove all instructions up 'til the last use, since they're // just calculating the value we already have. BB->erase(I, LastUseMI); - MI = I = LastUseMI; + I = LastUseMI; // Extend the live range of the scratch register PrevLastUseMI->getOperand(PrevLastUseOp).setIsKill(false); From isanbard at gmail.com Sun Dec 27 19:47:48 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:47:48 -0000 Subject: [llvm-commits] [llvm] r92188 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200912280147.nBS1lmD1019313@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:47:48 2009 New Revision: 92188 URL: http://llvm.org/viewvc/llvm-project?rev=92188&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=92188&r1=92187&r2=92188&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Dec 27 19:47:48 2009 @@ -187,7 +187,6 @@ SelectionDAGLegalize::ShuffleWithNarrowerEltType(EVT NVT, EVT VT, DebugLoc dl, SDValue N1, SDValue N2, SmallVectorImpl &Mask) const { - EVT EltVT = NVT.getVectorElementType(); unsigned NumMaskElts = VT.getVectorNumElements(); unsigned NumDestElts = NVT.getVectorNumElements(); unsigned NumEltsGrowth = NumDestElts / NumMaskElts; From isanbard at gmail.com Sun Dec 27 19:48:56 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:48:56 -0000 Subject: [llvm-commits] [llvm] r92189 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Message-ID: <200912280148.nBS1muGQ019375@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:48:56 2009 New Revision: 92189 URL: http://llvm.org/viewvc/llvm-project?rev=92189&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=92189&r1=92188&r2=92189&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Sun Dec 27 19:48:56 2009 @@ -2026,8 +2026,6 @@ GetExpandedInteger(NewLHS, LHSLo, LHSHi); GetExpandedInteger(NewRHS, RHSLo, RHSHi); - EVT VT = NewLHS.getValueType(); - if (CCCode == ISD::SETEQ || CCCode == ISD::SETNE) { if (RHSLo == RHSHi) { if (ConstantSDNode *RHSCST = dyn_cast(RHSLo)) { From isanbard at gmail.com Sun Dec 27 19:51:31 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:51:31 -0000 Subject: [llvm-commits] [llvm] r92190 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200912280151.nBS1pVhM019494@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:51:30 2009 New Revision: 92190 URL: http://llvm.org/viewvc/llvm-project?rev=92190&view=rev Log: Remove dead store. 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=92190&r1=92189&r2=92190&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Dec 27 19:51:30 2009 @@ -567,9 +567,9 @@ if (Changed) { if (TimePassesIsEnabled) { NamedRegionTimer T("Type Legalization 2", GroupName); - Changed = CurDAG->LegalizeTypes(); + CurDAG->LegalizeTypes(); } else { - Changed = CurDAG->LegalizeTypes(); + CurDAG->LegalizeTypes(); } if (ViewDAGCombineLT) From isanbard at gmail.com Sun Dec 27 19:53:00 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:53:00 -0000 Subject: [llvm-commits] [llvm] r92191 - /llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Message-ID: <200912280153.nBS1r0k1019546@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:53:00 2009 New Revision: 92191 URL: http://llvm.org/viewvc/llvm-project?rev=92191&view=rev Log: Remove dead store and simplify code. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=92191&r1=92190&r2=92191&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Sun Dec 27 19:53:00 2009 @@ -429,13 +429,12 @@ // Asm->EOL("Region start"); - if (!S.EndLabel) { + if (!S.EndLabel) EndLabelPtr = (intptr_t)EndFunction; - JCE->emitInt32((intptr_t)EndFunction - BeginLabelPtr); - } else { + else EndLabelPtr = JCE->getLabelAddress(S.EndLabel); - JCE->emitInt32(EndLabelPtr - BeginLabelPtr); - } + + JCE->emitInt32(EndLabelPtr - BeginLabelPtr); //Asm->EOL("Region length"); if (!S.PadLabel) { From isanbard at gmail.com Sun Dec 27 19:54:16 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:54:16 -0000 Subject: [llvm-commits] [llvm] r92192 - /llvm/trunk/lib/Linker/LinkModules.cpp Message-ID: <200912280154.nBS1sGhQ019591@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:54:15 2009 New Revision: 92192 URL: http://llvm.org/viewvc/llvm-project?rev=92192&view=rev Log: Remove dead store. Modified: llvm/trunk/lib/Linker/LinkModules.cpp Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=92192&r1=92191&r2=92192&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Sun Dec 27 19:54:15 2009 @@ -664,7 +664,6 @@ Var->eraseFromParent(); else cast(DGV)->eraseFromParent(); - DGV = NewDGV; // If the symbol table renamed the global, but it is an externally visible // symbol, DGV must be an existing global with internal linkage. Rename. From isanbard at gmail.com Sun Dec 27 19:57:40 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 01:57:40 -0000 Subject: [llvm-commits] [llvm] r92193 - /llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Message-ID: <200912280157.nBS1veGx019708@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 19:57:39 2009 New Revision: 92193 URL: http://llvm.org/viewvc/llvm-project?rev=92193&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=92193&r1=92192&r2=92193&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Sun Dec 27 19:57:39 2009 @@ -944,8 +944,6 @@ unsigned DestReg, unsigned SubIdx, const MachineInstr *Orig, const TargetRegisterInfo *TRI) const { - DebugLoc dl = Orig->getDebugLoc(); - if (SubIdx && TargetRegisterInfo::isPhysicalRegister(DestReg)) { DestReg = TRI->getSubReg(DestReg, SubIdx); SubIdx = 0; From isanbard at gmail.com Sun Dec 27 20:00:30 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 02:00:30 -0000 Subject: [llvm-commits] [llvm] r92194 - /llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Message-ID: <200912280200.nBS20U0e019803@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 20:00:30 2009 New Revision: 92194 URL: http://llvm.org/viewvc/llvm-project?rev=92194&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=92194&r1=92193&r2=92194&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Sun Dec 27 20:00:30 2009 @@ -190,7 +190,6 @@ EVT PtrVT = Op.getValueType(); JumpTableSDNode *JT = cast(Op); SDValue JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT); - SDValue Zero = DAG.getConstant(0, PtrVT); // FIXME there isn't really any debug info here DebugLoc dl = Op.getDebugLoc(); From isanbard at gmail.com Sun Dec 27 20:01:07 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 02:01:07 -0000 Subject: [llvm-commits] [llvm] r92195 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp Message-ID: <200912280201.nBS217Mn019836@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 20:01:06 2009 New Revision: 92195 URL: http://llvm.org/viewvc/llvm-project?rev=92195&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=92195&r1=92194&r2=92195&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sun Dec 27 20:01:06 2009 @@ -3389,7 +3389,6 @@ // Convert over the clobber constraints. IsFirst = true; - ValueCount = 0; for (std::vector::iterator I = Constraints.begin(), E = Constraints.end(); I != E; ++I) { if (I->Type != InlineAsm::isClobber) From isanbard at gmail.com Sun Dec 27 20:04:53 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 02:04:53 -0000 Subject: [llvm-commits] [llvm] r92196 - /llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Message-ID: <200912280204.nBS24rxQ019960@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 20:04:53 2009 New Revision: 92196 URL: http://llvm.org/viewvc/llvm-project?rev=92196&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=92196&r1=92195&r2=92196&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Sun Dec 27 20:04:53 2009 @@ -748,9 +748,7 @@ case ISD::UNINDEXED: { // The vector type we really want to load from the 16-byte chunk. EVT vecVT = EVT::getVectorVT(*DAG.getContext(), - VT, (128 / VT.getSizeInBits())), - stVecVT = EVT::getVectorVT(*DAG.getContext(), - StVT, (128 / StVT.getSizeInBits())); + VT, (128 / VT.getSizeInBits())); SDValue alignLoadVec; SDValue basePtr = SN->getBasePtr(); @@ -2622,8 +2620,6 @@ // Type to extend to MVT OpVT = Op.getValueType().getSimpleVT(); - EVT VecVT = EVT::getVectorVT(*DAG.getContext(), - OpVT, (128 / OpVT.getSizeInBits())); // Type to extend from SDValue Op0 = Op.getOperand(0); From isanbard at gmail.com Sun Dec 27 20:05:36 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 02:05:36 -0000 Subject: [llvm-commits] [llvm] r92197 - /llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Message-ID: <200912280205.nBS25aHQ019991@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 20:05:36 2009 New Revision: 92197 URL: http://llvm.org/viewvc/llvm-project?rev=92197&view=rev Log: Remove dead variable. Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp?rev=92197&r1=92196&r2=92197&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Sun Dec 27 20:05:36 2009 @@ -217,7 +217,6 @@ } bool MSP430DAGToDAGISel::MatchAddress(SDValue N, MSP430ISelAddressMode &AM) { - DebugLoc dl = N.getDebugLoc(); DEBUG({ errs() << "MatchAddress: "; AM.dump(); From isanbard at gmail.com Sun Dec 27 20:07:00 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 28 Dec 2009 02:07:00 -0000 Subject: [llvm-commits] [llvm] r92198 - /llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp Message-ID: <200912280207.nBS270Hn020044@zion.cs.uiuc.edu> Author: void Date: Sun Dec 27 20:07:00 2009 New Revision: 92198 URL: http://llvm.org/viewvc/llvm-project?rev=92198&view=rev Log: Mark variable used by 'assert' as 'unused'. Modified: llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp Modified: llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp?rev=92198&r1=92197&r2=92198&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp Sun Dec 27 20:07:00 2009 @@ -270,10 +270,10 @@ const { // Create a frame entry for the FPW register that must be saved. if (hasFP(MF)) { - int FrameIdx = MF.getFrameInfo()->CreateFixedObject(2, -4, true, false); + int ATTRIBUTE_UNUSED FrameIdx = + MF.getFrameInfo()->CreateFixedObject(2, -4, true, false); assert(FrameIdx == MF.getFrameInfo()->getObjectIndexBegin() && "Slot for FPW register must be last in order to be found!"); - FrameIdx = 0; } } From sanjiv.gupta at microchip.com Sun Dec 27 20:40:33 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Mon, 28 Dec 2009 02:40:33 -0000 Subject: [llvm-commits] [llvm] r92199 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.h Message-ID: <200912280240.nBS2eYY9020990@zion.cs.uiuc.edu> Author: sgupta Date: Sun Dec 27 20:40:33 2009 New Revision: 92199 URL: http://llvm.org/viewvc/llvm-project?rev=92199&view=rev Log: Allow targets to specify the return type of libcalls that are generated for floating point comparisons, rather than hard-coding them as i32. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=92199&r1=92198&r2=92199&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Sun Dec 27 20:40:33 2009 @@ -139,6 +139,12 @@ virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const; + /// getCmpLibcallReturnType - Return the ValueType for comparison + /// libcalls. Comparions libcalls include floating point comparion calls, + /// and Ordered/Unordered check calls on floating point numbers. + virtual + MVT::SimpleValueType getCmpLibcallReturnType() const; + /// getBooleanContents - For targets without i1 registers, this gives the /// nature of the high-bits of boolean values held in types wider than i1. /// "Boolean values" are special true/false values produced by nodes like Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=92199&r1=92198&r2=92199&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Sun Dec 27 20:40:33 2009 @@ -637,7 +637,8 @@ } } - EVT RetVT = MVT::i32; // FIXME: is this the correct return type? + // Use the target specific return value for comparions lib calls. + EVT RetVT = TLI.getCmpLibcallReturnType(); SDValue Ops[2] = { LHSInt, RHSInt }; NewLHS = MakeLibCall(LC1, RetVT, Ops, 2, false/*sign irrelevant*/, dl); NewRHS = DAG.getConstant(0, RetVT); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=92199&r1=92198&r2=92199&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sun Dec 27 20:40:33 2009 @@ -713,6 +713,10 @@ return PointerTy.SimpleTy; } +MVT::SimpleValueType TargetLowering::getCmpLibcallReturnType() const { + return MVT::i32; // return the default value +} + /// getVectorTypeBreakdown - Vector types are broken down into some number of /// legal first class types. For example, MVT::v8f32 maps to 2 MVT::v4f32 /// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=92199&r1=92198&r2=92199&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Sun Dec 27 20:40:33 2009 @@ -371,6 +371,11 @@ return MVT::i8; } +MVT::SimpleValueType +PIC16TargetLowering::getCmpLibcallReturnType() const { + return MVT::i8; +} + /// The type legalizer framework of generating legalizer can generate libcalls /// only when the operand/result types are illegal. /// PIC16 needs to generate libcalls even for the legal types (i8) for some ops. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=92199&r1=92198&r2=92199&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Sun Dec 27 20:40:33 2009 @@ -84,6 +84,7 @@ virtual const char *getTargetNodeName(unsigned Opcode) const; /// getSetCCResultType - Return the ISD::SETCC ValueType virtual MVT::SimpleValueType getSetCCResultType(EVT ValType) const; + virtual MVT::SimpleValueType getCmpLibcallReturnType() const; SDValue LowerShift(SDValue Op, SelectionDAG &DAG); SDValue LowerMUL(SDValue Op, SelectionDAG &DAG); SDValue LowerADD(SDValue Op, SelectionDAG &DAG); From sanjiv.gupta at microchip.com Sun Dec 27 22:53:27 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Mon, 28 Dec 2009 04:53:27 -0000 Subject: [llvm-commits] [llvm] r92201 - in /llvm/trunk: lib/Target/PIC16/PIC16ISelLowering.cpp test/CodeGen/PIC16/C16-11.ll Message-ID: <200912280453.nBS4rSvk025298@zion.cs.uiuc.edu> Author: sgupta Date: Sun Dec 27 22:53:24 2009 New Revision: 92201 URL: http://llvm.org/viewvc/llvm-project?rev=92201&view=rev Log: Fixed llc crash for zext (i1 -> i8) loads. Added: llvm/trunk/test/CodeGen/PIC16/C16-11.ll Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=92201&r1=92200&r2=92201&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Sun Dec 27 22:53:24 2009 @@ -930,7 +930,7 @@ } else if (VT == MVT::i16) { BP = DAG.getNode(ISD::BUILD_PAIR, dl, VT, PICLoads[0], PICLoads[1]); - if (MemVT == MVT::i8) + if ((MemVT == MVT::i8) || (MemVT == MVT::i1)) Chain = getChain(PICLoads[0]); else Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, @@ -942,7 +942,7 @@ BPs[1] = DAG.getNode(ISD::BUILD_PAIR, dl, MVT::i16, PICLoads[2], PICLoads[3]); BP = DAG.getNode(ISD::BUILD_PAIR, dl, VT, BPs[0], BPs[1]); - if (MemVT == MVT::i8) + if ((MemVT == MVT::i8) || (MemVT == MVT::i1)) Chain = getChain(PICLoads[0]); else if (MemVT == MVT::i16) Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Added: llvm/trunk/test/CodeGen/PIC16/C16-11.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PIC16/C16-11.ll?rev=92201&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PIC16/C16-11.ll (added) +++ llvm/trunk/test/CodeGen/PIC16/C16-11.ll Sun Dec 27 22:53:24 2009 @@ -0,0 +1,37 @@ +;RUN: llc < %s -march=pic16 + + at c612.auto.a.b = internal global i1 false ; [#uses=2] + at c612.auto.A.b = internal global i1 false ; [#uses=2] + +define void @c612() nounwind { +entry: + %tmp3.b = load i1* @c612.auto.a.b ; [#uses=1] + %tmp3 = zext i1 %tmp3.b to i16 ; [#uses=1] + %tmp4.b = load i1* @c612.auto.A.b ; [#uses=1] + %tmp4 = select i1 %tmp4.b, i16 2, i16 0 ; [#uses=1] + %cmp5 = icmp ne i16 %tmp3, %tmp4 ; [#uses=1] + %conv7 = zext i1 %cmp5 to i8 ; [#uses=1] + tail call void @expectWrap(i8 %conv7, i8 2) + ret void +} + +define void @expectWrap(i8 %boolresult, i8 %errCode) nounwind { +entry: + %tobool = icmp eq i8 %boolresult, 0 ; [#uses=1] + br i1 %tobool, label %if.then, label %if.end + +if.then: ; preds = %entry + tail call void @exit(i16 1) + unreachable + +if.end: ; preds = %entry + ret void +} + +define i16 @main() nounwind { +entry: + tail call void @c612() + ret i16 0 +} + +declare void @exit(i16) noreturn nounwind