[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.74 -> 1.75 --- Log message: expand brind so that we don't have to implement jump tables right now --- Diffs of the changes: (+1 -0) ARMISelDAGToDAG.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.74 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.75 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.74Wed Oct 18 07:03:07 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Oct 19 05:56:43 2006 @@ -66,6 +66,7 @@ setOperationAction(ISD::SETCC, MVT::f64, Expand); setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); + setOperationAction(ISD::BRIND, MVT::i32, Expand); setOperationAction(ISD::BR_CC, MVT::i32, Custom); setOperationAction(ISD::BR_CC, MVT::f32, Custom); setOperationAction(ISD::BR_CC, MVT::f64, Custom); ___ 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/ARMISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.75 -> 1.76 --- Log message: expand SIGN_EXTEND_INREG --- Diffs of the changes: (+4 -0) ARMISelDAGToDAG.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.75 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.76 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.75Thu Oct 19 05:56:43 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Oct 19 07:06:50 2006 @@ -59,6 +59,10 @@ setOperationAction(ISD::GlobalAddress, MVT::i32, Custom); setOperationAction(ISD::ConstantPool, MVT::i32, Custom); + setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16, Expand); + setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i8 , Expand); + setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1 , Expand); + setOperationAction(ISD::SELECT, MVT::i32, Expand); setOperationAction(ISD::SETCC, MVT::i32, Expand); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/constants.ll
Changes in directory llvm/test/Regression/CodeGen/ARM: constants.ll updated: 1.1 -> 1.2 --- Log message: print common symbols --- Diffs of the changes: (+4 -1) constants.ll |5 - 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/ARM/constants.ll diff -u llvm/test/Regression/CodeGen/ARM/constants.ll:1.1 llvm/test/Regression/CodeGen/ARM/constants.ll:1.2 --- llvm/test/Regression/CodeGen/ARM/constants.ll:1.1 Thu Sep 21 06:29:52 2006 +++ llvm/test/Regression/CodeGen/ARM/constants.ll Thu Oct 19 08:30:40 2006 @@ -4,7 +4,10 @@ ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #256" | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=arm | grep ".word.*257" | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #-1073741761" | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #1008" | wc -l | grep 1 +; RUN: llvm-as < %s | llc -march=arm | grep "mov r0, #1008" | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=arm | grep "\.comm.*a,4,4" | wc -l | grep 1 + +%a = internal global int 0 uint %f1() { ret uint 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/ARMAsmPrinter.cpp
Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.24 -> 1.25 --- Log message: print common symbols --- Diffs of the changes: (+33 -17) ARMAsmPrinter.cpp | 50 +- 1 files changed, 33 insertions(+), 17 deletions(-) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.24 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.25 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.24 Tue Oct 17 13:04:52 2006 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Thu Oct 19 08:30:40 2006 @@ -278,26 +278,42 @@ unsigned Size = TD->getTypeSize(C->getType()); unsigned Align = TD->getTypeAlignment(C->getType()); -switch (I->getLinkage()) { -default: - assert(0 && "Unknown linkage type!"); - break; -case GlobalValue::ExternalLinkage: - O << "\t.globl " << name << "\n"; - break; -case GlobalValue::InternalLinkage: - break; -} +if (C->isNullValue() && +(I->hasLinkOnceLinkage() || I->hasInternalLinkage() || + I->hasWeakLinkage())) { + SwitchToDataSection(".data", I); + if (I->hasInternalLinkage()) +O << "\t.local " << name << "\n"; + + O << "\t.comm " << name << "," << TD->getTypeSize(C->getType()) +<< "," << (unsigned)TD->getTypeAlignment(C->getType()); + O << "\t\t"; + O << TAI->getCommentString() << " "; + WriteAsOperand(O, I, true, true, &M); + O << "\n"; +} else { + switch (I->getLinkage()) { + default: +assert(0 && "Unknown linkage type!"); +break; + case GlobalValue::ExternalLinkage: +O << "\t.globl " << name << "\n"; +break; + case GlobalValue::InternalLinkage: +break; + } -assert (!C->isNullValue()); -SwitchToDataSection(".data", I); + assert (!C->isNullValue()); + SwitchToDataSection(".data", I); -EmitAlignment(Align, I); -O << "\t.type " << name << ", %object\n"; -O << "\t.size " << name << ", " << Size << "\n"; -O << name << ":\n"; -EmitGlobalConstant(C); + EmitAlignment(Align, I); + O << "\t.type " << name << ", %object\n"; + O << "\t.size " << name << ", " << Size << "\n"; + O << name << ":\n"; + EmitGlobalConstant(C); +} } + AsmPrinter::doFinalization(M); return false; // success } ___ 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/ARMInstrInfo.td
Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.66 -> 1.67 --- Log message: implement extloadi8 and extloadi16 --- Diffs of the changes: (+8 -0) ARMInstrInfo.td |8 1 files changed, 8 insertions(+) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.66 llvm/lib/Target/ARM/ARMInstrInfo.td:1.67 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.66Wed Oct 18 11:21:43 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Thu Oct 19 07:45:04 2006 @@ -160,6 +160,10 @@ "ldrb $dst, [$addr]", [(set IntRegs:$dst, (zextloadi8 IntRegs:$addr))]>; +def LDRB2 : InstARM<(ops IntRegs:$dst, IntRegs:$addr), + "ldrb $dst, [$addr]", + [(set IntRegs:$dst, (extloadi8 IntRegs:$addr))]>; + def LDRSB : InstARM<(ops IntRegs:$dst, IntRegs:$addr), "ldrsb $dst, [$addr]", [(set IntRegs:$dst, (sextloadi8 IntRegs:$addr))]>; @@ -168,6 +172,10 @@ "ldrh $dst, [$addr]", [(set IntRegs:$dst, (zextloadi16 IntRegs:$addr))]>; +def LDRH2 : InstARM<(ops IntRegs:$dst, IntRegs:$addr), + "ldrh $dst, [$addr]", + [(set IntRegs:$dst, (extloadi16 IntRegs:$addr))]>; + def LDRSH : InstARM<(ops IntRegs:$dst, IntRegs:$addr), "ldrsh $dst, [$addr]", [(set IntRegs:$dst, (sextloadi16 IntRegs:$addr))]>; ___ 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/ARMInstrInfo.td
Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.67 -> 1.68 --- Log message: implement undef --- Diffs of the changes: (+8 -0) ARMInstrInfo.td |8 1 files changed, 8 insertions(+) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.67 llvm/lib/Target/ARM/ARMInstrInfo.td:1.68 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.67Thu Oct 19 07:45:04 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Thu Oct 19 08:45:00 2006 @@ -143,6 +143,14 @@ "!ADJCALLSTACKDOWN $amt", [(callseq_start imm:$amt)]>, Imp<[R13],[R13]>; +def IMPLICIT_DEF_Int : InstARM<(ops IntRegs:$dst), + "@IMPLICIT_DEF $dst", + [(set IntRegs:$dst, (undef))]>; +def IMPLICIT_DEF_FP : InstARM<(ops FPRegs:$dst), "@IMPLICIT_DEF $dst", + [(set FPRegs:$dst, (undef))]>; +def IMPLICIT_DEF_DFP : InstARM<(ops DFPRegs:$dst), "@IMPLICIT_DEF $dst", + [(set DFPRegs:$dst, (undef))]>; + let isReturn = 1 in { def bx: InstARM<(ops), "bx r14", [(retflag)]>; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/NewNightlyTest.pl
Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.63 -> 1.64 --- Log message: 80 cols fix. --- Diffs of the changes: (+2 -1) NewNightlyTest.pl |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.63 llvm/utils/NewNightlyTest.pl:1.64 --- llvm/utils/NewNightlyTest.pl:1.63 Fri Sep 29 12:31:45 2006 +++ llvm/utils/NewNightlyTest.plThu Oct 19 10:24:04 2006 @@ -136,7 +136,8 @@ "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "DISABLE-ASSERTIONS=1 ". - "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release-asserts"; next;} + "OPTIMIZE_OPTION=-O2"; + $BUILDTYPE="release-asserts"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } if (/^-disable-llc$/){ $PROGTESTOPTS .= " DISABLE_LLC=1"; $CONFIGUREARGS .= " --disable-llc_diffs"; next; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c sse.stepfft.c
Changes in directory llvm-test/SingleSource/UnitTests/Vector/SSE: sse.expandfft.c updated: 1.3 -> 1.4 sse.stepfft.c updated: 1.2 -> 1.3 --- Log message: Change this program to use the valloc method as _mm_alloc is not present on all platforms. valloc is overkill, but there's only four such allocations in the program so it shouldn't cause scalability problems due to page-size allocations and it will ensure the largest necessary alignment size on any platform.o This helps the test program compile on Linux. --- Diffs of the changes: (+11 -9) sse.expandfft.c | 12 +++- sse.stepfft.c |8 2 files changed, 11 insertions(+), 9 deletions(-) Index: llvm-test/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c diff -u llvm-test/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c:1.3 llvm-test/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c:1.4 --- llvm-test/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c:1.3 Tue Apr 4 13:51:30 2006 +++ llvm-test/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c Thu Oct 19 11:54:12 2006 @@ -5,6 +5,7 @@ #include "xmmintrin.h" #define N 1024 #define N2 N/2 + main() { /* @@ -14,15 +15,16 @@ wpp, SAM. Math. ETHZ 21 May, 2002 */ int first,i,icase,it,n; - float error,fnm1,seed,sign,z0,z1,ggl(); + double error; + float fnm1,seed,sign,z0,z1,ggl(); float *x,*y,*z,*w; float t1,ln2,mflops; void cffti(),cfft2(); /* allocate storage for x,y,z,w on 4-word bndr. */ - x = (float *)_mm_malloc(8*N, 16); - y = (float *)_mm_malloc(8*N, 16); - z = (float *)_mm_malloc(8*N, 16); - w = (float *)_mm_malloc(4*N, 16); + x = (float *)valloc(8*N); + y = (float *)valloc(8*N); + z = (float *)valloc(8*N); + w = (float *)valloc(4*N); first = 1; seed = 331.0; for(icase=0;icase<2;icase++){ Index: llvm-test/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c diff -u llvm-test/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c:1.2 llvm-test/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c:1.3 --- llvm-test/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c:1.2 Tue Apr 4 13:52:26 2006 +++ llvm-test/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c Thu Oct 19 11:54:12 2006 @@ -17,10 +17,10 @@ float t1,ln2,mflops; void cffti(),cfft2(); /* allocate storage for x,y,z,w on 4-word bndr. */ - x = (float *)_mm_malloc(8*N, 16); - y = (float *)_mm_malloc(8*N, 16); - z = (float *)_mm_malloc(8*N, 16); - w = (float *)_mm_malloc(4*N, 16); + x = (float *)valloc(8*N); + y = (float *)valloc(8*N); + z = (float *)valloc(8*N); + w = (float *)valloc(4*N); first = 1; seed = 331.0; for(icase=0;icase<2;icase++){ ___ 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/ARMInstrInfo.td
Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.68 -> 1.69 --- Log message: use Pat to implement extloadi8 and extloadi16 --- Diffs of the changes: (+5 -8) ARMInstrInfo.td | 13 + 1 files changed, 5 insertions(+), 8 deletions(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.68 llvm/lib/Target/ARM/ARMInstrInfo.td:1.69 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.68Thu Oct 19 08:45:00 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Thu Oct 19 12:05:03 2006 @@ -168,10 +168,6 @@ "ldrb $dst, [$addr]", [(set IntRegs:$dst, (zextloadi8 IntRegs:$addr))]>; -def LDRB2 : InstARM<(ops IntRegs:$dst, IntRegs:$addr), - "ldrb $dst, [$addr]", - [(set IntRegs:$dst, (extloadi8 IntRegs:$addr))]>; - def LDRSB : InstARM<(ops IntRegs:$dst, IntRegs:$addr), "ldrsb $dst, [$addr]", [(set IntRegs:$dst, (sextloadi8 IntRegs:$addr))]>; @@ -180,10 +176,6 @@ "ldrh $dst, [$addr]", [(set IntRegs:$dst, (zextloadi16 IntRegs:$addr))]>; -def LDRH2 : InstARM<(ops IntRegs:$dst, IntRegs:$addr), - "ldrh $dst, [$addr]", - [(set IntRegs:$dst, (extloadi16 IntRegs:$addr))]>; - def LDRSH : InstARM<(ops IntRegs:$dst, IntRegs:$addr), "ldrsh $dst, [$addr]", [(set IntRegs:$dst, (sextloadi16 IntRegs:$addr))]>; @@ -342,3 +334,8 @@ def : Pat<(ARMcall texternalsym:$dst), (bl texternalsym:$dst)>; + +def : Pat<(extloadi8 IntRegs:$addr), + (LDRB IntRegs:$addr)>; +def : Pat<(extloadi16 IntRegs:$addr), + (LDRH IntRegs:$addr)>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll 2004-11-27-SetCCForCastLargerAndConstant.ll
Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-10-19-SignedToUnsignedCastAndConst.ll added (r1.1) 2004-11-27-SetCCForCastLargerAndConstant.ll updated: 1.5 -> 1.6 --- Log message: Fix bug in PR454: http://llvm.org/PR454 resolution. Added new test case. This fixes llvmAsmParser.cpp miscompile by llvm on PowerPC Darwin. --- Diffs of the changes: (+8 -24) 2004-11-27-SetCCForCastLargerAndConstant.ll | 24 2006-10-19-SignedToUnsignedCastAndConst.ll |8 2 files changed, 8 insertions(+), 24 deletions(-) Index: llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll:1.1 *** /dev/null Thu Oct 19 13:54:18 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll Thu Oct 19 13:54:08 2006 *** *** 0 --- 1,8 + ; This test case is reduced from llvmAsmParser.cpp + ; The optimizer should not remove the cast here. + ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep 'cast.*int' + bool %test(short %X) { + %A = cast short %X to uint + %B = setgt uint %A, 1330 + ret bool %B + } Index: llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll diff -u llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll:1.5 llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll:1.6 --- llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll:1.5 Sun Apr 24 01:55:40 2005 +++ llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll Thu Oct 19 13:54:08 2006 @@ -31,12 +31,6 @@ ret bool %C } -bool %lt_signed_to_small_unsigned(sbyte %SB) { - %Y = cast sbyte %SB to uint ; [#uses=1] - %C = setlt uint %Y, 17 ; [#uses=1] - ret bool %C -} - bool %lt_signed_to_small_signed(sbyte %SB) { %Y = cast sbyte %SB to int %C = setlt int %Y, 17 @@ -73,12 +67,6 @@ ret bool %C } -bool %lt_unsigned_to_small_signed(ubyte %SB) { - %Y = cast ubyte %SB to int - %C = setlt int %Y, 17 - ret bool %C -} - bool %lt_unsigned_to_small_negative(ubyte %SB) { %Y = cast ubyte %SB to int %C = setlt int %Y, -17 @@ -103,12 +91,6 @@ ret bool %C } -bool %gt_signed_to_small_unsigned(sbyte %SB) { - %Y = cast sbyte %SB to uint ; [#uses=1] - %C = setgt uint %Y, 17 ; [#uses=1] - ret bool %C -} - bool %gt_signed_to_small_signed(sbyte %SB) { %Y = cast sbyte %SB to int %C = setgt int %Y, 17 @@ -145,12 +127,6 @@ ret bool %C } -bool %gt_unsigned_to_small_signed(ubyte %SB) { - %Y = cast ubyte %SB to int - %C = setgt int %Y, 17 - ret bool %C -} - bool %gt_unsigned_to_small_negative(ubyte %SB) { %Y = cast ubyte %SB to int %C = setgt int %Y, -17 ___ 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.520 -> 1.521 --- Log message: Fix bug in PR454: http://llvm.org/PR454 resolution. Added new test case. This fixes llvmAsmParser.cpp miscompile by llvm on PowerPC Darwin. --- Diffs of the changes: (+15 -1) InstructionCombining.cpp | 16 +++- 1 files changed, 15 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.521 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520 Mon Oct 16 18:08:08 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 19 13:54:08 2006 @@ -4785,7 +4785,21 @@ Constant *Res = ConstantExpr::getCast(CI, SrcTy); if (ConstantExpr::getCast(Res, DestTy) == CI) { - RHSCIOp = Res; + // Make sure that src sign and dest sign match. For example, + // + // %A = cast short %X to uint + // %B = setgt uint %A, 1330 + // + // It is incorrect to transformt this into + // + // %B = setgt short %X, 1330 + // + // because %A may have negative value. + // However, it is OK if SrcTy is bool. See cast-set.ll testcase. + if (isSignSrc == isSignDest || SrcTy == Type::BoolTy) +RHSCIOp = Res; + else +return 0; } else { // If the value cannot be represented in the shorter type, we cannot emit // a simple comparison. ___ 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.521 -> 1.522 --- Log message: Typo. --- 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.521 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.522 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.521 Thu Oct 19 13:54:08 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 19 14:05:38 2006 @@ -4790,7 +4790,7 @@ // %A = cast short %X to uint // %B = setgt uint %A, 1330 // - // It is incorrect to transformt this into + // It is incorrect to tranform this into // // %B = setgt short %X, 1330 // ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Instruction.def
Changes in directory llvm/include/llvm: Instruction.def updated: 1.19 -> 1.19.6.1 --- Log message: Replace Div with UDiv and SDiv, renumber accordingly. --- Diffs of the changes: (+38 -37) Instruction.def | 75 1 files changed, 38 insertions(+), 37 deletions(-) Index: llvm/include/llvm/Instruction.def diff -u llvm/include/llvm/Instruction.def:1.19 llvm/include/llvm/Instruction.def:1.19.6.1 --- llvm/include/llvm/Instruction.def:1.19 Fri Apr 7 20:15:18 2006 +++ llvm/include/llvm/Instruction.def Thu Oct 19 14:21:35 2006 @@ -90,55 +90,56 @@ // Standard binary operators... FIRST_BINARY_INST( 7) -HANDLE_BINARY_INST( 7, Add , BinaryOperator) -HANDLE_BINARY_INST( 8, Sub , BinaryOperator) -HANDLE_BINARY_INST( 9, Mul , BinaryOperator) -HANDLE_BINARY_INST(10, Div , BinaryOperator) -HANDLE_BINARY_INST(11, Rem , BinaryOperator) +HANDLE_BINARY_INST( 7, Add , BinaryOperator) +HANDLE_BINARY_INST( 8, Sub , BinaryOperator) +HANDLE_BINARY_INST( 9, Mul , BinaryOperator) +HANDLE_BINARY_INST(10, UDiv , BinaryOperator) +HANDLE_BINARY_INST(11, SDiv , BinaryOperator) +HANDLE_BINARY_INST(12, Rem , BinaryOperator) // Logical operators... -HANDLE_BINARY_INST(12, And , BinaryOperator) -HANDLE_BINARY_INST(13, Or, BinaryOperator) -HANDLE_BINARY_INST(14, Xor , BinaryOperator) +HANDLE_BINARY_INST(13, And , BinaryOperator) +HANDLE_BINARY_INST(14, Or, BinaryOperator) +HANDLE_BINARY_INST(15, Xor , BinaryOperator) // Binary comparison operators... -HANDLE_BINARY_INST(15, SetEQ , SetCondInst) -HANDLE_BINARY_INST(16, SetNE , SetCondInst) -HANDLE_BINARY_INST(17, SetLE , SetCondInst) -HANDLE_BINARY_INST(18, SetGE , SetCondInst) -HANDLE_BINARY_INST(19, SetLT , SetCondInst) -HANDLE_BINARY_INST(20, SetGT , SetCondInst) - LAST_BINARY_INST(20) +HANDLE_BINARY_INST(16, SetEQ , SetCondInst) +HANDLE_BINARY_INST(17, SetNE , SetCondInst) +HANDLE_BINARY_INST(18, SetLE , SetCondInst) +HANDLE_BINARY_INST(19, SetGE , SetCondInst) +HANDLE_BINARY_INST(20, SetLT , SetCondInst) +HANDLE_BINARY_INST(21, SetGT , SetCondInst) + LAST_BINARY_INST(21) // Memory operators... - FIRST_MEMORY_INST(21) -HANDLE_MEMORY_INST(21, Malloc, MallocInst) // Heap management instructions -HANDLE_MEMORY_INST(22, Free , FreeInst ) -HANDLE_MEMORY_INST(23, Alloca, AllocaInst) // Stack management -HANDLE_MEMORY_INST(24, Load , LoadInst ) // Memory manipulation instrs -HANDLE_MEMORY_INST(25, Store , StoreInst ) -HANDLE_MEMORY_INST(26, GetElementPtr, GetElementPtrInst) - LAST_MEMORY_INST(26) + FIRST_MEMORY_INST(22) +HANDLE_MEMORY_INST(22, Malloc, MallocInst) // Heap management instructions +HANDLE_MEMORY_INST(23, Free , FreeInst ) +HANDLE_MEMORY_INST(24, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(25, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(26, Store , StoreInst ) +HANDLE_MEMORY_INST(27, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(27) // Other operators... - FIRST_OTHER_INST(27) -HANDLE_OTHER_INST(27, PHI, PHINode) // PHI node instruction -HANDLE_OTHER_INST(28, Cast , CastInst ) // Type cast -HANDLE_OTHER_INST(29, Call , CallInst ) // Call a function + FIRST_OTHER_INST(28) +HANDLE_OTHER_INST(28, PHI, PHINode) // PHI node instruction +HANDLE_OTHER_INST(29, Cast , CastInst ) // Type cast +HANDLE_OTHER_INST(30, Call , CallInst ) // Call a function -HANDLE_OTHER_INST(30, Shl, ShiftInst ) // Shift operations -HANDLE_OTHER_INST(31, Shr, ShiftInst ) +HANDLE_OTHER_INST(31, Shl, ShiftInst ) // Shift operations +HANDLE_OTHER_INST(32, Shr, ShiftInst ) // 32 -> Empty slot used to be used for vanext in llvm 1.5 and before. // 33 -> Empty slot used to be used for vaarg in llvm 1.5 and before. -HANDLE_OTHER_INST(34, Select , SelectInst ) // select instruction +HANDLE_OTHER_INST(33, Select , SelectInst ) // select instruction -HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass -HANDLE_OTHER_INST(36, UserOp2, Instruction) -HANDLE_OTHER_INST(37, VAArg , VAArgInst ) // vaarg instruction -HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst)// extract from vector. -HANDLE_OTHER_INST(39, InsertElement, InsertElementInst) // insert into vector -HANDLE_OTHER_INST(40, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. - LAST_OTHER_INST(40) +HANDLE_OTHER_INST(34, UserOp1, Instruction) // May be used internally in a pass +HANDLE_OTHER_INST(35, UserOp2, Instruction) +HANDLE_OTHER_INST(36, VAArg , VAArgInst ) // vaarg instruction +HANDLE_OTHER_INST(37, ExtractElement, ExtractElementInst)// extract from vector. +HANDLE_OTHER_INST(38, InsertElement, InsertElementInst) // insert into vector +HANDLE_OTHER_INST(39, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. + LAST_OTHER_INST(39) #undef FIRST_TERM_INST #undef HANDLE_TERM_INST ___ llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y ParserInternals.h
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.78 -> 1.78.2.1 llvmAsmParser.y updated: 1.266.2.1 -> 1.266.2.2 ParserInternals.h updated: 1.45 -> 1.45.2.1 --- Log message: Add support for handling sdiv and udiv instructions while retaining backwards compatibility with the old div instruction. --- Diffs of the changes: (+69 -20) Lexer.l | 16 +-- ParserInternals.h | 16 +++ llvmAsmParser.y | 57 -- 3 files changed, 69 insertions(+), 20 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.78 llvm/lib/AsmParser/Lexer.l:1.78.2.1 --- llvm/lib/AsmParser/Lexer.l:1.78 Tue Oct 17 21:19:55 2006 +++ llvm/lib/AsmParser/Lexer.l Thu Oct 19 14:16:00 2006 @@ -39,8 +39,18 @@ yy_scan_string (str); } +// Construct a token value for a non-obsolete token #define RET_TOK(type, Enum, sym) \ - llvmAsmlval.type = Instruction::Enum; return sym + llvmAsmlval.type.opcode = Instruction::Enum; \ + llvmAsmlval.type.obsolete = false; \ + return sym + +// Construct a token value for an obsolete token +#define RET_TOK_OBSOLETE(type, Enum, sym) \ + llvmAsmlval.type.opcode = Instruction::Enum; \ + llvmAsmlval.type.obsolete = true; \ + return sym + namespace llvm { @@ -247,7 +257,9 @@ add { RET_TOK(BinaryOpVal, Add, ADD); } sub { RET_TOK(BinaryOpVal, Sub, SUB); } mul { RET_TOK(BinaryOpVal, Mul, MUL); } -div { RET_TOK(BinaryOpVal, Div, DIV); } +div { RET_TOK_OBSOLETE(BinaryOpVal, UDiv, UDIV); } +udiv{ RET_TOK(BinaryOpVal, UDiv, UDIV); } +sdiv{ RET_TOK(BinaryOpVal, UDiv, UDIV); } rem { RET_TOK(BinaryOpVal, Rem, REM); } and { RET_TOK(BinaryOpVal, And, AND); } or { RET_TOK(BinaryOpVal, Or , OR ); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.1 llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.2 --- llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.1Wed Oct 18 22:57:55 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Oct 19 14:16:00 2006 @@ -813,6 +813,23 @@ return Ty; } +// This function is +template +static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& Ty) { + if (OI.obsolete) { +switch (OI.opcode) { + default: +GenerateError("Invalid Obsolete OpCode"); +break; + case Instruction::UDiv: +if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; +break; +} +OI.obsolete = false; + } +} + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1004,11 +1021,11 @@ char *StrVal; // This memory is strdup'd! llvm::ValID ValIDVal; // strdup'd memory maybe! - llvm::Instruction::BinaryOpsBinaryOpVal; - llvm::Instruction::TermOps TermOpVal; - llvm::Instruction::MemoryOpsMemOpVal; - llvm::Instruction::OtherOps OtherOpVal; - llvm::Module::EndiannessEndianness; + BinaryOpInfo BinaryOpVal; + TermOpInfoTermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } %type Module FunctionList @@ -1076,8 +1093,8 @@ // Binary Operators %type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories -%token ADD SUB MUL DIV REM AND OR XOR -%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators +%token ADD SUB MUL UDIV SDIV REM AND OR XOR +%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators // Memory Instructions %token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR @@ -1114,7 +1131,7 @@ // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -ArithmeticOps: ADD | SUB | MUL | DIV | REM; +ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | REM ; LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; @@ -1642,12 +1659,14 @@ | ArithmeticOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) GEN_ERROR("Binary operator types must match!"); +sanitizeOpCode($1,$3->getType()); +CHECK_FOR_ERROR; // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the // broken case. See PR424 for more information. if (!isa($3->getType())) { - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -1655,7 +1674,7 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; defaul
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.522 -> 1.523 --- Log message: Typo Typo. --- 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.522 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.523 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.522 Thu Oct 19 14:05:38 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 19 14:21:36 2006 @@ -4790,7 +4790,7 @@ // %A = cast short %X to uint // %B = setgt uint %A, 1330 // - // It is incorrect to tranform this into + // It is incorrect to transform this into // // %B = setgt short %X, 1330 // ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Instructions.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.93.2.1 -> 1.93.2.2 Constants.cpp updated: 1.163.2.1 -> 1.163.2.2 Instruction.cpp updated: 1.53 -> 1.53.2.1 Instructions.cpp updated: 1.42.2.1 -> 1.42.2.2 --- Log message: Make adjustments for DIV -> SDIV UDIV --- Diffs of the changes: (+64 -28) ConstantFolding.cpp | 75 Constants.cpp |9 -- Instruction.cpp |6 ++-- Instructions.cpp|2 - 4 files changed, 64 insertions(+), 28 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.1 llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.2 --- llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.1Wed Oct 18 22:57:56 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Oct 19 14:53:31 2006 @@ -40,7 +40,8 @@ virtual Constant *add(const Constant *V1, const Constant *V2) const = 0; virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0; virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0; -virtual Constant *div(const Constant *V1, const Constant *V2) const = 0; +virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0; +virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0; virtual Constant *rem(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0; @@ -106,8 +107,11 @@ virtual Constant *mul(const Constant *V1, const Constant *V2) const { return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2); } - virtual Constant *div(const Constant *V1, const Constant *V2) const { -return SubClassName::Div((const ArgType *)V1, (const ArgType *)V2); + virtual Constant *udiv(const Constant *V1, const Constant *V2) const { +return SubClassName::UDiv((const ArgType *)V1, (const ArgType *)V2); + } + virtual Constant *sdiv(const Constant *V1, const Constant *V2) const { +return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2); } virtual Constant *rem(const Constant *V1, const Constant *V2) const { return SubClassName::Rem((const ArgType *)V1, (const ArgType *)V2); @@ -178,16 +182,17 @@ // Default "noop" implementations //======// - static Constant *Add(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Sub(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Mul(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Div(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Rem(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *And(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Xor(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shl(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shr(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Rem (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; } static Constant *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } @@ -373,8 +378,11 @@ static Constant *Mul(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getMul); } - static Constant *Div(const ConstantPacked *V1, const ConstantPacked *V2) { -return EvalVectorOp(V1, V2, ConstantExpr::getDiv); + static Constant *UDiv(const ConstantPacked *V1, const ConstantPacked *V2) { +return EvalVectorOp(V1, V2, ConstantExpr::getUDiv); + } + static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) { +return EvalVectorOp(V1, V2, ConstantExpr::getSDiv); } static Constant *Rem(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getRem); @@ -493,8 +501,20 @@ DEF_CAST(Double, ConstantFP , double) #undef DEF_CAST - static Constant *Div(con
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.523 -> 1.524 --- Log message: It is OK to remove extra cast if operation is EQ/NE even though source and destination sign may not match but other conditions are met. --- Diffs of the changes: (+3 -2) InstructionCombining.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.523 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.524 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.523 Thu Oct 19 14:21:36 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 19 15:59:13 2006 @@ -4795,8 +4795,9 @@ // %B = setgt short %X, 1330 // // because %A may have negative value. - // However, it is OK if SrcTy is bool. See cast-set.ll testcase. - if (isSignSrc == isSignDest || SrcTy == Type::BoolTy) + // However, it is OK if SrcTy is bool (See cast-set.ll testcase) + // OR operation is EQ/NE. + if (isSignSrc == isSignDest || SrcTy == Type::BoolTy || SCI.isEquality()) RHSCIOp = Res; else return 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/docs/ProgrammersManual.html Stacker.html
Changes in directory llvm/docs: ProgrammersManual.html updated: 1.94 -> 1.94.2.1 Stacker.html updated: 1.20 -> 1.20.6.1 --- Log message: Adjust documentation for Constant[SU]Int -> ConstantInt. --- Diffs of the changes: (+14 -19) ProgrammersManual.html | 21 - Stacker.html | 12 ++-- 2 files changed, 14 insertions(+), 19 deletions(-) Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.94 llvm/docs/ProgrammersManual.html:1.94.2.1 --- llvm/docs/ProgrammersManual.html:1.94 Wed Oct 11 13:00:22 2006 +++ llvm/docs/ProgrammersManual.htmlThu Oct 19 15:58:53 2006 @@ -2390,8 +2390,8 @@ Constant represents a base class for different types of constants. It -is subclassed by ConstantBool, ConstantInt, ConstantSInt, ConstantUInt, -ConstantArray etc for representing the various types of Constants. +is subclassed by ConstantBool, ConstantInt, ConstantArray etc for representing +the various types of Constants. @@ -2406,17 +2406,12 @@ Important Subclasses of Constant - ConstantSInt : This subclass of Constant represents a signed integer - constant. + ConstantInt : This subclass of Constant represents an integer constant. - int64_t getValue() const: Returns the underlying value of - this constant. - - - ConstantUInt : This class represents an unsigned integer. - - uint64_t getValue() const: Returns the underlying value of - this constant. + int64_t getSExtValue() const: Returns the underlying value of + this constant as a sign extended signed integer value. + uint64_t getZExtValue() const: Returns the underlying value + of this constant as a zero extended unsigned integer value. ConstantFP : This class represents a floating point constant. @@ -2559,7 +2554,7 @@ mailto:[EMAIL PROTECTED]">Dinakar Dhurjati and mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.org";>The LLVM Compiler Infrastructure - Last modified: $Date: 2006/10/11 18:00:22 $ + Last modified: $Date: 2006/10/19 20:58:53 $ Index: llvm/docs/Stacker.html diff -u llvm/docs/Stacker.html:1.20 llvm/docs/Stacker.html:1.20.6.1 --- llvm/docs/Stacker.html:1.20 Mon Mar 13 23:39:39 2006 +++ llvm/docs/Stacker.html Thu Oct 19 15:58:53 2006 @@ -139,7 +139,7 @@ Value* expression(BasicBlock* bb, Value* a, Value* b, Value* x, Value* y ) { -ConstantSInt* one = ConstantSInt::get(Type::IntTy, 1); +ConstantInt* one = ConstantInt::get(Type::IntTy, 1); BinaryOperator* or1 = BinaryOperator::createOr(a, b, "", bb); BinaryOperator* add1 = BinaryOperator::createAdd(x, one, "", bb); BinaryOperator* add2 = BinaryOperator::createAdd(y, one, "", bb); @@ -308,7 +308,7 @@ std::vectorindex_vector; -index_vector.push_back( ConstantSInt::get( Type::LongTy, 0 ); +index_vector.push_back( ConstantInt::get( Type::LongTy, 0 ); // ... push other indices ... GetElementPtrInst* gep = new GetElementPtrInst( ptr, index_vector ); @@ -367,9 +367,9 @@ Constants are Values like anything else and can be operands of instructions Integer constants, frequently needed, can be created using the static "get" - methods of the ConstantInt, ConstantSInt, and ConstantUInt classes. The nice thing - about these is that you can "get" any kind of integer quickly. - There's a special method on Constant class which allows you to get the null + methods of the ConstantInt class. The nice thing about these is that you can + "get" any kind of integer quickly. + There's a special method on Constant class which allows you to get the null constant for any type. This is really handy for initializing large arrays or structures, etc. @@ -1405,7 +1405,7 @@ mailto:[EMAIL PROTECTED]">Reid Spencer http://llvm.org";>LLVM Compiler Infrastructure - Last modified: $Date: 2006/03/14 05:39:39 $ + Last modified: $Date: 2006/10/19 20:58:53 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.18.2.1 -> 1.18.2.2 --- Log message: Remove useless conversions. --- Diffs of the changes: (+2 -2) StackerCompiler.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.1 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.2 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.1 Wed Oct 18 22:57:56 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Thu Oct 19 16:06:26 2006 @@ -721,7 +721,7 @@ // Compare the condition against 0 SetCondInst* cond_inst = new SetCondInst( Instruction::SetNE, cond, -ConstantInt::get( Type::LongTy, uint32_t(0)) ); +ConstantInt::get( Type::LongTy, 0) ); bb->getInstList().push_back( cond_inst ); // Create an exit block @@ -805,7 +805,7 @@ // Compare the condition against 0 SetCondInst* cond_inst = new SetCondInst( -Instruction::SetNE, cond, ConstantInt::get( Type::LongTy, uint32_t(0))); +Instruction::SetNE, cond, ConstantInt::get( Type::LongTy, 0)); test->getInstList().push_back( cond_inst ); // Add the branch instruction ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll
Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-10-19-SignedToUnsignedCastAndConst-2.ll added (r1.1) --- Log message: It is OK to remove extra cast if operation is EQ/NE even though source and destination sign may not match but other conditions are met. --- Diffs of the changes: (+9 -0) 2006-10-19-SignedToUnsignedCastAndConst-2.ll |9 + 1 files changed, 9 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll:1.1 *** /dev/null Thu Oct 19 15:59:23 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll Thu Oct 19 15:59:13 2006 *** *** 0 --- 1,9 + ; The optimizer should be able to remove cast operation here. + ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | not grep 'cast.*int' + + bool %eq_signed_to_small_unsigned(sbyte %SB) { +%Y = cast sbyte %SB to uint ; [#uses=1] +%C = seteq uint %Y, 17 ; [#uses=1] +ret bool %C + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.289 -> 1.290 --- Log message: Partially in response to PR926: http://llvm.org/PR926 : insert the newly created machine basic blocks into the basic block list when lowering the switch inst. into a binary tree of if-then statements. This allows the "visitSwitchCase" func to allow for fall-through behavior. --- Diffs of the changes: (+17 -8) SelectionDAGISel.cpp | 25 + 1 files changed, 17 insertions(+), 8 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.290 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289Mon Oct 16 15:52:31 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Oct 19 16:46:38 2006 @@ -882,6 +882,7 @@ // Figure out which block is immediately after the current one. MachineBasicBlock *NextBlock = 0; MachineFunction::iterator BBI = CurMBB; + if (++BBI != CurMBB->getParent()->end()) NextBlock = BBI; @@ -890,10 +891,12 @@ if (I.getNumOperands() == 2) { // Update machine-CFG edges. MachineBasicBlock *DefaultMBB = FuncInfo.MBBMap[I.getDefaultDest()]; + // If this is not a fall-through branch, emit the branch. if (DefaultMBB != NextBlock) DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(), DAG.getBasicBlock(DefaultMBB))); + CurMBB->addSuccessor(DefaultMBB); return; } @@ -902,10 +905,12 @@ // representing each one, and sort the vector so that we can efficiently // create a binary search tree from them. std::vector Cases; + for (unsigned i = 1; i < I.getNumSuccessors(); ++i) { MachineBasicBlock *SMBB = FuncInfo.MBBMap[I.getSuccessor(i)]; Cases.push_back(Case(I.getSuccessorValue(i), SMBB)); } + std::sort(Cases.begin(), Cases.end(), CaseCmp()); // Get the Value to be switched on and default basic blocks, which will be @@ -956,6 +961,7 @@ SwitchOp = DAG.getNode(ISD::TRUNCATE, TLI.getPointerTy(), SUB); else SwitchOp = DAG.getNode(ISD::ZERO_EXTEND, TLI.getPointerTy(), SUB); + unsigned JumpTableReg = FuncInfo.MakeReg(TLI.getPointerTy()); SDOperand CopyTo = DAG.getCopyToReg(getRoot(), JumpTableReg, SwitchOp); @@ -973,14 +979,14 @@ // the default BB. std::vector DestBBs; uint64_t TEI = First; - for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) { + + for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) if (cast(ii->first)->getRawValue() == TEI) { DestBBs.push_back(ii->second); ++ii; } else { DestBBs.push_back(Default); } - } // Update successor info for (std::vector::iterator I = DestBBs.begin(), @@ -1024,16 +1030,15 @@ MachineBasicBlock *Target = CR.Range.first->second; SelectionDAGISel::CaseBlock CB(ISD::SETEQ, SV, C, Target, Default, CR.CaseBB); + // If the MBB representing the leaf node is the current MBB, then just // call visitSwitchCase to emit the code into the current block. // Otherwise, push the CaseBlock onto the vector to be later processed // by SDISel, and insert the node's MBB before the next MBB. if (CR.CaseBB == CurMBB) visitSwitchCase(CB); - else { + else SwitchCases.push_back(CB); -CurMF->getBasicBlockList().insert(BBI, CR.CaseBB); - } } else { // split case range at pivot CaseItr Pivot = CR.Range.first + (Size / 2); @@ -1041,6 +1046,7 @@ CaseRange RHSR(Pivot, CR.Range.second); Constant *C = Pivot->first; MachineBasicBlock *RHSBB = 0, *LHSBB = 0; + // We know that we branch to the LHS if the Value being switched on is // less than the Pivot value, C. We use this to optimize our binary // tree a bit, by recognizing that if SV is greater than or equal to the @@ -1054,8 +1060,10 @@ LHSBB = LHSR.first->second; } else { LHSBB = new MachineBasicBlock(LLVMBB); +CurMF->getBasicBlockList().insert(BBI, LHSBB); CaseVec.push_back(CaseRec(LHSBB,C,CR.GE,LHSR)); } + // Similar to the optimization above, if the Value being switched on is // known to be less than the Constant CR.LT, and the current Case Value // is CR.LT - 1, then we can branch directly to the target block for @@ -1066,19 +1074,20 @@ RHSBB = RHSR.first->second; } else { RHSBB = new MachineBasicBlock(LLVMBB); +CurMF->getBasicBlockList().insert(BBI, RHSBB); CaseVec.push_back(CaseRec(RHSBB,CR.LT,C,RHSR)); } + // Create a CaseBlock record representing a conditional branch to // the LHS node if the value being switc
[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll
Changes in directory llvm/test/Regression/CodeGen/X86: 2006-10-19-SwitchUnnecessaryBranching.ll added (r1.1) --- Log message: Testcase for P926 --- Diffs of the changes: (+27 -0) 2006-10-19-SwitchUnnecessaryBranching.ll | 27 +++ 1 files changed, 27 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll:1.1 *** /dev/null Thu Oct 19 18:22:09 2006 --- llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll Thu Oct 19 18:21:59 2006 *** *** 0 --- 1,27 + ; RUN: llvm-as < %s | llc -march=x86 | %prcontext "jg LBB1_5" 1 | grep "LBB1_4:" + + %str = internal constant [14 x sbyte] c"Hello world!\0A\00" ; <[14 x sbyte]*> [#uses=1] + %str = internal constant [13 x sbyte] c"Blah world!\0A\00"; <[13 x sbyte]*> [#uses=1] + + implementation ; Functions: + + int %main(int %argc, sbyte** %argv) { + entry: + switch int %argc, label %UnifiedReturnBlock [ +int 1, label %bb +int 2, label %bb2 + ] + + bb: ; preds = %entry + %tmp1 = tail call int (sbyte*, ...)* %printf( sbyte* getelementptr ([14 x sbyte]* %str, int 0, uint 0) ); [#uses=0] + ret int 0 + + bb2: ; preds = %entry + %tmp4 = tail call int (sbyte*, ...)* %printf( sbyte* getelementptr ([13 x sbyte]* %str, int 0, uint 0) ); [#uses=0] + ret int 0 + + UnifiedReturnBlock: ; preds = %entry + ret int 0 + } + + declare int %printf(sbyte*, ...) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.198.2.1 -> 1.198.2.2 --- Log message: Combine two loops that no longer need to be differentiated by type signedness. --- Diffs of the changes: (+3 -6) Reader.cpp |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.1 llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.2 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.1 Wed Oct 18 22:57:55 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 19 18:54:13 2006 @@ -1700,12 +1700,9 @@ read_data(Data, Data+ATy->getNumElements()); std::vector Elements(ATy->getNumElements()); -if (ATy->getElementType() == Type::SByteTy) - for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) -Elements[i] = ConstantInt::get(Type::SByteTy, (signed char)Data[i]); -else - for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) -Elements[i] = ConstantInt::get(Type::UByteTy, (unsigned char)Data[i]); +const Type* ElemType = ATy->getElementType(); +for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) + Elements[i] = ConstantInt::get(ElemType, (unsigned char)Data[i]); // Create the constant, inserting it as needed. Constant *C = ConstantArray::get(ATy, Elements); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Constant.h
Changes in directory llvm/include/llvm: Constant.h updated: 1.31 -> 1.32 --- Log message: add a method to determine whether evaluation of a constant can trap. --- Diffs of the changes: (+4 -0) Constant.h |4 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Constant.h diff -u llvm/include/llvm/Constant.h:1.31 llvm/include/llvm/Constant.h:1.32 --- llvm/include/llvm/Constant.h:1.31 Wed Sep 27 19:37:43 2006 +++ llvm/include/llvm/Constant.hThu Oct 19 19:27:06 2006 @@ -54,6 +54,10 @@ virtual bool isNullValue() const = 0; virtual void print(std::ostream &O) const; + + /// canTrap - Return true if evaluation of this constant could trap. This is + /// true for things like constant expressions that could divide by zero. + bool canTrap() const; // Specialize get/setOperand for Constant's as their operands are always // constants as well. ___ 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.163 -> 1.164 --- Log message: add a method to determine whether evaluation of a constant can trap. --- Diffs of the changes: (+27 -0) Constants.cpp | 27 +++ 1 files changed, 27 insertions(+) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.163 llvm/lib/VMCore/Constants.cpp:1.164 --- llvm/lib/VMCore/Constants.cpp:1.163 Thu Sep 28 18:34:27 2006 +++ llvm/lib/VMCore/Constants.cpp Thu Oct 19 19:27:06 2006 @@ -58,6 +58,33 @@ delete this; } +/// canTrap - Return true if evaluation of this constant could trap. This is +/// true for things like constant expressions that could divide by zero. +bool Constant::canTrap() const { + assert(getType()->isFirstClassType() && "Cannot evaluate aggregate vals!"); + // The only thing that could possibly trap are constant exprs. + const ConstantExpr *CE = dyn_cast(this); + if (!CE) return false; + + // ConstantExpr traps if any operands can trap. + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) +if (getOperand(i)->canTrap()) + return true; + + // Otherwise, only specific operations can trap. + switch (CE->getOpcode()) { + default: +return false; + case Instruction::Div: + case Instruction::Rem: +// Div and rem can trap if the RHS is not known to be non-zero. +if (!isa(getOperand(1)) || getOperand(1)->isNullValue()) + return true; +return false; + } +} + + // Static constructor to create a '0' constant of arbitrary type... Constant *Constant::getNullValue(const Type *Ty) { switch (Ty->getTypeID()) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Instruction.def IntrinsicInst.h
Changes in directory llvm/include/llvm: Instruction.def updated: 1.19.6.1 -> 1.19.6.2 IntrinsicInst.h updated: 1.18 -> 1.18.4.1 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+39 -40) Instruction.def | 75 +++- IntrinsicInst.h |4 +- 2 files changed, 39 insertions(+), 40 deletions(-) Index: llvm/include/llvm/Instruction.def diff -u llvm/include/llvm/Instruction.def:1.19.6.1 llvm/include/llvm/Instruction.def:1.19.6.2 --- llvm/include/llvm/Instruction.def:1.19.6.1 Thu Oct 19 14:21:35 2006 +++ llvm/include/llvm/Instruction.def Thu Oct 19 19:34:43 2006 @@ -90,56 +90,55 @@ // Standard binary operators... FIRST_BINARY_INST( 7) -HANDLE_BINARY_INST( 7, Add , BinaryOperator) -HANDLE_BINARY_INST( 8, Sub , BinaryOperator) -HANDLE_BINARY_INST( 9, Mul , BinaryOperator) -HANDLE_BINARY_INST(10, UDiv , BinaryOperator) -HANDLE_BINARY_INST(11, SDiv , BinaryOperator) -HANDLE_BINARY_INST(12, Rem , BinaryOperator) +HANDLE_BINARY_INST( 7, Add , BinaryOperator) +HANDLE_BINARY_INST( 8, Sub , BinaryOperator) +HANDLE_BINARY_INST( 9, Mul , BinaryOperator) +HANDLE_BINARY_INST(10, Div , BinaryOperator) +HANDLE_BINARY_INST(11, Rem , BinaryOperator) // Logical operators... -HANDLE_BINARY_INST(13, And , BinaryOperator) -HANDLE_BINARY_INST(14, Or, BinaryOperator) -HANDLE_BINARY_INST(15, Xor , BinaryOperator) +HANDLE_BINARY_INST(12, And , BinaryOperator) +HANDLE_BINARY_INST(13, Or, BinaryOperator) +HANDLE_BINARY_INST(14, Xor , BinaryOperator) // Binary comparison operators... -HANDLE_BINARY_INST(16, SetEQ , SetCondInst) -HANDLE_BINARY_INST(17, SetNE , SetCondInst) -HANDLE_BINARY_INST(18, SetLE , SetCondInst) -HANDLE_BINARY_INST(19, SetGE , SetCondInst) -HANDLE_BINARY_INST(20, SetLT , SetCondInst) -HANDLE_BINARY_INST(21, SetGT , SetCondInst) - LAST_BINARY_INST(21) +HANDLE_BINARY_INST(15, SetEQ , SetCondInst) +HANDLE_BINARY_INST(16, SetNE , SetCondInst) +HANDLE_BINARY_INST(17, SetLE , SetCondInst) +HANDLE_BINARY_INST(18, SetGE , SetCondInst) +HANDLE_BINARY_INST(19, SetLT , SetCondInst) +HANDLE_BINARY_INST(20, SetGT , SetCondInst) + LAST_BINARY_INST(20) // Memory operators... - FIRST_MEMORY_INST(22) -HANDLE_MEMORY_INST(22, Malloc, MallocInst) // Heap management instructions -HANDLE_MEMORY_INST(23, Free , FreeInst ) -HANDLE_MEMORY_INST(24, Alloca, AllocaInst) // Stack management -HANDLE_MEMORY_INST(25, Load , LoadInst ) // Memory manipulation instrs -HANDLE_MEMORY_INST(26, Store , StoreInst ) -HANDLE_MEMORY_INST(27, GetElementPtr, GetElementPtrInst) - LAST_MEMORY_INST(27) + FIRST_MEMORY_INST(21) +HANDLE_MEMORY_INST(21, Malloc, MallocInst) // Heap management instructions +HANDLE_MEMORY_INST(22, Free , FreeInst ) +HANDLE_MEMORY_INST(23, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(24, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(25, Store , StoreInst ) +HANDLE_MEMORY_INST(26, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(26) // Other operators... - FIRST_OTHER_INST(28) -HANDLE_OTHER_INST(28, PHI, PHINode) // PHI node instruction -HANDLE_OTHER_INST(29, Cast , CastInst ) // Type cast -HANDLE_OTHER_INST(30, Call , CallInst ) // Call a function + FIRST_OTHER_INST(27) +HANDLE_OTHER_INST(27, PHI, PHINode) // PHI node instruction +HANDLE_OTHER_INST(28, Cast , CastInst ) // Type cast +HANDLE_OTHER_INST(29, Call , CallInst ) // Call a function -HANDLE_OTHER_INST(31, Shl, ShiftInst ) // Shift operations -HANDLE_OTHER_INST(32, Shr, ShiftInst ) +HANDLE_OTHER_INST(30, Shl, ShiftInst ) // Shift operations +HANDLE_OTHER_INST(31, Shr, ShiftInst ) // 32 -> Empty slot used to be used for vanext in llvm 1.5 and before. // 33 -> Empty slot used to be used for vaarg in llvm 1.5 and before. -HANDLE_OTHER_INST(33, Select , SelectInst ) // select instruction +HANDLE_OTHER_INST(34, Select , SelectInst ) // select instruction -HANDLE_OTHER_INST(34, UserOp1, Instruction) // May be used internally in a pass -HANDLE_OTHER_INST(35, UserOp2, Instruction) -HANDLE_OTHER_INST(36, VAArg , VAArgInst ) // vaarg instruction -HANDLE_OTHER_INST(37, ExtractElement, ExtractElementInst)// extract from vector. -HANDLE_OTHER_INST(38, InsertElement, InsertElementInst) // insert into vector -HANDLE_OTHER_INST(39, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. - LAST_OTHER_INST(39) +HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass +HANDLE_OTHER_INST(36, UserOp2, Instruction) +HANDLE_OTHER_INST(37, VAArg , VAAr
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ConstantRange.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp
Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.86.2.1 -> 1.86.2.2 ConstantRange.cpp updated: 1.15.2.1 -> 1.15.2.2 ScalarEvolution.cpp updated: 1.53.2.1 -> 1.53.2.2 ScalarEvolutionExpander.cpp updated: 1.3 -> 1.3.6.1 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+7 -7) BasicAliasAnalysis.cpp |4 ++-- ConstantRange.cpp |2 +- ScalarEvolution.cpp |6 +++--- ScalarEvolutionExpander.cpp |2 +- 4 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86.2.1 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86.2.2 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86.2.1 Wed Oct 18 22:57:55 2006 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppThu Oct 19 19:34:43 2006 @@ -669,7 +669,7 @@ if (const ConstantInt *Op1C = dyn_cast(Op1)) { // If this is an array index, make sure the array element is in range. if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) -if (Op1C->getRawValue() >= AT->getNumElements()) +if (Op1C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } else { @@ -692,7 +692,7 @@ if (const ConstantInt *Op2C = dyn_cast(Op2)) { // If this is an array index, make sure the array element is in range. if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) -if (Op2C->getRawValue() >= AT->getNumElements()) +if (Op2C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } else { // Conservatively assume the minimum value for this index GEP2Ops[i] = Constant::getNullValue(Op2->getType()); Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.15.2.1 llvm/lib/Analysis/ConstantRange.cpp:1.15.2.2 --- llvm/lib/Analysis/ConstantRange.cpp:1.15.2.1Wed Oct 18 22:57:55 2006 +++ llvm/lib/Analysis/ConstantRange.cpp Thu Oct 19 19:34:43 2006 @@ -161,7 +161,7 @@ // Simply subtract the bounds... Constant *Result = ConstantExpr::getSub(Upper, Lower); - return cast(Result)->getRawValue(); + return cast(Result)->getZExtValue(); } /// contains - Return true if the specified value is in the set. Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.1 llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.2 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.1 Wed Oct 18 22:57:55 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Oct 19 19:34:43 2006 @@ -507,7 +507,7 @@ // Handle this case efficiently, it is common to have constant iteration // counts while computing loop exit values. if (SCEVConstant *SC = dyn_cast(V)) { -uint64_t Val = SC->getValue()->getRawValue(); +uint64_t Val = SC->getValue()->getZExtValue(); uint64_t Result = 1; for (; NumSteps; --NumSteps) Result *= Val-(NumSteps-1); @@ -1605,7 +1605,7 @@ const std::vector &Indices) { Constant *Init = GV->getInitializer(); for (unsigned i = 0, e = Indices.size(); i != e; ++i) { -uint64_t Idx = Indices[i]->getRawValue(); +uint64_t Idx = Indices[i]->getZExtValue(); if (ConstantStruct *CS = dyn_cast(Init)) { assert(Idx < CS->getNumOperands() && "Bad struct index!"); Init = cast(CS->getOperand(Idx)); @@ -1935,7 +1935,7 @@ // this is a constant evolving PHI node, get the final value at // the specified iteration number. Constant *RV = getConstantEvolutionLoopExitValue(PN, - ICC->getValue()->getRawValue(), + ICC->getValue()->getZExtValue(), LI); if (RV) return SCEVUnknown::get(RV); } Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3.6.1 --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3 Sat Feb 4 03:51:53 2006 +++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Thu Oct 19 19:34:43 2006 @@ -144,7 +144,7 @@ // IF the step is by one, just return the inserted IV. if (ConstantIntegral *CI = dyn_cast(F)) - if (CI->getRawValue() == 1) + if (CI->getZExtValue() == 1) return I; // If the insert poi
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
Changes in directory llvm/lib/Target/X86: X86IntelAsmPrinter.cpp updated: 1.60 -> 1.60.2.1 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+1 -1) X86IntelAsmPrinter.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.60 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.60.2.1 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.60 Wed Oct 4 22:01:21 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Thu Oct 19 19:34:44 2006 @@ -474,7 +474,7 @@ unsigned len = 0; bool inString = false; for (unsigned i = 0; i < NumElts; i++) { - int n = cast(CVA->getOperand(i))->getRawValue() & 255; + int n = cast(CVA->getOperand(i))->getZExtValue() & 255; if (len == 0) O << "\tdb "; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp GlobalOpt.cpp SimplifyLibCalls.cpp
Changes in directory llvm/lib/Transforms/IPO: ArgumentPromotion.cpp updated: 1.27 -> 1.27.2.1 GlobalOpt.cpp updated: 1.68.2.1 -> 1.68.2.2 SimplifyLibCalls.cpp updated: 1.69.2.1 -> 1.69.2.2 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+32 -33) ArgumentPromotion.cpp |6 +++--- GlobalOpt.cpp | 21 ++--- SimplifyLibCalls.cpp | 38 +++--- 3 files changed, 32 insertions(+), 33 deletions(-) Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.27 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.27.2.1 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.27 Tue Oct 3 02:26:07 2006 +++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Thu Oct 19 19:34:44 2006 @@ -307,8 +307,8 @@ unsigned idx = 0; for (; idx < LHS.size() && idx < RHS.size(); ++idx) { if (LHS[idx] != RHS[idx]) { - return cast(LHS[idx])->getRawValue() < - cast(RHS[idx])->getRawValue(); + return cast(LHS[idx])->getZExtValue() < + cast(RHS[idx])->getZExtValue(); } } @@ -518,7 +518,7 @@ std::string NewName = I->getName(); for (unsigned i = 0, e = Operands.size(); i != e; ++i) if (ConstantInt *CI = dyn_cast(Operands[i])) - NewName += "."+itostr((int64_t)CI->getRawValue()); + NewName += "."+itostr((int64_t)CI->getZExtValue()); else NewName += ".x"; TheArg->setName(NewName+".val"); Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.68.2.1 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.68.2.2 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.68.2.1 Wed Oct 18 22:57:56 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Thu Oct 19 19:34:44 2006 @@ -270,7 +270,7 @@ static Constant *getAggregateConstantElement(Constant *Agg, Constant *Idx) { ConstantInt *CI = dyn_cast(Idx); if (!CI) return 0; - unsigned IdxV = (unsigned)CI->getRawValue(); + unsigned IdxV = CI->getZExtValue(); if (ConstantStruct *CS = dyn_cast(Agg)) { if (IdxV < CS->getNumOperands()) return CS->getOperand(IdxV); @@ -435,8 +435,7 @@ // Ignore the 1th operand, which has to be zero or else the program is quite // broken (undefined). Get the 2nd operand, which is the structure or array // index. -unsigned Val = - (unsigned)cast(GEP->getOperand(2))->getRawValue(); +unsigned Val = cast(GEP->getOperand(2))->getZExtValue(); if (Val >= NewGlobals.size()) Val = 0; // Out of bound array access. Value *NewPtr = NewGlobals[Val]; @@ -673,11 +672,11 @@ DEBUG(std::cerr << "PROMOTING MALLOC GLOBAL: " << *GV << " MALLOC = " <<*MI); ConstantInt *NElements = cast(MI->getArraySize()); - if (NElements->getRawValue() != 1) { + if (NElements->getZExtValue() != 1) { // If we have an array allocation, transform it to a single element // allocation to make the code below simpler. Type *NewTy = ArrayType::get(MI->getAllocatedType(), - (unsigned)NElements->getRawValue()); + NElements->getZExtValue()); MallocInst *NewMI = new MallocInst(NewTy, Constant::getNullValue(Type::UIntTy), MI->getAlignment(), MI->getName(), MI); @@ -1089,7 +1088,7 @@ // Restrict this transformation to only working on small allocations // (2048 bytes currently), as we don't want to introduce a 16M global or // something. -if (NElements->getRawValue()* +if (NElements->getZExtValue()* TD.getTypeSize(MI->getAllocatedType()) < 2048) { GVI = OptimizeGlobalAddressOfMalloc(GV, MI); return true; @@ -1432,7 +1431,7 @@ // Init priority must be standard. ConstantInt *CI = dyn_cast(CS->getOperand(0)); - if (!CI || CI->getRawValue() != 65535) + if (!CI || CI->getZExtValue() != 65535) return 0; } else { return 0; @@ -1577,7 +1576,7 @@ // Replace the element that we are supposed to. ConstantInt *CU = cast(Addr->getOperand(OpNo)); -unsigned Idx = (unsigned)CU->getZExtValue(); +unsigned Idx = CU->getZExtValue(); assert(Idx < STy->getNumElements() && "Struct index out of range!"); Elts[Idx] = EvaluateStoreInto(Elts[Idx], Val, Addr, OpNo+1); @@ -1603,9 +1602,9 @@ " ConstantFoldLoadThroughGEPConstantExpr"); } -
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Utils/Local.cpp LowerAllocations.cpp LowerSwitch.cpp SimplifyCFG.cpp
Changes in directory llvm/lib/Transforms/Utils: Local.cpp updated: 1.58.4.1 -> 1.58.4.2 LowerAllocations.cpp updated: 1.61.2.1 -> 1.61.2.2 LowerSwitch.cpp updated: 1.24.2.1 -> 1.24.2.2 SimplifyCFG.cpp updated: 1.99 -> 1.99.2.1 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+7 -7) Local.cpp|8 LowerAllocations.cpp |2 +- LowerSwitch.cpp |2 +- SimplifyCFG.cpp |2 +- 4 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/Transforms/Utils/Local.cpp diff -u llvm/lib/Transforms/Utils/Local.cpp:1.58.4.1 llvm/lib/Transforms/Utils/Local.cpp:1.58.4.2 --- llvm/lib/Transforms/Utils/Local.cpp:1.58.4.1Wed Oct 18 22:57:56 2006 +++ llvm/lib/Transforms/Utils/Local.cpp Thu Oct 19 19:34:44 2006 @@ -287,10 +287,10 @@ } } else if (ConstantInt *CI = dyn_cast(I.getOperand())) { if (const ArrayType *ATy = dyn_cast(*I)) { -if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) +if (CI->getZExtValue() >= ATy->getNumElements()) return 0; if (ConstantArray *CA = dyn_cast(C)) - C = CA->getOperand((unsigned)CI->getRawValue()); + C = CA->getOperand(CI->getZExtValue()); else if (isa(C)) C = Constant::getNullValue(ATy->getElementType()); else if (isa(C)) @@ -298,10 +298,10 @@ else return 0; } else if (const PackedType *PTy = dyn_cast(*I)) { -if ((uint64_t)CI->getRawValue() >= PTy->getNumElements()) +if (CI->getZExtValue() >= PTy->getNumElements()) return 0; if (ConstantPacked *CP = dyn_cast(C)) - C = CP->getOperand((unsigned)CI->getRawValue()); + C = CP->getOperand(CI->getZExtValue()); else if (isa(C)) C = Constant::getNullValue(PTy->getElementType()); else if (isa(C)) Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.61.2.1 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.61.2.2 --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.61.2.1 Wed Oct 18 22:57:56 2006 +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Thu Oct 19 19:34:44 2006 @@ -126,7 +126,7 @@ if (MI->isArrayAllocation()) { if (isa(MallocArg) && -cast(MallocArg)->getRawValue() == 1) { +cast(MallocArg)->getZExtValue() == 1) { MallocArg = MI->getOperand(0); // Operand * 1 = Operand } else if (Constant *CO = dyn_cast(MI->getOperand(0))) { CO = ConstantExpr::getCast(CO, IntPtrTy); Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.24.2.1 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.24.2.2 --- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.24.2.1 Wed Oct 18 22:57:56 2006 +++ llvm/lib/Transforms/Utils/LowerSwitch.cpp Thu Oct 19 19:34:44 2006 @@ -130,7 +130,7 @@ Case& Pivot = *(Begin + Mid); DEBUG(std::cerr << "Pivot ==> " - << (int64_t)cast(Pivot.first)->getRawValue() + << cast(Pivot.first)->getSExtValue() << "\n"); BasicBlock* LBranch = switchConvert(LHS.begin(), LHS.end(), Val, Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99.2.1 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99 Thu Aug 3 16:40:24 2006 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Thu Oct 19 19:34:44 2006 @@ -1153,7 +1153,7 @@ /// applications that sort ConstantInt's to ensure uniqueness. struct ConstantIntOrdering { bool operator()(const ConstantInt *LHS, const ConstantInt *RHS) const { - return LHS->getRawValue() < RHS->getRawValue(); + return LHS->getZExtValue() < RHS->getZExtValue(); } }; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/AsmPrinter.cpp IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.111.2.1 -> 1.111.2.2 IntrinsicLowering.cpp updated: 1.43.6.1 -> 1.43.6.2 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+13 -21) AsmPrinter.cpp|6 +++--- IntrinsicLowering.cpp | 28 ++-- 2 files changed, 13 insertions(+), 21 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.111.2.1 llvm/lib/CodeGen/AsmPrinter.cpp:1.111.2.2 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.111.2.1 Wed Oct 18 22:57:55 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Thu Oct 19 19:34:43 2006 @@ -493,7 +493,7 @@ O << "\""; for (unsigned i = 0; i != LastElt; ++i) { unsigned char C = -(unsigned char)cast(CVA->getOperand(i))->getRawValue(); +(unsigned char)cast(CVA->getOperand(i))->getZExtValue(); if (C == '"') { O << "\\\""; @@ -525,7 +525,7 @@ void AsmPrinter::EmitString(const ConstantArray *CVA) const { unsigned NumElts = CVA->getNumOperands(); if (TAI->getAscizDirective() && NumElts && - cast(CVA->getOperand(NumElts-1))->getRawValue() == 0) { + cast(CVA->getOperand(NumElts-1))->getZExtValue() == 0) { O << TAI->getAscizDirective(); printAsCString(O, CVA, NumElts-1); } else { @@ -605,7 +605,7 @@ } } else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) { if (const ConstantInt *CI = dyn_cast(CV)) { - uint64_t Val = CI->getRawValue(); + uint64_t Val = CI->getZExtValue(); if (TAI->getData64bitsDirective()) O << TAI->getData64bitsDirective() << Val << "\n"; Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.43.6.1 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.43.6.2 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.43.6.1 Wed Oct 18 22:57:55 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Oct 19 19:34:43 2006 @@ -166,12 +166,10 @@ Value *Tmp1 = new ShiftInst(Instruction::Shr, V, ConstantInt::get(Type::UByteTy,24),"bswap.1", IP); Tmp3 = BinaryOperator::createAnd(Tmp3, - ConstantInt::get(Type::UIntTy, - uint32_t(0xFF)), + ConstantInt::get(Type::UIntTy, 0xFF), "bswap.and3", IP); Tmp2 = BinaryOperator::createAnd(Tmp2, - ConstantInt::get(Type::UIntTy, - uint32_t(0xFF00)), + ConstantInt::get(Type::UIntTy, 0xFF00), "bswap.and2", IP); Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or1", IP); Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or2", IP); @@ -197,27 +195,22 @@ ConstantInt::get(Type::UByteTy,56),"bswap.1", IP); Tmp7 = BinaryOperator::createAnd(Tmp7, ConstantInt::get(Type::ULongTy, - uint64_t(0xFFULL)), + 0xFFULL), "bswap.and7", IP); Tmp6 = BinaryOperator::createAnd(Tmp6, - ConstantInt::get(Type::ULongTy, - uint64_t(0xFF00ULL)), + ConstantInt::get(Type::ULongTy, 0xFF00ULL), "bswap.and6", IP); Tmp5 = BinaryOperator::createAnd(Tmp5, - ConstantInt::get(Type::ULongTy, - uint64_t(0xFFULL)), + ConstantInt::get(Type::ULongTy, 0xFFULL), "bswap.and5", IP); Tmp4 = BinaryOperator::createAnd(Tmp4, - ConstantInt::get(Type::ULongTy, - uint64_t(0xFF00ULL)), + ConstantInt::get(Type::ULongTy, 0xFF00ULL), "bswap.and4", IP); Tmp3 = BinaryOperator::createAnd(Tmp3, - ConstantInt::get(Type::ULongTy, - uint64_t(0xFFULL)), + ConstantInt::get(Type::ULongTy, 0xFFULL), "bswap.and3", IP); Tmp2 = BinaryOperator::createAnd(Tmp2, - ConstantInt::get(Type::ULongTy, - uint64_t(0xFF00ULL)), + Constant
[llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Instructions.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.93.2.2 -> 1.93.2.3 Constants.cpp updated: 1.163.2.2 -> 1.163.2.3 Instruction.cpp updated: 1.53.2.1 -> 1.53.2.2 Instructions.cpp updated: 1.42.2.2 -> 1.42.2.3 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+72 -138) ConstantFolding.cpp | 123 +++- Constants.cpp | 79 + Instruction.cpp |6 -- Instructions.cpp|2 4 files changed, 72 insertions(+), 138 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.2 llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.3 --- llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.2Thu Oct 19 14:53:31 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Oct 19 19:34:44 2006 @@ -40,8 +40,7 @@ virtual Constant *add(const Constant *V1, const Constant *V2) const = 0; virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0; virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0; -virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0; -virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0; +virtual Constant *div(const Constant *V1, const Constant *V2) const = 0; virtual Constant *rem(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0; @@ -107,11 +106,8 @@ virtual Constant *mul(const Constant *V1, const Constant *V2) const { return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2); } - virtual Constant *udiv(const Constant *V1, const Constant *V2) const { -return SubClassName::UDiv((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *sdiv(const Constant *V1, const Constant *V2) const { -return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2); + virtual Constant *div(const Constant *V1, const Constant *V2) const { +return SubClassName::Div((const ArgType *)V1, (const ArgType *)V2); } virtual Constant *rem(const Constant *V1, const Constant *V2) const { return SubClassName::Rem((const ArgType *)V1, (const ArgType *)V2); @@ -182,17 +178,16 @@ // Default "noop" implementations //======// - static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Rem (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Add(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Sub(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Mul(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Div(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Rem(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *And(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Xor(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shl(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shr(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } @@ -378,11 +373,8 @@ static Constant *Mul(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getMul); } - static Constant *UDiv(const ConstantPacked *V1, const ConstantPacked *V2) { -return EvalVectorOp(V1, V2, ConstantExpr::getUDiv); - } - static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) { -return EvalVectorOp(V1, V2, ConstantExpr::getSDi
[llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.289.2.1 -> 1.289.2.2 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+11 -11) SelectionDAGISel.cpp | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.1 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.2 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.1Wed Oct 18 22:57:55 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Oct 19 19:34:43 2006 @@ -641,7 +641,7 @@ return N = DAG.getNode(ISD::VBUILD_VECTOR,MVT::Vector,&Ops[0],Ops.size()); } else { // Canonicalize all constant ints to be unsigned. - return N = DAG.getConstant(cast(C)->getRawValue(),VT); + return N = DAG.getConstant(cast(C)->getZExtValue(),VT); } } @@ -929,8 +929,8 @@ // lowering the switch to a binary tree of conditional branches. if (TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) && Cases.size() > 5) { -uint64_t First = cast(Cases.front().first)->getRawValue(); -uint64_t Last = cast(Cases.back().first)->getRawValue(); +uint64_t First =cast(Cases.front().first)->getZExtValue(); +uint64_t Last = cast(Cases.back().first)->getZExtValue(); double Density = (double)Cases.size() / (double)((Last - First) + 1ULL); if (Density >= 0.3125) { @@ -978,7 +978,7 @@ std::vector DestBBs; uint64_t TEI = First; for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) { -if (cast(ii->first)->getRawValue() == TEI) { +if (cast(ii->first)->getZExtValue() == TEI) { DestBBs.push_back(ii->second); ++ii; } else { @@ -1053,8 +1053,8 @@ // rather than creating a leaf node for it. if ((LHSR.second - LHSR.first) == 1 && LHSR.first->first == CR.GE && - cast(C)->getRawValue() == - (cast(CR.GE)->getRawValue() + 1ULL)) { + cast(C)->getZExtValue() == + (cast(CR.GE)->getZExtValue() + 1ULL)) { LHSBB = LHSR.first->second; } else { LHSBB = new MachineBasicBlock(LLVMBB); @@ -1065,8 +1065,8 @@ // is CR.LT - 1, then we can branch directly to the target block for // the current Case Value, rather than emitting a RHS leaf node for it. if ((RHSR.second - RHSR.first) == 1 && CR.LT && - cast(RHSR.first->first)->getRawValue() == - (cast(CR.LT)->getRawValue() - 1ULL)) { + cast(RHSR.first->first)->getZExtValue() == + (cast(CR.LT)->getZExtValue() - 1ULL)) { RHSBB = RHSR.first->second; } else { RHSBB = new MachineBasicBlock(LLVMBB); @@ -1267,7 +1267,7 @@ // If this is a constant subscript, handle it quickly. if (ConstantInt *CI = dyn_cast(Idx)) { -if (CI->getRawValue() == 0) continue; +if (CI->getZExtValue() == 0) continue; uint64_t Offs; if (CI->getType()->isSigned()) Offs = (int64_t) @@ -3122,7 +3122,7 @@ for (GetElementPtrInst::op_iterator OI = GEPI->op_begin()+1, E = GEPI->op_end(); OI != E; ++OI) { if (ConstantInt *CI = dyn_cast(*OI)) { - if (CI->getRawValue()) { + if (CI->getZExtValue()) { hasConstantIndex = true; break; } @@ -3164,7 +3164,7 @@ // Handle constant subscripts. if (ConstantInt *CI = dyn_cast(Idx)) { -if (CI->getRawValue() == 0) continue; +if (CI->getZExtValue() == 0) continue; if (CI->getType()->isSigned()) ConstantOffset += (int64_t)TD->getTypeSize(Ty)*CI->getSExtValue(); else ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/CBackend/Writer.cpp
Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.272.2.1 -> 1.272.2.2 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+1 -1) Writer.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.272.2.1 llvm/lib/Target/CBackend/Writer.cpp:1.272.2.2 --- llvm/lib/Target/CBackend/Writer.cpp:1.272.2.1 Wed Oct 18 22:57:56 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Thu Oct 19 19:34:44 2006 @@ -460,7 +460,7 @@ // Do not include the last character, which we know is null for (unsigned i = 0, e = CPA->getNumOperands()-1; i != e; ++i) { - unsigned char C = cast(CPA->getOperand(i))->getRawValue(); + unsigned char C = cast(CPA->getOperand(i))->getZExtValue(); // Print it out literally if it is a printable character. The only thing // to be careful about is when the last letter output was a hex escape ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/TargetData.cpp
Changes in directory llvm/lib/Target: TargetData.cpp updated: 1.70.4.1 -> 1.70.4.2 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+1 -1) TargetData.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/TargetData.cpp diff -u llvm/lib/Target/TargetData.cpp:1.70.4.1 llvm/lib/Target/TargetData.cpp:1.70.4.2 --- llvm/lib/Target/TargetData.cpp:1.70.4.1 Wed Oct 18 22:57:56 2006 +++ llvm/lib/Target/TargetData.cpp Thu Oct 19 19:34:43 2006 @@ -346,7 +346,7 @@ Ty = cast(Ty)->getElementType(); // Get the array index and the size of each array element. - int64_t arrayIdx = cast(Idx[CurIDX])->getRawValue(); + int64_t arrayIdx = cast(Idx[CurIDX])->getZExtValue(); Result += arrayIdx * (int64_t)getTypeSize(Ty); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/TransformInternals.h
Changes in directory llvm/lib/Transforms: TransformInternals.h updated: 1.27 -> 1.27.10.1 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+1 -1) TransformInternals.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/TransformInternals.h diff -u llvm/lib/Transforms/TransformInternals.h:1.27 llvm/lib/Transforms/TransformInternals.h:1.27.10.1 --- llvm/lib/Transforms/TransformInternals.h:1.27 Tue Jul 26 11:38:28 2005 +++ llvm/lib/Transforms/TransformInternals.hThu Oct 19 19:34:44 2006 @@ -25,7 +25,7 @@ namespace llvm { static inline int64_t getConstantValue(const ConstantInt *CPI) { - return (int64_t)cast(CPI)->getRawValue(); + return (int64_t)cast(CPI)->getZExtValue(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll
Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: 2006-10-19-UncondDiv.ll added (r1.1) --- Log message: new testcase for PR957: http://llvm.org/PR957 --- Diffs of the changes: (+35 -0) 2006-10-19-UncondDiv.ll | 35 +++ 1 files changed, 35 insertions(+) Index: llvm/test/Regression/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll diff -c /dev/null llvm/test/Regression/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll:1.1 *** /dev/null Thu Oct 19 19:41:41 2006 --- llvm/test/Regression/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll Thu Oct 19 19:41:31 2006 *** *** 0 --- 1,35 + ; RUN: llvm-as < %s | opt -simplifycfg -disable-output && + ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep select + + ; PR957 + + uint %test(uint %tmp) { + cond_false179: ; preds = %cond_true + %tmp181 = seteq uint %tmp, 0; [#uses=1] + br bool %tmp181, label %cond_true182, label %cond_next185 + + cond_true182: ; preds = %cond_false179 + br label %cond_next185 + + cond_next185: ; preds = %cond_true182, %cond_false179 + %d0.3 = phi uint [ div (uint 1, uint 0), %cond_true182 ], [ %tmp, + %cond_false179 ]; [#uses=7] + + ret uint %d0.3 + } + + uint %test2(uint %tmp) { + cond_false179: ; preds = %cond_true + %tmp181 = seteq uint %tmp, 0; [#uses=1] + br bool %tmp181, label %cond_true182, label %cond_next185 + + cond_true182: ; preds = %cond_false179 + br label %cond_next185 + + cond_next185: ; preds = %cond_true182, %cond_false179 + %d0.3 = phi uint [ div (uint 1, uint 0), %cond_true182 ], [ %tmp, + %cond_false179 ]; [#uses=7] + call uint %test(uint 4) + ret uint %d0.3 + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.99 -> 1.100 --- Log message: Fix SimplifyCFG/2006-10-19-UncondDiv.ll by disabling a bad xform. --- Diffs of the changes: (+39 -22) SimplifyCFG.cpp | 61 +++- 1 files changed, 39 insertions(+), 22 deletions(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.100 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99 Thu Aug 3 16:40:24 2006 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Thu Oct 19 19:42:07 2006 @@ -323,7 +323,14 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB, std::set *AggressiveInsts) { Instruction *I = dyn_cast(V); - if (!I) return true;// Non-instructions all dominate instructions. + if (!I) { +// Non-instructions all dominate instructions, but not all constantexprs +// can be executed unconditionally. +if (ConstantExpr *C = dyn_cast(V)) + if (C->canTrap()) +return false; +return true; + } BasicBlock *PBB = I->getParent(); // We don't want to allow weird loops that might have the "if condition" in @@ -1297,28 +1304,38 @@ if (FVPN->getParent() == FalseSucc) FalseValue = FVPN->getIncomingValueForBlock(BI->getParent()); -TrueSucc->removePredecessor(BI->getParent()); -FalseSucc->removePredecessor(BI->getParent()); +// In order for this transformation to be safe, we must be able to +// unconditionally execute both operands to the return. This is +// normally the case, but we could have a potentially-trapping +// constant expression that prevents this transformation from being +// safe. +if ((!isa(TrueValue) || + !cast(TrueValue)->canTrap()) && +(!isa(TrueValue) || + !cast(TrueValue)->canTrap())) { + TrueSucc->removePredecessor(BI->getParent()); + FalseSucc->removePredecessor(BI->getParent()); -// Insert a new select instruction. -Value *NewRetVal; -Value *BrCond = BI->getCondition(); -if (TrueValue != FalseValue) - NewRetVal = new SelectInst(BrCond, TrueValue, - FalseValue, "retval", BI); -else - NewRetVal = TrueValue; - -DEBUG(std::cerr << "\nCHANGING BRANCH TO TWO RETURNS INTO SELECT:" - << "\n " << *BI << "Select = " << *NewRetVal - << "TRUEBLOCK: " << *TrueSucc << "FALSEBLOCK: "<< *FalseSucc); - -new ReturnInst(NewRetVal, BI); -BI->eraseFromParent(); -if (Instruction *BrCondI = dyn_cast(BrCond)) - if (isInstructionTriviallyDead(BrCondI)) -BrCondI->eraseFromParent(); -return true; + // Insert a new select instruction. + Value *NewRetVal; + Value *BrCond = BI->getCondition(); + if (TrueValue != FalseValue) +NewRetVal = new SelectInst(BrCond, TrueValue, + FalseValue, "retval", BI); + else +NewRetVal = TrueValue; + + DEBUG(std::cerr << "\nCHANGING BRANCH TO TWO RETURNS INTO SELECT:" +<< "\n " << *BI << "Select = " << *NewRetVal +<< "TRUEBLOCK: " << *TrueSucc << "FALSEBLOCK: "<< *FalseSucc); + + new ReturnInst(NewRetVal, BI); + BI->eraseFromParent(); + if (Instruction *BrCondI = dyn_cast(BrCond)) +if (isInstructionTriviallyDead(BrCondI)) + BrCondI->eraseFromParent(); + return true; +} } } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp LoopStrengthReduce.cpp LoopUnroll.cpp Reassociate.cpp ScalarReplAggregates.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.520.2.1 -> 1.520.2.2 LoopStrengthReduce.cpp updated: 1.89.2.1 -> 1.89.2.2 LoopUnroll.cpp updated: 1.28 -> 1.28.2.1 Reassociate.cpp updated: 1.62 -> 1.62.2.1 ScalarReplAggregates.cpp updated: 1.44.2.1 -> 1.44.2.2 --- Log message: Make some simplifications for ConstantInt: 1. Get rid of getRawValue, replace with getZExtValue 2. Single constructor (uint64_t) and get method (int64_t) 3. Canonicalize the constant to a zero extended unsigned 64-bit integer when it is created. 4. Adjust getZExtValue() to be a do-nothing (just returns the already canonicalized value). 5. Compensate for above changes everywhere else. --- Diffs of the changes: (+50 -50) InstructionCombining.cpp | 78 +++ LoopStrengthReduce.cpp |2 - LoopUnroll.cpp |4 +- Reassociate.cpp |2 - ScalarReplAggregates.cpp | 14 5 files changed, 50 insertions(+), 50 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.1 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.2 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.1 Wed Oct 18 22:57:56 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 19 19:34:44 2006 @@ -1798,14 +1798,14 @@ if (Anded == CRHS) { // See if all bits from the first bit set in the Add RHS up are included // in the mask. First, get the rightmost bit. -uint64_t AddRHSV = CRHS->getRawValue(); +uint64_t AddRHSV = CRHS->getZExtValue(); // Form a mask of all bits from the lowest bit added through the top. uint64_t AddRHSHighBits = ~((AddRHSV & -AddRHSV)-1); AddRHSHighBits &= C2->getType()->getIntegralTypeMask(); // See if the and mask includes all of these bits. -uint64_t AddRHSHighBitsAnd = AddRHSHighBits & C2->getRawValue(); +uint64_t AddRHSHighBitsAnd = AddRHSHighBits & C2->getZExtValue(); if (AddRHSHighBits == AddRHSHighBitsAnd) { // Okay, the xform is safe. Insert the new add pronto. @@ -1848,7 +1848,7 @@ // highest order bit set. static bool isSignBit(ConstantInt *CI) { unsigned NumBits = CI->getType()->getPrimitiveSizeInBits(); - return (CI->getRawValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1)); + return (CI->getZExtValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1)); } /// RemoveNoopCast - Strip off nonconverting casts from the value. @@ -2064,7 +2064,7 @@ if (CI->isAllOnesValue()) // X * -1 == 0 - X return BinaryOperator::createNeg(Op0, I.getName()); - int64_t Val = (int64_t)cast(CI)->getRawValue(); + int64_t Val = (int64_t)cast(CI)->getZExtValue(); if (isPowerOf2_64(Val)) { // Replace X*(2^C) with X << C uint64_t C = Log2_64(Val); return new ShiftInst(Instruction::Shl, Op0, @@ -2290,7 +2290,7 @@ if (RHSI->getOpcode() == Instruction::Shl && isa(RHSI->getOperand(0)) && RHSI->getOperand(0)->getType()->isUnsigned()) { -uint64_t C1 = cast(RHSI->getOperand(0))->getRawValue(); +uint64_t C1 = cast(RHSI->getOperand(0))->getZExtValue(); if (isPowerOf2_64(C1)) { uint64_t C2 = Log2_64(C1); Value *Add = RHSI->getOperand(1); @@ -2515,17 +2515,17 @@ // isOneBitSet - Return true if there is exactly one bit set in the specified // constant. static bool isOneBitSet(const ConstantInt *CI) { - uint64_t V = CI->getRawValue(); + uint64_t V = CI->getZExtValue(); return V && (V & (V-1)) == 0; } #if 0 // Currently unused // isLowOnes - Return true if the constant is of the form 0+1+. static bool isLowOnes(const ConstantInt *CI) { - uint64_t V = CI->getRawValue(); + uint64_t V = CI->getZExtValue(); // There won't be bits set in parts that the type doesn't contain. - V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue(); + V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue(); uint64_t U = V+1; // If it is low ones, this should be a power of two. return U && V && (U & V) == 0; @@ -2535,11 +2535,11 @@ // 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->getRawValue(); + uint64_t V = ~CI->getZExtValue(); if (~V == 0) return false; // 0's does not match "1+" // There won't be bits set in parts that the type doesn't contain. - V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue(); + V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue(); uint64_t U = V+1; // If it is low ones, this should be a power of two. return U && V && (U & V) == 0; @@ -2664,7 +2664,7 @@ // Adding a one to a single bit bit-field should be turned int
[llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.289.2.2 -> 1.289.2.3 --- Log message: Remove an un-needed test. --- Diffs of the changes: (+20 -21) SelectionDAGISel.cpp | 41 - 1 files changed, 20 insertions(+), 21 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.2 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.3 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.2Thu Oct 19 19:34:43 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Oct 19 19:43:17 2006 @@ -236,27 +236,26 @@ Function::iterator BB = Fn.begin(), EB = Fn.end(); for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (AllocaInst *AI = dyn_cast(I)) - if (ConstantInt *CUI = dyn_cast(AI->getArraySize())) -if (CUI->getType()->isUnsigned()) { - const Type *Ty = AI->getAllocatedType(); - uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); - unsigned Align = -std::max((unsigned)TLI.getTargetData()->getTypeAlignment(Ty), - AI->getAlignment()); - - // If the alignment of the value is smaller than the size of the - // value, and if the size of the value is particularly small - // (<= 8 bytes), round up to the size of the value for potentially - // better performance. - // - // FIXME: This could be made better with a preferred alignment hook in - // TargetData. It serves primarily to 8-byte align doubles for X86. - if (Align < TySize && TySize <= 8) Align = TySize; - TySize *= CUI->getZExtValue(); // Get total allocated size. - if (TySize == 0) TySize = 1; // Don't create zero-sized stack objects. - StaticAllocaMap[AI] = -MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align); -} + if (ConstantInt *CUI = dyn_cast(AI->getArraySize())) { +const Type *Ty = AI->getAllocatedType(); +uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); +unsigned Align = + std::max((unsigned)TLI.getTargetData()->getTypeAlignment(Ty), + AI->getAlignment()); + +// If the alignment of the value is smaller than the size of the +// value, and if the size of the value is particularly small +// (<= 8 bytes), round up to the size of the value for potentially +// better performance. +// +// FIXME: This could be made better with a preferred alignment hook in +// TargetData. It serves primarily to 8-byte align doubles for X86. +if (Align < TySize && TySize <= 8) Align = TySize; +TySize *= CUI->getZExtValue(); // Get total allocated size. +if (TySize == 0) TySize = 1; // Don't create zero-sized stack objects. +StaticAllocaMap[AI] = + MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align); + } for (; BB != EB; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) ___ 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.524 -> 1.525 --- Log message: While creating mask, use 1ULL instead of 1. --- 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.524 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.525 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.524 Thu Oct 19 15:59:13 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 19 20:16:56 2006 @@ -5595,7 +5595,7 @@ unsigned SrcBitSize = Src->getType()->getPrimitiveSizeInBits(); unsigned DestBitSize = CI.getType()->getPrimitiveSizeInBits(); assert(SrcBitSize < DestBitSize && "Not a zext?"); -Constant *C = ConstantUInt::get(Type::ULongTy, (1 << SrcBitSize)-1); +Constant *C = ConstantUInt::get(Type::ULongTy, (1ULL << SrcBitSize)-1); C = ConstantExpr::getCast(C, CI.getType()); return BinaryOperator::createAnd(Res, C); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.74.2.1 -> 1.74.2.2 --- Log message: Get rid of useless call. --- Diffs of the changes: (+1 -2) ARMISelDAGToDAG.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.74.2.1 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.74.2.2 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.74.2.1Wed Oct 18 22:57:56 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Oct 19 20:17:20 2006 @@ -805,8 +805,7 @@ case ISD::Constant: { uint32_t val = cast(N)->getValue(); if(!isRotInt8Immediate(val)) { - const Type *t = MVT::getTypeForValueType(MVT::i32); - Constant*C = ConstantInt::get(t, val); + Constant*C = ConstantInt::get(Type::UIntTy, val); int alignment = 2; SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment); SDOperandZ = CurDAG->getTargetConstant(0, MVT::i32); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Instructions.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.93.2.3 -> 1.93.2.4 Constants.cpp updated: 1.163.2.3 -> 1.163.2.4 Instruction.cpp updated: 1.53.2.2 -> 1.53.2.3 Instructions.cpp updated: 1.42.2.3 -> 1.42.2.4 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+64 -28) ConstantFolding.cpp | 75 Constants.cpp |9 -- Instruction.cpp |6 ++-- Instructions.cpp|2 - 4 files changed, 64 insertions(+), 28 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.3 llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.4 --- llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.3Thu Oct 19 19:34:44 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Oct 19 23:27:18 2006 @@ -40,7 +40,8 @@ virtual Constant *add(const Constant *V1, const Constant *V2) const = 0; virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0; virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0; -virtual Constant *div(const Constant *V1, const Constant *V2) const = 0; +virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0; +virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0; virtual Constant *rem(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0; @@ -106,8 +107,11 @@ virtual Constant *mul(const Constant *V1, const Constant *V2) const { return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2); } - virtual Constant *div(const Constant *V1, const Constant *V2) const { -return SubClassName::Div((const ArgType *)V1, (const ArgType *)V2); + virtual Constant *udiv(const Constant *V1, const Constant *V2) const { +return SubClassName::UDiv((const ArgType *)V1, (const ArgType *)V2); + } + virtual Constant *sdiv(const Constant *V1, const Constant *V2) const { +return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2); } virtual Constant *rem(const Constant *V1, const Constant *V2) const { return SubClassName::Rem((const ArgType *)V1, (const ArgType *)V2); @@ -178,16 +182,17 @@ // Default "noop" implementations //======// - static Constant *Add(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Sub(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Mul(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Div(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Rem(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *And(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Xor(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shl(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shr(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Rem (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; } static Constant *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } @@ -373,8 +378,11 @@ static Constant *Mul(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getMul); } - static Constant *Div(const ConstantPacked *V1, const ConstantPacked *V2) { -return EvalVectorOp(V1, V2, ConstantExpr::getDiv); + static Constant *UDiv(const ConstantPacked *V1, const ConstantPacked *V2) { +return EvalVectorOp(V1, V2, ConstantExpr::getUDiv); + } + static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) { +return EvalVectorOp(V1, V2, ConstantExpr::getSDiv); } static Constant *Rem(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getRem); @@ -493,8 +501,20 @@ DEF_CAST(Double, ConstantFP , double) #undef DEF_CAST - static Constant *Div(co
[llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h ScalarEvolutionExpressions.h
Changes in directory llvm/include/llvm/Analysis: ScalarEvolutionExpander.h updated: 1.5 -> 1.5.6.1 ScalarEvolutionExpressions.h updated: 1.7 -> 1.7.6.1 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+2 -2) ScalarEvolutionExpander.h|2 +- ScalarEvolutionExpressions.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.5 llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.5.6.1 --- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.5Fri Mar 31 22:48:52 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.hThu Oct 19 23:27:17 2006 @@ -140,7 +140,7 @@ const Type *Ty = S->getType(); Value *LHS = expandInTy(S->getLHS(), Ty); Value *RHS = expandInTy(S->getRHS(), Ty); - return BinaryOperator::createDiv(LHS, RHS, "tmp.", InsertPt); + return BinaryOperator::createSDiv(LHS, RHS, "tmp.", InsertPt); } Value *visitAddRecExpr(SCEVAddRecExpr *S); Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.7 llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.7.6.1 --- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.7 Fri Mar 31 22:48:52 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Thu Oct 19 23:27:17 2006 @@ -293,7 +293,7 @@ //======// - /// SCEVSDivExpr - This class represents a binary unsigned division operation. + /// SCEVSDivExpr - This class represents a binary signed division operation. /// class SCEVSDivExpr : public SCEV { SCEVHandle LHS, RHS; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.520.2.2 -> 1.520.2.3 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+13 -10) InstructionCombining.cpp | 23 +-- 1 files changed, 13 insertions(+), 10 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.2 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.3 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.2 Thu Oct 19 19:34:44 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 19 23:27:17 2006 @@ -1975,11 +1975,11 @@ } // 0 - (X sdiv C) -> (X sdiv -C) - if (Op1I->getOpcode() == Instruction::Div) + if (Op1I->getOpcode() == Instruction::SDiv) if (ConstantInt *CSI = dyn_cast(Op0)) - if (CSI->getType()->isSigned() && CSI->isNullValue()) + if (CSI->isNullValue()) if (Constant *DivRHS = dyn_cast(Op1I->getOperand(1))) - return BinaryOperator::createDiv(Op1I->getOperand(0), + return BinaryOperator::createSDiv(Op1I->getOperand(0), ConstantExpr::getNeg(DivRHS)); // X - X*C --> X * (1-C) @@ -2174,11 +2174,13 @@ return BinaryOperator::createNeg(Op0); if (Instruction *LHS = dyn_cast(Op0)) - if (LHS->getOpcode() == Instruction::Div) + if (LHS->getOpcode() == Instruction::SDiv || + LHS->getOpcode()==Instruction::UDiv) if (ConstantInt *LHSRHS = dyn_cast(LHS->getOperand(1))) { // (X / C1) / C2 -> X / (C1*C2) - return BinaryOperator::createDiv(LHS->getOperand(0), - ConstantExpr::getMul(RHS, LHSRHS)); + return BinaryOperator::create( +Instruction::BinaryOps(LHS->getOpcode()), LHS->getOperand(0), + ConstantExpr::getMul(RHS, LHSRHS),""); } // Check to see if this is an unsigned division with an exact power of 2, @@ -2195,7 +2197,7 @@ // -X/C -> X/-C if (RHS->getType()->isSigned()) if (Value *LHSNeg = dyn_castNegVal(Op0)) -return BinaryOperator::createDiv(LHSNeg, ConstantExpr::getNeg(RHS)); +return BinaryOperator::createSDiv(LHSNeg, ConstantExpr::getNeg(RHS)); if (!RHS->isNullValue()) { if (SelectInst *SI = dyn_cast(Op0)) @@ -2279,7 +2281,7 @@ RHS = ConstantExpr::getCast(R, NTy); else RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName()), I); - Instruction *Div = BinaryOperator::createDiv(LHS, RHS, I.getName()); + Instruction *Div = BinaryOperator::createUDiv(LHS, RHS, I.getName()); InsertNewInstBefore(Div, I); return new CastInst(Div, I.getType()); } @@ -3722,7 +3724,7 @@ static bool MulWithOverflow(ConstantInt *&Result, ConstantInt *In1, ConstantInt *In2) { Result = cast(ConstantExpr::getMul(In1, In2)); - return !In2->isNullValue() && ConstantExpr::getDiv(Result, In2) != In1; + return !In2->isNullValue() && ConstantExpr::getUDiv(Result, In2) != In1; } static bool isPositive(ConstantInt *C) { @@ -4379,7 +4381,8 @@ } break; - case Instruction::Div: + case Instruction::SDiv: + case Instruction::UDiv: // Fold: (div X, C1) op C2 -> range check if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { // Fold this div into the comparison, producing a range check. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Support/PatternMatch.h
Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.9 -> 1.9.2.1 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+8 -2) PatternMatch.h | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.9 llvm/include/llvm/Support/PatternMatch.h:1.9.2.1 --- llvm/include/llvm/Support/PatternMatch.h:1.9Mon Sep 18 00:17:11 2006 +++ llvm/include/llvm/Support/PatternMatch.hThu Oct 19 23:27:17 2006 @@ -112,9 +112,15 @@ } template -inline BinaryOp_match m_Div(const LHS &L, +inline BinaryOp_match m_UDiv(const LHS &L, const RHS &R) { - return BinaryOp_match(L, R); + return BinaryOp_match(L, R); +} + +template +inline BinaryOp_match m_SDiv(const LHS &L, +const RHS &R) { + return BinaryOp_match(L, R); } template ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.18.2.2 -> 1.18.2.3 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+2 -2) StackerCompiler.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.2 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.3 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.2 Thu Oct 19 16:06:26 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Thu Oct 19 23:27:18 2006 @@ -1041,7 +1041,7 @@ LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); BinaryOperator* divop = -BinaryOperator::create( Instruction::Div, op1, op2); +BinaryOperator::create( Instruction::SDiv, op1, op2); bb->getInstList().push_back( divop ); push_value( bb, divop ); break; @@ -1072,7 +1072,7 @@ // Divide by the third operand BinaryOperator* divop = -BinaryOperator::create( Instruction::Div, multop, op3); +BinaryOperator::create( Instruction::SDiv, multop, op3); bb->getInstList().push_back( divop ); // Push the result ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.53.2.2 -> 1.53.2.3 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+13 -13) ScalarEvolution.cpp | 26 +- 1 files changed, 13 insertions(+), 13 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.2 llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.3 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.2 Thu Oct 19 19:34:43 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Oct 19 23:27:17 2006 @@ -989,9 +989,9 @@ SCEVHandle SCEVSDivExpr::get(const SCEVHandle &LHS, const SCEVHandle &RHS) { if (SCEVConstant *RHSC = dyn_cast(RHS)) { if (RHSC->getValue()->equalsInt(1)) - return LHS;// X /s 1 --> x + return LHS;// X sdiv 1 --> x if (RHSC->getValue()->isAllOnesValue()) - return SCEV::getNegativeSCEV(LHS); // X /s -1 --> -x + return SCEV::getNegativeSCEV(LHS); // X sdiv -1 --> -x if (SCEVConstant *LHSC = dyn_cast(LHS)) { Constant *LHSCV = LHSC->getValue(); @@ -1001,7 +1001,7 @@ LHSCV->getType()->getSignedVersion()); if (RHSCV->getType()->isUnsigned()) RHSCV = ConstantExpr::getCast(RHSCV, LHSCV->getType()); - return SCEVUnknown::get(ConstantExpr::getDiv(LHSCV, RHSCV)); + return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV)); } } @@ -1384,8 +1384,8 @@ case Instruction::Mul: return SCEVMulExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); -case Instruction::Div: - if (V->getType()->isInteger() && V->getType()->isSigned()) +case Instruction::SDiv: + if (V->getType()->isInteger()) return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); break; @@ -2058,16 +2058,16 @@ return std::make_pair(CNC, CNC); } - Constant *Two = ConstantInt::get(L->getValue()->getType(), 2); + Constant *C = L->getValue(); + Constant *Two = ConstantInt::get(C->getType(), 2); // Convert from chrec coefficients to polynomial coefficients AX^2+BX+C - Constant *C = L->getValue(); // The B coefficient is M-N/2 Constant *B = ConstantExpr::getSub(M->getValue(), - ConstantExpr::getDiv(N->getValue(), + ConstantExpr::getSDiv(N->getValue(), Two)); // The A coefficient is N/2 - Constant *A = ConstantExpr::getDiv(N->getValue(), Two); + Constant *A = ConstantExpr::getSDiv(N->getValue(), Two); // Compute the B^2-4ac term. Constant *SqrtTerm = @@ -2102,9 +2102,9 @@ SqrtTerm = ConstantExpr::getCast(SqrtTerm, SignedTy); Constant *Solution1 = -ConstantExpr::getDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); +ConstantExpr::getSDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); Constant *Solution2 = -ConstantExpr::getDiv(ConstantExpr::getSub(NegB, SqrtTerm), TwoA); +ConstantExpr::getSDiv(ConstantExpr::getSub(NegB, SqrtTerm), TwoA); return std::make_pair(SCEVUnknown::get(Solution1), SCEVUnknown::get(Solution2)); } @@ -2150,7 +2150,7 @@ Constant *StartNegC = ConstantExpr::getNeg(StartCC); Constant *Rem = ConstantExpr::getRem(StartNegC, StepC->getValue()); if (Rem->isNullValue()) { - Constant *Result =ConstantExpr::getDiv(StartNegC,StepC->getValue()); + Constant *Result =ConstantExpr::getSDiv(StartNegC,StepC->getValue()); return SCEVUnknown::get(Result); } } @@ -2352,7 +2352,7 @@ Constant *ExitValue = Upper; if (A != One) { ExitValue = ConstantExpr::getSub(ConstantExpr::getAdd(Upper, A), One); - ExitValue = ConstantExpr::getDiv(ExitValue, A); + ExitValue = ConstantExpr::getSDiv(ExitValue, A); } assert(isa(ExitValue) && "Constant folding of integers not implemented?"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Constants.h Instruction.def
Changes in directory llvm/include/llvm: Constants.h updated: 1.88.2.1 -> 1.88.2.2 Instruction.def updated: 1.19.6.2 -> 1.19.6.3 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+40 -38) Constants.h |3 +- Instruction.def | 75 2 files changed, 40 insertions(+), 38 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.88.2.1 llvm/include/llvm/Constants.h:1.88.2.2 --- llvm/include/llvm/Constants.h:1.88.2.1 Wed Oct 18 22:57:55 2006 +++ llvm/include/llvm/Constants.h Thu Oct 19 23:27:17 2006 @@ -560,7 +560,8 @@ static Constant *getAdd(Constant *C1, Constant *C2); static Constant *getSub(Constant *C1, Constant *C2); static Constant *getMul(Constant *C1, Constant *C2); - static Constant *getDiv(Constant *C1, Constant *C2); + static Constant *getUDiv(Constant *C1, Constant *C2); + static Constant *getSDiv(Constant *C1, Constant *C2); static Constant *getRem(Constant *C1, Constant *C2); static Constant *getAnd(Constant *C1, Constant *C2); static Constant *getOr(Constant *C1, Constant *C2); Index: llvm/include/llvm/Instruction.def diff -u llvm/include/llvm/Instruction.def:1.19.6.2 llvm/include/llvm/Instruction.def:1.19.6.3 --- llvm/include/llvm/Instruction.def:1.19.6.2 Thu Oct 19 19:34:43 2006 +++ llvm/include/llvm/Instruction.def Thu Oct 19 23:27:17 2006 @@ -90,55 +90,56 @@ // Standard binary operators... FIRST_BINARY_INST( 7) -HANDLE_BINARY_INST( 7, Add , BinaryOperator) -HANDLE_BINARY_INST( 8, Sub , BinaryOperator) -HANDLE_BINARY_INST( 9, Mul , BinaryOperator) -HANDLE_BINARY_INST(10, Div , BinaryOperator) -HANDLE_BINARY_INST(11, Rem , BinaryOperator) +HANDLE_BINARY_INST( 7, Add , BinaryOperator) +HANDLE_BINARY_INST( 8, Sub , BinaryOperator) +HANDLE_BINARY_INST( 9, Mul , BinaryOperator) +HANDLE_BINARY_INST(10, UDiv , BinaryOperator) +HANDLE_BINARY_INST(11, SDiv , BinaryOperator) +HANDLE_BINARY_INST(12, Rem , BinaryOperator) // Logical operators... -HANDLE_BINARY_INST(12, And , BinaryOperator) -HANDLE_BINARY_INST(13, Or, BinaryOperator) -HANDLE_BINARY_INST(14, Xor , BinaryOperator) +HANDLE_BINARY_INST(13, And , BinaryOperator) +HANDLE_BINARY_INST(14, Or, BinaryOperator) +HANDLE_BINARY_INST(15, Xor , BinaryOperator) // Binary comparison operators... -HANDLE_BINARY_INST(15, SetEQ , SetCondInst) -HANDLE_BINARY_INST(16, SetNE , SetCondInst) -HANDLE_BINARY_INST(17, SetLE , SetCondInst) -HANDLE_BINARY_INST(18, SetGE , SetCondInst) -HANDLE_BINARY_INST(19, SetLT , SetCondInst) -HANDLE_BINARY_INST(20, SetGT , SetCondInst) - LAST_BINARY_INST(20) +HANDLE_BINARY_INST(16, SetEQ , SetCondInst) +HANDLE_BINARY_INST(17, SetNE , SetCondInst) +HANDLE_BINARY_INST(18, SetLE , SetCondInst) +HANDLE_BINARY_INST(19, SetGE , SetCondInst) +HANDLE_BINARY_INST(20, SetLT , SetCondInst) +HANDLE_BINARY_INST(21, SetGT , SetCondInst) + LAST_BINARY_INST(21) // Memory operators... - FIRST_MEMORY_INST(21) -HANDLE_MEMORY_INST(21, Malloc, MallocInst) // Heap management instructions -HANDLE_MEMORY_INST(22, Free , FreeInst ) -HANDLE_MEMORY_INST(23, Alloca, AllocaInst) // Stack management -HANDLE_MEMORY_INST(24, Load , LoadInst ) // Memory manipulation instrs -HANDLE_MEMORY_INST(25, Store , StoreInst ) -HANDLE_MEMORY_INST(26, GetElementPtr, GetElementPtrInst) - LAST_MEMORY_INST(26) + FIRST_MEMORY_INST(22) +HANDLE_MEMORY_INST(22, Malloc, MallocInst) // Heap management instructions +HANDLE_MEMORY_INST(23, Free , FreeInst ) +HANDLE_MEMORY_INST(24, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(25, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(26, Store , StoreInst ) +HANDLE_MEMORY_INST(27, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(27) // Other operators... - FIRST_OTHER_INST(27) -HANDLE_OTHER_INST(27, PHI, PHINode) // PHI node instruction -HANDLE_OTHER_INST(28, Cast , CastInst ) // Type cast -HANDLE_OTHER_INST(29, Call , CallInst ) // Call a function + FIRST_OTHER_INST(28) +HANDLE_OTHER_INST(28, PHI, PHINode) // PHI node instruction +HANDLE_OTHER_INST(29, Cast , CastInst ) // Type cast +HANDLE_OTHER_INST(30, Call , CallInst ) // Call a function -HANDLE_OTHER_INST(30, Shl, ShiftInst ) // Shift operations -HANDLE_OTHER_INST(31, Shr, ShiftInst ) +HANDLE_OTHER_INST(31, Shl, ShiftInst ) // Shift operations +HANDLE_OTHER_INST(32, Shr, ShiftInst ) // 32 -> Empty slot used to be used for vanext in llvm 1.5 and before. // 33 -> Empty slot used to be used for vaarg in llvm 1.5 and before. -HANDLE_OTHER_INST(34, Select , SelectInst ) // select instruction +HANDLE_OTHER_INST(33, Select , SelectInst ) // select instruction -HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass -HANDLE_OTHER_INST(36, UserOp2, Instruction) -HANDLE_OTHER_INST(37, VAArg , VAArgInst ) // vaarg instruction -H
[llvm-commits] [SignlessTypes] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.198.2.2 -> 1.198.2.3 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+2 -0) Reader.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.2 llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.3 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.2 Thu Oct 19 18:54:13 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 19 23:27:17 2006 @@ -675,6 +675,7 @@ Result = new VAArgInst(getValue(iType, Oprnds[0]), getSanitizedType(Oprnds[1])); break; +#if 0 // FIXME: This needs to be handled case 32: { //VANext_old const Type* ArgTy = getValue(iType, Oprnds[0])->getType(); Function* NF = TheModule->getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, @@ -714,6 +715,7 @@ Result = new VAArgInst(foo, getSanitizedType(Oprnds[1])); break; } +#endif case Instruction::ExtractElement: { if (Oprnds.size() != 2) error("Invalid extractelement instruction!"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll
Bill, After updating to the head, this test case is failing for me on Linux. Reid. On Thu, 2006-10-19 at 18:22 -0500, Bill Wendling wrote: > > Changes in directory llvm/test/Regression/CodeGen/X86: > > 2006-10-19-SwitchUnnecessaryBranching.ll added (r1.1) > --- > Log message: > > Testcase for P926 > > > --- > Diffs of the changes: (+27 -0) > > 2006-10-19-SwitchUnnecessaryBranching.ll | 27 +++ > 1 files changed, 27 insertions(+) > > > Index: > llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll > diff -c /dev/null > llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll:1.1 > *** /dev/null Thu Oct 19 18:22:09 2006 > --- llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll > Thu Oct 19 18:21:59 2006 > *** > *** 0 > --- 1,27 > + ; RUN: llvm-as < %s | llc -march=x86 | %prcontext "jg LBB1_5" 1 | grep > "LBB1_4:" Are you sure that "grep" is right? > + > + %str = internal constant [14 x sbyte] c"Hello world!\0A\00" ; <[14 > x sbyte]*> [#uses=1] > + %str = internal constant [13 x sbyte] c"Blah world!\0A\00" ; <[13 > x sbyte]*> [#uses=1] > + > + implementation ; Functions: > + > + int %main(int %argc, sbyte** %argv) { > + entry: > + switch int %argc, label %UnifiedReturnBlock [ > + int 1, label %bb > + int 2, label %bb2 > + ] > + > + bb: ; preds = %entry > + %tmp1 = tail call int (sbyte*, ...)* %printf( sbyte* getelementptr ([14 > x sbyte]* %str, int 0, uint 0) ); [#uses=0] > + ret int 0 > + > + bb2:; preds = %entry > + %tmp4 = tail call int (sbyte*, ...)* %printf( sbyte* getelementptr ([13 > x sbyte]* %str, int 0, uint 0) ); [#uses=0] > + ret int 0 > + > + UnifiedReturnBlock: ; preds = %entry > + ret int 0 > + } > + > + declare int %printf(sbyte*, ...) > > > > ___ > 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