Re: [llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
> Add isStrictPositive() to APInt to determine if this APInt Value > 0. Shouldn't this be "isStrictlyPositive"? Duncan. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.58 -> 1.59 --- Log message: Fix obvious typo in comment. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.58 llvm/include/llvm/Target/TargetData.h:1.59 --- llvm/include/llvm/Target/TargetData.h:1.58 Mon Feb 19 16:35:00 2007 +++ llvm/include/llvm/Target/TargetData.h Mon Mar 19 09:25:02 2007 @@ -157,7 +157,7 @@ /// type. uint64_t getTypeSize(const Type *Ty) const; - /// getTypeSizeInBits - Return the number of bytes necessary to hold the + /// getTypeSizeInBits - Return the number of bits necessary to hold the /// specified type. uint64_t getTypeSizeInBits(const Type* Ty) const; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
On Mon, 2007-03-19 at 10:11 +0100, Duncan Sands wrote: > > Add isStrictPositive() to APInt to determine if this APInt Value > 0. > > Shouldn't this be "isStrictlyPositive"? Yes, it Should. Sheng, please correct the name of this function as Duncan suggested. Thanks, Reid. > > Duncan. > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.224 -> 1.225 --- Log message: Remove -reduce-joining-phys-regs options. Make it on by default. --- Diffs of the changes: (+1 -3) LiveIntervalAnalysis.cpp |4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.224 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.225 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.224 Sun Mar 18 23:22:35 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Mar 19 13:08:26 2007 @@ -42,7 +42,6 @@ STATISTIC(numPeep , "Number of identity moves eliminated after coalescing"); STATISTIC(numFolded , "Number of loads/stores folded into instructions"); STATISTIC(numAborts , "Number of times interval joining aborted"); -static cl::opt ReduceJoinPhys("reduce-joining-phy-regs", cl::Hidden); namespace { RegisterPass X("liveintervals", "Live Interval Analysis"); @@ -937,8 +936,7 @@ // virtual register. Once the coalescing is done, it cannot be broken and // these are not spillable! If the destination interval uses are far away, // think twice about coalescing them! - if (ReduceJoinPhys && !mopd->isDead() && - MRegisterInfo::isPhysicalRegister(repSrcReg)) { + if (!mopd->isDead() && MRegisterInfo::isPhysicalRegister(repSrcReg)) { // Small function. No need to worry! unsigned Threshold = allocatableRegs_.count() * 2; if (r2iMap_.size() <= Threshold) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/BugPoint/crash-basictest.ll crash-narrowfunctiontest.ll remove_arguments_test.ll
Changes in directory llvm/test/BugPoint: crash-basictest.ll updated: 1.2 -> 1.3 crash-narrowfunctiontest.ll updated: 1.2 -> 1.3 remove_arguments_test.ll updated: 1.2 -> 1.3 --- Log message: Don't upgrade these. --- Diffs of the changes: (+18 -20) crash-basictest.ll |9 - crash-narrowfunctiontest.ll | 14 ++ remove_arguments_test.ll| 15 --- 3 files changed, 18 insertions(+), 20 deletions(-) Index: llvm/test/BugPoint/crash-basictest.ll diff -u llvm/test/BugPoint/crash-basictest.ll:1.2 llvm/test/BugPoint/crash-basictest.ll:1.3 --- llvm/test/BugPoint/crash-basictest.ll:1.2 Fri Dec 29 14:01:32 2006 +++ llvm/test/BugPoint/crash-basictest.ll Mon Mar 19 13:08:42 2007 @@ -1,9 +1,8 @@ ; Basic test for bugpoint. -; RUN: llvm-upgrade < %s > %t1.ll -; RUN: bugpoint %t1.ll -domset -idom -domset -bugpoint-crashcalls \ +; RUN: bugpoint %s -domset -idom -domset -bugpoint-crashcalls \ ; RUN: -domset -idom -domset -int %test() { - call int %test() - ret int %0 +define i32 @test() { + call i32 @test() + ret i32 %1 } Index: llvm/test/BugPoint/crash-narrowfunctiontest.ll diff -u llvm/test/BugPoint/crash-narrowfunctiontest.ll:1.2 llvm/test/BugPoint/crash-narrowfunctiontest.ll:1.3 --- llvm/test/BugPoint/crash-narrowfunctiontest.ll:1.2 Fri Dec 29 14:01:32 2006 +++ llvm/test/BugPoint/crash-narrowfunctiontest.ll Mon Mar 19 13:08:42 2007 @@ -1,14 +1,12 @@ ; Test that bugpoint can narrow down the testcase to the important function ; -; RUN: llvm-upgrade < %s > %t1.ll -; RUN: bugpoint %t1.ll -bugpoint-crashcalls +; RUN: bugpoint %s -bugpoint-crashcalls -int %foo() { ret int 1 } +define i32 @foo() { ret i32 1 } -int %test() { - call int %test() - ret int %0 +define i32 @test() { + call i32 @test() + ret i32 %1 } -int %bar() { ret int 2 } - +define i32 @bar() { ret i32 2 } Index: llvm/test/BugPoint/remove_arguments_test.ll diff -u llvm/test/BugPoint/remove_arguments_test.ll:1.2 llvm/test/BugPoint/remove_arguments_test.ll:1.3 --- llvm/test/BugPoint/remove_arguments_test.ll:1.2 Fri Dec 29 14:01:32 2006 +++ llvm/test/BugPoint/remove_arguments_test.ll Mon Mar 19 13:08:42 2007 @@ -1,10 +1,11 @@ -; RUN: llvm-upgrade < %s > %t1.ll -; RUN: bugpoint %t1.ll -bugpoint-crashcalls +; RUN: bugpoint %s -bugpoint-crashcalls -; Test to make sure that arguments are removed from the function if they are unnecessary. +; Test to make sure that arguments are removed from the function if they are +; unnecessary. -declare int %test2() -int %test(int %A, int %B, float %C) { - call int %test2() - ret int %0 +declare i32 @test2() + +define i32 @test(i32 %A, i32 %B, float %C) { + call i32 @test2() + ret i32 %1 } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c
Changes in directory llvm/test/CFrontend: 2005-06-15-ExpandGotoInternalProblem.c updated: 1.1 -> 1.2 --- Log message: Use opt instead of gccas. --- Diffs of the changes: (+2 -1) 2005-06-15-ExpandGotoInternalProblem.c |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c diff -u llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c:1.1 llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c:1.2 --- llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c:1.1 Wed Jun 15 17:42:53 2005 +++ llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c Mon Mar 19 13:25:55 2007 @@ -1,4 +1,5 @@ -// RUN: %llvmgcc -std=c99 %s -S -o - | gccas -o /dev/null +// RUN: %llvmgcc -std=c99 %s -S -o - | llvm-as | \ +// RUN:opt -std-compile-opts -disable-output // PR580 int X, Y; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.79 -> 1.80 --- Log message: fix ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll --- Diffs of the changes: (+2 -1) ScalarReplAggregates.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.79 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.80 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.79Sun Mar 18 19:16:43 2007 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Mar 19 13:25:57 2007 @@ -661,7 +661,8 @@ // up. for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); UI != E; ) { -GetElementPtrInst *GEPI = cast(*UI++); +GetElementPtrInst *GEPI = dyn_cast(*UI++); +if (!GEPI) continue; gep_type_iterator I = gep_type_begin(GEPI); ++I; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/2007-03-01-SpillerCrash.ll
Changes in directory llvm/test/CodeGen/X86: 2007-03-01-SpillerCrash.ll updated: 1.1 -> 1.2 --- Log message: For PR1258: http://llvm.org/PR1258 : Revise numeric value references to accommodate collapsed type planes. --- Diffs of the changes: (+56 -56) 2007-03-01-SpillerCrash.ll | 112 ++--- 1 files changed, 56 insertions(+), 56 deletions(-) Index: llvm/test/CodeGen/X86/2007-03-01-SpillerCrash.ll diff -u llvm/test/CodeGen/X86/2007-03-01-SpillerCrash.ll:1.1 llvm/test/CodeGen/X86/2007-03-01-SpillerCrash.ll:1.2 --- llvm/test/CodeGen/X86/2007-03-01-SpillerCrash.ll:1.1Fri Mar 2 04:37:19 2007 +++ llvm/test/CodeGen/X86/2007-03-01-SpillerCrash.llMon Mar 19 13:27:35 2007 @@ -8,78 +8,78 @@ mul <4 x float> %0, %2 ; <<4 x float>>:3 [#uses=1] sub <4 x float> zeroinitializer, %3 ; <<4 x float>>:4 [#uses=1] mul <4 x float> %4, zeroinitializer ; <<4 x float>>:5 [#uses=2] - bitcast <4 x float> zeroinitializer to <4 x i32>; <<4 x i32>>:0 [#uses=1] - and <4 x i32> %0, < i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647 >; <<4 x i32>>:1 [#uses=1] - bitcast <4 x i32> %1 to <4 x float> ; <<4 x float>>:6 [#uses=2] - extractelement <4 x float> %6, i32 0; :0 [#uses=1] - extractelement <4 x float> %6, i32 1; :1 [#uses=2] - br i1 false, label %0, label %5 + bitcast <4 x float> zeroinitializer to <4 x i32>; <<4 x i32>>:6 [#uses=1] + and <4 x i32> %6, < i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647 >; <<4 x i32>>:7 [#uses=1] + bitcast <4 x i32> %7 to <4 x float> ; <<4 x float>>:8 [#uses=2] + extractelement <4 x float> %8, i32 0; :9 [#uses=1] + extractelement <4 x float> %8, i32 1; :10 [#uses=2] + br i1 false, label %11, label %19 -; :0; preds = %test.exit - br i1 false, label %3, label %1 +; :11 ; preds = %test.exit + br i1 false, label %17, label %12 -; :1; preds = %0 - br i1 false, label %5, label %2 +; :12 ; preds = %11 + br i1 false, label %19, label %13 -; :2; preds = %1 - sub float -0.00e+00, 0.00e+00 ; :2 [#uses=1] +; :13 ; preds = %12 + sub float -0.00e+00, 0.00e+00 ; :14 [#uses=1] %tmp207 = extractelement <4 x float> zeroinitializer, i32 0 ; [#uses=1] %tmp208 = extractelement <4 x float> zeroinitializer, i32 2 ; [#uses=1] - sub float -0.00e+00, %tmp208; :3 [#uses=1] + sub float -0.00e+00, %tmp208; :15 [#uses=1] %tmp155 = extractelement <4 x float> zeroinitializer, i32 0 ; [#uses=1] %tmp156 = extractelement <4 x float> zeroinitializer, i32 2 ; [#uses=1] - sub float -0.00e+00, %tmp156; :4 [#uses=1] - br label %5 + sub float -0.00e+00, %tmp156; :16 [#uses=1] + br label %19 -; :3; preds = %0 - br i1 false, label %5, label %4 +; :17 ; preds = %11 + br i1 false, label %19, label %18 -; :4; preds = %3 - br label %5 +; :18 ; preds = %17 + br label %19 -; :5; preds = %4, %3, %2, %1, %test.exit - phi i32 [ 5, %4 ], [ 3, %2 ], [ 1, %test.exit ], [ 2, %1 ], [ 4, %3 ] ; :0 [#uses=0] - phi float [ 0.00e+00, %4 ], [ %4, %2 ], [ 0.00e+00, %test.exit ], [ 0.00e+00, %1 ], [ 0.00e+00, %3 ]; :5 [#uses=1] - phi float [ 0.00e+00, %4 ], [ %tmp155, %2 ], [ 0.00e+00, %test.exit ], [ 0.00e+00, %1 ], [ 0.00e+00, %3 ] ; :6 [#uses=1] - phi float [ 0.00e+00, %4 ], [ %3, %2 ], [ 0.00e+00, %test.exit ], [ 0.00e+00, %1 ], [ 0.00e+00, %3 ]; :7 [#uses=1] - phi float [ 0.00e+00, %4 ], [ %tmp207, %2 ], [ 0.00e+00, %test.exit ], [ 0.00e+00, %1 ], [ 0.00e+00, %3 ] ; :8 [#uses=1] - phi float [ 0.00e+00, %4 ], [ %1, %2 ], [ %0, %test.exit ], [ %1, %1 ], [ 0.00e+00, %3 ]; :9 [#uses=2] - phi float [ 0.00e+00, %4 ], [ %2, %2 ], [ 0.00e+00, %test.exit ], [ 0.00e+00, %1 ], [ 0.00e+00, %3 ]; :10 [#uses=1] - phi float [ 0.00e+00, %4 ], [ 0.00e+00, %2 ], [ 0.00e+00, %test.exit ], [ 0.00e+00, %1 ], [ 0.00e+00, %3 ] ; :11 [#uses=1] - insertelement <4 x float> undef, float %11, i32 0 ; <<4 x float>>:7 [#uses=1] - insertelement <4 x float> %7, float %10, i32 1 ; <<4 x float>>:8 [#uses=0] - insertelement <4 x float> undef, float %8, i32 0; <<4 x float>>:9 [#uses=1] - inserte
[llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-03-07-CombinerCrash.ll
Changes in directory llvm/test/CodeGen/ARM: 2007-03-07-CombinerCrash.ll updated: 1.1 -> 1.2 --- Log message: For PR1258: http://llvm.org/PR1258 : Revise numeric value references to accommodate collapsed type planes. --- Diffs of the changes: (+12 -12) 2007-03-07-CombinerCrash.ll | 24 1 files changed, 12 insertions(+), 12 deletions(-) Index: llvm/test/CodeGen/ARM/2007-03-07-CombinerCrash.ll diff -u llvm/test/CodeGen/ARM/2007-03-07-CombinerCrash.ll:1.1 llvm/test/CodeGen/ARM/2007-03-07-CombinerCrash.ll:1.2 --- llvm/test/CodeGen/ARM/2007-03-07-CombinerCrash.ll:1.1 Wed Mar 7 02:12:39 2007 +++ llvm/test/CodeGen/ARM/2007-03-07-CombinerCrash.ll Mon Mar 19 13:27:35 2007 @@ -3,19 +3,19 @@ define fastcc i8* @read_sleb128(i8* %p, i32* %val) { br label %bb -bb: - %p_addr.0 = getelementptr i8* %p, i32 0 - %tmp2 = load i8* %p_addr.0 - %tmp4.rec = add i32 0, 1 - %tmp4 = getelementptr i8* %p, i32 %tmp4.rec - %tmp56 = zext i8 %tmp2 to i32 - %tmp7 = and i32 %tmp56, 127 - %tmp9 = shl i32 %tmp7, 0 - %tmp11 = or i32 %tmp9, 0 - icmp slt i8 %tmp2, 0 - br i1 %0, label %bb, label %cond_next28 +bb:; preds = %bb, %0 + %p_addr.0 = getelementptr i8* %p, i32 0 ; [#uses=1] + %tmp2 = load i8* %p_addr.0 ; [#uses=2] + %tmp4.rec = add i32 0, 1; [#uses=1] + %tmp4 = getelementptr i8* %p, i32 %tmp4.rec ; [#uses=1] + %tmp56 = zext i8 %tmp2 to i32 ; [#uses=1] + %tmp7 = and i32 %tmp56, 127 ; [#uses=1] + %tmp9 = shl i32 %tmp7, 0; [#uses=1] + %tmp11 = or i32 %tmp9, 0; [#uses=1] + icmp slt i8 %tmp2, 0; :1 [#uses=1] + br i1 %1, label %bb, label %cond_next28 -cond_next28: +cond_next28: ; preds = %bb store i32 %tmp11, i32* %val ret i8* %tmp4 } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll
Changes in directory llvm/test/Transforms/ADCE: 2002-01-31-UseStuckAround.ll updated: 1.3 -> 1.4 --- Log message: For PR1258: http://llvm.org/PR1258 : Revise numeric value references to accommodate collapsed type planes. --- Diffs of the changes: (+5 -5) 2002-01-31-UseStuckAround.ll | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll diff -u llvm/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll:1.3 llvm/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll:1.4 --- llvm/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll:1.3 Fri Dec 1 22:23:08 2006 +++ llvm/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll Mon Mar 19 13:27:35 2007 @@ -1,14 +1,14 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -adce +; RUN: llvm-as %s -o - | opt -adce implementation -int "main"(int %argc) +define i32 @"main"(i32 %argc) begin br label %2 - %retval = phi int [ %argc, %2 ] ; [#uses=2] - %two = add int %retval, %retval ; [#uses=1] - ret int %two + %retval = phi i32 [ %argc, %2 ] ; [#uses=2] + %two = add i32 %retval, %retval ; [#uses=1] + ret i32 %two br label %1 end ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Integer/basictest_bt.ll constexpr_bt.ll constpointer_bt.ll indirectcall_bt.ll testvarargs_bt.ll
Changes in directory llvm/test/Integer: basictest_bt.ll updated: 1.2 -> 1.3 constexpr_bt.ll updated: 1.3 -> 1.4 constpointer_bt.ll updated: 1.2 -> 1.3 indirectcall_bt.ll updated: 1.3 -> 1.4 testvarargs_bt.ll updated: 1.2 -> 1.3 --- Log message: For PR1258: http://llvm.org/PR1258 : Revise numeric value references to accommodate collapsed type planes. --- Diffs of the changes: (+27 -29) basictest_bt.ll| 36 +--- constexpr_bt.ll|4 ++-- constpointer_bt.ll |6 +++--- indirectcall_bt.ll |8 testvarargs_bt.ll |2 +- 5 files changed, 27 insertions(+), 29 deletions(-) Index: llvm/test/Integer/basictest_bt.ll diff -u llvm/test/Integer/basictest_bt.ll:1.2 llvm/test/Integer/basictest_bt.ll:1.3 --- llvm/test/Integer/basictest_bt.ll:1.2 Fri Jan 26 02:25:06 2007 +++ llvm/test/Integer/basictest_bt.ll Mon Mar 19 13:27:35 2007 @@ -2,33 +2,31 @@ ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: diff %t1.ll %t2.ll -implementation +implementation ; Functions: ; Test "stripped" format where nothing is symbolic... this is how the bytecode ; format looks anyways (except for negative vs positive offsets)... ; -define void @"void"(i39, i39) ; Def %0, %1 -begin - add i39 0, 0 ; Def 2 - sub i39 0, 4 ; Def 3 - br label %1 +define void @void(i39, i39) { + add i39 0, 0; :3 [#uses=2] + sub i39 0, 4; :4 [#uses=2] + br label %5 -; :1; preds = %1, %0 - add i39 %0, %1; Def 4 - sub i39 %4, %3; Def 5 - icmp sle i39 %5, %2 ; Def 0 - i1 plane - br i1 %0, label %2, label %1 +; :5; preds = %5, %2 + add i39 %0, %1 ; :6 [#uses=2] + sub i39 %6, %4 ; :7 [#uses=1] + icmp sle i39 %7, %3 ; :8 [#uses=1] + br i1 %8, label %9, label %5 -; :2; preds = %1 - add i39 %0, %1; Def 6 - sub i39 %4, %3; Def 7 - icmp sle i39 %7, %2 ; Def 1 - i1 plane +; :9; preds = %5 + add i39 %0, %1 ; :10 [#uses=0] + sub i39 %6, %4 ; :11 [#uses=1] + icmp sle i39 %11, %3; :12 [#uses=0] ret void -end +} ; This function always returns zero -define i39 @"zarro"() -begin +define i39 @zarro() { Startup: ret i39 0 -end +} Index: llvm/test/Integer/constexpr_bt.ll diff -u llvm/test/Integer/constexpr_bt.ll:1.3 llvm/test/Integer/constexpr_bt.ll:1.4 --- llvm/test/Integer/constexpr_bt.ll:1.3 Fri Jan 26 02:25:06 2007 +++ llvm/test/Integer/constexpr_bt.ll Mon Mar 19 13:27:35 2007 @@ -24,8 +24,8 @@ @t9 = global i33 fptosi (float sitofp (i33 8 to float) to i33) ;; Nested cast expression -global i32* bitcast (float* @0 to i32*) ;; Forward numeric reference -global float* @0 ;; Duplicate forward numeric reference +global i32* bitcast (float* @4 to i32*) ;; Forward numeric reference +global float* @4 ;; Duplicate forward numeric reference global float 0.0 Index: llvm/test/Integer/constpointer_bt.ll diff -u llvm/test/Integer/constpointer_bt.ll:1.2 llvm/test/Integer/constpointer_bt.ll:1.3 --- llvm/test/Integer/constpointer_bt.ll:1.2Fri Jan 26 02:25:06 2007 +++ llvm/test/Integer/constpointer_bt.llMon Mar 19 13:27:35 2007 @@ -16,10 +16,10 @@ @t2 = global i40 * @t1 -global float * @0;; Forward numeric reference -global float * @0;; Duplicate forward numeric reference +global float * @2;; Forward numeric reference +global float * @2;; Duplicate forward numeric reference global float 0.0 -global float * @0;; Numeric reference +global float * @2;; Numeric reference @fptr = global void() * @f ;; Forward ref method defn Index: llvm/test/Integer/indirectcall_bt.ll diff -u llvm/test/Integer/indirectcall_bt.ll:1.3 llvm/test/Integer/indirectcall_bt.ll:1.4 --- llvm/test/Integer/indirectcall_bt.ll:1.3Tue Jan 30 10:16:01 2007 +++ llvm/test/Integer/indirectcall_bt.llMon Mar 19 13:27:35 2007 @@ -8,8 +8,8 @@ define i63 @"fib"(i63 %n) begin - icmp ult i63 %n, 2 ; {i1}:0 - br i1 %0, label %BaseCase, label %RecurseCase + icmp ult i63 %n, 2 ; {i1}:1 + br i1 %1, label %BaseCase, label %RecurseCase BaseCase: ret i63 1 @@ -25,8 +25,8 @@ define i63 @"realmain"(i32 %argc, i8 ** %argv) begin - icmp eq i32 %argc, 2 ; {i1}:0 - br i1 %0, label %HasArg, label %Continue + icmp eq i32 %argc, 2 ; {i1}:1 + br i1 %1, label %HasArg, label %Continue HasArg: ; %n1 = atoi(argv[1]) %n1 = add i32 1, 1 Index: llvm/test/Integer/testvarargs_bt.ll diff -u llvm/test/Integer/testvarargs_bt.ll:1.2 llvm/test/Integer/testvarargs_bt.ll:1.3 --- llvm/test/Integer/testvarargs_bt.ll:1.2 Fri Jan 26 02:25:06 2007 +
[llvm-commits] CVS: llvm/test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll
Changes in directory llvm/test/Transforms/ScalarRepl: 2007-03-19-CanonicalizeMemcpy.ll added (r1.1) --- Log message: add a testcase the resent patches fail on. --- Diffs of the changes: (+45 -0) 2007-03-19-CanonicalizeMemcpy.ll | 45 +++ 1 files changed, 45 insertions(+) Index: llvm/test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll diff -c /dev/null llvm/test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll:1.1 *** /dev/null Mon Mar 19 13:25:58 2007 --- llvm/test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.llMon Mar 19 13:25:48 2007 *** *** 0 --- 1,45 + ; RUN: llvm-as < %s | opt -scalarrepl -disable-output + + target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" + target triple = "arm-apple-darwin8" + %struct.CGPoint = type { float, float } + %struct.aal_big_range_t = type { i32, i32 } + %struct.aal_callback_t = type { i8* (i8*, i32)*, void (i8*, i8*)* } + %struct.aal_edge_pool_t = type { %struct.aal_edge_pool_t*, i32, i32, [0 x %struct.aal_edge_t] } + %struct.aal_edge_t = type { %struct.CGPoint, %struct.CGPoint, i32 } + %struct.aal_range_t = type { i16, i16 } + %struct.aal_span_pool_t = type { %struct.aal_span_pool_t*, [341 x %struct.aal_span_t] } + %struct.aal_span_t = type { %struct.aal_span_t*, %struct.aal_big_range_t } + %struct.aal_spanarray_t = type { [2 x %struct.aal_range_t] } + %struct.aal_spanbucket_t = type { i16, [2 x i8], %struct.anon } + %struct.aal_state_t = type { %struct.CGPoint, %struct.CGPoint, %struct.CGPoint, i32, float, float, float, float, %struct.CGPoint, %struct.CGPoint, float, float, float, float, i32, i32, i32, i32, float, float, i8*, i32, i32, %struct.aal_edge_pool_t*, %struct.aal_edge_pool_t*, i8*, %struct.aal_callback_t*, i32, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_pool_t*, i8, float, i8, i32 } + %struct.anon = type { %struct.aal_spanarray_t } + + implementation ; Functions: + + declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) + + define fastcc void @aal_insert_span() { + entry: + %SB = alloca %struct.aal_spanbucket_t, align 4 ; <%struct.aal_spanbucket_t*> [#uses=2] + br i1 false, label %cond_true, label %cond_next79 + + cond_true:; preds = %entry + br i1 false, label %cond_next, label %cond_next114.i + + cond_next114.i: ; preds = %cond_true + ret void + + cond_next:; preds = %cond_true + %SB19 = bitcast %struct.aal_spanbucket_t* %SB to i8*; [#uses=1] + call void @llvm.memcpy.i32( i8* %SB19, i8* null, i32 12, i32 0 ) + br i1 false, label %cond_next34, label %cond_next79 + + cond_next34: ; preds = %cond_next + %i.2.reload22 = load i32* null ; [#uses=1] + %tmp51 = getelementptr %struct.aal_spanbucket_t* %SB, i32 0, i32 2, i32 0, i32 0, i32 %i.2.reload22, i32 1 ; [#uses=0] + ret void + + cond_next79: ; preds = %cond_next, %entry + ret void + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.263 -> 1.264 --- Log message: For PR1258: http://llvm.org/PR1258 : Radically simplify the SlotMachine. There is no need to keep Value planes around any more. This change causes slot numbering to number all un-named, non-void values starting at 0 and incrementing monotonically through the function, regardless of type (including BasicBlocks). Getting slot numbers is now a single lookup operation instead of a double lookup. --- Diffs of the changes: (+20 -39) AsmWriter.cpp | 59 +++--- 1 files changed, 20 insertions(+), 39 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.263 llvm/lib/VMCore/AsmWriter.cpp:1.264 --- llvm/lib/VMCore/AsmWriter.cpp:1.263 Tue Feb 27 14:25:25 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Mar 19 13:32:53 2007 @@ -48,17 +48,7 @@ public: /// @brief A mapping of Values to slot numbers - typedef std::map ValueMap; - - /// @brief A plane with next slot number and ValueMap - struct ValuePlane { -unsigned next_slot;///< The next slot number to use -ValueMap map; ///< The map of Value* -> unsigned -ValuePlane() { next_slot = 0; } ///< Make sure we start at 0 - }; - - /// @brief The map of planes by Type - typedef std::map TypedPlanes; + typedef std::map ValueMap; /// @} /// @name Constructors @@ -131,10 +121,12 @@ bool FunctionProcessed; /// @brief The TypePlanes map for the module level data - TypedPlanes mMap; + ValueMap mMap; + unsigned mNext; /// @brief The TypePlanes map for the function level data - TypedPlanes fMap; + ValueMap fMap; + unsigned fNext; /// @} @@ -1385,6 +1377,7 @@ : TheModule(M)///< Saved for lazy initialization. , TheFunction(0) , FunctionProcessed(false) + , mMap(), mNext(0), fMap(), fNext(0) { } @@ -1394,6 +1387,7 @@ : TheModule(F ? F->getParent() : 0) ///< Saved for lazy initialization , TheFunction(F) ///< Saved for lazy initialization , FunctionProcessed(false) + , mMap(), mNext(0), fMap(), fNext(0) { } @@ -1430,6 +1424,7 @@ // Process the arguments, basic blocks, and instructions of a function. void SlotMachine::processFunction() { SC_DEBUG("begin processFunction!\n"); + fNext = 0; // Add all the function arguments with no names. for(Function::const_arg_iterator AI = TheFunction->arg_begin(), @@ -1471,12 +1466,10 @@ initialize(); // Find the type plane in the module map - TypedPlanes::const_iterator MI = mMap.find(V->getType()); + ValueMap::const_iterator MI = mMap.find(V); if (MI == mMap.end()) return -1; - - // Lookup the value in the module plane's map. - ValueMap::const_iterator MVI = MI->second.map.find(V); - return MVI != MI->second.map.end() ? int(MVI->second) : -1; + + return MI->second; } @@ -1487,33 +1480,23 @@ // Check for uninitialized state and do lazy initialization. initialize(); - // Get the type of the value - const Type *VTy = V->getType(); - - TypedPlanes::const_iterator FI = fMap.find(VTy); + ValueMap::const_iterator FI = fMap.find(V); if (FI == fMap.end()) return -1; - // Lookup the Value in the function and module maps. - ValueMap::const_iterator FVI = FI->second.map.find(V); - - // If the value doesn't exist in the function map, it is a - if (FVI == FI->second.map.end()) return -1; - - return FVI->second; + return FI->second; } /// CreateModuleSlot - Insert the specified GlobalValue* into the slot table. void SlotMachine::CreateModuleSlot(const GlobalValue *V) { assert(V && "Can't insert a null Value into SlotMachine!"); + assert(V->getType() != Type::VoidTy && "Doesn't need a slot!"); + assert(!V->hasName() && "Doesn't need a slot!"); - unsigned DestSlot = 0; - const Type *VTy = V->getType(); - - ValuePlane &PlaneMap = mMap[VTy]; - DestSlot = PlaneMap.map[V] = PlaneMap.next_slot++; + unsigned DestSlot = mNext++; + mMap[V] = DestSlot; - SC_DEBUG(" Inserting value [" << VTy << "] = " << V << " slot=" << + SC_DEBUG(" Inserting value [" << V->getType() << "] = " << V << " slot=" << DestSlot << " ["); // G = Global, F = Function, o = other SC_DEBUG((isa(V) ? 'G' : 'F') << "]\n"); @@ -1525,10 +1508,8 @@ const Type *VTy = V->getType(); assert(VTy != Type::VoidTy && !V->hasName() && "Doesn't need a slot!"); - unsigned DestSlot = 0; - - ValuePlane &PlaneMap = fMap[VTy]; - DestSlot = PlaneMap.map[V] = PlaneMap.next_slot++; + unsigned DestSlot = fNext++; + fMap[V] = DestSlot; // G = Global, F = Function, o = other SC_DEBUG(" Inserting value [" << VTy << "] = " << V << " slot=" << ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/ParserInternals.h
Changes in directory llvm/lib/AsmParser: ParserInternals.h updated: 1.53 -> 1.54 --- Log message: Add and Operator== method to ValID so equality can be done properly for named or numbered ValIDs. --- Diffs of the changes: (+20 -0) ParserInternals.h | 20 1 files changed, 20 insertions(+) Index: llvm/lib/AsmParser/ParserInternals.h diff -u llvm/lib/AsmParser/ParserInternals.h:1.53 llvm/lib/AsmParser/ParserInternals.h:1.54 --- llvm/lib/AsmParser/ParserInternals.h:1.53 Fri Jan 26 02:04:51 2007 +++ llvm/lib/AsmParser/ParserInternals.hMon Mar 19 13:34:28 2007 @@ -207,6 +207,26 @@ default: assert(0 && "Unknown value type!"); return false; } } + + bool operator==(const ValID &V) const { +if (Type == V.Type) { + switch (Type) { +case LocalID: +case GlobalID: return Num == V.Num; +case LocalName: +case GlobalName: return strcmp(Name, V.Name) == 0; +case ConstSIntVal: return ConstPool64 == V.ConstPool64; +case ConstUIntVal: return UConstPool64 == V.UConstPool64; +case ConstFPVal:return ConstPoolFP == V.ConstPoolFP; +case ConstantVal: return ConstantValue == V.ConstantValue; +case ConstNullVal: return true; +case ConstUndefVal: return true; +case ConstZeroVal: return true; +default: assert(0 && "Unknown value type!"); return false; + } +} +return false; + } }; struct TypeWithAttrs { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.327 -> 1.328 --- Log message: For PR1248: http://llvm.org/PR1248 : Eliminate support for type planes in numbered values. This simplifies the data structures involved in managing forward definitions, etc. Instead of requiring maps from type to value, we can now just use a vector of values. These changes also required rewrites of some support functions such as InsertValue, getBBVal, and ResolveDefinitions. Some other cosmetic changes were made as well. --- Diffs of the changes: (+171 -157) llvmAsmParser.y | 328 +--- 1 files changed, 171 insertions(+), 157 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.327 llvm/lib/AsmParser/llvmAsmParser.y:1.328 --- llvm/lib/AsmParser/llvmAsmParser.y:1.327Thu Mar 1 13:32:01 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Mar 19 13:39:36 2007 @@ -84,13 +84,12 @@ typedef std::vector ValueList; // Numbered defs static void -ResolveDefinitions(std::map &LateResolvers, - std::map *FutureLateResolvers = 0); +ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); static struct PerModuleInfo { Module *CurrentModule; - std::map Values; // Module level numbered definitions - std::map LateResolveValues; + ValueList Values; // Module level numbered definitions + ValueList LateResolveValues; std::vectorTypes; std::map LateResolveTypes; @@ -208,17 +207,16 @@ static struct PerFunctionInfo { Function *CurrentFunction; // Pointer to current function being created - std::map Values; // Keep track of #'d definitions - std::map LateResolveValues; + ValueList Values; // Keep track of #'d definitions + unsigned NextValNum; + ValueList LateResolveValues; bool isDeclare; // Is this function a forward declararation? GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. GlobalValue::VisibilityTypes Visibility; /// BBForwardRefs - When we see forward references to basic blocks, keep /// track of them here. - std::map > BBForwardRefs; - std::vector NumberedBlocks; - unsigned NextBBNum; + std::map BBForwardRefs; inline PerFunctionInfo() { CurrentFunction = 0; @@ -229,16 +227,14 @@ inline void FunctionStart(Function *M) { CurrentFunction = M; -NextBBNum = 0; +NextValNum = 0; } void FunctionDone() { -NumberedBlocks.clear(); - // Any forward referenced blocks left? if (!BBForwardRefs.empty()) { GenerateError("Undefined reference to label " + - BBForwardRefs.begin()->first->getName()); + BBForwardRefs.begin()->second->getName()); return; } @@ -246,6 +242,7 @@ ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); Values.clear(); // Clear out function local definitions +BBForwardRefs.clear(); CurrentFunction = 0; isDeclare = false; Linkage = GlobalValue::ExternalLinkage; @@ -260,14 +257,23 @@ // Code to handle definitions of all the types //===--===// -static int InsertValue(Value *V, - std::map &ValueTab = CurFun.Values) { - if (V->hasName()) return -1; // Is this a numbered definition? - - // Yes, insert the value into the value table... - ValueList &List = ValueTab[V->getType()]; - List.push_back(V); - return List.size()-1; +static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { + // Things that have names or are void typed don't get slot numbers + if (V->hasName() || (V->getType() == Type::VoidTy)) +return; + + // In the case of function values, we have to allow for the forward reference + // of basic blocks, which are included in the numbering. Consequently, we keep + // track of the next insertion location with NextValNum. When a BB gets + // inserted, it could change the size of the CurFun.Values vector. + if (&ValueTab == &CurFun.Values) { +if (ValueTab.size() <= CurFun.NextValNum) + ValueTab.resize(CurFun.NextValNum+1); +ValueTab[CurFun.NextValNum++] = V; +return; + } + // For all other lists, its okay to just tack it on the back of the vector. + ValueTab.push_back(V); } static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { @@ -314,11 +320,11 @@ return Typ; } -// getValNonImprovising - Look up the value specified by the provided type and +// getExistingVal - Look up the value specified by the provided type and // the provided ValID. If the value exists and has already been defined, return // it. Otherwise return null. // -static Value *getValNonImprovising(const Type *Ty, const ValID &D) { +static Value *getExistingVal(const Type *Ty, const ValID &D) { if (isa(Ty)) { GenerateError("Fu
[llvm-commits] CVS: llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll
Changes in directory llvm/test/Assembler: 2007-03-18-InvalidNumberedVar.ll added (r1.1) --- Log message: For PR1258: http://llvm.org/PR1258 : Test that invalid numbered value references get an error message. --- Diffs of the changes: (+9 -0) 2007-03-18-InvalidNumberedVar.ll |9 + 1 files changed, 9 insertions(+) Index: llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll diff -c /dev/null llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll:1.1 *** /dev/null Mon Mar 19 13:41:47 2007 --- llvm/test/Assembler/2007-03-18-InvalidNumberedVar.llMon Mar 19 13:41:37 2007 *** *** 0 --- 1,9 + ; PR 1258 + ; RUN: llvm-as < %s 2>&1 >/dev/null -f | grep "Numbered.*does not match" + + define i32 @test1(i32 %a, i32 %b) { + entry: + icmp eq i32 %b, %a ; :0 [#uses=1] + zext i1 %0 to i32 ; :0 [#uses=1] + ret i32 %0 ; Invalid Type for %0 + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
On Mar 19, 2007, at 11:33 AM, Reid Spencer wrote: > For PR1258: http://llvm.org/PR1258 : > Radically simplify the SlotMachine. There is no need to keep Value > planes > around any more. This change causes slot numbering to number all un- > named, > non-void values starting at 0 and incrementing monotonically > through the > function, regardless of type (including BasicBlocks). Getting slot > numbers > is now a single lookup operation instead of a double lookup. Woot, thanks Reid! -Chris > > --- > Diffs of the changes: (+20 -39) > > AsmWriter.cpp | 59 ++ > +--- > 1 files changed, 20 insertions(+), 39 deletions(-) > > > Index: llvm/lib/VMCore/AsmWriter.cpp > diff -u llvm/lib/VMCore/AsmWriter.cpp:1.263 llvm/lib/VMCore/ > AsmWriter.cpp:1.264 > --- llvm/lib/VMCore/AsmWriter.cpp:1.263 Tue Feb 27 14:25:25 2007 > +++ llvm/lib/VMCore/AsmWriter.cpp Mon Mar 19 13:32:53 2007 > @@ -48,17 +48,7 @@ > public: > >/// @brief A mapping of Values to slot numbers > - typedef std::map ValueMap; > - > - /// @brief A plane with next slot number and ValueMap > - struct ValuePlane { > -unsigned next_slot;///< The next slot number to use > -ValueMap map; ///< The map of Value* -> unsigned > -ValuePlane() { next_slot = 0; } ///< Make sure we start at 0 > - }; > - > - /// @brief The map of planes by Type > - typedef std::map TypedPlanes; > + typedef std::map ValueMap; > > /// @} > /// @name Constructors > @@ -131,10 +121,12 @@ >bool FunctionProcessed; > >/// @brief The TypePlanes map for the module level data > - TypedPlanes mMap; > + ValueMap mMap; > + unsigned mNext; > >/// @brief The TypePlanes map for the function level data > - TypedPlanes fMap; > + ValueMap fMap; > + unsigned fNext; > > /// @} > > @@ -1385,6 +1377,7 @@ >: TheModule(M)///< Saved for lazy initialization. >, TheFunction(0) >, FunctionProcessed(false) > + , mMap(), mNext(0), fMap(), fNext(0) > { > } > > @@ -1394,6 +1387,7 @@ >: TheModule(F ? F->getParent() : 0) ///< Saved for lazy > initialization >, TheFunction(F) ///< Saved for lazy initialization >, FunctionProcessed(false) > + , mMap(), mNext(0), fMap(), fNext(0) > { > } > > @@ -1430,6 +1424,7 @@ > // Process the arguments, basic blocks, and instructions of a > function. > void SlotMachine::processFunction() { >SC_DEBUG("begin processFunction!\n"); > + fNext = 0; > >// Add all the function arguments with no names. >for(Function::const_arg_iterator AI = TheFunction->arg_begin(), > @@ -1471,12 +1466,10 @@ >initialize(); > >// Find the type plane in the module map > - TypedPlanes::const_iterator MI = mMap.find(V->getType()); > + ValueMap::const_iterator MI = mMap.find(V); >if (MI == mMap.end()) return -1; > - > - // Lookup the value in the module plane's map. > - ValueMap::const_iterator MVI = MI->second.map.find(V); > - return MVI != MI->second.map.end() ? int(MVI->second) : -1; > + > + return MI->second; > } > > > @@ -1487,33 +1480,23 @@ >// Check for uninitialized state and do lazy initialization. >initialize(); > > - // Get the type of the value > - const Type *VTy = V->getType(); > - > - TypedPlanes::const_iterator FI = fMap.find(VTy); > + ValueMap::const_iterator FI = fMap.find(V); >if (FI == fMap.end()) return -1; > > - // Lookup the Value in the function and module maps. > - ValueMap::const_iterator FVI = FI->second.map.find(V); > - > - // If the value doesn't exist in the function map, it is a > - if (FVI == FI->second.map.end()) return -1; > - > - return FVI->second; > + return FI->second; > } > > > /// CreateModuleSlot - Insert the specified GlobalValue* into the > slot table. > void SlotMachine::CreateModuleSlot(const GlobalValue *V) { >assert(V && "Can't insert a null Value into SlotMachine!"); > + assert(V->getType() != Type::VoidTy && "Doesn't need a slot!"); > + assert(!V->hasName() && "Doesn't need a slot!"); > > - unsigned DestSlot = 0; > - const Type *VTy = V->getType(); > - > - ValuePlane &PlaneMap = mMap[VTy]; > - DestSlot = PlaneMap.map[V] = PlaneMap.next_slot++; > + unsigned DestSlot = mNext++; > + mMap[V] = DestSlot; > > - SC_DEBUG(" Inserting value [" << VTy << "] = " << V << " slot=" << > + SC_DEBUG(" Inserting value [" << V->getType() << "] = " << V << > " slot=" << > DestSlot << " ["); >// G = Global, F = Function, o = other >SC_DEBUG((isa(V) ? 'G' : 'F') << "]\n"); > @@ -1525,10 +1508,8 @@ >const Type *VTy = V->getType(); >assert(VTy != Type::VoidTy && !V->hasName() && "Doesn't need a > slot!"); > > - unsigned DestSlot = 0; > - > - ValuePlane &PlaneMap = fMap[VTy]; > - DestSlot = PlaneMap.map[V] = PlaneMap.next_slot++; > + unsigned DestSlot = fNext++; > + fMap[V] = DestSlot; > >// G = Global, F = Function, o = other >SC_DEBUG(" Inserting value [" << VTy << "] = " << V << " slot=" << >
[llvm-commits] [125159] Fix arry ref size calculation.
Revision: 125159 Author: dpatel Date: 2007-03-19 12:06:59 -0700 (Mon, 19 Mar 2007) Log Message: --- Fix arry ref size calculation. Patch by Duncan Sands. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp === --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 08:51:20 UTC (rev 125158) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 19:06:59 UTC (rev 125159) @@ -4562,9 +4562,8 @@ tree length = arrayLength(TREE_TYPE(Array)); if (length && !host_integerp(length, 1)) { // Make sure that ArrayAddr is of type ElementTy*, then do a 2-index gep. - tree ElTy = TREE_TYPE(TREE_TYPE(Array)); ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); - Value *Scale = Emit(TYPE_SIZE_UNIT(ElTy), 0); + Value *Scale = Emit(array_ref_element_size(exp), 0); if (Scale->getType() != IntPtrTy) Scale = CastToUIntType(Scale, IntPtrTy); @@ -4595,7 +4594,7 @@ // float foo(int w, float A[][w], int g) { return A[g][0]; } ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); - Value *TypeSize = Emit(TYPE_SIZE_UNIT(IndexedType), 0); + Value *TypeSize = Emit(array_ref_element_size(exp), 0); if (TypeSize->getType() != IntPtrTy) TypeSize = CastToUIntType(TypeSize, IntPtrTy); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] llvm-gcc: use array_ref_element_size when emitting an ARRAY_REF
On Mar 9, 2007, at 1:56 AM, Duncan Sands wrote: > The array element type doesn't always have a known size, which is > why the > ARRAY_REF supplies the size, extractable with > array_ref_element_size. Fix > and Ada testcase attached. > > Ciao, Applied. - Devang ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/AdaFrontend/array_ref.adb
Changes in directory llvm/test/AdaFrontend: array_ref.adb added (r1.1) --- Log message: Test handling of ARRAY_REF when the component type is of unknown size. --- Diffs of the changes: (+11 -0) array_ref.adb | 11 +++ 1 files changed, 11 insertions(+) Index: llvm/test/AdaFrontend/array_ref.adb diff -c /dev/null llvm/test/AdaFrontend/array_ref.adb:1.1 *** /dev/null Mon Mar 19 14:56:28 2007 --- llvm/test/AdaFrontend/array_ref.adb Mon Mar 19 14:56:18 2007 *** *** 0 --- 1,11 + -- RUN: %llvmgcc -c %s -o /dev/null + procedure Array_Ref is +type A is array (Natural range <>, Natural range <>) of Boolean; +type A_Access is access A; +function Get (X : A_Access) return Boolean is +begin + return X (0, 0); +end; + begin +null; + end; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/System/Win32/Program.inc
Changes in directory llvm/lib/System/Win32: Program.inc updated: 1.22 -> 1.23 --- Log message: Fix mingw32 build --- Diffs of the changes: (+1 -0) Program.inc |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/System/Win32/Program.inc diff -u llvm/lib/System/Win32/Program.inc:1.22 llvm/lib/System/Win32/Program.inc:1.23 --- llvm/lib/System/Win32/Program.inc:1.22 Fri Mar 9 05:53:34 2007 +++ llvm/lib/System/Win32/Program.inc Mon Mar 19 15:19:08 2007 @@ -100,6 +100,7 @@ #ifdef __MINGW32__ // Due to unknown reason, mingw32's w32api doesn't have this declaration. + extern "C" BOOL WINAPI SetInformationJobObject(HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInfoClass, LPVOID lpJobObjectInfo, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Assembler/2007-03-19-NegValue.ll
Changes in directory llvm/test/Assembler: 2007-03-19-NegValue.ll added (r1.1) --- Log message: Test case noticed by Sheng that fails because negative values that are greater than 64-bits don't have the sign bits extended on construction of the APInt. --- Diffs of the changes: (+7 -0) 2007-03-19-NegValue.ll |7 +++ 1 files changed, 7 insertions(+) Index: llvm/test/Assembler/2007-03-19-NegValue.ll diff -c /dev/null llvm/test/Assembler/2007-03-19-NegValue.ll:1.1 *** /dev/null Mon Mar 19 15:35:36 2007 --- llvm/test/Assembler/2007-03-19-NegValue.ll Mon Mar 19 15:35:26 2007 *** *** 0 --- 1,7 + ; Test whether negative values > 64 bits retain their negativeness. + ; RUN: llvm-as < %s | llvm-dis | grep 'add i65.*, -1' + + define i65 @testConsts(i65 %N) { + %a = add i65 %N, -1 + ret i65 %a + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Changes in directory llvm/include/llvm/ADT: APInt.h updated: 1.43 -> 1.44 --- Log message: Add an indication of signedness to the uint64_t constructor so sign bits can be extended. This helps fix test/Assembler/2007-03-19-NegValue.ll --- Diffs of the changes: (+1 -1) APInt.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.43 llvm/include/llvm/ADT/APInt.h:1.44 --- llvm/include/llvm/ADT/APInt.h:1.43 Mon Mar 19 00:22:18 2007 +++ llvm/include/llvm/ADT/APInt.h Mon Mar 19 15:36:48 2007 @@ -151,7 +151,7 @@ public: /// @brief Create a new APInt of numBits width, initialized as val. - APInt(uint32_t numBits, uint64_t val); + APInt(uint32_t numBits, uint64_t val, bool isSigned = false); /// Note that numWords can be smaller or larger than the corresponding bit /// width but any extraneous bits will be dropped. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.71 -> 1.72 --- Log message: Implement extension of sign bits for negative values in the uint64_t constructor. This helps to fix test/Assembler/2007-03-19-NegValue.ll --- Diffs of the changes: (+5 -1) APInt.cpp |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.71 llvm/lib/Support/APInt.cpp:1.72 --- llvm/lib/Support/APInt.cpp:1.71 Mon Mar 12 13:37:25 2007 +++ llvm/lib/Support/APInt.cpp Mon Mar 19 15:37:47 2007 @@ -43,7 +43,8 @@ return result; } -APInt::APInt(uint32_t numBits, uint64_t val) : BitWidth(numBits), VAL(0) { +APInt::APInt(uint32_t numBits, uint64_t val, bool isSigned ) + : BitWidth(numBits), VAL(0) { assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small"); assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large"); if (isSingleWord()) @@ -51,6 +52,9 @@ else { pVal = getClearedMemory(getNumWords()); pVal[0] = val; +if (isSigned && int64_t(val) < 0) + for (unsigned i = 1; i < getNumWords(); ++i) +pVal[i] = -1ULL; } clearUnusedBits(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.227 -> 1.228 --- Log message: Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as a negative number. This is needed to fix test/Assembler/2007-03-19-NegValue.ll --- Diffs of the changes: (+2 -2) Constants.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.227 llvm/lib/VMCore/Constants.cpp:1.228 --- llvm/lib/VMCore/Constants.cpp:1.227 Wed Mar 7 18:59:12 2007 +++ llvm/lib/VMCore/Constants.cpp Mon Mar 19 15:39:08 2007 @@ -203,9 +203,9 @@ DenseMapAPIntKeyInfo> IntMapTy; static ManagedStatic IntConstants; -ConstantInt *ConstantInt::get(const Type *Ty, uint64_t V) { +ConstantInt *ConstantInt::get(const Type *Ty, uint64_t V, bool isSigned) { const IntegerType *ITy = cast(Ty); - return get(APInt(ITy->getBitWidth(), V)); + return get(APInt(ITy->getBitWidth(), V, isSigned)); } // Get a ConstantInt from an APInt. Note that the value stored in the DenseMap ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Constants.h
Changes in directory llvm/include/llvm: Constants.h updated: 1.138 -> 1.139 --- Log message: Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as a negative number. This is needed to fix test/Assembler/2007-03-19-NegValue.ll --- Diffs of the changes: (+1 -1) Constants.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.138 llvm/include/llvm/Constants.h:1.139 --- llvm/include/llvm/Constants.h:1.138 Thu Mar 1 18:27:06 2007 +++ llvm/include/llvm/Constants.h Mon Mar 19 15:39:08 2007 @@ -94,7 +94,7 @@ /// either getSExtValue() or getZExtValue() will yield a correctly sized and /// signed value for the type Ty. /// @brief Get a ConstantInt for a specific value. - static ConstantInt *get(const Type *Ty, uint64_t V); + static ConstantInt *get(const Type *Ty, uint64_t V, bool isSigned = false); /// Return a ConstantInt with the specified value and an implied Type. The /// type is the integer type that corresponds to the bit width of the value. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.328 -> 1.329 --- Log message: Fix test/Assembler/2007-03-19-NegValue.ll by using the new "isSigned" parameter on ConstantInt::get to indicate the signedness of the intended value. --- Diffs of the changes: (+4 -9) llvmAsmParser.y | 13 - 1 files changed, 4 insertions(+), 9 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.328 llvm/lib/AsmParser/llvmAsmParser.y:1.329 --- llvm/lib/AsmParser/llvmAsmParser.y:1.328Mon Mar 19 13:39:36 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Mar 19 15:40:22 2007 @@ -392,7 +392,7 @@ Ty->getDescription() + "'"); return 0; } -return ConstantInt::get(Ty, D.ConstPool64); +return ConstantInt::get(Ty, D.ConstPool64, true); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { @@ -401,7 +401,7 @@ "' is invalid or out of range"); return 0; } else { // This is really a signed reference. Transmogrify. -return ConstantInt::get(Ty, D.ConstPool64); +return ConstantInt::get(Ty, D.ConstPool64, true); } } else { return ConstantInt::get(Ty, D.UConstPool64); @@ -1742,10 +1742,7 @@ | IntType ESINT64VAL { // integral constants if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type"); -APInt Val(64, $2); -uint32_t BitWidth = cast($1)->getBitWidth(); -Val.sextOrTrunc(BitWidth); -$$ = ConstantInt::get(Val); +$$ = ConstantInt::get($1, $2, true); CHECK_FOR_ERROR } | IntType ESAPINTVAL { // arbitrary precision integer constants @@ -1761,9 +1758,7 @@ | IntType EUINT64VAL { // integral constants if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type"); -uint32_t BitWidth = cast($1)->getBitWidth(); -APInt Val(BitWidth, $2); -$$ = ConstantInt::get(Val); +$$ = ConstantInt::get($1, $2, false); CHECK_FOR_ERROR } | IntType EUAPINTVAL { // arbitrary precision integer constants ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs
Changes in directory llvm/lib/AsmParser: llvmAsmParser.cpp.cvs updated: 1.73 -> 1.74 llvmAsmParser.y.cvs updated: 1.74 -> 1.75 --- Log message: Regenerate. --- Diffs of the changes: (+146 -156) llvmAsmParser.cpp.cvs | 289 -- llvmAsmParser.y.cvs | 13 -- 2 files changed, 146 insertions(+), 156 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.73 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.74 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.73 Mon Mar 19 13:40:50 2007 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvsMon Mar 19 15:40:51 2007 @@ -716,7 +716,7 @@ Ty->getDescription() + "'"); return 0; } -return ConstantInt::get(Ty, D.ConstPool64); +return ConstantInt::get(Ty, D.ConstPool64, true); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { @@ -725,7 +725,7 @@ "' is invalid or out of range"); return 0; } else { // This is really a signed reference. Transmogrify. -return ConstantInt::get(Ty, D.ConstPool64); +return ConstantInt::get(Ty, D.ConstPool64, true); } } else { return ConstantInt::get(Ty, D.UConstPool64); @@ -1695,20 +1695,20 @@ 1272, 1279, 1284, 1292, 1310, 1328, 1333, 1345, 1355, 1359, 1369, 1376, 1383, 1390, 1395, 1400, 1407, 1408, 1415, 1422, 1430, 1435, 1446, 1474, 1490, 1519, 1547, 1572, 1591, 1617, -1637, 1649, 1656, 1722, 1732, 1742, 1751, 1761, 1769, 1779, -1784, 1789, 1797, 1809, 1831, 1839, 1845, 1856, 1861, 1866, -1872, 1878, 1887, 1891, 1899, 1899, 1910, 1915, 1923, 1924, -1928, 1928, 1932, 1932, 1935, 1938, 1950, 1974, 1985, 1985, -1995, 1995, 2003, 2003, 2013, 2016, 2022, 2035, 2039, 2044, -2046, 2051, 2056, 2065, 2075, 2086, 2090, 2099, 2108, 2113, -2225, 2225, 2227, 2236, 2236, 2238, 2243, 2255, 2259, 2264, -2268, 2272, 2276, 2280, 2284, 2288, 2292, 2296, 2321, 2325, -2339, 2343, 2347, 2351, 2357, 2357, 2363, 2372, 2376, 2385, -2394, 2403, 2407, 2412, 2416, 2420, 2425, 2435, 2454, 2463, -2530, 2534, 2541, 2552, 2565, 2575, 2586, 2596, 2604, 2612, -2615, 2616, 2623, 2627, 2632, 2653, 2670, 2683, 2696, 2708, -2716, 2723, 2729, 2735, 2741, 2756, 2820, 2825, 2829, 2836, -2843, 2851, 2858, 2866, 2874, 2888, 2905 +1637, 1649, 1656, 1722, 1732, 1742, 1748, 1758, 1764, 1774, +1779, 1784, 1792, 1804, 1826, 1834, 1840, 1851, 1856, 1861, +1867, 1873, 1882, 1886, 1894, 1894, 1905, 1910, 1918, 1919, +1923, 1923, 1927, 1927, 1930, 1933, 1945, 1969, 1980, 1980, +1990, 1990, 1998, 1998, 2008, 2011, 2017, 2030, 2034, 2039, +2041, 2046, 2051, 2060, 2070, 2081, 2085, 2094, 2103, 2108, +2220, 2220, , 2231, 2231, 2233, 2238, 2250, 2254, 2259, +2263, 2267, 2271, 2275, 2279, 2283, 2287, 2291, 2316, 2320, +2334, 2338, 2342, 2346, 2352, 2352, 2358, 2367, 2371, 2380, +2389, 2398, 2402, 2407, 2411, 2415, 2420, 2430, 2449, 2458, +2525, 2529, 2536, 2547, 2560, 2570, 2581, 2591, 2599, 2607, +2610, 2611, 2618, 2622, 2627, 2648, 2665, 2678, 2691, 2703, +2711, 2718, 2724, 2730, 2736, 2751, 2815, 2820, 2824, 2831, +2838, 2846, 2853, 2861, 2869, 2883, 2900 }; #endif @@ -4058,16 +4058,13 @@ { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); -APInt Val(64, (yyvsp[0].SInt64Val)); -uint32_t BitWidth = cast((yyvsp[-1].PrimType))->getBitWidth(); -Val.sextOrTrunc(BitWidth); -(yyval.ConstVal) = ConstantInt::get(Val); +(yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true); CHECK_FOR_ERROR ;} break; case 156: -#line 1751 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1748 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[-1].PrimType))->getBitWidth(); if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { @@ -4081,19 +4078,17 @@ break; case 157: -#line 1761 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1758 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); -uint32_t BitWidth = cast((yyvsp[-1].PrimType))->getBitWidth(); -APInt Val(BitWidth, (yyvsp[0].UInt64Val)); -(yyval.ConstVal) = C
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.662 -> 1.663 --- Log message: Remove a redundant clause in an if statement. Patch by Sheng Zhou. --- Diffs of the changes: (+0 -1) InstructionCombining.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.662 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.663 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.662 Sun Mar 18 17:51:34 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 15:47:50 2007 @@ -8158,7 +8158,6 @@ // Check to see if we are changing the return type... if (OldRetTy != FT->getReturnType()) { if (Callee->isDeclaration() && !Caller->use_empty() && -OldRetTy != FT->getReturnType() && // Conversion is ok if changing from pointer to int of same size. !(isa(FT->getReturnType()) && TD->getIntPtrType() == OldRetTy)) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [125160] Better support for variable size struct fields.
Revision: 125160 Author: dpatel Date: 2007-03-19 13:55:02 -0700 (Mon, 19 Mar 2007) Log Message: --- Better support for variable size struct fields. Patch by Duncan Sands. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-convert.cpp apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp === --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 19:06:59 UTC (rev 125159) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 20:55:02 UTC (rev 125160) @@ -4660,12 +4660,6 @@ assert(DECL_LLVM_SET_P(FieldDecl) && "Struct not laid out for LLVM?"); ConstantInt *CI = cast(DECL_LLVM(FieldDecl)); uint32_t MemberIndex = CI->getZExtValue(); -if (MemberIndex == ~0U) { - assert(isStructWithVarSizeArrayAtEnd(StructTy) && - "Isn't var sized array access!"); - CI = ConstantInt::get(Type::Int32Ty, StructTy->getNumContainedTypes()-1); - MemberIndex = CI->getZExtValue(); -} assert(MemberIndex < StructTy->getNumContainedTypes() && "Field Idx out of range!"); FieldPtr = new GetElementPtrInst(StructAddrLV.Ptr, @@ -5476,35 +5470,32 @@ // If not, things are much simpler. assert(DECL_LLVM_SET_P(Field) && "Struct not laid out for LLVM?"); unsigned FieldNo = cast(DECL_LLVM(Field))->getZExtValue(); - + assert(FieldNo < ResultElts.size() && "Invalid struct field number!"); + + // Example: struct X { int A; char C[]; } x = { 4, "foo" }; + assert(TYPE_SIZE(TREE_TYPE(Field)) || + (FieldNo == ResultElts.size()-1 && + isStructWithVarSizeArrayAtEnd(STy)) + && "field with no size is not array at end of struct!"); + // If this is an initialization of a global that ends with a variable // sized array at its end, and the initializer has a non-zero number of - // elements, we must handle this case now. In this case, FieldNo is ~0U - // and Val contains the actual type for the array. - if (FieldNo == ~0U) { -// Handle: struct X { int A; char C[]; } x = { 4, "foo" }; -assert(isStructWithVarSizeArrayAtEnd(STy) && - "Struct doesn't end with variable sized array!"); -FieldNo = STy->getNumElements()-1; -ResultElts[FieldNo] = Val; - } else { -assert(FieldNo < ResultElts.size() && "Invalid struct field number!"); - -// Otherwise, we know that the initializer has to match the element type -// of the LLVM structure field. If not, then there is something that is -// not straight-forward going on. For example, we could be initializing -// an unaligned integer field (e.g. due to attribute packed) with an -// integer. The struct field will have type [4 x ubyte] instead of -// "int" for example. If we ignored this, we would lay out the -// initializer wrong. -if (Val->getType() != STy->getElementType(FieldNo)) - Val = ConvertStructFieldInitializerToType(Val, + // elements, then Val contains the actual type for the array. Otherwise, + // we know that the initializer has to match the element type of the LLVM + // structure field. If not, then there is something that is not + // straight-forward going on. For example, we could be initializing an + // unaligned integer field (e.g. due to attribute packed) with an + // integer. The struct field will have type [4 x ubyte] instead of + // "int" for example. If we ignored this, we would lay out the + // initializer wrong. + if (TYPE_SIZE(TREE_TYPE(Field)) && + Val->getType() != STy->getElementType(FieldNo)) +Val = ConvertStructFieldInitializerToType(Val, STy->getElementType(FieldNo)); -ResultElts[FieldNo] = Val; - } + ResultElts[FieldNo] = Val; } - + NextField = TREE_CHAIN(Field); } @@ -5716,31 +5707,18 @@ ConstantInt *CI = cast(DECL_LLVM(FieldDecl)); uint64_t MemberIndex = CI->getZExtValue(); -if (MemberIndex != ~0U) { - std::vector Idxs; - Idxs.push_back(Constant::getNullValue(Type::Int32Ty)); - Idxs.push_back(CI); - FieldPtr = ConstantExpr::getGetElementPtr(StructAddrLV, &Idxs[0], -Idxs.size()); - - // Now that we did an offset from the start of the struct, subtract off - // the offset from BitStart. - if (MemberIndex) { -const StructLayout *SL = TD.getStructLayout(cast(StructTy)); -BitStart -= SL->getElementOffset(MemberIndex) * 8; - } -} else { - // We were unable to make a nice offset, emit an ugly one. - Constant *Offset = Convert(field_offset); - FieldPtr = ConstantExpr::getPtrToInt(StructAddrLV, Offset->getType(
Re: [llvm-commits] llvm-gcc: better support for variable size struct fields
On Mar 6, 2007, at 8:25 AM, Duncan Sands wrote: > This patch applies on top of the previously posted patch > "llvm-gcc: use component_ref_field_offset in component references", > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070226/045399.html > > . > > This fixes wrong handling of structs containing more than one > variable sized field. Two C testcases are attached. Consider > for example the struct from VarSizeInStruct1: > struct f { char w; char x[n]; char z[]; }; > DecodeStructFields does the following: it creates a field for > w; it skips x; it doesn't skip z because it is the last field, > however it thinks it starts at byte offset 0 because it starts > at the variable offset n+1, and so pops w out of the struct > and replaces it with z, leading to the LLVM struct { [0 * i8] }. > This causes an assertion failure later on in EmitLV_COMPONENT_REF. > The other testcase is similar, and leads to a different assertion > failure. > > I first prepared a minimal fix, but later noticed that the code for > handling variable sized struct fields was unnecessarily complicated > and came up with this more involved patch, which removes a bunch of > special casing. The existing code seems rather fixated on whether > TYPE_SIZE is constant or not, when what really matters is whether the > field starts at a constant offset. I simply skip over fields if and > only if they don't start at a constant offset, and let variable sized > fields be emitted and indexed like any others (no more ~0U field > indices). > I remove the special casing for ~0U field indices everywhere in favour > of the generic code, for example in EmitLV_COMPONENT_REF. The only > place where something still needs to be done is in > ConvertRecordCONSTRUCTOR, > but there too the code simplifies. > > I see no additional failures in the regression test suite or in > MultiSource with these changes. Applied. - Devang ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.663 -> 1.664 --- Log message: 1. Use APInt::getSignBit to reduce clutter (patch by Sheng Zhou) 2. Replace uses of the "isPositive" utility function with APInt::isPositive --- Diffs of the changes: (+4 -8) InstructionCombining.cpp | 12 1 files changed, 4 insertions(+), 8 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.663 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.664 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.663 Mon Mar 19 15:47:50 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 15:58:18 2007 @@ -2760,7 +2760,7 @@ // highest order bit set. static bool isSignBit(ConstantInt *CI) { unsigned NumBits = CI->getType()->getPrimitiveSizeInBits(); - return (CI->getZExtValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1)); + return CI->getValue() == APInt::getSignBit(NumBits); } Instruction *InstCombiner::visitSub(BinaryOperator &I) { @@ -4925,10 +4925,6 @@ return Changed ? &I : 0; } -static bool isPositive(ConstantInt *C) { - return C->getSExtValue() >= 0; -} - /// AddWithOverflow - Compute Result = In1+In2, returning true if the result /// overflowed for this type. static bool AddWithOverflow(ConstantInt *&Result, ConstantInt *In1, @@ -5707,12 +5703,12 @@ LoBound = Prod; LoOverflow = ProdOV; HiOverflow = ProdOV || AddWithOverflow(HiBound, LoBound, DivRHS); - } else if (isPositive(DivRHS)) { // Divisor is > 0. + } else if (DivRHS->getValue().isPositive()) { // Divisor is > 0. if (CI->isNullValue()) { // (X / pos) op 0 // Can't overflow. LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); HiBound = DivRHS; -} else if (isPositive(CI)) { // (X / pos) op pos +} else if (CI->getValue().isPositive()) { // (X / pos) op pos LoBound = Prod; LoOverflow = ProdOV; HiOverflow = ProdOV || AddWithOverflow(HiBound, Prod, DivRHS); @@ -5729,7 +5725,7 @@ HiBound = cast(ConstantExpr::getNeg(DivRHS)); if (HiBound == DivRHS) LoBound = 0; // - INTMIN = INTMIN -} else if (isPositive(CI)) { // (X / neg) op pos +} else if (CI->getValue().isPositive()) { // (X / neg) op pos HiOverflow = LoOverflow = ProdOV; if (!LoOverflow) LoOverflow = AddWithOverflow(LoBound, Prod, AddOne(DivRHS)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.664 -> 1.665 --- Log message: Implement isOneBitSet in terms of APInt::countPopulation. --- Diffs of the changes: (+1 -2) InstructionCombining.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.664 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.665 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.664 Mon Mar 19 15:58:18 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 16:04:43 2007 @@ -3474,8 +3474,7 @@ // isOneBitSet - Return true if there is exactly one bit set in the specified // constant. static bool isOneBitSet(const ConstantInt *CI) { - uint64_t V = CI->getZExtValue(); - return V && (V & (V-1)) == 0; + return CI->getValue().countPopulation() == 1; } #if 0 // Currently unused ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.665 -> 1.666 --- Log message: Implement isMinValuePlusOne using facilities of APInt instead of uint64_t Patch by Zhou Sheng. --- Diffs of the changes: (+4 -5) InstructionCombining.cpp |9 - 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.665 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.666 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.665 Mon Mar 19 16:04:43 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 16:08:07 2007 @@ -3463,12 +3463,11 @@ static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) { if (isSigned) { // Calculate 11 -unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); -int64_t Val = -1;// All ones -Val <<= TypeBits-1; // Shift over to the right spot -return C->getSExtValue() == Val+1; +uint32_t TypeBits = C->getType()->getPrimitiveSizeInBits(); +APInt Val(APInt::getSignedMinValue(TypeBits)); +return C->getValue() == Val+1; } - return C->getZExtValue() == 1; // unsigned + return C->getValue() == 1; // unsigned } // isOneBitSet - Return true if there is exactly one bit set in the specified ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.666 -> 1.667 --- Log message: Implement isMaxValueMinusOne in terms of APInt instead of uint64_t. Patch by Sheng Zhou. --- Diffs of the changes: (+4 -5) InstructionCombining.cpp |9 - 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.666 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.667 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.666 Mon Mar 19 16:08:07 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 16:10:28 2007 @@ -3449,14 +3449,13 @@ // isMaxValueMinusOne - return true if this is Max-1 static bool isMaxValueMinusOne(const ConstantInt *C, bool isSigned) { + uint32_t TypeBits = C->getType()->getPrimitiveSizeInBits(); if (isSigned) { // Calculate 01..1 -unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); -int64_t Val = INT64_MAX; // All ones -Val >>= 64-TypeBits; // Shift out unwanted 1 bits... -return C->getSExtValue() == Val-1; +APInt Val(APInt::getSignedMaxValue(TypeBits)); +return C->getValue() == Val-1; } - return C->getZExtValue() == C->getType()->getBitMask()-1; + return C->getValue() == APInt::getAllOnesValue(TypeBits) - 1; } // isMinValuePlusOne - return true if this is Min+1 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> 1. Use APInt::getSignBit to reduce clutter (patch by Sheng Zhou) > 2. Replace uses of the "isPositive" utility function with > APInt::isPositive Oooh, beautiful. Nice work guys, -Chris > > --- > Diffs of the changes: (+4 -8) > > InstructionCombining.cpp | 12 > 1 files changed, 4 insertions(+), 8 deletions(-) > > > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.663 > llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.664 > --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.663 Mon > Mar 19 15:47:50 2007 > +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 > 15:58:18 2007 > @@ -2760,7 +2760,7 @@ > // highest order bit set. > static bool isSignBit(ConstantInt *CI) { >unsigned NumBits = CI->getType()->getPrimitiveSizeInBits(); > - return (CI->getZExtValue() & (~0ULL >> (64-NumBits))) == (1ULL > << (NumBits-1)); > + return CI->getValue() == APInt::getSignBit(NumBits); > } > > Instruction *InstCombiner::visitSub(BinaryOperator &I) { > @@ -4925,10 +4925,6 @@ >return Changed ? &I : 0; > } > > -static bool isPositive(ConstantInt *C) { > - return C->getSExtValue() >= 0; > -} > - > /// AddWithOverflow - Compute Result = In1+In2, returning true if > the result > /// overflowed for this type. > static bool AddWithOverflow(ConstantInt *&Result, ConstantInt *In1, > @@ -5707,12 +5703,12 @@ > LoBound = Prod; > LoOverflow = ProdOV; > HiOverflow = ProdOV || AddWithOverflow(HiBound, > LoBound, DivRHS); > - } else if (isPositive(DivRHS)) { // Divisor is > 0. > + } else if (DivRHS->getValue().isPositive()) { // Divisor > is > 0. > if (CI->isNullValue()) { // (X / pos) op 0 >// Can't overflow. >LoBound = cast(ConstantExpr::getNeg > (SubOne(DivRHS))); >HiBound = DivRHS; > -} else if (isPositive(CI)) { // (X / pos) op pos > +} else if (CI->getValue().isPositive()) { // (X / > pos) op pos >LoBound = Prod; >LoOverflow = ProdOV; >HiOverflow = ProdOV || AddWithOverflow(HiBound, > Prod, DivRHS); > @@ -5729,7 +5725,7 @@ >HiBound = cast(ConstantExpr::getNeg > (DivRHS)); >if (HiBound == DivRHS) > LoBound = 0; // - INTMIN = INTMIN > -} else if (isPositive(CI)) { // (X / neg) op pos > +} else if (CI->getValue().isPositive()) { // (X / > neg) op pos >HiOverflow = LoOverflow = ProdOV; >if (!LoOverflow) > LoOverflow = AddWithOverflow(LoBound, Prod, AddOne > (DivRHS)); > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> Implement isOneBitSet in terms of APInt::countPopulation. > @@ -3474,8 +3474,7 @@ > // isOneBitSet - Return true if there is exactly one bit set in > the specified > // constant. > static bool isOneBitSet(const ConstantInt *CI) { > - uint64_t V = CI->getZExtValue(); > - return V && (V & (V-1)) == 0; > + return CI->getValue().countPopulation() == 1; > } Are you sure this is a good idea? countPopulation is *much* slower than a couple of and's and a subtract. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.72 -> 1.73 --- Log message: Fix coding standards violation. --- Diffs of the changes: (+1 -1) APInt.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.72 llvm/lib/Support/APInt.cpp:1.73 --- llvm/lib/Support/APInt.cpp:1.72 Mon Mar 19 15:37:47 2007 +++ llvm/lib/Support/APInt.cpp Mon Mar 19 16:19:02 2007 @@ -43,7 +43,7 @@ return result; } -APInt::APInt(uint32_t numBits, uint64_t val, bool isSigned ) +APInt::APInt(uint32_t numBits, uint64_t val, bool isSigned) : BitWidth(numBits), VAL(0) { assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small"); assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
On Mon, 2007-03-19 at 14:16 -0700, Chris Lattner wrote: > > Implement isOneBitSet in terms of APInt::countPopulation. > > > @@ -3474,8 +3474,7 @@ > > // isOneBitSet - Return true if there is exactly one bit set in > > the specified > > // constant. > > static bool isOneBitSet(const ConstantInt *CI) { > > - uint64_t V = CI->getZExtValue(); > > - return V && (V & (V-1)) == 0; > > + return CI->getValue().countPopulation() == 1; > > } > > Are you sure this is a good idea? countPopulation is *much* slower > than a couple of and's and a subtract. Its the temporary construction of APInts that makes the performance of the existing algorithm poor. This will construct 3 temporaries, each potentially with a malloc. Using countPopulation is constant time (I agree, not super fast, but consistent) and much easier to read in the code. > > -Chris > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.667 -> 1.668 --- Log message: APIntify the isHighOnes utility function. --- Diffs of the changes: (+6 -5) InstructionCombining.cpp | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.667 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.668 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.667 Mon Mar 19 16:10:28 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 16:29:50 2007 @@ -3491,14 +3491,15 @@ // isHighOnes - Return true if the constant is of the form 1+0+. // This is the same as lowones(~X). static bool isHighOnes(const ConstantInt *CI) { - uint64_t V = ~CI->getZExtValue(); - if (~V == 0) return false; // 0's does not match "1+" + if (CI->getValue() == 0) return false; // 0's does not match "1+" + + APInt V(~CI->getValue()); // There won't be bits set in parts that the type doesn't contain. - V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue(); + V &= APInt::getAllOnesValue(CI->getType()->getBitWidth()); - uint64_t U = V+1; // If it is low ones, this should be a power of two. - return U && V && (U & V) == 0; + APInt U(V+1); // If it is low ones, this should be a power of two. + return (U!=0) && (V!=0) && (U & V) == 0; } /// getICmpCode - Encode a icmp predicate into a three bit mask. These bits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html
Changes in directory llvm/docs: WritingAnLLVMPass.html updated: 1.53 -> 1.54 --- Log message: Document LoopPass. --- Diffs of the changes: (+89 -1) WritingAnLLVMPass.html | 90 - 1 files changed, 89 insertions(+), 1 deletion(-) Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.53 llvm/docs/WritingAnLLVMPass.html:1.54 --- llvm/docs/WritingAnLLVMPass.html:1.53 Wed Mar 14 14:32:21 2007 +++ llvm/docs/WritingAnLLVMPass.htmlMon Mar 19 17:21:25 2007 @@ -43,6 +43,14 @@ The doFinalization(Module &) method + The LoopPass class + +The doInitialization(Loop *, +LPPassManager &) method +The runOnLoop method +The doFinalization() + method + The BasicBlockPass class The doInitialization(Function @@ -126,6 +134,7 @@ the ModulePass, CallGraphSCCPass, FunctionPass, or LoopPass, or BasicBlockPass classes, which gives the system more information about what your pass does, and how it can be combined with other passes. One of the main features of the LLVM Pass Framework is that it @@ -689,6 +698,85 @@ + The LoopPass class + + + + + All LoopPass execute on each loop in the function independent of +all of the other loops in the function. LoopPass processes loops in +loop nest order such that outer most loop is processed last. + + LoopPass subclasses are allowed to update loop nest using +LPPassManager interface. Implementing a loop pass is usually +straightforward. Looppass's may overload three virtual methods to +do their work. All these methods should return true if they modified the +program, or false if they didn't. + + + + + The doInitialization(Loop *, + LPPassManager &) + method + + + + + + virtual bool doInitialization(Loop *, LPPassManager &LPM); + + +The doInitialization method is designed to do simple initialization +type of stuff that does not depend on the functions being processed. The +doInitialization method call is not scheduled to overlap with any +other pass executions (thus it should be very fast). LPPassManager +interface should be used to access Function or Module level analysis +information. + + + + + + + The runOnLoop method + + + + + + virtual bool runOnLoop(Loop *, LPPassManager &LPM) = 0; + + +The runOnLoop method must be implemented by your subclass to do +the transformation or analysis work of your pass. As usual, a true value should +be returned if the function is modified. LPPassManager interface +should be used to update loop nest. + + + + + + The doFinalization() method + + + + + + virtual bool doFinalization(); + + +The doFinalization method is an infrequently used method that is +called when the pass framework has finished calling runOnLoop for every loop in the +program being compiled. + + + + + + + The BasicBlockPass class @@ -1711,7 +1799,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.org";>The LLVM Compiler Infrastructure - Last modified: $Date: 2007/03/14 19:32:21 $ + Last modified: $Date: 2007/03/19 22:21:25 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll
Changes in directory llvm/test/Transforms/InstCombine: 2007-03-19-BadTruncChangePR1261.ll added (r1.1) --- Log message: Add test case for PR1261: http://llvm.org/PR1261 , currently XFAILed. --- Diffs of the changes: (+14 -0) 2007-03-19-BadTruncChangePR1261.ll | 14 ++ 1 files changed, 14 insertions(+) Index: llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll diff -c /dev/null llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll:1.1 *** /dev/null Mon Mar 19 18:28:26 2007 --- llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll Mon Mar 19 18:28:16 2007 *** *** 0 --- 1,14 + ; For PR1261. Before bit accurate type support in InstCombine, this would + ; turn the sext into a zext. + ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis && + ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | not grep zext + ; XFAIL: * + + define i16 @test(i31 %zzz) { + entry: + %A = sext i31 %zzz to i32 + %B = add i32 %A, 16384 + %C = lshr i32 %B, 15 + %D = trunc i32 %C to i16 + ret i16 %D + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll
Changes in directory llvm/test/Transforms/InstCombine: 2007-03-19-BadTruncChangePR1261.ll updated: 1.1 -> 1.2 --- Log message: Make this test a little simpler/faster. --- Diffs of the changes: (+1 -2) 2007-03-19-BadTruncChangePR1261.ll |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll diff -u llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll:1.1 llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll:1.2 --- llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll:1.1 Mon Mar 19 18:28:16 2007 +++ llvm/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll Mon Mar 19 18:36:19 2007 @@ -1,7 +1,6 @@ ; For PR1261. Before bit accurate type support in InstCombine, this would ; turn the sext into a zext. -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis && -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | not grep zext +; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep sext ; XFAIL: * define i16 @test(i31 %zzz) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [125161] Return the correct type for ARRAY_RANGE_REF.
Revision: 125161 Author: dpatel Date: 2007-03-19 16:38:02 -0700 (Mon, 19 Mar 2007) Log Message: --- Return the correct type for ARRAY_RANGE_REF. Patch by Duncan Sands. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp === --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 20:55:02 UTC (rev 125160) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 23:38:02 UTC (rev 125161) @@ -4558,6 +4558,8 @@ // If this is an index into an array, codegen as a GEP. if (TREE_CODE(TREE_TYPE(Array)) == ARRAY_TYPE) { +Value *Ptr; + // Check for variable sized array reference. tree length = arrayLength(TREE_TYPE(Array)); if (length && !host_integerp(length, 1)) { @@ -4568,13 +4570,16 @@ Scale = CastToUIntType(Scale, IntPtrTy); IndexVal = BinaryOperator::createMul(IndexVal, Scale, "tmp", CurBB); - Value *Ptr = new GetElementPtrInst(ArrayAddr, IndexVal, "tmp", CurBB); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp; + Ptr = new GetElementPtrInst(ArrayAddr, IndexVal, "tmp", CurBB); +} else { + // Otherwise, this is not a variable-sized array, use a GEP to index. + Ptr = new GetElementPtrInst(ArrayAddr, ConstantInt::get(Type::Int32Ty, 0), + IndexVal, "tmp", CurBB); } -// Otherwise, this is not a variable-sized array, use a GEP to index. -return new GetElementPtrInst(ArrayAddr, ConstantInt::get(Type::Int32Ty, 0), - IndexVal, "tmp", CurBB); +// The result type is an ElementTy* in the case of an ARRAY_REF, an array +// of ElementTy in the case of ARRAY_RANGE_REF. Return the correct type. +return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp; } // Otherwise, this is an index off a pointer, codegen as a 2-idx GEP. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] llvm-gcc: return the correct type for ARRAY_RANGE_REF
On Mar 14, 2007, at 3:51 PM, Duncan Sands wrote: > An ARRAY_RANGE_REF is for extracting a range of elements from > an array, for example elements 1 to 2 of an [3 x i32], while > ARRAY_REF is for extracting a single element, say element 2. > EmitLV_ARRAY_REF, which handles both expression types, should > return a [2 x i32]* in the first case and an i32* in the second > case (currently it always returns a pointer to the element type). > The testcase is, as ever, in Ada (Ada is the only front-end that > generates ARRAY_RANGE_REF). Applied. - Devang ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
On Mar 19, 2007, at 2:21 PM, Reid Spencer wrote: > On Mon, 2007-03-19 at 14:16 -0700, Chris Lattner wrote: >>> Implement isOneBitSet in terms of APInt::countPopulation. >> >>> @@ -3474,8 +3474,7 @@ >>> // isOneBitSet - Return true if there is exactly one bit set in >>> the specified >>> // constant. >>> static bool isOneBitSet(const ConstantInt *CI) { >>> - uint64_t V = CI->getZExtValue(); >>> - return V && (V & (V-1)) == 0; >>> + return CI->getValue().countPopulation() == 1; >>> } >> >> Are you sure this is a good idea? countPopulation is *much* slower >> than a couple of and's and a subtract. > > Its the temporary construction of APInts that makes the performance of > the existing algorithm poor. This will construct 3 temporaries, each > potentially with a malloc. Using countPopulation is constant time (I > agree, not super fast, but consistent) and much easier to read in the > code. Optimizing for the "big" apint case isn't interesting, please optimize for the small case. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
On Mar 19, 2007, at 5:02 PM, Chris Lattner wrote: > On Mar 19, 2007, at 2:21 PM, Reid Spencer wrote: >> On Mon, 2007-03-19 at 14:16 -0700, Chris Lattner wrote: Implement isOneBitSet in terms of APInt::countPopulation. >>> @@ -3474,8 +3474,7 @@ // isOneBitSet - Return true if there is exactly one bit set in the specified // constant. static bool isOneBitSet(const ConstantInt *CI) { - uint64_t V = CI->getZExtValue(); - return V && (V & (V-1)) == 0; + return CI->getValue().countPopulation() == 1; } >>> >>> Are you sure this is a good idea? countPopulation is *much* slower >>> than a couple of and's and a subtract. >> >> Its the temporary construction of APInts that makes the >> performance of >> the existing algorithm poor. This will construct 3 temporaries, each >> potentially with a malloc. Using countPopulation is constant time (I >> agree, not super fast, but consistent) and much easier to read in the >> code. > > Optimizing for the "big" apint case isn't interesting, please > optimize for the small case. Better yet, just call APInt::isPowerOf2. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.668 -> 1.669 --- Log message: Make isOneBitSet faster by using APInt::isPowerOf2. Thanks Chris. --- Diffs of the changes: (+1 -1) InstructionCombining.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.668 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.669 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.668 Mon Mar 19 16:29:50 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 19:16:52 2007 @@ -3472,7 +3472,7 @@ // isOneBitSet - Return true if there is exactly one bit set in the specified // constant. static bool isOneBitSet(const ConstantInt *CI) { - return CI->getValue().countPopulation() == 1; + return CI->getValue().isPowerOf2(); } #if 0 // Currently unused ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Value.cpp
Changes in directory llvm/lib/VMCore: Value.cpp updated: 1.71 -> 1.72 --- Log message: Fix a nasty memory leak, caused by my revamp of the value symbol table. --- Diffs of the changes: (+5 -0) Value.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/VMCore/Value.cpp diff -u llvm/lib/VMCore/Value.cpp:1.71 llvm/lib/VMCore/Value.cpp:1.72 --- llvm/lib/VMCore/Value.cpp:1.71 Sun Mar 4 18:00:42 2007 +++ llvm/lib/VMCore/Value.cpp Mon Mar 19 19:18:10 2007 @@ -56,6 +56,11 @@ #endif assert(use_begin() == use_end() && "Uses remain when a value is destroyed!"); + // If this value is named, destroy the name. This should not be in a symtab + // at this point. + if (Name) +Name->Destroy(); + // There should be no uses of this object anymore, remove it. LeakDetector::removeGarbageObject(this); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.h
Changes in directory llvm/lib/Target/ARM: ARMISelLowering.h updated: 1.4 -> 1.5 --- Log message: fix obvious comment bug --- Diffs of the changes: (+1 -1) ARMISelLowering.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMISelLowering.h diff -u llvm/lib/Target/ARM/ARMISelLowering.h:1.4 llvm/lib/Target/ARM/ARMISelLowering.h:1.5 --- llvm/lib/Target/ARM/ARMISelLowering.h:1.4 Fri Mar 16 03:43:56 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.h Mon Mar 19 19:30:56 2007 @@ -67,7 +67,7 @@ } //===--===// - // ARMTargetLowering - X86 Implementation of the TargetLowering interface + // ARMTargetLowering - ARM Implementation of the TargetLowering interface class ARMTargetLowering : public TargetLowering { int VarArgsFrameIndex;// FrameIndex for start of varargs area. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.118 -> 1.119 --- Log message: use types of loads and stores, not address, in CheckForIVReuse --- Diffs of the changes: (+28 -7) LoopStrengthReduce.cpp | 35 --- 1 files changed, 28 insertions(+), 7 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.118 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.119 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.118 Tue Mar 13 15:34:37 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Mar 19 19:47:50 2007 @@ -43,6 +43,9 @@ STATISTIC(NumVariable, "Number of PHIs with variable strides"); namespace { + + class BasedUser; + /// IVStrideUse - Keep track of one use of a strided induction variable, where /// the stride is stored externally. The Offset member keeps track of the /// offset from the IV, User is the actual user of the operand, and 'Operand' @@ -174,7 +177,10 @@ void OptimizeIndvars(Loop *L); -unsigned CheckForIVReuse(const SCEVHandle&, IVExpr&, const Type*); +unsigned CheckForIVReuse(const SCEVHandle&, IVExpr&, const Type*, + const std::vector& UsersToProcess); + +bool ValidStride(int64_t, const std::vector& UsersToProcess); void StrengthReduceStridedIVUsers(const SCEVHandle &Stride, IVUsersOfOneStride &Uses, @@ -871,13 +877,25 @@ return false; } +/// ValidStride - Check whether the given Scale is valid for all loads and +/// stores in UsersToProcess. Pulled into a function to avoid disturbing the +/// sensibilities of those who dislike goto's. +/// +bool LoopStrengthReduce::ValidStride(int64_t Scale, + const std::vector& UsersToProcess) { + for (unsigned i=0, e = UsersToProcess.size(); i!=e; ++i) +if (!TLI->isLegalAddressScale(Scale, UsersToProcess[i].Inst->getType())) + return false; + return true; +} /// CheckForIVReuse - Returns the multiple if the stride is the multiple /// of a previous stride and it is a legal value for the target addressing /// mode scale component. This allows the users of this stride to be rewritten /// as prev iv * factor. It returns 0 if no reuse is possible. -unsigned LoopStrengthReduce::CheckForIVReuse(const SCEVHandle &Stride, - IVExpr &IV, const Type *Ty) { +unsigned LoopStrengthReduce::CheckForIVReuse(const SCEVHandle &Stride, +IVExpr &IV, const Type *Ty, +const std::vector& UsersToProcess) { if (!TLI) return 0; if (SCEVConstant *SC = dyn_cast(Stride)) { @@ -890,7 +908,11 @@ if (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0) continue; int64_t Scale = SInt / SSInt; - if (TLI->isLegalAddressScale(Scale, Ty)) { + // Check that this stride is valid for all the types used for loads and + // stores; if it can be used for some and not others, we might as well use + // the original stride everywhere, since we have to create the IV for it + // anyway. + if (ValidStride(Scale, UsersToProcess)) for (std::vector::iterator II = SI->second.IVs.begin(), IE = SI->second.IVs.end(); II != IE; ++II) // FIXME: Only handle base == 0 for now. @@ -899,10 +921,8 @@ IV = *II; return Scale; } - } } } - return 0; } @@ -955,7 +975,8 @@ Value *IncV = NULL; IVExpr ReuseIV; unsigned RewriteFactor = CheckForIVReuse(Stride, ReuseIV, - CommonExprs->getType()); + CommonExprs->getType(), + UsersToProcess); if (RewriteFactor != 0) { DOUT << "BASED ON IV of STRIDE " << *ReuseIV.Stride << " and BASE " << *ReuseIV.Base << " :\n"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.329 -> 1.330 --- Log message: Plug some PATypeHolder memory leaks. --- Diffs of the changes: (+25 -6) llvmAsmParser.y | 31 +-- 1 files changed, 25 insertions(+), 6 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.329 llvm/lib/AsmParser/llvmAsmParser.y:1.330 --- llvm/lib/AsmParser/llvmAsmParser.y:1.329Mon Mar 19 15:40:22 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Mar 19 20:13:00 2007 @@ -513,9 +513,16 @@ CurFun.CurrentFunction->getBasicBlockList().remove(BB); CurFun.CurrentFunction->getBasicBlockList().push_back(BB); +// We're about to erase the entry, save the key so we can clean it up. +ValID Tmp = BBI->first; + // Erase the forward ref from the map as its no longer "forward" CurFun.BBForwardRefs.erase(ID); +// The key has been removed from the map but so we don't want to leave +// strdup'd memory around so destroy it too. +Tmp.destroy(); + // If its a numbered definition, bump the number and set the BB value. if (ID.Type == ValID::LocalID) { assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); @@ -1294,8 +1301,10 @@ std::vector Attrs; Attrs.push_back($5); for (TypeWithAttrsList::iterator I=$3->begin(), E=$3->end(); I != E; ++I) { - Params.push_back(I->Ty->get()); - if (I->Ty->get() != Type::VoidTy) + const Type *Ty = I->Ty->get(); + delete I->Ty; I->Ty = 0; + Params.push_back(Ty); + if (Ty != Type::VoidTy) Attrs.push_back(I->Attrs); } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; @@ -1312,8 +1321,10 @@ std::vector Attrs; Attrs.push_back($5); for (TypeWithAttrsList::iterator I=$3->begin(), E=$3->end(); I != E; ++I) { - Params.push_back(I->Ty->get()); - if (I->Ty->get() != Type::VoidTy) + const Type* Ty = I->Ty->get(); + delete I->Ty; I->Ty = 0; + Params.push_back(Ty); + if (Ty != Type::VoidTy) Attrs.push_back(I->Attrs); } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; @@ -1429,11 +1440,13 @@ // TypeListI : Types { $$ = new std::list(); -$$->push_back(*$1); delete $1; +$$->push_back(*$1); +delete $1; CHECK_FOR_ERROR } | TypeListI ',' Types { -($$=$1)->push_back(*$3); delete $3; +($$=$1)->push_back(*$3); +delete $3; CHECK_FOR_ERROR }; @@ -2479,6 +2492,8 @@ PFTy = PointerType::get(Ty); } +delete $3; + Value *V = getVal(PFTy, $4); // Get the function we're calling... CHECK_FOR_ERROR BasicBlock *Normal = getBBVal($11); @@ -2595,6 +2610,7 @@ $$ = new ValueRefList(); ValueRefListEntry E; E.Attrs = $3; E.Val = getVal($1->get(), $2); $$->push_back(E); +delete $1; } | ValueRefList ',' Types ValueRef OptParamAttrs { if (!UpRefs.empty()) @@ -2602,6 +2618,7 @@ $$ = $1; ValueRefListEntry E; E.Attrs = $5; E.Val = getVal($3->get(), $4); $$->push_back(E); +delete $3; CHECK_FOR_ERROR } | /*empty*/ { $$ = new ValueRefList(); }; @@ -2674,6 +2691,7 @@ $$ = CmpInst::create($1, $2, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("icmp operator returned null"); +delete $3; } | FCMP FPredicates Types ValueRef ',' ValueRef { if (!UpRefs.empty()) @@ -2687,6 +2705,7 @@ $$ = CmpInst::create($1, $2, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("fcmp operator returned null"); +delete $3; } | CastOps ResolvedVal TO Types { if (!UpRefs.empty()) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/ADT/BitVector.h
Changes in directory llvm/include/llvm/ADT: BitVector.h updated: 1.17 -> 1.18 --- Log message: Add a dtor to fix leaks from all clients of BitVector. --- Diffs of the changes: (+4 -0) BitVector.h |4 1 files changed, 4 insertions(+) Index: llvm/include/llvm/ADT/BitVector.h diff -u llvm/include/llvm/ADT/BitVector.h:1.17 llvm/include/llvm/ADT/BitVector.h:1.18 --- llvm/include/llvm/ADT/BitVector.h:1.17 Thu Mar 1 20:31:37 2007 +++ llvm/include/llvm/ADT/BitVector.h Mon Mar 19 21:10:56 2007 @@ -86,6 +86,10 @@ Bits = new BitWord[Capacity]; std::copy(RHS.Bits, &RHS.Bits[Capacity], Bits); } + + ~BitVector() { +delete[] Bits; + } /// size - Returns the number of bits in this bitvector. unsigned size() const { return Size; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Changes in directory llvm/include/llvm/ADT: APInt.h updated: 1.44 -> 1.45 --- Log message: Correct the name: isStrictPositive --> isStrictlyPositive. --- Diffs of the changes: (+1 -1) APInt.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.44 llvm/include/llvm/ADT/APInt.h:1.45 --- llvm/include/llvm/ADT/APInt.h:1.44 Mon Mar 19 15:36:48 2007 +++ llvm/include/llvm/ADT/APInt.h Mon Mar 19 21:18:16 2007 @@ -376,7 +376,7 @@ /// This just tests if the value of this APInt is strictly positive (> 0). /// @brief Determine if this APInt Value is strictly positive. - inline bool isStrictPositive() const { + inline bool isStrictlyPositive() const { return isPositive() && (*this) != 0; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp
Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.25 -> 1.26 --- Log message: fix indentation --- Diffs of the changes: (+1 -1) ARMISelLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.25 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.26 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.25Mon Mar 19 02:48:02 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Mon Mar 19 21:25:53 2007 @@ -161,7 +161,7 @@ // Only ARMv6 has BSWAP. if (!Subtarget->hasV6Ops()) - setOperationAction(ISD::BSWAP, MVT::i32, Expand); +setOperationAction(ISD::BSWAP, MVT::i32, Expand); // These are expanded into libcalls. setOperationAction(ISD::SDIV, MVT::i32, Expand); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] llvm-gcc: better support for variable size struct fields
On Mar 6, 2007, at 8:25 AM, Duncan Sands wrote: > This patch applies on top of the previously posted patch > "llvm-gcc: use component_ref_field_offset in component references", > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > Mon-20070226/045399.html. > > Duncan. > > <2007-03-06-VarSizeInStruct1.c> > <2007-03-06-VarSizeInStruct2.c> Cool, thanks for applying this Devang, Duncan, can you check in the testcases plz? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> APIntify the isHighOnes utility function. > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.667 > llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.668 > --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.667 Mon > Mar 19 16:10:28 2007 > +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Mar 19 > 16:29:50 2007 > @@ -3491,14 +3491,15 @@ > // isHighOnes - Return true if the constant is of the form 1+0+. > // This is the same as lowones(~X). > static bool isHighOnes(const ConstantInt *CI) { > - uint64_t V = ~CI->getZExtValue(); > - if (~V == 0) return false; // 0's does not match "1+" > + if (CI->getValue() == 0) return false; // 0's does not match "1+" Why not call isZero() ? > + > + APInt V(~CI->getValue()); > >// There won't be bits set in parts that the type doesn't contain. > - V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue(); > + V &= APInt::getAllOnesValue(CI->getType()->getBitWidth()); This is an obvious no-op, please remove it. > - uint64_t U = V+1; // If it is low ones, this should be a power > of two. > - return U && V && (U & V) == 0; > + APInt U(V+1); // If it is low ones, this should be a power of two. > + return (U!=0) && (V!=0) && (U & V) == 0; > } Please change this to ispoweroftwo(V+1), at which point you can drop the isZero check above. -Chris > > /// getICmpCode - Encode a icmp predicate into a three bit mask. > These bits > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/shift-codegen.ll
Changes in directory llvm/test/CodeGen/X86: shift-codegen.ll added (r1.1) --- Log message: These functions should use shll, not lea. --- Diffs of the changes: (+27 -0) shift-codegen.ll | 27 +++ 1 files changed, 27 insertions(+) Index: llvm/test/CodeGen/X86/shift-codegen.ll diff -c /dev/null llvm/test/CodeGen/X86/shift-codegen.ll:1.1 *** /dev/null Tue Mar 20 01:01:51 2007 --- llvm/test/CodeGen/X86/shift-codegen.ll Tue Mar 20 01:01:41 2007 *** *** 0 --- 1,27 + ; RUN: llvm-as < %s | llc -relocation-model=static -march=x86 | grep 'shll $3' | wc -l | grep 2 + + ; This should produce two shll instructions, not any lea's. + + target triple = "i686-apple-darwin8" + @Y = weak global i32 0 ; [#uses=1] + @X = weak global i32 0 ; [#uses=2] + + implementation ; Functions: + + define void @fn1() { + entry: + %tmp = load i32* @Y ; [#uses=1] + %tmp1 = shl i32 %tmp, 3 ; [#uses=1] + %tmp2 = load i32* @X; [#uses=1] + %tmp3 = or i32 %tmp1, %tmp2 ; [#uses=1] + store i32 %tmp3, i32* @X + ret void + } + + define i32 @fn2(i32 %X, i32 %Y) { + entry: + %tmp2 = shl i32 %Y, 3 ; [#uses=1] + %tmp4 = or i32 %tmp2, %X; [#uses=1] + ret i32 %tmp4 + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp X86InstrInfo.cpp
Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.145 -> 1.146 X86InstrInfo.cpp updated: 1.78 -> 1.79 --- Log message: Two changes: 1) codegen a shift of a register as a shift, not an LEA. 2) teach the RA to convert a shift to an LEA instruction if it wants something in three-address form. This gives us asm diffs like: - leal (,%eax,4), %eax + shll $2, %eax which is faster on some processors and smaller on all of them. and, more interestingly: - movl 24(%esi), %eax - leal (,%eax,4), %edi + movl 24(%esi), %edi + shll $2, %edi Without #2, #1 was a significant pessimization in some cases. This implements CodeGen/X86/shift-codegen.ll --- Diffs of the changes: (+39 -13) X86ISelDAGToDAG.cpp |7 +++ X86InstrInfo.cpp| 45 - 2 files changed, 39 insertions(+), 13 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.145 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.146 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.145 Sun Feb 4 14:18:17 2007 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Mar 20 01:08:29 2007 @@ -886,10 +886,9 @@ else AM.IndexReg = CurDAG->getRegister(0, VT); - if (AM.Scale > 2) -Complexity += 2; - // Don't match just leal(,%reg,2). It's cheaper to do addl %reg, %reg - else if (AM.Scale > 1) + // Don't match just leal(,%reg,2). It's cheaper to do addl %reg, %reg, or with + // a simple shift. + if (AM.Scale > 1) Complexity++; // FIXME: We are artificially lowering the criteria to turn ADD %reg, $GA Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.78 llvm/lib/Target/X86/X86InstrInfo.cpp:1.79 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.78 Thu Mar 8 16:09:11 2007 +++ llvm/lib/Target/X86/X86InstrInfo.cppTue Mar 20 01:08:29 2007 @@ -132,29 +132,57 @@ MachineInstr *NewMI = NULL; // FIXME: 16-bit LEA's are really slow on Athlons, but not bad on P4's. When - // we have subtarget support, enable the 16-bit LEA generation here. + // we have better subtarget support, enable the 16-bit LEA generation here. bool DisableLEA16 = true; switch (MI->getOpcode()) { - default: break; + default: return 0; case X86::SHUFPSrri: { assert(MI->getNumOperands() == 4 && "Unknown shufps instruction!"); -const X86Subtarget *Subtarget = &TM.getSubtarget(); +if (!TM.getSubtarget().hasSSE2()) return 0; + unsigned A = MI->getOperand(0).getReg(); unsigned B = MI->getOperand(1).getReg(); unsigned C = MI->getOperand(2).getReg(); -unsigned M = MI->getOperand(3).getImmedValue(); -if (!Subtarget->hasSSE2() || B != C) return 0; +unsigned M = MI->getOperand(3).getImm(); +if (B != C) return 0; NewMI = BuildMI(get(X86::PSHUFDri), A).addReg(B).addImm(M); -goto Done; +break; + } + case X86::SHL32ri: { +assert(MI->getNumOperands() == 3 && "Unknown shift instruction!"); +// NOTE: LEA doesn't produce flags like shift does, but LLVM never uses +// the flags produced by a shift yet, so this is safe. +unsigned Dest = MI->getOperand(0).getReg(); +unsigned Src = MI->getOperand(1).getReg(); +unsigned ShAmt = MI->getOperand(2).getImm(); +if (ShAmt == 0 || ShAmt >= 4) return 0; + +NewMI = BuildMI(get(X86::LEA32r), Dest) + .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0); +break; + } + case X86::SHL16ri: { +assert(MI->getNumOperands() == 3 && "Unknown shift instruction!"); +if (DisableLEA16) return 0; + +// NOTE: LEA doesn't produce flags like shift does, but LLVM never uses +// the flags produced by a shift yet, so this is safe. +unsigned Dest = MI->getOperand(0).getReg(); +unsigned Src = MI->getOperand(1).getReg(); +unsigned ShAmt = MI->getOperand(2).getImm(); +if (ShAmt == 0 || ShAmt >= 4) return 0; + +NewMI = BuildMI(get(X86::LEA16r), Dest) + .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0); +break; } } // FIXME: None of these instructions are promotable to LEAs without // additional information. In particular, LEA doesn't set the flags that // add and inc do. :( - return 0; - + if (0) switch (MI->getOpcode()) { case X86::INC32r: case X86::INC64_32r: @@ -220,7 +248,6 @@ break; } -Done: if (NewMI) { NewMI->copyKillDeadInfo(MI); LV.instructionChanged(MI, NewMI); // Update live variables ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits