[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.119 -> 1.120 --- Log message: Don't overload var names. --- Diffs of the changes: (+4 -4) ConstantFolding.cpp |8 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.119 llvm/lib/VMCore/ConstantFolding.cpp:1.120 --- llvm/lib/VMCore/ConstantFolding.cpp:1.119 Sat Dec 23 00:05:41 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Sat Dec 23 04:21:26 2006 @@ -883,11 +883,11 @@ // null pointer, do the comparison with the pre-casted value. if (V2->isNullValue() && (isa(CE1->getType()) || CE1->getType()->isIntegral())) { -bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false : +bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false : (CE1->getOpcode() == Instruction::SExt ? true : (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); return evaluateICmpRelation( -CE1Op0, Constant::getNullValue(CE1Op0->getType()), isSigned); +CE1Op0, Constant::getNullValue(CE1Op0->getType()), sgnd); } // If the dest type is a pointer type, and the RHS is a constantexpr cast @@ -898,11 +898,11 @@ if (CE2->isCast() && isa(CE1->getType()) && CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() && CE1->getOperand(0)->getType()->isIntegral()) { - bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false : + bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false : (CE1->getOpcode() == Instruction::SExt ? true : (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); return evaluateICmpRelation(CE1->getOperand(0), CE2->getOperand(0), - isSigned); + sgnd); } break; ___ 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.573 -> 1.574 --- Log message: For PR1065: http://llvm.org/PR1065 : Don't allow CmpInst instances to be processed in FoldSelectOpOp because you can't easily swap their operands. --- Diffs of the changes: (+7 -12) InstructionCombining.cpp | 19 +++ 1 files changed, 7 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.573 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.574 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.573 Sat Dec 23 00:05:41 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Dec 23 12:58:04 2006 @@ -6555,13 +6555,7 @@ } // Only handle binary, compare and shift operators here. - if (!isa(TI) && !isa(TI) && !isa(TI)) -return 0; - - // If the CmpInst predicates don't match, then the instructions aren't the - // same and we can't continue. - if (isa(TI) && isa(FI) && - (cast(TI)->getPredicate() != cast(FI)->getPredicate())) + if (!isa(TI) && !isa(TI)) return 0; // Figure out if the operations have any operands in common. @@ -6603,12 +6597,13 @@ return BinaryOperator::create(BO->getOpcode(), MatchOp, NewSI); else return BinaryOperator::create(BO->getOpcode(), NewSI, MatchOp); - } else { -if (MatchIsOpZero) - return new ShiftInst(cast(TI)->getOpcode(), MatchOp, NewSI); -else - return new ShiftInst(cast(TI)->getOpcode(), NewSI, MatchOp); } + + assert(isa(TI) && "Should only have Shift here"); + if (MatchIsOpZero) +return new ShiftInst(cast(TI)->getOpcode(), MatchOp, NewSI); + else +return new ShiftInst(cast(TI)->getOpcode(), NewSI, MatchOp); } Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h
Changes in directory llvm/include/llvm: InstrTypes.h updated: 1.56 -> 1.57 --- Log message: Add some documentation to make Nick happy. --- Diffs of the changes: (+2 -1) InstrTypes.h |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.56 llvm/include/llvm/InstrTypes.h:1.57 --- llvm/include/llvm/InstrTypes.h:1.56 Sat Dec 23 00:05:40 2006 +++ llvm/include/llvm/InstrTypes.h Sat Dec 23 13:06:54 2006 @@ -532,7 +532,8 @@ unsigned getNumOperands() const { return 2; } /// This is just a convenience that dispatches to the subclasses. - /// @brief Swap the operands. + /// @brief Swap the operands and adjust predicate accordingly to retain + /// the same comparison. void swapOperands(); /// This is just a convenience that dispatches to the subclasses. ___ 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-12-23-Select-Cmp-Cmp.ll
Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-12-23-Select-Cmp-Cmp.ll added (r1.1) --- Log message: Test case for PR1065: http://llvm.org/PR1065 . --- Diffs of the changes: (+33 -0) 2006-12-23-Select-Cmp-Cmp.ll | 33 + 1 files changed, 33 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll:1.1 *** /dev/null Sat Dec 23 13:14:20 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll Sat Dec 23 13:14:10 2006 *** *** 0 --- 1,33 + ; For PR1065. This causes an assertion in instcombine if a select with two cmp + ; operands is encountered. + ; RUN: llvm-as < %s | opt -instcombine -disable-output + ; ModuleID = 'PR1065.bc' + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + %struct.internal_state = type { int } + %struct.mng_data = type { uint, sbyte*, uint, uint, uint, uint, uint, uint, uint, uint, uint, ubyte, uint, uint, uint, sbyte, uint, uint, uint, uint, ushort, ushort, ushort, sbyte, sbyte, double, double, double, sbyte, sbyte, sbyte, sbyte, uint, uint, uint, uint, int, sbyte, int, int, sbyte*, sbyte* (uint)*, void (sbyte*, uint)*, void (sbyte*, sbyte*, uint)*, sbyte (%struct.mng_data*)*, sbyte (%struct.mng_data*)*, sbyte (%struct.mng_data*, sbyte*, uint, uint*)*, sbyte (%struct.mng_data*, sbyte*, uint, uint*)*, sbyte (%struct.mng_data*, int, sbyte, int, uint, int, int, sbyte*)*, sbyte (%struct.mng_data*, int, int, sbyte*)*, sbyte (%struct.mng_data*, uint, uint)*, sbyte (%struct.mng_data*, ubyte, sbyte*, sbyte*, sbyte*, sbyte*)*, sbyte (%struct.mng_data*)*, sbyte (%struct.mng_data*, sbyte*)*, sbyte (%struct.mng_data*, sbyte*)*, sbyte (%struct.mng_data*, uint, uint)*, sbyte (%struct.mng_data*, int, uint, sbyte*)*, sbyte (%struct.mng_data*, ubyte, ubyte, uint, uint)*, sbyte* ! (%struct.mng_data*, uint)*, sbyte* (%struct.mng_data*, uint)*, sbyte* (%struct.mng_data*, uint)*, sbyte (%struct.mng_data*, uint, uint, uint, uint)*, uint (%struct.mng_data*)*, sbyte (%struct.mng_data*, uint)*, sbyte (%struct.mng_data*, uint)*, sbyte (%struct.mng_data*, uint, uint, uint, uint, uint, uint, uint, uint)*, sbyte (%struct.mng_data*, ubyte)*, sbyte (%struct.mng_data*, uint, sbyte*)*, sbyte (%struct.mng_data*, uint, sbyte, sbyte*)*, sbyte, int, uint, sbyte*, sbyte*, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, uint, uint, ubyte, ubyte, ubyte, ubyte, ubyte, uint, sbyte, sbyte, sbyte, uint, ubyte*, uint, ubyte*, uint, sbyte, ubyte, sbyte, uint, ubyte*, ubyte*, uint, uint, ubyte*, ubyte*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, sbyte, sbyte, int, uint, ubyte*, sbyte, sbyte, uint, uint, ui! nt, uint, uint, uint, sbyte, sbyte, sbyte, sbyte, int, int, sb! yte*, ui nt, uint, uint, sbyte, sbyte, uint, uint, uint, uint, sbyte, sbyte, ubyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, uint, sbyte*, sbyte*, sbyte*, uint, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct.mng_savedata*, uint, uint, uint, uint, sbyte, int, int, int, int, int, int, int, int, int, int, int, int, uint, uint, uint, uint, ubyte*, ubyte*, ubyte*, sbyte, sbyte, int, int, int, int, int, int, int, int, int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, [256 x ubyte], double, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, ushort, sbyte, ubyte, sbyte, ubyte, sbyte, int, int, sbyte, int, int, int, int, ushort, ushort, ushort, ubyte, ushort, ubyte, int, int, uint, uint, ubyte, uint, uint, sbyte, int, int, int, int, ubyte, uint, uint, sbyte, int, int, int, int, uint, sbyte, uint, ubyte, ushort, ushort, ushort, short, uint, [256 x %struct.mng_palette8e], uint, [256 x ubyte], uint, uint, uint, uint, uint,! uint, uint, uint, uint, ubyte, uint, sbyte*, ushort, ushort, ushort, sbyte*, ubyte, ubyte, uint, uint, uint, uint, sbyte, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, sbyte*, ubyte, ubyte, ubyte, uint, sbyte*, sbyte*, ushort, ushort, ushort, ushort, int, int, sbyte*, %struct.z_stream, int, int, int, int, int, uint, sbyte, sbyte, [256 x uint], sbyte } + %struct.mng_palette8e = type { ubyte, ubyte, ubyte } + %struct.mng_pushdata = type { sbyte*, sbyte*, uint, sbyte, ubyte*, uint } + %struct.mng_savedata = type { sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, ushort, ushort, ushort, ubyte, ushort, ubyte, ubyte, uint, uint, sbyte, int, int, int, int, uint, [256 x %struct.mng_palette8e], uint, [256 x ubyte], uint, uint, uint, uint, uint, uint, uint, uint, uint, ubyte, uint, sbyte*, ushort, ushort, ushort }
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.574 -> 1.575 --- Log message: Shut up some compilers that can't accurately analyze variable usage correctly and emit "may be used uninitialized" warnings. --- Diffs of the changes: (+2 -2) InstructionCombining.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.574 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.575 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.574 Sat Dec 23 12:58:04 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Dec 23 13:17:57 2006 @@ -4518,8 +4518,8 @@ if (KnownOne | KnownZero) { // Compute the Min, Max and RHS values based on the known bits. For the // EQ and NE we use unsigned values. - uint64_t UMin, UMax, URHSVal; - int64_t SMin, SMax, SRHSVal; + uint64_t UMin = 0, UMax = 0, URHSVal = 0; + int64_t SMin = 0, SMax = 0, SRHSVal = 0; if (ICmpInst::isSignedPredicate(I.getPredicate())) { SRHSVal = CI->getSExtValue(); ComputeSignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, SMin, ___ 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.575 -> 1.576 --- Log message: For PR1066: http://llvm.org/PR1066 : Fix this by ensuring that a bitcast is inserted to do sign switching. This is only temporarily needed as the merging of signed and unsigned is next on the SignlessTypes plate. --- Diffs of the changes: (+8 -2) InstructionCombining.cpp | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.575 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.576 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.575 Sat Dec 23 13:17:57 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Dec 23 18:40:59 2006 @@ -2002,8 +2002,14 @@ if (CU->getZExtValue() == SI->getType()->getPrimitiveSizeInBits()-1) { // Ok, the transformation is safe. Insert AShr. - return new ShiftInst(Instruction::AShr, SI->getOperand(0), -CU, SI->getName()); + // FIXME: Once integer types are signless, this cast should be + // removed. + Value *ShiftOp = SI->getOperand(0); + if (ShiftOp->getType() != I.getType()) +ShiftOp = InsertCastBefore(Instruction::BitCast, ShiftOp, + I.getType(), I); + return new ShiftInst(Instruction::AShr, ShiftOp, CU, + SI->getName()); } } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits