[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.70 -> 1.71
---
Log message:

Get even more accurate on the casting.


---
Diffs of the changes:  (+5 -8)

 ScalarEvolution.cpp |   13 +
 1 files changed, 5 insertions(+), 8 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.70 
llvm/lib/Analysis/ScalarEvolution.cpp:1.71
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.70  Mon Dec 11 23:04:59 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Tue Dec 12 03:17:50 2006
@@ -1567,8 +1567,7 @@
 ConstantInt *CompVal = RHSC->getValue();
 const Type *RealTy = ExitCond->getOperand(0)->getType();
 CompVal = dyn_cast(
-  ConstantExpr::getIntegerCast(CompVal, RealTy, 
-   CompVal->getType()->isSigned()));
+  ConstantExpr::getBitCast(CompVal, RealTy));
 if (CompVal) {
   // Form the constant range.
   ConstantRange CompRange(Cond, CompVal);
@@ -1577,12 +1576,10 @@
   // range.
   if (CompRange.getLower()->getType()->isSigned()) {
 const Type *NewTy = RHSC->getValue()->getType();
-Constant *NewL = 
-  ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy, 
- CompRange.getLower()->getType()->isSigned());
-Constant *NewU = 
-  ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy,
- CompRange.getUpper()->getType()->isSigned());
+Constant *NewL = ConstantExpr::getBitCast(CompRange.getLower(), 
+  NewTy);
+Constant *NewU = ConstantExpr::getBitCast(CompRange.getUpper(), 
+  NewTy);
 CompRange = ConstantRange(NewL, NewU);
   }
 



___
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

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.562 -> 1.563
---
Log message:

Fix numerous inferred casts. 


---
Diffs of the changes:  (+121 -77)

 InstructionCombining.cpp |  198 ---
 1 files changed, 121 insertions(+), 77 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.562 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.562   Wed Dec  6 
19:30:31 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 03:18:51 2006
@@ -205,13 +205,14 @@
 /// InsertCastBefore - Insert a cast of V to TY before the instruction POS.
 /// This also adds the cast to the worklist.  Finally, this returns the
 /// cast.
-Value *InsertCastBefore(Value *V, const Type *Ty, Instruction &Pos) {
+Value *InsertCastBefore(Instruction::CastOps opc, Value *V, const Type *Ty,
+Instruction &Pos) {
   if (V->getType() == Ty) return V;
 
   if (Constant *CV = dyn_cast(V))
-return ConstantExpr::getCast(CV, Ty);
+return ConstantExpr::getCast(opc, CV, Ty);
   
-  Instruction *C = CastInst::createInferredCast(V, Ty, V->getName(), &Pos);
+  Instruction *C = CastInst::create(opc, V, Ty, V->getName(), &Pos);
   WorkList.push_back(C);
   return C;
 }
@@ -269,7 +270,8 @@
 /// InsertBefore instruction.  This is specialized a bit to avoid inserting
 /// casts that are known to not do anything...
 ///
-Value *InsertOperandCastBefore(Value *V, const Type *DestTy,
+Value *InsertOperandCastBefore(Instruction::CastOps opcode,
+   Value *V, const Type *DestTy,
Instruction *InsertBefore);
 
 // SimplifyCommutative - This performs a few simplifications for 
commutative
@@ -398,13 +400,14 @@
 /// InsertBefore instruction.  This is specialized a bit to avoid inserting
 /// casts that are known to not do anything...
 ///
-Value *InstCombiner::InsertOperandCastBefore(Value *V, const Type *DestTy,
+Value *InstCombiner::InsertOperandCastBefore(Instruction::CastOps opcode,
+ Value *V, const Type *DestTy,
  Instruction *InsertBefore) {
   if (V->getType() == DestTy) return V;
   if (Constant *C = dyn_cast(V))
-return ConstantExpr::getCast(C, DestTy);
+return ConstantExpr::getCast(opcode, C, DestTy);
   
-  return InsertCastBefore(V, DestTy, *InsertBefore);
+  return InsertCastBefore(opcode, V, DestTy, *InsertBefore);
 }
 
 // SimplifyCommutative - This performs a few simplifications for commutative
@@ -1894,7 +1897,7 @@
 (CI->getType()->getPrimitiveSize() == 
  TD->getIntPtrType()->getPrimitiveSize()) 
 && isa(CI->getOperand(0)->getType())) {
-  Value *I2 = InsertCastBefore(CI->getOperand(0),
+  Value *I2 = InsertCastBefore(Instruction::BitCast, CI->getOperand(0),
PointerType::get(Type::SByteTy), I);
   I2 = InsertNewInstBefore(new GetElementPtrInst(I2, Other, "ctg2"), I);
   return new PtrToIntInst(I2, CI->getType());
@@ -2190,7 +2193,7 @@
   SCOpTy->getPrimitiveSizeInBits()-1);
 if (SCIOp0->getType()->isUnsigned()) {
   const Type *NewTy = SCIOp0->getType()->getSignedVersion();
-  SCIOp0 = InsertCastBefore(SCIOp0, NewTy, I);
+  SCIOp0 = InsertCastBefore(Instruction::BitCast, SCIOp0, NewTy, I);
 }
 
 Value *V =
@@ -2200,8 +2203,14 @@
 
 // If the multiply type is not the same as the source type, sign extend
 // or truncate to the multiply type.
-if (I.getType() != V->getType())
-  V = InsertCastBefore(V, I.getType(), I);
+if (I.getType() != V->getType()) {
+  unsigned SrcBits = V->getType()->getPrimitiveSizeInBits();
+  unsigned DstBits = I.getType()->getPrimitiveSizeInBits();
+  Instruction::CastOps opcode = 
+(SrcBits == DstBits ? Instruction::BitCast : 
+ (SrcBits < DstBits ? Instruction::SExt : Instruction::Trunc));
+  V = InsertCastBefore(opcode, V, I.getType(), I);
+}
 
 Value *OtherOp = Op0 == BoolCast ? I.getOperand(1) : Op0;
 return BinaryOperator::createAnd(V, OtherOp);
@@ -2863,12 +2872,14 @@
   Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS);
   Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask);
   if (CI == AndRHS) {  // Masking out bits shifted in.
+// (Val ashr C1) & C2 -> (Val lshr C1) & C2
 // Make the argument unsigned.
 Value *ShVal = Op->getOperand(0);
 ShVal = InsertNewInstBefore(new ShiftInst(Instruction::LShr, ShVal,
   OpRH

[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Utils:

LowerAllocations.cpp updated: 1.65 -> 1.66
---
Log message:

Fix the casting for the computation of the Malloc size.


---
Diffs of the changes:  (+3 -3)

 LowerAllocations.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.65 
llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66
--- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.65 Mon Dec 11 23:05:00 2006
+++ llvm/lib/Transforms/Utils/LowerAllocations.cpp  Tue Dec 12 03:17:08 2006
@@ -122,15 +122,15 @@
 MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize(AllocTy));
   else
 MallocArg = ConstantExpr::getSizeOf(AllocTy);
-  MallocArg = ConstantExpr::getIntegerCast(cast(MallocArg), 
-   IntPtrTy, true /*SExt*/);
+  MallocArg = ConstantExpr::getTruncOrBitCast(cast(MallocArg), 
+  IntPtrTy);
 
   if (MI->isArrayAllocation()) {
 if (isa(MallocArg) &&
 cast(MallocArg)->getZExtValue() == 1) {
   MallocArg = MI->getOperand(0); // Operand * 1 = Operand
 } else if (Constant *CO = dyn_cast(MI->getOperand(0))) {
-  CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true /*SExt*/);
+  CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, false /*ZExt*/);
   MallocArg = ConstantExpr::getMul(CO, cast(MallocArg));
 } else {
   Value *Scale = MI->getOperand(0);



___
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/2006-12-11-LoadConstants.c

2006-12-12 Thread Jim Laskey


Changes in directory llvm-test/SingleSource/UnitTests:

2006-12-11-LoadConstants.c updated: 1.1 -> 1.2
---
Log message:

Add more constants.

---
Diffs of the changes:  (+131 -0)

 2006-12-11-LoadConstants.c |  131 +
 1 files changed, 131 insertions(+)


Index: llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c
diff -u llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.1 
llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.2
--- llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.1 Mon Dec 
11 14:22:44 2006
+++ llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c Tue Dec 12 
07:15:29 2006
@@ -92,6 +92,72 @@
 long long uuus() { return 0x7fff7fff7fffLL; }
 long long () { return 0x7fff7fff7fff7fffLL; }
 
+long long bit00() { return 0x0001LL; }
+long long bit01() { return 0x0002LL; }
+long long bit02() { return 0x0004LL; }
+long long bit03() { return 0x0008LL; }
+long long bit04() { return 0x0010LL; }
+long long bit05() { return 0x0020LL; }
+long long bit06() { return 0x0040LL; }
+long long bit07() { return 0x0080LL; }
+long long bit08() { return 0x0100LL; }
+long long bit09() { return 0x0200LL; }
+long long bit10() { return 0x0400LL; }
+long long bit11() { return 0x0800LL; }
+long long bit12() { return 0x1000LL; }
+long long bit13() { return 0x2000LL; }
+long long bit14() { return 0x4000LL; }
+long long bit15() { return 0x8000LL; }
+long long bit16() { return 0x0001LL; }
+long long bit17() { return 0x0002LL; }
+long long bit18() { return 0x0004LL; }
+long long bit19() { return 0x0008LL; }
+long long bit20() { return 0x0010LL; }
+long long bit21() { return 0x0020LL; }
+long long bit22() { return 0x0040LL; }
+long long bit23() { return 0x0080LL; }
+long long bit24() { return 0x0100LL; }
+long long bit25() { return 0x0200LL; }
+long long bit26() { return 0x0400LL; }
+long long bit27() { return 0x0800LL; }
+long long bit28() { return 0x1000LL; }
+long long bit29() { return 0x2000LL; }
+long long bit30() { return 0x4000LL; }
+long long bit31() { return 0x8000LL; }
+long long bit32() { return 0x0001LL; }
+long long bit33() { return 0x0002LL; }
+long long bit34() { return 0x0004LL; }
+long long bit35() { return 0x0008LL; }
+long long bit36() { return 0x0010LL; }
+long long bit37() { return 0x0020LL; }
+long long bit38() { return 0x0040LL; }
+long long bit39() { return 0x0080LL; }
+long long bit40() { return 0x0100LL; }
+long long bit41() { return 0x0200LL; }
+long long bit42() { return 0x0400LL; }
+long long bit43() { return 0x0800LL; }
+long long bit44() { return 0x1000LL; }
+long long bit45() { return 0x2000LL; }
+long long bit46() { return 0x4000LL; }
+long long bit47() { return 0x8000LL; }
+long long bit48() { return 0x0001LL; }
+long long bit49() { return 0x0002LL; }
+long long bit50() { return 0x0004LL; }
+long long bit51() { return 0x0008LL; }
+long long bit52() { return 0x0010LL; }
+long long bit53() { return 0x0020LL; }
+long long bit54() { return 0x0040LL; }
+long long bit55() { return 0x0080LL; }
+long long bit56() { return 0x0100LL; }
+long long bit57() { return 0x0200LL; }
+long long bit58() { return 0x0400LL; }
+long long bit59() { return 0x0800LL; }
+long long bit60() { return 0x1000LL; }
+long long bit61() { return 0x2000LL; }
+long long bit62() { return 0x4000LL; }
+long long bit63() { return 0x8000LL; }
+
+
 int main(int argc, const char *argv[]) {
   printf("%08x\n", zz());
   printf("%08x\n", zs());
@@ -185,5 +251,70 @@
   printf("%016llx\n", uuus());
   printf("%016llx\n", ());
 
+  printf("%016llx\n", bit00());
+  printf("%016llx\n", bit01());
+  printf("%016llx\n", bit02());
+  printf("%016llx\n", bit03());
+  printf("%016llx\n", bit04());
+  printf("%016llx\n", bit05());
+  printf("%016llx\n", bit06());
+  printf("%016llx\n", bit07());
+  printf("%016llx\n", bit08());
+  printf("%016llx\n", bit09());
+  printf("%016llx\n", bit10());
+  printf("%016llx\n", bit11());
+  printf("%016llx\n", bit12());
+  printf("%016llx\n", bit13());
+  printf("%016llx\n", bit14());
+  printf("%016llx\n", bit15());
+  printf("%016llx\n", bit16());
+  printf("%016llx\n", bit17());
+  printf("%016llx\n", bit18());
+  printf("%016llx\n", bit19());
+  print

[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCInstr64Bit.td

2006-12-12 Thread Jim Laskey


Changes in directory llvm/lib/Target/PowerPC:

PPCISelDAGToDAG.cpp updated: 1.227 -> 1.228
PPCInstr64Bit.td updated: 1.33 -> 1.34
---
Log message:

Reduce number of instructions to load 64-bit constants.

---
Diffs of the changes:  (+75 -42)

 PPCISelDAGToDAG.cpp |   75 
 PPCInstr64Bit.td|   42 -
 2 files changed, 75 insertions(+), 42 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.227 
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.228
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.227   Thu Dec  7 16:21:48 2006
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Dec 12 07:23:43 2006
@@ -766,6 +766,81 @@
 
   switch (N->getOpcode()) {
   default: break;
+  
+  case ISD::Constant: {
+if (N->getValueType(0) == MVT::i64) {
+  // Get 64 bit value.
+  int64_t Imm = cast(N)->getValue();
+  // Assume no remaining bits.
+  unsigned Remainder = 0;
+  // Assume no shift required.
+  unsigned Shift = 0;
+  
+  // If it can't be represented as a 32 bit value.
+  if (!isInt32(Imm)) {
+Shift = CountTrailingZeros_64(Imm);
+int64_t ImmSh = static_cast(Imm) >> Shift;
+
+// If the shifted value fits 32 bits.
+if (isInt32(ImmSh)) {
+  // Go with the shifted value.
+  Imm = ImmSh;
+} else {
+  // Still stuck with a 64 bit value.
+  Remainder = Imm;
+  Shift = 32;
+  Imm >>= 32;
+}
+  }
+  
+  // Intermediate operand.
+  SDNode *Result;
+
+  // Handle first 32 bits.
+  unsigned Lo = Imm & 0x;
+  unsigned Hi = (Imm >> 16) & 0x;
+  
+  // Simple value.
+  if (isInt16(Imm)) {
+   // Just the Lo bits.
+Result = CurDAG->getTargetNode(PPC::LI8, MVT::i64, getI32Imm(Lo));
+  } else if (Lo) {
+// Handle the Hi bits.
+unsigned OpC = Hi ? PPC::LIS8 : PPC::LI8;
+Result = CurDAG->getTargetNode(OpC, MVT::i64, getI32Imm(Hi));
+// And Lo bits.
+Result = CurDAG->getTargetNode(PPC::ORI8, MVT::i64,
+   SDOperand(Result, 0), getI32Imm(Lo));
+  } else {
+   // Just the Hi bits.
+Result = CurDAG->getTargetNode(PPC::LIS8, MVT::i64, getI32Imm(Hi));
+  }
+  
+  // If no shift, we're done.
+  if (!Shift) return Result;
+
+  // Shift for next step if the upper 32-bits were not zero.
+  if (Imm) {
+Result = CurDAG->getTargetNode(PPC::RLDICR, MVT::i64,
+   SDOperand(Result, 0),
+   getI32Imm(Shift), getI32Imm(63 - 
Shift));
+  }
+
+  // Add in the last bits as required.
+  if ((Hi = (Remainder >> 16) & 0x)) {
+Result = CurDAG->getTargetNode(PPC::ORIS8, MVT::i64,
+   SDOperand(Result, 0), getI32Imm(Hi));
+  } 
+  if ((Lo = Remainder & 0x)) {
+Result = CurDAG->getTargetNode(PPC::ORI8, MVT::i64,
+   SDOperand(Result, 0), getI32Imm(Lo));
+  }
+  
+  return Result;
+}
+break;
+  }
+  
   case ISD::SETCC:
 return SelectSETCC(Op);
   case PPCISD::GlobalBaseReg:


Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td
diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.33 
llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.34
--- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.33   Wed Dec  6 15:46:13 2006
+++ llvm/lib/Target/PowerPC/PPCInstr64Bit.tdTue Dec 12 07:23:43 2006
@@ -474,48 +474,6 @@
 // Instruction Patterns
 //
 
-// Immediate support.
-// Handled above:
-//   sext(0x___,  i8) -> li imm
-//   sext(0x___, i16) -> lis imm>>16
-
-// sext(0x___,  i16)  -> lis + ori
-def sext_0x____i16 : PatLeaf<(imm), [{
-  return N->getValue() == (uint64_t)(int32_t)N->getValue();
-}]>;
-def : Pat<(i64 sext_0x____i16:$imm),
-  (ORI8 (LIS8 (HI16 imm:$imm)), (LO16 imm:$imm))>;
-
-// zext(0x___7FFF, i16) -> oris (li lo16(imm)), imm>>16
-def zext_0x___7FFF_i16 : PatLeaf<(imm), [{
-  return (N->getValue() & 0x8000ULL) == 0;
-}]>;
-def : Pat<(i64 zext_0x___7FFF_i16:$imm),
-  (ORIS8 (LI8 (LO16 imm:$imm)), (HI16 imm:$imm))>;
-
-// zext(0x___, i16) -> oris (ori (li 0), lo16(imm)), imm>>16
-def zext_0x____i16 : PatLeaf<(imm), [{
-  return (N->getValue() & 0xULL) == 0;
-}]>;
-def : Pat<(i64 zext_0x____i16:$imm),
-  (ORIS8 (ORI8 (LI8 0), (LO16 imm:$imm)), (HI16 imm:$imm))>;
-
-// FIXME: Handle smart forms where the top 32-bits are set.  Right now, stuff
-// like 0xABCD0123BCDE hits the case below, which produces ORI R, R, 0's! 
-
-// Fully general (and most expensive: 6 instructions!) imme

[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp

2006-12-12 Thread Rafael Espindola


Changes in directory llvm/lib/Target/ARM:

ARMISelDAGToDAG.cpp updated: 1.89 -> 1.90
---
Log message:

don't use "ordinary" addressing mode 1 when mvn is appropriate


---
Diffs of the changes:  (+2 -0)

 ARMISelDAGToDAG.cpp |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.89 
llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.90
--- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.89Mon Dec 11 19:03:11 2006
+++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Dec 12 08:03:29 2006
@@ -849,6 +849,8 @@
   case ISD::Constant: {
 uint32_t val = cast(N)->getValue();
 if(!isRotInt8Immediate(val)) {
+  if (isRotInt8Immediate(~val))
+return false; //use MVN
   Constant*C = ConstantInt::get(Type::UIntTy, val);
   int  alignment = 2;
   SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment);



___
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/mvn.ll

2006-12-12 Thread Rafael Espindola


Changes in directory llvm/test/Regression/CodeGen/ARM:

mvn.ll updated: 1.2 -> 1.3
---
Log message:

don't use "ordinary" addressing mode 1 when mvn is appropriate


---
Diffs of the changes:  (+12 -1)

 mvn.ll |   13 -
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/test/Regression/CodeGen/ARM/mvn.ll
diff -u llvm/test/Regression/CodeGen/ARM/mvn.ll:1.2 
llvm/test/Regression/CodeGen/ARM/mvn.ll:1.3
--- llvm/test/Regression/CodeGen/ARM/mvn.ll:1.2 Mon Dec 11 19:03:11 2006
+++ llvm/test/Regression/CodeGen/ARM/mvn.ll Tue Dec 12 08:03:29 2006
@@ -1,5 +1,5 @@
 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 5
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 6
 
 int %f1() {
 entry:
@@ -53,3 +53,14 @@
%tmp3not = xor int %tmp3, -1;  [#uses=1]
ret int %tmp3not
 }
+
+int %f9() {
+entry:
+%tmp4845 = add int 0, 0
+br  label %cond_true4848
+
+cond_true4848:  ; preds = %bb4835
+%tmp4851 = sub int -3, 0;  [#uses=1]
+%abc = add int %tmp4851, %tmp4845
+ret int %abc
+}



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp

2006-12-12 Thread Jim Laskey


Changes in directory llvm/utils/TableGen:

SubtargetEmitter.cpp updated: 1.21 -> 1.22
---
Log message:

Honor the command line specification for machine type.

---
Diffs of the changes:  (+1 -0)

 SubtargetEmitter.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/utils/TableGen/SubtargetEmitter.cpp
diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.21 
llvm/utils/TableGen/SubtargetEmitter.cpp:1.22
--- llvm/utils/TableGen/SubtargetEmitter.cpp:1.21   Thu Nov  2 19:28:12 2006
+++ llvm/utils/TableGen/SubtargetEmitter.cppTue Dec 12 10:07:33 2006
@@ -460,6 +460,7 @@
 "  const std::string &CPU) {\n"
 "  SubtargetFeatures Features(FS);\n"
 "  Features.setCPUIfNone(CPU);\n"
+"  setCPU(Features.getCPU());\n"
 "  uint32_t Bits =  Features.getBits(SubTypeKV, SubTypeKVSize,\n"
 "FeatureKV, FeatureKVSize);\n";
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-ggc4] -m64 needs to be treated as a power4

2006-12-12 Thread Jim Laskey


Index: rs6000/rs6000.h
===
--- rs6000/rs6000.h (revision 121250)
+++ rs6000/rs6000.h (working copy)
@@ -3613,7 +3613,6 @@
   { switch (rs6000_cpu) { \
 case PROCESSOR_RIOS1: \
 case PROCESSOR_RIOS2: \
-case PROCESSOR_RS64A: \
 case PROCESSOR_MPCCORE: \
 case PROCESSOR_PPC403: \
 case PROCESSOR_PPC405: \
@@ -3628,6 +3627,7 @@
 case PROCESSOR_PPC7400: F.setCPU("7400"); break; \
 case PROCESSOR_PPC7450: F.setCPU("7450"); break; \
 case PROCESSOR_PPC8540: F.setCPU("7450"); break; \
+case PROCESSOR_RS64A: \
 case PROCESSOR_POWER4: \
 case PROCESSOR_POWER5: F.setCPU("970"); break; /* FIXME: NOT  
RIGHT */ \

 } \



smime.p7s
Description: S/MIME cryptographic signature
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

2006-12-12 Thread Jim Laskey


Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.218 -> 1.219
---
Log message:

Honor the command line specification for machine type.

---
Diffs of the changes:  (+12 -1)

 PPCAsmPrinter.cpp |   13 -
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.218 
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.219
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.218 Thu Dec  7 16:21:48 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp   Tue Dec 12 10:07:33 2006
@@ -542,8 +542,19 @@
 
 
 bool DarwinAsmPrinter::doInitialization(Module &M) {
-  if (Subtarget.isGigaProcessor())
+  const std::string &CPU = Subtarget.getCPU();
+  
+  if (CPU != "generic")
+O << "\t.machine ppc" << CPU << "\n";
+  else if (Subtarget.isGigaProcessor())
 O << "\t.machine ppc970\n";
+  else if (Subtarget.isPPC64())
+O << "\t.machine ppc64\n";
+  else if (Subtarget.hasAltivec())
+O << "\t.machine ppc7400\n";
+  else
+O << "\t.machine ppc\n";
+ 
   AsmPrinter::doInitialization(M);
   
   // Darwin wants symbols to be quoted if they have complex names.



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Target/SubtargetFeature.h TargetSubtarget.h

2006-12-12 Thread Jim Laskey


Changes in directory llvm/include/llvm/Target:

SubtargetFeature.h updated: 1.7 -> 1.8
TargetSubtarget.h updated: 1.2 -> 1.3
---
Log message:

Honor the command line specification for machine type.

---
Diffs of the changes:  (+8 -0)

 SubtargetFeature.h |3 +++
 TargetSubtarget.h  |5 +
 2 files changed, 8 insertions(+)


Index: llvm/include/llvm/Target/SubtargetFeature.h
diff -u llvm/include/llvm/Target/SubtargetFeature.h:1.7 
llvm/include/llvm/Target/SubtargetFeature.h:1.8
--- llvm/include/llvm/Target/SubtargetFeature.h:1.7 Fri Mar 24 04:00:56 2006
+++ llvm/include/llvm/Target/SubtargetFeature.h Tue Dec 12 10:07:33 2006
@@ -81,6 +81,9 @@
   /// Set the CPU string.  Replaces previous setting.  Setting to "" clears 
CPU.
   void setCPU(const std::string &String);
   
+  /// Get the CPU string.
+  const std::string &getCPU() const { return Features[0]; }
+  
   /// Setting CPU string only if no string is set.
   void setCPUIfNone(const std::string &String);
   


Index: llvm/include/llvm/Target/TargetSubtarget.h
diff -u llvm/include/llvm/Target/TargetSubtarget.h:1.2 
llvm/include/llvm/Target/TargetSubtarget.h:1.3
--- llvm/include/llvm/Target/TargetSubtarget.h:1.2  Mon Jul 11 21:41:19 2005
+++ llvm/include/llvm/Target/TargetSubtarget.h  Tue Dec 12 10:07:33 2006
@@ -14,6 +14,8 @@
 #ifndef LLVM_TARGET_TARGETSUBTARGET_H
 #define LLVM_TARGET_TARGETSUBTARGET_H
 
+#include 
+
 namespace llvm {
 
 
//===--===//
@@ -25,10 +27,13 @@
 class TargetSubtarget {
   TargetSubtarget(const TargetSubtarget&);   // DO NOT IMPLEMENT
   void operator=(const TargetSubtarget&);  // DO NOT IMPLEMENT
+  std::string CPU; // CPU name.
 protected: // Can only create subclasses...
   TargetSubtarget();
 public:
   virtual ~TargetSubtarget();
+  void setCPU(const std::string &C) { CPU = C; }
+  const std::string &getCPU() const { return CPU; }
 };
 
 } // End llvm namespace



___
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/mvn.ll

2006-12-12 Thread Rafael Espindola


Changes in directory llvm/test/Regression/CodeGen/ARM:

mvn.ll updated: 1.3 -> 1.4
---
Log message:

more general matching of the MVN instruction


---
Diffs of the changes:  (+7 -1)

 mvn.ll |8 +++-
 1 files changed, 7 insertions(+), 1 deletion(-)


Index: llvm/test/Regression/CodeGen/ARM/mvn.ll
diff -u llvm/test/Regression/CodeGen/ARM/mvn.ll:1.3 
llvm/test/Regression/CodeGen/ARM/mvn.ll:1.4
--- llvm/test/Regression/CodeGen/ARM/mvn.ll:1.3 Tue Dec 12 08:03:29 2006
+++ llvm/test/Regression/CodeGen/ARM/mvn.ll Tue Dec 12 11:10:13 2006
@@ -1,5 +1,5 @@
 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 6
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 7
 
 int %f1() {
 entry:
@@ -64,3 +64,9 @@
 %abc = add int %tmp4851, %tmp4845
 ret int %abc
 }
+
+bool %f10(int %a) {
+entry:
+%tmp102 = seteq int -2, %a  ;  [#uses=1]
+ret bool %tmp102
+}



___
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 ARMInstrInfo.td

2006-12-12 Thread Rafael Espindola


Changes in directory llvm/lib/Target/ARM:

ARMISelDAGToDAG.cpp updated: 1.90 -> 1.91
ARMInstrInfo.td updated: 1.78 -> 1.79
---
Log message:

more general matching of the MVN instruction


---
Diffs of the changes:  (+11 -37)

 ARMISelDAGToDAG.cpp |   37 +++--
 ARMInstrInfo.td |   11 ---
 2 files changed, 11 insertions(+), 37 deletions(-)


Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.90 
llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.91
--- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.90Tue Dec 12 08:03:29 2006
+++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Dec 12 11:10:13 2006
@@ -849,13 +849,17 @@
   case ISD::Constant: {
 uint32_t val = cast(N)->getValue();
 if(!isRotInt8Immediate(val)) {
-  if (isRotInt8Immediate(~val))
-return false; //use MVN
-  Constant*C = ConstantInt::get(Type::UIntTy, val);
-  int  alignment = 2;
-  SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment);
-  SDOperandZ = CurDAG->getTargetConstant(0, MVT::i32);
-  SDNode  *n = CurDAG->getTargetNode(ARM::LDR,  MVT::i32, Addr, Z);
+  SDOperand Z = CurDAG->getTargetConstant(0, MVT::i32);
+  SDNode *n;
+  if (isRotInt8Immediate(~val)) {
+SDOperand C = CurDAG->getTargetConstant(~val,  MVT::i32);
+n   = CurDAG->getTargetNode(ARM::MVN,  MVT::i32, C, Z, Z);
+ } else {
+Constant*C = ConstantInt::get(Type::UIntTy, val);
+int  alignment = 2;
+SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment);
+n  = CurDAG->getTargetNode(ARM::LDR,  MVT::i32, Addr, Z);
+  }
   Arg= SDOperand(n, 0);
 } else
   Arg= CurDAG->getTargetConstant(val,MVT::i32);
@@ -887,25 +891,6 @@
   return true;
 }
 
-bool ARMDAGToDAGISel::SelectAddrMode1a(SDOperand Op,
-  SDOperand N,
-  SDOperand &Arg,
-  SDOperand &Shift,
-  SDOperand &ShiftType) {
-  if (N.getOpcode() != ISD::Constant)
-return false;
-
-  uint32_t val = ~cast(N)->getValue();
-  if(!isRotInt8Immediate(val))
-return false;
-
-  Arg   = CurDAG->getTargetConstant(val,MVT::i32);
-  Shift = CurDAG->getTargetConstant(0, MVT::i32);
-  ShiftType = CurDAG->getTargetConstant(ARMShift::LSL, MVT::i32);
-
-  return true;
-}
-
 bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand Op, SDOperand N,
   SDOperand &Arg, SDOperand &Offset) {
   //TODO: complete and cleanup!


Index: llvm/lib/Target/ARM/ARMInstrInfo.td
diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.78 
llvm/lib/Target/ARM/ARMInstrInfo.td:1.79
--- llvm/lib/Target/ARM/ARMInstrInfo.td:1.78Mon Dec 11 19:03:11 2006
+++ llvm/lib/Target/ARM/ARMInstrInfo.td Tue Dec 12 11:10:13 2006
@@ -18,11 +18,6 @@
   let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm);
 }
 
-def op_addr_mode1a : Operand {
-  let PrintMethod = "printAddrMode1";
-  let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm);
-}
-
 def op_addr_mode2 : Operand {
   let PrintMethod = "printAddrMode2";
   let MIOperandInfo = (ops ptr_rc, i32imm);
@@ -38,9 +33,6 @@
 def addr_mode1 : ComplexPattern;
 
-//Addressing Mode 1a: MVN hack
-def addr_mode1a : ComplexPattern;
-
 //Addressing Mode 2: Load and Store Word or Unsigned Byte
 def addr_mode2 : ComplexPattern;
 
@@ -201,9 +193,6 @@
 def MVN : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src),
"mvn $dst, $src", [(set IntRegs:$dst, (not 
addr_mode1:$src))]>;
 
-def MVN2: InstARM<(ops IntRegs:$dst, op_addr_mode1:$src),
-   "mvn $dst, $src", [(set IntRegs:$dst, 
addr_mode1a:$src)]>;
-
 def ADD : Addr1BinOp<"add",  add>;
 def ADCS: Addr1BinOp<"adcs", adde>;
 def ADDS: Addr1BinOp<"adds", addc>;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-test/MultiSource/Applications/oggenc/oggenc.c

2006-12-12 Thread Chris Lattner


Changes in directory llvm-test/MultiSource/Applications/oggenc:

oggenc.c updated: 1.3 -> 1.4
---
Log message:

this code is dead when the -s option is passed (which llvm-test does), but
it is dangerous, remove it.


---
Diffs of the changes:  (+1 -1)

 oggenc.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-test/MultiSource/Applications/oggenc/oggenc.c
diff -u llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.3 
llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.4
--- llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.3  Sun Jan 22 
12:41:05 2006
+++ llvm-test/MultiSource/Applications/oggenc/oggenc.c  Tue Dec 12 12:23:39 2006
@@ -790,7 +790,7 @@
if(opt.serial == 0)
{
/* We randomly pick a serial number. This is then incremented 
for each file */
-   srand(time(NULL));
+   srand(0);
opt.serial = rand();
}
 



___
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

2006-12-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.563 -> 1.564
---
Log message:

Fix regression on 400.perlbench last night.


---
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.563 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.564
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563   Tue Dec 12 
03:18:51 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 12:41:03 2006
@@ -3112,7 +3112,7 @@
 } else if (CastOp->getOpcode() == Instruction::Or) {
   // Change: and (cast (or X, C1) to T), C2
   // into  : trunc(C1)&C2 iff trunc(C1)&C2 == C2
-  Constant *C3 = ConstantExpr::getBitCast(AndCI, I.getType());
+  Constant *C3 = ConstantExpr::getTrunc(AndCI, I.getType());
   if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS)   // trunc(C1)&C2
 return ReplaceInstUsesWith(I, AndRHS);
 }



___
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

2006-12-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.564 -> 1.565
---
Log message:

this can be trunc or bitcast, per line 3092.


---
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.564 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.565
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.564   Tue Dec 12 
12:41:03 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 13:11:20 2006
@@ -3112,7 +3112,7 @@
 } else if (CastOp->getOpcode() == Instruction::Or) {
   // Change: and (cast (or X, C1) to T), C2
   // into  : trunc(C1)&C2 iff trunc(C1)&C2 == C2
-  Constant *C3 = ConstantExpr::getTrunc(AndCI, I.getType());
+  Constant *C3 = 
ConstantExpr::getTruncOrBitCast(AndCI,I.getType());
   if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS)   // trunc(C1)&C2
 return ReplaceInstUsesWith(I, AndRHS);
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2006-12-12 Thread Reid Spencer
On Tue, 2006-12-12 at 12:41 -0600, Chris Lattner wrote:
> 
> Changes in directory llvm/lib/Transforms/Scalar:
> 
> InstructionCombining.cpp updated: 1.563 -> 1.564
> ---
> Log message:
> 
> Fix regression on 400.perlbench last night.

Chris, Thanks. I should have SPEC2006 in a few weeks. Are you sure this
shouldn't be getTruncOrBitCast ?

Reid.

> 
> 
> ---
> 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.563 
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.564
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563 Tue Dec 12 
> 03:18:51 2006
> +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp   Tue Dec 12 
> 12:41:03 2006
> @@ -3112,7 +3112,7 @@
>  } else if (CastOp->getOpcode() == Instruction::Or) {
>// Change: and (cast (or X, C1) to T), C2
>// into  : trunc(C1)&C2 iff trunc(C1)&C2 == C2
> -  Constant *C3 = ConstantExpr::getBitCast(AndCI, I.getType());
> +  Constant *C3 = ConstantExpr::getTrunc(AndCI, I.getType());
>if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS)   // 
> trunc(C1)&C2
>  return ReplaceInstUsesWith(I, AndRHS);
>  }
> 
> 
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2006-12-12 Thread Chris Lattner

On Dec 12, 2006, at 11:07 AM, Reid Spencer wrote:

> On Tue, 2006-12-12 at 12:41 -0600, Chris Lattner wrote:
>>
>> Changes in directory llvm/lib/Transforms/Scalar:
>>
>> InstructionCombining.cpp updated: 1.563 -> 1.564
>> ---
>> Log message:
>>
>> Fix regression on 400.perlbench last night.
>
> Chris, Thanks. I should have SPEC2006 in a few weeks. Are you sure  
> this
> shouldn't be getTruncOrBitCast ?

You're right, fixed.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp

2006-12-12 Thread Jim Laskey


Changes in directory llvm/utils/TableGen:

SubtargetEmitter.cpp updated: 1.22 -> 1.23
---
Log message:

Rollback changes to take a different tack.

---
Diffs of the changes:  (+0 -1)

 SubtargetEmitter.cpp |1 -
 1 files changed, 1 deletion(-)


Index: llvm/utils/TableGen/SubtargetEmitter.cpp
diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.22 
llvm/utils/TableGen/SubtargetEmitter.cpp:1.23
--- llvm/utils/TableGen/SubtargetEmitter.cpp:1.22   Tue Dec 12 10:07:33 2006
+++ llvm/utils/TableGen/SubtargetEmitter.cppTue Dec 12 13:26:50 2006
@@ -460,7 +460,6 @@
 "  const std::string &CPU) {\n"
 "  SubtargetFeatures Features(FS);\n"
 "  Features.setCPUIfNone(CPU);\n"
-"  setCPU(Features.getCPU());\n"
 "  uint32_t Bits =  Features.getBits(SubTypeKV, SubTypeKVSize,\n"
 "FeatureKV, FeatureKVSize);\n";
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

2006-12-12 Thread Jim Laskey


Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.219 -> 1.220
---
Log message:

Rollback changes to take a different tack.

---
Diffs of the changes:  (+5 -0)

 PPCAsmPrinter.cpp |5 +
 1 files changed, 5 insertions(+)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.219 
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.220
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.219 Tue Dec 12 10:07:33 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp   Tue Dec 12 13:26:50 2006
@@ -542,6 +542,10 @@
 
 
 bool DarwinAsmPrinter::doInitialization(Module &M) {
+#if 1
+  if (Subtarget.isGigaProcessor())
+ O << "\t.machine ppc970\n";
+#else
   const std::string &CPU = Subtarget.getCPU();
   
   if (CPU != "generic")
@@ -554,6 +558,7 @@
 O << "\t.machine ppc7400\n";
   else
 O << "\t.machine ppc\n";
+#endif
  
   AsmPrinter::doInitialization(M);
   



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Target/TargetSubtarget.h

2006-12-12 Thread Jim Laskey


Changes in directory llvm/include/llvm/Target:

TargetSubtarget.h updated: 1.4 -> 1.5
---
Log message:

Remove unneeded include.

---
Diffs of the changes:  (+0 -2)

 TargetSubtarget.h |2 --
 1 files changed, 2 deletions(-)


Index: llvm/include/llvm/Target/TargetSubtarget.h
diff -u llvm/include/llvm/Target/TargetSubtarget.h:1.4 
llvm/include/llvm/Target/TargetSubtarget.h:1.5
--- llvm/include/llvm/Target/TargetSubtarget.h:1.4  Tue Dec 12 13:26:50 2006
+++ llvm/include/llvm/Target/TargetSubtarget.h  Tue Dec 12 13:36:53 2006
@@ -14,8 +14,6 @@
 #ifndef LLVM_TARGET_TARGETSUBTARGET_H
 #define LLVM_TARGET_TARGETSUBTARGET_H
 
-#include 
-
 namespace llvm {
 
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Target/SubtargetFeature.h TargetSubtarget.h

2006-12-12 Thread Jim Laskey


Changes in directory llvm/include/llvm/Target:

SubtargetFeature.h updated: 1.8 -> 1.9
TargetSubtarget.h updated: 1.3 -> 1.4
---
Log message:

Rollback changes to take a different tack.

---
Diffs of the changes:  (+0 -6)

 SubtargetFeature.h |3 ---
 TargetSubtarget.h  |3 ---
 2 files changed, 6 deletions(-)


Index: llvm/include/llvm/Target/SubtargetFeature.h
diff -u llvm/include/llvm/Target/SubtargetFeature.h:1.8 
llvm/include/llvm/Target/SubtargetFeature.h:1.9
--- llvm/include/llvm/Target/SubtargetFeature.h:1.8 Tue Dec 12 10:07:33 2006
+++ llvm/include/llvm/Target/SubtargetFeature.h Tue Dec 12 13:26:50 2006
@@ -81,9 +81,6 @@
   /// Set the CPU string.  Replaces previous setting.  Setting to "" clears 
CPU.
   void setCPU(const std::string &String);
   
-  /// Get the CPU string.
-  const std::string &getCPU() const { return Features[0]; }
-  
   /// Setting CPU string only if no string is set.
   void setCPUIfNone(const std::string &String);
   


Index: llvm/include/llvm/Target/TargetSubtarget.h
diff -u llvm/include/llvm/Target/TargetSubtarget.h:1.3 
llvm/include/llvm/Target/TargetSubtarget.h:1.4
--- llvm/include/llvm/Target/TargetSubtarget.h:1.3  Tue Dec 12 10:07:33 2006
+++ llvm/include/llvm/Target/TargetSubtarget.h  Tue Dec 12 13:26:50 2006
@@ -27,13 +27,10 @@
 class TargetSubtarget {
   TargetSubtarget(const TargetSubtarget&);   // DO NOT IMPLEMENT
   void operator=(const TargetSubtarget&);  // DO NOT IMPLEMENT
-  std::string CPU; // CPU name.
 protected: // Can only create subclasses...
   TargetSubtarget();
 public:
   virtual ~TargetSubtarget();
-  void setCPU(const std::string &C) { CPU = C; }
-  const std::string &getCPU() const { return CPU; }
 };
 
 } // End llvm namespace



___
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/LegalizeDAG.cpp

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.432 -> 1.433
---
Log message:

- When expanding a bit_convert whose src operand is also to be expanded and
its expansion result type is equal to the result type of the bit_convert,
e.g. (i64 bit_convert (f64 op)) if FP is not legal
returns the result of the expanded source operand.
- Store f32 / f64 may be expanded to a single store i32/i64.


---
Diffs of the changes:  (+16 -2)

 LegalizeDAG.cpp |   18 --
 1 files changed, 16 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.432 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.433
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.432 Mon Dec 11 23:22:21 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Tue Dec 12 13:53:13 2006
@@ -1735,7 +1735,7 @@
   }
 } else {
   ExpandOp(Node->getOperand(1), Lo, Hi);
-  IncrementSize = MVT::getSizeInBits(Hi.getValueType())/8;
+  IncrementSize = Hi.Val ? MVT::getSizeInBits(Hi.getValueType())/8 : 0;
 
   if (!TLI.isLittleEndian())
 std::swap(Lo, Hi);
@@ -1743,6 +1743,13 @@
 
 Lo = DAG.getStore(Tmp1, Lo, Tmp2, ST->getSrcValue(),
   ST->getSrcValueOffset());
+
+if (Hi.Val == NULL) {
+  // Must be int <-> float one-to-one expansion.
+  Result = Lo;
+  break;
+}
+
 Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2,
getIntPtrConstant(IncrementSize));
 assert(isTypeLegal(Tmp2.getValueType()) &&
@@ -4593,7 +4600,14 @@
 // f32 / f64 must be expanded to i32 / i64.
 if (VT == MVT::f32 || VT == MVT::f64) {
   Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0));
-  Hi = SDOperand();
+  break;
+}
+
+// If source operand will be expanded to the same type as VT, i.e.
+// i64 <- f64, i32 <- f32, expand the source operand instead.
+MVT::ValueType VT0 = Node->getOperand(0).getValueType();
+if (getTypeAction(VT0) == Expand && TLI.getTypeToTransformTo(VT0) == VT) {
+  ExpandOp(Node->getOperand(0), Lo, Hi);
   break;
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp

2006-12-12 Thread Jim Laskey


Changes in directory llvm/utils/TableGen:

SubtargetEmitter.cpp updated: 1.23 -> 1.24
---
Log message:

Ignore entries with blank names.

---
Diffs of the changes:  (+4 -2)

 SubtargetEmitter.cpp |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/utils/TableGen/SubtargetEmitter.cpp
diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.23 
llvm/utils/TableGen/SubtargetEmitter.cpp:1.24
--- llvm/utils/TableGen/SubtargetEmitter.cpp:1.23   Tue Dec 12 13:26:50 2006
+++ llvm/utils/TableGen/SubtargetEmitter.cppTue Dec 12 14:55:58 2006
@@ -87,7 +87,7 @@
  << "static llvm::SubtargetFeatureKV FeatureKV[] = {\n";
   
   // For each feature
-  for (unsigned i = 0, N = FeatureList.size(); i < N;) {
+  for (unsigned i = 0, N = FeatureList.size(); i < N; ++i) {
 // Next feature
 Record *Feature = FeatureList[i];
 
@@ -95,6 +95,8 @@
 std::string CommandLineName = Feature->getValueAsString("Name");
 std::string Desc = Feature->getValueAsString("Desc");
 
+if (CommandLineName.empty()) continue;
+
 // Emit as { "feature", "decription", feactureEnum }
 OS << "  { "
<< "\"" << CommandLineName << "\", "
@@ -103,7 +105,7 @@
<< " }";
 
 // Depending on 'if more in the list' emit comma
-if (++i < N) OS << ",";
+if ((i + 1) < N) OS << ",";
 
 OS << "\n";
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC.td PPCAsmPrinter.cpp PPCSubtarget.h

2006-12-12 Thread Jim Laskey


Changes in directory llvm/lib/Target/PowerPC:

PPC.td updated: 1.18 -> 1.19
PPCAsmPrinter.cpp updated: 1.220 -> 1.221
PPCSubtarget.h updated: 1.19 -> 1.20
---
Log message:

Honor cpu directive, take two.

---
Diffs of the changes:  (+81 -34)

 PPC.td|   56 +-
 PPCAsmPrinter.cpp |   37 +++
 PPCSubtarget.h|   22 +
 3 files changed, 81 insertions(+), 34 deletions(-)


Index: llvm/lib/Target/PowerPC/PPC.td
diff -u llvm/lib/Target/PowerPC/PPC.td:1.18 llvm/lib/Target/PowerPC/PPC.td:1.19
--- llvm/lib/Target/PowerPC/PPC.td:1.18 Fri Jun 16 12:34:12 2006
+++ llvm/lib/Target/PowerPC/PPC.td  Tue Dec 12 14:57:07 2006
@@ -19,6 +19,21 @@
 // PowerPC Subtarget features.
 //
  
+//===--===//
+// CPU Directives 
//
+//===--===//
+
+def Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">;
+def Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">;
+def Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
+def Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
+def Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
+def Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", 
"">;
+def Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">;
+def Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">;
+def Directive32  : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">;
+def Directive64  : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">;
+
 def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
 "Enable 64-bit instructions">;
 def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
@@ -44,26 +59,33 @@
 // PowerPC processors supported.
 //
 
-def : Processor<"generic", G3Itineraries, []>;
-def : Processor<"601", G3Itineraries, []>;
-def : Processor<"602", G3Itineraries, []>;
-def : Processor<"603", G3Itineraries, []>;
-def : Processor<"603e", G3Itineraries, []>;
-def : Processor<"603ev", G3Itineraries, []>;
-def : Processor<"604", G3Itineraries, []>;
-def : Processor<"604e", G3Itineraries, []>;
-def : Processor<"620", G3Itineraries, []>;
-def : Processor<"g3", G3Itineraries, []>;
-def : Processor<"7400", G4Itineraries, [FeatureAltivec]>;
-def : Processor<"g4", G4Itineraries, [FeatureAltivec]>;
-def : Processor<"7450", G4PlusItineraries, [FeatureAltivec]>;
-def : Processor<"g4+", G4PlusItineraries, [FeatureAltivec]>;
-def : Processor<"750", G3Itineraries, []>;
+def : Processor<"generic", G3Itineraries, [Directive32]>;
+def : Processor<"601", G3Itineraries, [Directive601]>;
+def : Processor<"602", G3Itineraries, [Directive602]>;
+def : Processor<"603", G3Itineraries, [Directive603]>;
+def : Processor<"603e", G3Itineraries, [Directive603]>;
+def : Processor<"603ev", G3Itineraries, [Directive603]>;
+def : Processor<"604", G3Itineraries, [Directive604]>;
+def : Processor<"604e", G3Itineraries, [Directive604]>;
+def : Processor<"620", G3Itineraries, [Directive620]>;
+def : Processor<"g3", G3Itineraries, [Directive7400]>;
+def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec]>;
+def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec]>;
+def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec]>;
+def : Processor<"g4+", G4PlusItineraries, [Directive750, FeatureAltivec]>;
+def : Processor<"750", G4Itineraries, [Directive750, FeatureAltivec]>;
 def : Processor<"970", G5Itineraries,
-  [FeatureAltivec, FeatureGPUL, FeatureFSqrt, FeatureSTFIWX,
+  [Directive970, FeatureAltivec,
+   FeatureGPUL, FeatureFSqrt, FeatureSTFIWX,
Feature64Bit /*, Feature64BitRegs */]>;
 def : Processor<"g5", G5Itineraries,
-  [FeatureAltivec, FeatureGPUL, FeatureFSqrt, FeatureSTFIWX,
+  [Directive970, FeatureAltivec,
+   FeatureGPUL, FeatureFSqrt, FeatureSTFIWX,
+   Feature64Bit /*, Feature64BitRegs */]>;
+def : Processor<"ppc", G3Itineraries, [Directive32]>;
+def : Processor<"ppc64", G5Itineraries,
+  [Directive64, FeatureAltivec,
+   FeatureGPUL, FeatureFSqrt, FeatureSTFIWX,
Feature64Bit /*, Feature64BitRegs */]>;
 
 


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.220 
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.221
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.220 Tue Dec 12 13:26:50 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp   Tue Dec 12 14:57:08 2006
@@ -542,23 +542,26 @@
 
 
 b

[llvm-commits] [llvm-commit][llvm-gcc4] Use new cpu directives.

2006-12-12 Thread Jim Laskey

Index: rs6000.h
===
--- rs6000.h(revision 121251)
+++ rs6000.h(working copy)
@@ -3616,7 +3616,7 @@
 case PROCESSOR_MPCCORE: \
 case PROCESSOR_PPC403: \
 case PROCESSOR_PPC405: \
-case PROCESSOR_PPC440: F.setCPU("generic"); break; \
+case PROCESSOR_PPC440: F.setCPU("ppc"); break; \
 case PROCESSOR_PPC601: F.setCPU("601"); break; \
 case PROCESSOR_PPC603: F.setCPU("603"); break; \
 case PROCESSOR_PPC604: F.setCPU("604"); break; \
@@ -3627,7 +3627,7 @@
 case PROCESSOR_PPC7400: F.setCPU("7400"); break; \
 case PROCESSOR_PPC7450: F.setCPU("7450"); break; \
 case PROCESSOR_PPC8540: F.setCPU("7450"); break; \
-case PROCESSOR_RS64A: \
+case PROCESSOR_RS64A: F.setCPU("ppc64"); break; \
 case PROCESSOR_POWER4: \
 case PROCESSOR_POWER5: F.setCPU("970"); break; /* FIXME: NOT  
RIGHT */ \

 } \



smime.p7s
Description: S/MIME cryptographic signature
___
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

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.328 -> 1.329
---
Log message:

Expand i32/i64 CopyToReg f32/f64 to BIT_CONVERT + CopyToReg.

---
Diffs of the changes:  (+3 -0)

 SelectionDAGISel.cpp |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.328 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.329
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.328Tue Dec 12 
01:27:38 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Tue Dec 12 15:21:32 2006
@@ -3942,6 +3942,9 @@
 else
   Op = DAG.getNode(ISD::ANY_EXTEND, DestVT, Op);
 return DAG.getCopyToReg(getRoot(), Reg, Op);
+  } else if (SrcVT == MVT::f32 || SrcVT == MVT::f64) {
+return DAG.getCopyToReg(getRoot(), Reg,
+DAG.getNode(ISD::BIT_CONVERT, DestVT, Op));
   } else  {
 // The src value is expanded into multiple registers.
 SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, DestVT,



___
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/LegalizeDAG.cpp

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.433 -> 1.434
---
Log message:

Expand ConstantFP to load from CP if float types are being expanded.

---
Diffs of the changes:  (+44 -27)

 LegalizeDAG.cpp |   71 ++--
 1 files changed, 44 insertions(+), 27 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.433 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.434
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.433 Tue Dec 12 13:53:13 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Tue Dec 12 15:32:44 2006
@@ -488,6 +488,37 @@
   }
 }
 
+/// ExpandConstantFP - Expands the ConstantFP node by spilling the constant to
+/// memory.
+static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, SelectionDAG &DAG,
+  TargetLowering &TLI) {
+  bool Extend = false;
+
+  // If a FP immediate is precise when represented as a float and if the
+  // target can do an extending load from float to double, we put it into
+  // the constant pool as a float, even if it's is statically typed as a
+  // double.
+  MVT::ValueType VT = CFP->getValueType(0);
+  bool isDouble = VT == MVT::f64;
+  ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy :
+  Type::FloatTy, CFP->getValue());
+  if (isDouble && CFP->isExactlyValue((float)CFP->getValue()) &&
+  // Only do this if the target has a native EXTLOAD instruction from f32.
+  TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) {
+LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC,Type::FloatTy));
+VT = MVT::f32;
+Extend = true;
+  }
+
+  SDOperand CPIdx = DAG.getConstantPool(LLVMC, TLI.getPointerTy());
+  if (Extend) {
+return DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(),
+  CPIdx, NULL, 0, MVT::f32);
+  } else {
+return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx, NULL, 0);
+  }
+}
+
 
 /// LegalizeOp - We know that the specified value has a legal type.
 /// Recursively ensure that the operands have legal types, then return the
@@ -775,33 +806,7 @@
   }
   // FALLTHROUGH
 case TargetLowering::Expand:
-  // Otherwise we need to spill the constant to memory.
-  bool Extend = false;
-
-  // If a FP immediate is precise when represented as a float and if the
-  // target can do an extending load from float to double, we put it into
-  // the constant pool as a float, even if it's is statically typed as a
-  // double.
-  MVT::ValueType VT = CFP->getValueType(0);
-  bool isDouble = VT == MVT::f64;
-  ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy :
- Type::FloatTy, CFP->getValue());
-  if (isDouble && CFP->isExactlyValue((float)CFP->getValue()) &&
-  // Only do this if the target has a native EXTLOAD instruction from
-  // f32.
-  TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) {
-LLVMC = 
cast(ConstantExpr::getFPTrunc(LLVMC,Type::FloatTy));
-VT = MVT::f32;
-Extend = true;
-  }
-
-  SDOperand CPIdx = DAG.getConstantPool(LLVMC, TLI.getPointerTy());
-  if (Extend) {
-Result = DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(),
-CPIdx, NULL, 0, MVT::f32);
-  } else {
-Result = DAG.getLoad(VT, DAG.getEntryNode(), CPIdx, NULL, 0);
-  }
+  Result = ExpandConstantFP(CFP, DAG, TLI);
 }
 break;
   }
@@ -4398,6 +4403,12 @@
 Hi = DAG.getConstant(Cst >> MVT::getSizeInBits(NVT), NVT);
 break;
   }
+  case ISD::ConstantFP: {
+ConstantFPSDNode *CFP = cast(Node);
+SDOperand Tmp = ExpandConstantFP(CFP, DAG, TLI);
+ExpandOp(Tmp, Lo, Hi);
+break;
+  }
   case ISD::BUILD_PAIR:
 // Return the operands.
 Lo = Node->getOperand(0);
@@ -4484,6 +4495,12 @@
 
 if (ExtType == ISD::NON_EXTLOAD) {
   Lo = DAG.getLoad(NVT, Ch, Ptr, LD->getSrcValue(), 
LD->getSrcValueOffset());
+  if (VT == MVT::f32 || VT == MVT::f64) {
+// f32->i32 or f64->i64 one to one expansion.
+// Remember that we legalized the chain.
+AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Lo.getValue(1)));
+break;
+  }
 
   // Increment the pointer to the other half.
   unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8;



___
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/LegalizeDAG.cpp

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.434 -> 1.435
---
Log message:

Soft fp FNEG, SINT_TO_FP, UINT_TO_FP libcall expansion.

---
Diffs of the changes:  (+20 -1)

 LegalizeDAG.cpp |   21 -
 1 files changed, 20 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.434 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.435
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.434 Tue Dec 12 15:32:44 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Tue Dec 12 15:51:17 2006
@@ -4902,7 +4902,10 @@
   case ISD::UDIV: Lo = ExpandLibCall("__udivdi3", Node, Hi); break;
   case ISD::SREM: Lo = ExpandLibCall("__moddi3" , Node, Hi); break;
   case ISD::UREM: Lo = ExpandLibCall("__umoddi3", Node, Hi); break;
-  
+
+  case ISD::FNEG:
+Lo = ExpandLibCall(((VT == MVT::f32) ? "__negsf2" : "__negdf2"), Node, Hi);
+break;
   case ISD::FADD:
 Lo = ExpandLibCall(((VT == MVT::f32) ? "__addsf3" : "__adddf3"), Node, Hi);
 break;
@@ -4921,6 +4924,22 @@
   case ISD::FP_ROUND:
 Lo = ExpandLibCall("__truncdfsf2", Node, Hi);
 break;
+  case ISD::SINT_TO_FP:
+if (Node->getOperand(0).getValueType() == MVT::i64)
+  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatdisf" : "__floatdidf"),
+ Node, Hi);
+else
+  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatsisf" : "__floatsidf"),
+ Node, Hi);
+break;
+  case ISD::UINT_TO_FP:
+if (Node->getOperand(0).getValueType() == MVT::i64)
+  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatundisf" : 
"__floatundidf"),
+ Node, Hi);
+else
+  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatunsisf" : 
"__floatunsidf"),
+ Node, Hi);
+break;
   }
 
   // Make sure the resultant values have been legalized themselves, unless this



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.75 -> 1.76
---
Log message:

Set top level manager.


---
Diffs of the changes:  (+10 -1)

 PassManager.cpp |   11 ++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.75 
llvm/lib/VMCore/PassManager.cpp:1.76
--- llvm/lib/VMCore/PassManager.cpp:1.75Fri Dec  8 19:11:34 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:02:16 2006
@@ -333,7 +333,6 @@
   std::vector ForcedLastUses;
 
   // Top level manager.
-  // TODO : Make it a reference.
   PMTopLevelManager *TPM;
 
 private:
@@ -814,6 +813,8 @@
 
 FunctionPassManager_New::FunctionPassManager_New(ModuleProvider *P) {
   FPM = new FunctionPassManagerImpl_New(0);
+  // FPM is the top level manager.
+  FPM->setTopLevelManager(FPM);
   MP = P;
 }
 
@@ -880,6 +881,8 @@
   // Create and add new manager
   activeBBPassManager = 
 new BasicBlockPassManager_New(getDepth() + 1);
+  // Inherit top level manager
+  activeBBPassManager->setTopLevelManager(this->getTopLevelManager());
   addPassToManager(activeBBPassManager, false);
   TPM->addOtherPassManager(activeBBPassManager);
 
@@ -1013,6 +1016,8 @@
   activeFunctionPassManager = 
 new FunctionPassManagerImpl_New(getDepth() + 1);
   addPassToManager(activeFunctionPassManager, false);
+  // Inherit top level manager
+  
activeFunctionPassManager->setTopLevelManager(this->getTopLevelManager());
   TPM->addOtherPassManager(activeFunctionPassManager);
   
   // Add pass into new manager. This time it must succeed.
@@ -1077,6 +1082,8 @@
 
   if (!activeManager || !activeManager->addPass(P)) {
 activeManager = new ModulePassManager_New(getDepth() + 1);
+// Inherit top level manager
+activeManager->setTopLevelManager(this->getTopLevelManager());
 
 // This top level manager is going to manage activeManager. 
 // Set up analysis resolver to connect them.
@@ -1108,6 +1115,8 @@
 /// Create new pass manager
 PassManager_New::PassManager_New() {
   PM = new PassManagerImpl_New(0);
+  // PM is the top level manager
+  PM->setTopLevelManager(PM);
 }
 
 /// add - Add a pass to the queue of passes to run.  This passes ownership of



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.76 -> 1.77
---
Log message:

Initialize AnalysisImpls for ImmutablePass.


---
Diffs of the changes:  (+4 -1)

 PassManager.cpp |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.76 
llvm/lib/VMCore/PassManager.cpp:1.77
--- llvm/lib/VMCore/PassManager.cpp:1.76Tue Dec 12 16:02:16 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:21:37 2006
@@ -399,7 +399,9 @@
   // top level manager. Set up analysis resolver to connect them.
   AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
   P->setResolver(AR);
+  initializeAnalysisImpl(P);
   addImmutablePass(IP);
+  recordAvailableAnalysis(IP);
 } 
 else 
   addPass(P);
@@ -504,7 +506,9 @@
   // top level manager. Set up analysis resolver to connect them.
   AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
   P->setResolver(AR);
+  initializeAnalysisImpl(P);
   addImmutablePass(IP);
+  recordAvailableAnalysis(IP);
 }
 else 
   addPass(P);
@@ -634,7 +638,6 @@
 
 // Take a note of analysis required and made available by this pass.
 // Remove the analysis not preserved by this pass
-initializeAnalysisImpl(P);
 removeNotPreservedAnalysis(P);
 recordAvailableAnalysis(P);
   }



___
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/LegalizeDAG.cpp

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.435 -> 1.436
---
Log message:

Expand FP constant to integers if FP types are not legal.

---
Diffs of the changes:  (+13 -7)

 LegalizeDAG.cpp |   20 +---
 1 files changed, 13 insertions(+), 7 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.435 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.436
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.435 Tue Dec 12 15:51:17 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Tue Dec 12 16:19:28 2006
@@ -488,10 +488,10 @@
   }
 }
 
-/// ExpandConstantFP - Expands the ConstantFP node by spilling the constant to
-/// memory.
-static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, SelectionDAG &DAG,
-  TargetLowering &TLI) {
+/// ExpandConstantFP - Expands the ConstantFP node by either converting it to
+/// integer constant or spilling the constant to memory.
+static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, bool ToMem,
+  SelectionDAG &DAG, TargetLowering &TLI) {
   bool Extend = false;
 
   // If a FP immediate is precise when represented as a float and if the
@@ -502,6 +502,13 @@
   bool isDouble = VT == MVT::f64;
   ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy :
   Type::FloatTy, CFP->getValue());
+  if (!ToMem) {
+double Val = LLVMC->getValue();
+return isDouble
+  ? DAG.getConstant(DoubleToBits(Val), MVT::i64)
+  : DAG.getConstant(FloatToBits(Val), MVT::i32);
+  }
+
   if (isDouble && CFP->isExactlyValue((float)CFP->getValue()) &&
   // Only do this if the target has a native EXTLOAD instruction from f32.
   TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) {
@@ -806,7 +813,7 @@
   }
   // FALLTHROUGH
 case TargetLowering::Expand:
-  Result = ExpandConstantFP(CFP, DAG, TLI);
+  Result = ExpandConstantFP(CFP, true, DAG, TLI);
 }
 break;
   }
@@ -4405,8 +4412,7 @@
   }
   case ISD::ConstantFP: {
 ConstantFPSDNode *CFP = cast(Node);
-SDOperand Tmp = ExpandConstantFP(CFP, DAG, TLI);
-ExpandOp(Tmp, Lo, Hi);
+Lo = ExpandConstantFP(CFP, false, DAG, TLI);
 break;
   }
   case ISD::BUILD_PAIR:



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.77 -> 1.78
---
Log message:

o s/OtherPassManagers/IndirectPassManagers
o Make IndirectPassManagers vector of PMDataManager *
o Move PMTopLevelManager implementation below all class declarations.



---
Diffs of the changes:  (+113 -95)

 PassManager.cpp |  208 ++--
 1 files changed, 113 insertions(+), 95 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.77 
llvm/lib/VMCore/PassManager.cpp:1.78
--- llvm/lib/VMCore/PassManager.cpp:1.77Tue Dec 12 16:21:37 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:35:25 2006
@@ -86,6 +86,8 @@
 
 namespace llvm {
 
+class PMDataManager;
+
 
//===--===//
 // PMTopLevelManager
 //
@@ -143,8 +145,8 @@
 
   // Add Manager into the list of managers that are not directly
   // maintained by this top level pass manager
-  void addOtherPassManager(Pass *Manager) {
-OtherPassManagers.push_back(Manager);
+  inline void addIndirectPassManager(PMDataManager *Manager) {
+IndirectPassManagers.push_back(Manager);
   }
 
 private:
@@ -154,7 +156,7 @@
 
   /// Collection of pass managers that are not directly maintained
   /// by this pass manager
-  std::vector OtherPassManagers;
+  std::vector IndirectPassManagers;
 
   // Map to keep track of last user of the analysis pass.
   // LastUser->second is the last user of Lastuser->first.
@@ -164,96 +166,6 @@
   std::vector ImmutablePasses;
 };
   
-/// Set pass P as the last user of the given analysis passes.
-void PMTopLevelManager::setLastUser(std::vector &AnalysisPasses, 
-Pass *P) {
-
-  for (std::vector::iterator I = AnalysisPasses.begin(),
- E = AnalysisPasses.end(); I != E; ++I) {
-Pass *AP = *I;
-LastUser[AP] = P;
-// If AP is the last user of other passes then make P last user of
-// such passes.
-for (std::map::iterator LUI = LastUser.begin(),
-   LUE = LastUser.end(); LUI != LUE; ++LUI) {
-  if (LUI->second == AP)
-LastUser[LUI->first] = P;
-}
-  }
-
-}
-
-/// Collect passes whose last user is P
-void PMTopLevelManager::collectLastUses(std::vector &LastUses,
-Pass *P) {
-   for (std::map::iterator LUI = LastUser.begin(),
-  LUE = LastUser.end(); LUI != LUE; ++LUI)
-  if (LUI->second == P)
-LastUses.push_back(LUI->first);
-}
-
-/// Schedule pass P for execution. Make sure that passes required by
-/// P are run before P is run. Update analysis info maintained by
-/// the manager. Remove dead passes. This is a recursive function.
-void PMTopLevelManager::schedulePass(Pass *P) {
-
-  // TODO : Allocate function manager for this pass, other wise required set
-  // may be inserted into previous function manager
-
-  AnalysisUsage AnUsage;
-  P->getAnalysisUsage(AnUsage);
-  const std::vector &RequiredSet = AnUsage.getRequiredSet();
-  for (std::vector::const_iterator I = RequiredSet.begin(),
- E = RequiredSet.end(); I != E; ++I) {
-
-Pass *AnalysisPass = findAnalysisPass(*I);
-if (!AnalysisPass) {
-  // Schedule this analysis run first.
-  AnalysisPass = (*I)->createPass();
-  schedulePass(AnalysisPass);
-}
-  }
-
-  // Now all required passes are available.
-  addTopLevelPass(P);
-}
-
-/// Find the pass that implements Analysis AID. Search immutable
-/// passes and all pass managers. If desired pass is not found
-/// then return NULL.
-Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
-
-  Pass *P = NULL;
-  for (std::vector::iterator I = ImmutablePasses.begin(),
- E = ImmutablePasses.end(); P == NULL && I != E; ++I) {
-const PassInfo *PI = (*I)->getPassInfo();
-if (PI == AID)
-  P = *I;
-
-// If Pass not found then check the interfaces implemented by Immutable 
Pass
-if (!P) {
-  const std::vector &ImmPI = 
-PI->getInterfacesImplemented();
-  for (unsigned Index = 0, End = ImmPI.size(); 
-   P == NULL && Index != End; ++Index)
-if (ImmPI[Index] == AID)
-  P = *I;
-}
-  }
-
-  // Check pass managers
-  for (std::vector::iterator I = PassManagers.begin(),
- E = PassManagers.end(); P == NULL && I != E; ++I)
-P = (*I)->getResolver()->getAnalysisToUpdate(AID, false);
-
-  // Check other pass managers
-  for (std::vector::iterator I = OtherPassManagers.begin(),
- E = OtherPassManagers.end(); P == NULL && I != E; ++I)
-P = (*I)->getResolver()->getAnalysisToUpdate(AID, false);
-
-  return P;
-}
-
 
//===--===//
 // PMDataManager
 
@@ -526,6 +438,99 @@
 } // End of llvm namespace
 
 
//===--===//
+// PMTopLevelManager implementation
+
+/// Set pass P as the last user 

[llvm-commits] [release_19] CVS: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp CallTargets.cpp CompleteBottomUp.cpp DataStructure.cpp DataStructureAA.cpp DataStructureOpt.cpp DataStructureStats.cpp Equiv

2006-12-12 Thread John Criswell


Changes in directory llvm-poolalloc/lib/DSA:

BottomUpClosure.cpp updated: 1.123 -> 1.123.2.1
CallTargets.cpp updated: 1.4 -> 1.4.2.1
CompleteBottomUp.cpp updated: 1.37 -> 1.37.2.1
DataStructure.cpp updated: 1.248 -> 1.248.2.1
DataStructureAA.cpp updated: 1.40 -> 1.40.2.1
DataStructureOpt.cpp updated: 1.13 -> 1.13.2.1
DataStructureStats.cpp updated: 1.21 -> 1.21.2.1
EquivClassGraphs.cpp updated: 1.49 -> 1.49.2.1
GraphChecker.cpp updated: 1.21 -> 1.21.2.1
Local.cpp updated: 1.158 -> 1.158.2.1
Makefile updated: 1.5 -> 1.5.2.1
Printer.cpp updated: 1.86 -> 1.86.2.1
Steensgaard.cpp updated: 1.65 -> 1.65.2.1
TopDownClosure.cpp updated: 1.92 -> 1.92.2.1
---
Log message:

Adjusted DSA to build within the llvm-poolalloc project.
Merged in the pool inference code.



---
Diffs of the changes:  (+701 -61)

 BottomUpClosure.cpp|   12 -
 CallTargets.cpp|6 
 CompleteBottomUp.cpp   |4 
 DataStructure.cpp  |  247 ++
 DataStructureAA.cpp|4 
 DataStructureOpt.cpp   |4 
 DataStructureStats.cpp |4 
 EquivClassGraphs.cpp   |4 
 GraphChecker.cpp   |4 
 Local.cpp  |  453 ++---
 Makefile   |4 
 Printer.cpp|6 
 Steensgaard.cpp|5 
 TopDownClosure.cpp |5 
 14 files changed, 701 insertions(+), 61 deletions(-)


Index: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp
diff -u llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123 
llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123.2.1
--- llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123Mon Oct 23 14:55:24 2006
+++ llvm-poolalloc/lib/DSA/BottomUpClosure.cpp  Tue Dec 12 16:42:41 2006
@@ -14,8 +14,8 @@
 //
 
//===--===//
 #define DEBUG_TYPE "bu_dsa"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
 #include "llvm/Module.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/ADT/Statistic.h"
@@ -590,11 +590,11 @@
 ++NumBUInlines;
   } else {
 if (!Printed)
-  std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
-std::cerr << "  calls " << CalledFuncs.size()
+  DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n");
+  DEBUG(std::cerr << "  calls " << CalledFuncs.size()
   << " fns from site: " << CS.getCallSite().getInstruction()
-  << "  " << *CS.getCallSite().getInstruction();
-std::cerr << "   Fns =";
+  << "  " << *CS.getCallSite().getInstruction());
+DEBUG(std::cerr << "   Fns =");
 unsigned NumPrinted = 0;
 
 for (std::vector::iterator I = CalledFuncs.begin(),


Index: llvm-poolalloc/lib/DSA/CallTargets.cpp
diff -u llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4 
llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4.2.1
--- llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4  Sun Aug 27 17:31:12 2006
+++ llvm-poolalloc/lib/DSA/CallTargets.cpp  Tue Dec 12 16:42:41 2006
@@ -19,9 +19,9 @@
 
 #include "llvm/Module.h"
 #include "llvm/Instructions.h"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
-#include "llvm/Analysis/DataStructure/CallTargets.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
+#include "dsa/CallTargets.h"
 #include "llvm/ADT/Statistic.h"
 #include 
 #include "llvm/Constants.h"


Index: llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp
diff -u llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37 
llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37.2.1
--- llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37Fri Oct 13 12:38:22 2006
+++ llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp Tue Dec 12 16:42:41 2006
@@ -14,9 +14,9 @@
 
//===--===//
 
 #define DEBUG_TYPE "cbudatastructure"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
+#include "dsa/DataStructure.h"
 #include "llvm/Module.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DSGraph.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/SCCIterator.h"
 #include "llvm/ADT/Statistic.h"


Index: llvm-poolalloc/lib/DSA/DataStructure.cpp
diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248 
llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.1
--- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248  Thu Nov  2 14:25:49 2006
+++ llvm-poolalloc/lib/DSA/DataStructure.cppTue Dec 12 16:42:42 2006
@@ -1,3 +1,4 @@
+#define JTC 0
 //===- DataStructure.cpp - Implement the core data structure analysis 
-===//
 //
 // The LLVM Compiler Infrastructure
@@ -11,7 +12,9 @@
 //
 
//===--===//
 
-#include "llvm/Analysis/DataStructure/DSGraphTraits.h"
+#include "dsa/DSGraphTraits.h"
+#include "dsa/DataStructure.h"
+#include "d

[llvm-commits] [release_19] CVS: llvm-poolalloc/include/dsa/DSGraph.h DSNode.h DataStructure.h

2006-12-12 Thread John Criswell


Changes in directory llvm-poolalloc/include/dsa:

DSGraph.h updated: 1.110 -> 1.110.2.1
DSNode.h updated: 1.58 -> 1.58.2.1
DataStructure.h updated: 1.98 -> 1.98.2.1
---
Log message:

Adjusted DSA to build within the llvm-poolalloc project.
Merged in the pool inference code.


---
Diffs of the changes:  (+111 -7)

 DSGraph.h   |  100 +---
 DSNode.h|9 -
 DataStructure.h |9 -
 3 files changed, 111 insertions(+), 7 deletions(-)


Index: llvm-poolalloc/include/dsa/DSGraph.h
diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.110 
llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.1
--- llvm-poolalloc/include/dsa/DSGraph.h:1.110  Wed Feb 22 10:23:42 2006
+++ llvm-poolalloc/include/dsa/DSGraph.hTue Dec 12 16:42:37 2006
@@ -19,9 +19,13 @@
 #include "llvm/ADT/hash_map"
 #include "llvm/ADT/EquivalenceClasses.h"
 #include 
-
+#include 
+#include 
+#define LLVA_KERNEL 1
 namespace llvm {
 
+  //typedef map PoolDescriptorMapType;
+
 class GlobalValue;
 
 
//===--===//
@@ -170,6 +174,62 @@
 };
 
 
+#ifdef LLVA_KERNEL
+class MetaPool;
+class MetaPoolHandle {
+  MetaPool *Rep;
+  Instruction * Creator;
+public:
+  MetaPoolHandle(MetaPool *mp, Instruction * Maker = 0);
+  
+  MetaPool *getMetaPool() {
+return Rep;
+  }
+  void setMetaPool(MetaPool *v) {
+Rep = v;
+  }
+  ~MetaPoolHandle() {
+//do nothing for now
+  }
+  const std::string &getName();
+  Value *getMetaPoolValue();
+  void merge(MetaPoolHandle *other);
+};
+
+  class MetaPool {
+Value *MPD;
+hash_set HandleSet;
+
+  public:
+MetaPool(Value *mpd) : MPD(mpd) {
+}
+void addMetaPoolHandles(hash_set & mpHS) {
+  HandleSet.insert(mpHS.begin(), mpHS.end());
+}
+hash_set& getHandleSet() {
+  return HandleSet;
+}
+Value * getMetaPoolValue() {
+  return MPD;
+}
+void setMetaPoolValue(Value *V) {
+  MPD = V;
+}
+void insert(MetaPoolHandle *mph) {
+  HandleSet.insert(mph);
+}
+const std::string& getName() {
+  return MPD->getName();
+}
+~MetaPool() {
+  HandleSet.clear();
+}
+  };
+
+#endif
+  
+
+  
 
//===--===//
 /// DSGraph - The graph that represents a function.
 ///
@@ -219,13 +279,18 @@
   /// constructed for.
   const TargetData &TD;
 
+#ifdef LLVA_KERNEL
+  hash_map PoolDescriptors;
+#endif  
+
+  
+
   void operator=(const DSGraph &); // DO NOT IMPLEMENT
   DSGraph(const DSGraph&); // DO NOT IMPLEMENT
 public:
   // Create a new, empty, DSGraph.
   DSGraph(EquivalenceClasses &ECs, const TargetData &td)
-: GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) {}
-
+: GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) { }
   // Compute the local DSGraph
   DSGraph(EquivalenceClasses &ECs, const TargetData &TD,
   Function &F, DSGraph *GlobalsGraph);
@@ -238,13 +303,38 @@
   // source.  You need to set a new GlobalsGraph with the setGlobalsGraph
   // method.
   //
-  DSGraph(const DSGraph &DSG, EquivalenceClasses &ECs,
+  DSGraph( DSGraph &DSG, EquivalenceClasses &ECs,
   unsigned CloneFlags = 0);
   ~DSGraph();
 
   DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
   void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
 
+#ifdef LLVA_KERNEL
+#if 1
+  hash_map& getPoolDescriptorsMap() {
+return PoolDescriptors;
+  }
+  MetaPoolHandle *getPoolForNode(const DSNode *N) {
+if (PoolDescriptors.count(N) > 0) {
+  return PoolDescriptors[N];
+}
+return 0;
+  }
+#else
+  hash_map& getPoolDescriptorsMap() {
+return PoolDescriptors;
+  }
+  MetaPoolHandle *getPoolForNode(const DSNodeHandle *N) {
+if (PoolDescriptors.count(N) > 0) {
+  return PoolDescriptors[N];
+}
+return 0;
+  }
+#endif
+
+#endif  
+
   /// getGlobalECs - Return the set of equivalence classes that the global
   /// variables in the program form.
   EquivalenceClasses &getGlobalECs() const {
@@ -469,7 +559,7 @@
   ///
   /// The CloneFlags member controls various aspects of the cloning process.
   ///
-  void cloneInto(const DSGraph &G, unsigned CloneFlags = 0);
+  void cloneInto(DSGraph &G, unsigned CloneFlags = 0);
 
   /// getFunctionArgumentsForCall - Given a function that is currently in this
   /// graph, return the DSNodeHandles that correspond to the pointer-compatible


Index: llvm-poolalloc/include/dsa/DSNode.h
diff -u llvm-poolalloc/include/dsa/DSNode.h:1.58 
llvm-poolalloc/include/dsa/DSNode.h:1.58.2.1
--- llvm-poolalloc/include/dsa/DSNode.h:1.58Fri May 19 14:07:54 2006
+++ llvm-poolalloc/include/dsa/DSNode.h Tue Dec 12 16:42:37 2006
@@ -91,8 +91,9 @@
 Read= 1 << 6,   // This node is read in this context
 
 Array   = 1 << 7,   // This node is treated like an array
+External= 1 << 8,   // This node comes from an external source
 //#ifnd

[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.79 -> 1.80
---
Log message:

findAnalysisPass().

First search all available passes before searching ImmutablePasses.


---
Diffs of the changes:  (+13 -13)

 PassManager.cpp |   26 +-
 1 files changed, 13 insertions(+), 13 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.79 
llvm/lib/VMCore/PassManager.cpp:1.80
--- llvm/lib/VMCore/PassManager.cpp:1.79Tue Dec 12 16:47:13 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:50:05 2006
@@ -512,6 +512,19 @@
 Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
 
   Pass *P = NULL;
+  // Check pass managers
+  for (std::vector::iterator I = PassManagers.begin(),
+ E = PassManagers.end(); P == NULL && I != E; ++I) {
+PMDataManager *PMD = dynamic_cast(*I);
+assert(PMD && "This is not a PassManager");
+P = PMD->findAnalysisPass(AID, false);
+  }
+
+  // Check other pass managers
+  for (std::vector::iterator I = IndirectPassManagers.begin(),
+ E = IndirectPassManagers.end(); P == NULL && I != E; ++I)
+P = (*I)->findAnalysisPass(AID, false);
+
   for (std::vector::iterator I = ImmutablePasses.begin(),
  E = ImmutablePasses.end(); P == NULL && I != E; ++I) {
 const PassInfo *PI = (*I)->getPassInfo();
@@ -529,19 +542,6 @@
 }
   }
 
-  // Check pass managers
-  for (std::vector::iterator I = PassManagers.begin(),
- E = PassManagers.end(); P == NULL && I != E; ++I) {
-PMDataManager *PMD = dynamic_cast(*I);
-assert(PMD && "This is not a PassManager");
-P = PMD->findAnalysisPass(AID, false);
-  }
-
-  // Check other pass managers
-  for (std::vector::iterator I = IndirectPassManagers.begin(),
- E = IndirectPassManagers.end(); P == NULL && I != E; ++I)
-P = (*I)->findAnalysisPass(AID, false);
-
   return P;
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.80 -> 1.81
---
Log message:

Maintain ImmutablePasses list at top level only. Do not make them
directly available to individual managers.


---
Diffs of the changes:  (+0 -6)

 PassManager.cpp |6 --
 1 files changed, 6 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.80 
llvm/lib/VMCore/PassManager.cpp:1.81
--- llvm/lib/VMCore/PassManager.cpp:1.80Tue Dec 12 16:50:05 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:53:40 2006
@@ -200,12 +200,6 @@
   void initializeAnalysisInfo() { 
 ForcedLastUses.clear();
 AvailableAnalysis.clear();
-
-// Include immutable passes into AvailableAnalysis vector.
-std::vector &ImmutablePasses =  TPM->getImmutablePasses();
-for (std::vector::iterator I = ImmutablePasses.begin(),
-   E = ImmutablePasses.end(); I != E; ++I) 
-  recordAvailableAnalysis(*I);
   }
 
   /// Populate RequiredPasses with the analysis pass that are required by



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.78 -> 1.79
---
Log message:

Fix thinko.
While searching for a analysis in a pass manager, do not search it into
pass manager's manager.


---
Diffs of the changes:  (+18 -3)

 PassManager.cpp |   21 ++---
 1 files changed, 18 insertions(+), 3 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.78 
llvm/lib/VMCore/PassManager.cpp:1.79
--- llvm/lib/VMCore/PassManager.cpp:1.78Tue Dec 12 16:35:25 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:47:13 2006
@@ -260,6 +260,9 @@
   unsigned Depth;
 };
 
+//===--===//
+// BasicBlockPassManager_New
+//
 /// BasicBlockPassManager_New manages BasicBlockPass. It batches all the
 /// pass together and sequence them to process one basic block before
 /// processing next basic block.
@@ -288,6 +291,9 @@
 
 };
 
+//===--===//
+// FunctionPassManagerImpl_New
+//
 /// FunctionPassManagerImpl_New manages FunctionPasses and 
BasicBlockPassManagers.
 /// It batches all function passes and basic block pass managers together and
 /// sequence them to process one function at a time before processing next
@@ -356,6 +362,9 @@
   BasicBlockPassManager_New *activeBBPassManager;
 };
 
+//===--===//
+// ModulePassManager_New
+//
 /// ModulePassManager_New manages ModulePasses and function pass managers.
 /// It batches all Module passes  passes and function pass managers together 
and
 /// sequence them to process one module.
@@ -384,7 +393,10 @@
   FunctionPassManagerImpl_New *activeFunctionPassManager;
 };
 
-/// PassManager_New manages ModulePassManagers
+//===--===//
+// PassManagerImpl_New
+//
+/// PassManagerImpl_New manages ModulePassManagers
 class PassManagerImpl_New : public Pass,
 public PMDataManager,
 public PMTopLevelManager {
@@ -519,8 +531,11 @@
 
   // Check pass managers
   for (std::vector::iterator I = PassManagers.begin(),
- E = PassManagers.end(); P == NULL && I != E; ++I)
-P = (*I)->getResolver()->getAnalysisToUpdate(AID, false);
+ E = PassManagers.end(); P == NULL && I != E; ++I) {
+PMDataManager *PMD = dynamic_cast(*I);
+assert(PMD && "This is not a PassManager");
+P = PMD->findAnalysisPass(AID, false);
+  }
 
   // Check other pass managers
   for (std::vector::iterator I = IndirectPassManagers.begin(),



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [release_19] CVS: llvm-poolalloc/lib/Makefile

2006-12-12 Thread John Criswell


Changes in directory llvm-poolalloc/lib:

Makefile updated: 1.3 -> 1.3.2.1
---
Log message:

Build DSA and Pool Allocation in parallel.


---
Diffs of the changes:  (+1 -1)

 Makefile |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-poolalloc/lib/Makefile
diff -u llvm-poolalloc/lib/Makefile:1.3 llvm-poolalloc/lib/Makefile:1.3.2.1
--- llvm-poolalloc/lib/Makefile:1.3 Wed May 18 14:56:25 2005
+++ llvm-poolalloc/lib/Makefile Tue Dec 12 16:48:36 2006
@@ -6,6 +6,6 @@
 #
 # List all of the subdirectories that we will compile.
 #
-DIRS=PoolAllocate
+PARALLEL_DIRS=DSA PoolAllocate
 
 include $(LEVEL)/Makefile.common



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.82 -> 1.83
---
Log message:

Initialize activeManager.


---
Diffs of the changes:  (+3 -1)

 PassManager.cpp |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.82 
llvm/lib/VMCore/PassManager.cpp:1.83
--- llvm/lib/VMCore/PassManager.cpp:1.82Tue Dec 12 16:56:36 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:57:43 2006
@@ -395,7 +395,9 @@
 
 public:
 
-  PassManagerImpl_New(int D) : PMDataManager(D) {}
+  PassManagerImpl_New(int D) : PMDataManager(D) {
+activeManager = NULL;
+  }
 
   /// add - Add a pass to the queue of passes to run.  This passes ownership of
   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.81 -> 1.82
---
Log message:

Remove unused constructor.


---
Diffs of the changes:  (+0 -2)

 PassManager.cpp |2 --
 1 files changed, 2 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.81 
llvm/lib/VMCore/PassManager.cpp:1.82
--- llvm/lib/VMCore/PassManager.cpp:1.81Tue Dec 12 16:53:40 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:56:36 2006
@@ -296,8 +296,6 @@
 public PMDataManager,
 public PMTopLevelManager {
 public:
-  FunctionPassManagerImpl_New(ModuleProvider *P, int D) :
-PMDataManager(D) { /* TODO */ }
   FunctionPassManagerImpl_New(int D) : PMDataManager(D) { 
 activeBBPassManager = NULL;
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.84 -> 1.85
---
Log message:

collectRequiredAnalysisPasses().

Include RequiredTrainsitiveSet also.


---
Diffs of the changes:  (+8 -0)

 PassManager.cpp |8 
 1 files changed, 8 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.84 
llvm/lib/VMCore/PassManager.cpp:1.85
--- llvm/lib/VMCore/PassManager.cpp:1.84Tue Dec 12 17:07:44 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:09:32 2006
@@ -678,6 +678,14 @@
 assert (AnalysisPass && "Analysis pass is not available");
 RP.push_back(AnalysisPass);
   }
+
+  const std::vector &IDs = AnUsage.getRequiredTransitiveSet();
+  for (std::vector::const_iterator I = IDs.begin(),
+ E = IDs.end(); I != E; ++I) {
+Pass *AnalysisPass = findAnalysisPass(*I, true);
+assert (AnalysisPass && "Analysis pass is not available");
+RP.push_back(AnalysisPass);
+  }
 }
 
 // All Required analyses should be available to the pass as it runs!  Here



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.83 -> 1.84
---
Log message:

removeNotPreservedAnalysis().

Do not remove ImmutablePass from the list.


---
Diffs of the changes:  (+8 -4)

 PassManager.cpp |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.83 
llvm/lib/VMCore/PassManager.cpp:1.84
--- llvm/lib/VMCore/PassManager.cpp:1.83Tue Dec 12 16:57:43 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:07:44 2006
@@ -580,13 +580,17 @@
 
   const std::vector &PreservedSet = AnUsage.getPreservedSet();
   for (std::map::iterator I = AvailableAnalysis.begin(),
- E = AvailableAnalysis.end(); I != E; ++I ) {
+ E = AvailableAnalysis.end(); I != E; ) {
 if (std::find(PreservedSet.begin(), PreservedSet.end(), I->first) == 
 PreservedSet.end()) {
   // Remove this analysis
-  std::map::iterator J = I++;
-  AvailableAnalysis.erase(J);
-}
+  if (!dynamic_cast(I->second)) {
+std::map::iterator J = I++;
+AvailableAnalysis.erase(J);
+  } else
+++I;
+} else
+  ++I;
   }
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.86 -> 1.87
---
Log message:

Do not runOnFunction on external functions.


---
Diffs of the changes:  (+7 -0)

 PassManager.cpp |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.86 
llvm/lib/VMCore/PassManager.cpp:1.87
--- llvm/lib/VMCore/PassManager.cpp:1.86Tue Dec 12 17:13:09 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:15:28 2006
@@ -761,6 +761,9 @@
 bool
 BasicBlockPassManager_New::runOnFunction(Function &F) {
 
+  if (F.isExternal())
+return false;
+
   bool Changed = doInitialization(F);
   initializeAnalysisInfo();
 
@@ -972,6 +975,10 @@
 bool FunctionPassManagerImpl_New::runOnFunction(Function &F) {
 
   bool Changed = false;
+
+  if (F.isExternal())
+return false;
+
   initializeAnalysisInfo();
 
   for (std::vector::iterator itr = passVectorBegin(),



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [release_19] CVS: llvm-poolalloc/include/dsa/DSGraph.h DataStructure.h

2006-12-12 Thread John Criswell


Changes in directory llvm-poolalloc/include/dsa:

DSGraph.h updated: 1.110.2.1 -> 1.110.2.2
DataStructure.h updated: 1.98.2.1 -> 1.98.2.2
---
Log message:

Do not build with these enabled by default; let configure script enable
them.


---
Diffs of the changes:  (+0 -3)

 DSGraph.h   |1 -
 DataStructure.h |2 --
 2 files changed, 3 deletions(-)


Index: llvm-poolalloc/include/dsa/DSGraph.h
diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.1 
llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.2
--- llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.1  Tue Dec 12 16:42:37 2006
+++ llvm-poolalloc/include/dsa/DSGraph.hTue Dec 12 17:20:47 2006
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#define LLVA_KERNEL 1
 namespace llvm {
 
   //typedef map PoolDescriptorMapType;


Index: llvm-poolalloc/include/dsa/DataStructure.h
diff -u llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.1 
llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.2
--- llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.1 Tue Dec 12 16:42:37 2006
+++ llvm-poolalloc/include/dsa/DataStructure.h  Tue Dec 12 17:20:47 2006
@@ -37,8 +37,6 @@
 FunctionPass *createDataStructureStatsPass();
 FunctionPass *createDataStructureGraphCheckerPass();
 
-#define LLVA_KERNEL 1
-
 // FIXME: move this stuff to a private header
 namespace DataStructureAnalysis {
   /// isPointerType - Return true if this first class type is big enough to 
hold



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.85 -> 1.86
---
Log message:

Initialize AnalysisImpls for each pass before executing the pass.


---
Diffs of the changes:  (+3 -3)

 PassManager.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.85 
llvm/lib/VMCore/PassManager.cpp:1.86
--- llvm/lib/VMCore/PassManager.cpp:1.85Tue Dec 12 17:09:32 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:13:09 2006
@@ -768,7 +768,7 @@
 for (std::vector::iterator itr = passVectorBegin(),
e = passVectorEnd(); itr != e; ++itr) {
   Pass *P = *itr;
-  
+  initializeAnalysisImpl(P);
   BasicBlockPass *BP = dynamic_cast(P);
   Changed |= BP->runOnBasicBlock(*I);
   removeNotPreservedAnalysis(P);
@@ -977,7 +977,7 @@
   for (std::vector::iterator itr = passVectorBegin(),
  e = passVectorEnd(); itr != e; ++itr) {
 Pass *P = *itr;
-
+initializeAnalysisImpl(P);
 FunctionPass *FP = dynamic_cast(P);
 Changed |= FP->runOnFunction(F);
 removeNotPreservedAnalysis(P);
@@ -1104,7 +1104,7 @@
   for (std::vector::iterator itr = passVectorBegin(),
  e = passVectorEnd(); itr != e; ++itr) {
 Pass *P = *itr;
-
+initializeAnalysisImpl(P);
 ModulePass *MP = dynamic_cast(P);
 Changed |= MP->runOnModule(M);
 removeNotPreservedAnalysis(P);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.87 -> 1.88
---
Log message:

FunctionPassManager()

Set AnalysisResolver_New and add FPM to PassManagers list.


---
Diffs of the changes:  (+6 -0)

 PassManager.cpp |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.87 
llvm/lib/VMCore/PassManager.cpp:1.88
--- llvm/lib/VMCore/PassManager.cpp:1.87Tue Dec 12 17:15:28 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:27:37 2006
@@ -847,6 +847,12 @@
   FPM = new FunctionPassManagerImpl_New(0);
   // FPM is the top level manager.
   FPM->setTopLevelManager(FPM);
+
+  PMDataManager *PMD = dynamic_cast(FPM);
+  AnalysisResolver_New *AR = new AnalysisResolver_New(*PMD);
+  FPM->setResolver(AR);
+  
+  FPM->addPassManager(FPM);
   MP = P;
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Constants.h

2006-12-12 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.106 -> 1.107
---
Log message:

Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


---
Diffs of the changes:  (+12 -12)

 Constants.h |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.106 llvm/include/llvm/Constants.h:1.107
--- llvm/include/llvm/Constants.h:1.106 Mon Dec 11 18:51:07 2006
+++ llvm/include/llvm/Constants.h   Tue Dec 12 17:36:14 2006
@@ -514,18 +514,18 @@
 
   /// Cast constant expr
   ///
-  static Constant *getTrunc  (Constant *C, const Type *Ty);
-  static Constant *getSignExtend (Constant *C, const Type *Ty);
-  static Constant *getZeroExtend (Constant *C, const Type *Ty);
-  static Constant *getFPTrunc(Constant *C, const Type *Ty);
-  static Constant *getFPExtend   (Constant *C, const Type *Ty);
-  static Constant *getUIToFP (Constant *C, const Type *Ty);
-  static Constant *getSIToFP (Constant *C, const Type *Ty);
-  static Constant *getFPToUI (Constant *C, const Type *Ty);
-  static Constant *getFPToSI (Constant *C, const Type *Ty);
-  static Constant *getPtrToInt   (Constant *C, const Type *Ty);
-  static Constant *getIntToPtr   (Constant *C, const Type *Ty);
-  static Constant *getBitCast(Constant *C, const Type *Ty);
+  static Constant *getTrunc   (Constant *C, const Type *Ty);
+  static Constant *getSExt(Constant *C, const Type *Ty);
+  static Constant *getZExt(Constant *C, const Type *Ty);
+  static Constant *getFPTrunc (Constant *C, const Type *Ty);
+  static Constant *getFPExtend(Constant *C, const Type *Ty);
+  static Constant *getUIToFP  (Constant *C, const Type *Ty);
+  static Constant *getSIToFP  (Constant *C, const Type *Ty);
+  static Constant *getFPToUI  (Constant *C, const Type *Ty);
+  static Constant *getFPToSI  (Constant *C, const Type *Ty);
+  static Constant *getPtrToInt(Constant *C, const Type *Ty);
+  static Constant *getIntToPtr(Constant *C, const Type *Ty);
+  static Constant *getBitCast (Constant *C, const Type *Ty);
 
   // @brief Convenience function for getting one of the casting operations
   // using a CastOps opcode.



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.113 -> 1.114
Constants.cpp updated: 1.186 -> 1.187
---
Log message:

Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


---
Diffs of the changes:  (+10 -11)

 ConstantFolding.cpp |9 -
 Constants.cpp   |   12 ++--
 2 files changed, 10 insertions(+), 11 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.113 
llvm/lib/VMCore/ConstantFolding.cpp:1.114
--- llvm/lib/VMCore/ConstantFolding.cpp:1.113   Mon Dec 11 15:27:28 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Tue Dec 12 17:36:14 2006
@@ -743,8 +743,7 @@
 (SrcEltTy->isFloatingPoint() && DstEltTy->isFloatingPoint())) {
   for (unsigned i = 0; i != SrcNumElts; ++i)
 Result.push_back(
-  ConstantExpr::getCast(Instruction::BitCast, CP->getOperand(i), 
-DstEltTy));
+  ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy));
   return ConstantPacked::get(Result);
 }
 
@@ -1148,11 +1147,11 @@
   // Ok, we have two differing integer indices.  Sign extend them to be the 
same
   // type.  Long is always big enough, so we use it.
   if (C1->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
-C1 = ConstantExpr::getSignExtend(C1, Type::LongTy);
+C1 = ConstantExpr::getSExt(C1, Type::LongTy);
   else
 C1 = ConstantExpr::getBitCast(C1, Type::LongTy);
   if (C2->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
-C2 = ConstantExpr::getSignExtend(C2, Type::LongTy);
+C2 = ConstantExpr::getSExt(C2, Type::LongTy);
   else
 C2 = ConstantExpr::getBitCast(C2, Type::LongTy);
 
@@ -1672,7 +1671,7 @@
 R = ConstantExpr::getSExtOrBitCast(R, Idx0->getType());
 R = ConstantExpr::getMul(R, Idx0); // signed multiply
 // R is a signed integer, C is the GEP pointer so -> IntToPtr
-return ConstantExpr::getCast(Instruction::IntToPtr, R, C->getType());
+return ConstantExpr::getIntToPtr(R, C->getType());
   }
 }
   }


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.186 llvm/lib/VMCore/Constants.cpp:1.187
--- llvm/lib/VMCore/Constants.cpp:1.186 Mon Dec 11 23:38:50 2006
+++ llvm/lib/VMCore/Constants.cpp   Tue Dec 12 17:36:14 2006
@@ -1391,8 +1391,8 @@
   case Instruction::PtrToInt:
   case Instruction::IntToPtr:
   case Instruction::BitCast:
-New = ConstantExpr::getCast(
-OldC->getOpcode(), OldC->getOperand(0), NewTy);
+New = ConstantExpr::getCast(OldC->getOpcode(), OldC->getOperand(0), 
+NewTy);
 break;
   case Instruction::Select:
 New = ConstantExpr::getSelectTy(NewTy, OldC->getOperand(0),
@@ -1464,8 +1464,8 @@
   assert(0 && "Invalid cast opcode");
   break;
 case Instruction::Trunc:return getTrunc(C, Ty);
-case Instruction::ZExt: return getZeroExtend(C, Ty);
-case Instruction::SExt: return getSignExtend(C, Ty);
+case Instruction::ZExt: return getZExt(C, Ty);
+case Instruction::SExt: return getSExt(C, Ty);
 case Instruction::FPTrunc:  return getFPTrunc(C, Ty);
 case Instruction::FPExt:return getFPExtend(C, Ty);
 case Instruction::UIToFP:   return getUIToFP(C, Ty);
@@ -1547,7 +1547,7 @@
   return getFoldedCast(Instruction::Trunc, C, Ty);
 }
 
-Constant *ConstantExpr::getSignExtend(Constant *C, const Type *Ty) {
+Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) {
   assert(C->getType()->isIntegral() && "SEXt operand must be integral");
   assert(Ty->isInteger() && "SExt produces only integer");
   assert(C->getType()->getPrimitiveSizeInBits() < 
Ty->getPrimitiveSizeInBits()&&
@@ -1556,7 +1556,7 @@
   return getFoldedCast(Instruction::SExt, C, Ty);
 }
 
-Constant *ConstantExpr::getZeroExtend(Constant *C, const Type *Ty) {
+Constant *ConstantExpr::getZExt(Constant *C, const Type *Ty) {
   assert(C->getType()->isIntegral() && "ZEXt operand must be integral");
   assert(Ty->isInteger() && "ZExt produces only integer");
   assert(C->getType()->getPrimitiveSizeInBits() < 
Ty->getPrimitiveSizeInBits()&&



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.78 -> 1.79
---
Log message:

Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


---
Diffs of the changes:  (+4 -5)

 GlobalOpt.cpp |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.78 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.79
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.78  Wed Dec  6 19:30:31 2006
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Tue Dec 12 17:36:14 2006
@@ -708,8 +708,8 @@
 
   Constant *RepValue = NewGV;
   if (NewGV->getType() != GV->getType()->getElementType())
-RepValue = ConstantExpr::getCast(Instruction::BitCast,
- RepValue, 
GV->getType()->getElementType());
+RepValue = ConstantExpr::getBitCast(RepValue, 
+GV->getType()->getElementType());
 
   // If there is a comparison against null, we will insert a global bool to
   // keep track of whether the global was initialized yet or not.
@@ -1058,8 +1058,7 @@
   GV->getInitializer()->isNullValue()) {
 if (Constant *SOVC = dyn_cast(StoredOnceVal)) {
   if (GV->getInitializer()->getType() != SOVC->getType())
-SOVC = ConstantExpr::getCast(Instruction::BitCast,
- SOVC, GV->getInitializer()->getType());
+SOVC = ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType());
 
   // Optimize away any trapping uses of the loaded value.
   if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC))
@@ -1510,7 +1509,7 @@
   if (!GCL->use_empty()) {
 Constant *V = NGV;
 if (V->getType() != GCL->getType())
-  V = ConstantExpr::getCast(Instruction::BitCast, V, GCL->getType());
+  V = ConstantExpr::getBitCast(V, GCL->getType());
 GCL->replaceAllUsesWith(V);
   }
   GCL->eraseFromParent();



___
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

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.565 -> 1.566
---
Log message:

Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


---
Diffs of the changes:  (+31 -31)

 InstructionCombining.cpp |   62 +++
 1 files changed, 31 insertions(+), 31 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.565 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.566
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.565   Tue Dec 12 
13:11:20 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 17:36:14 2006
@@ -1792,8 +1792,7 @@
   case 8:  MiddleType = Type::SByteTy; break;
   }
   if (MiddleType) {
-Instruction *NewTrunc = 
-  CastInst::createInferredCast(XorLHS, MiddleType, "sext");
+Instruction *NewTrunc = new TruncInst(XorLHS, MiddleType, "sext");
 InsertNewInstBefore(NewTrunc, I);
 return new SExtInst(NewTrunc, I.getType());
   }
@@ -3097,16 +3096,12 @@
   // into  : and (cast X to T), trunc_or_bitcast(C1)&C2
   // This will fold the two constants together, which may allow 
   // other simplifications.
-  Instruction *NewCast =
-CastInst::createInferredCast(CastOp->getOperand(0), 
I.getType(),
- CastOp->getName()+".shrunk");
+  Instruction *NewCast = CastInst::createTruncOrBitCast(
+CastOp->getOperand(0), I.getType(), 
+CastOp->getName()+".shrunk");
   NewCast = InsertNewInstBefore(NewCast, I);
   // trunc_or_bitcast(C1)&C2
-  Instruction::CastOps opc = (
-  AndCI->getType()->getPrimitiveSizeInBits() == 
-  I.getType()->getPrimitiveSizeInBits() ? 
-  Instruction::BitCast : Instruction::Trunc);
-  Constant *C3 = ConstantExpr::getCast(opc, AndCI, I.getType());
+  Constant *C3 = 
ConstantExpr::getTruncOrBitCast(AndCI,I.getType());
   C3 = ConstantExpr::getAnd(C3, AndRHS);
   return BinaryOperator::createAnd(NewCast, C3);
 } else if (CastOp->getOpcode() == Instruction::Or) {
@@ -3286,7 +3281,8 @@
Op1C->getOperand(0),
I.getName());
 InsertNewInstBefore(NewOp, I);
-return CastInst::createInferredCast(NewOp, I.getType());
+return CastInst::createIntegerCast(NewOp, I.getType(), 
+   SrcTy->isSigned());
   }
 }
   }
@@ -3690,7 +3686,8 @@
   Op1C->getOperand(0),
   I.getName());
 InsertNewInstBefore(NewOp, I);
-return CastInst::createInferredCast(NewOp, I.getType());
+return CastInst::createIntegerCast(NewOp, I.getType(),
+   SrcTy->isSigned());
   }
   }
   
@@ -3871,7 +3868,8 @@
Op1C->getOperand(0),
I.getName());
 InsertNewInstBefore(NewOp, I);
-return CastInst::createInferredCast(NewOp, I.getType());
+return CastInst::createIntegerCast(NewOp, I.getType(), 
+   SrcTy->isSigned());
   }
   }
 
@@ -3947,7 +3945,7 @@
   }
 } else {
   // Convert to correct type.
-  Op = IC.InsertNewInstBefore(CastInst::createInferredCast(Op, SIntPtrTy,
+  Op = IC.InsertNewInstBefore(CastInst::createSExtOrBitCast(Op, SIntPtrTy,
Op->getName()+".c"), I);
   if (Size != 1)
 // We'll let instcombine(mul) convert this to a shl if possible.
@@ -4944,8 +4942,7 @@
   // If Op1 is a constant, we can fold the cast into the constant.
   if (Op1->getType() != Op0->getType())
 if (Constant *Op1C = dyn_cast(Op1)) {
-  Op1 = ConstantExpr::getCast(Instruction::BitCast, Op1C, 
-  Op0->getType());
+  Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());
 } else {
   // Otherwise, cast the RHS right before the setcc
   Op1 = InsertCastBefore(Instruction::BitCast, Op1, Op0->getType(), I);
@@ -5392,8 +5389,7 @@
   
   Value *Op = ShiftOp->getOperand(0);
   if (isShiftOfSignedShift != isSignedShift)
-Op = InsertNewInstBefore(
-   CastInst::createInferredCast(Op, I.getType(), "tmp"), I);
+Op = InsertNewInstBefore(new BitCastInst(Op, I.getType(), "tmp"), I);
   ShiftIns

[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.88 -> 1.89
---
Log message:

Add routines to dump pass manager queue.


---
Diffs of the changes:  (+62 -0)

 PassManager.cpp |   62 
 1 files changed, 62 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.88 
llvm/lib/VMCore/PassManager.cpp:1.89
--- llvm/lib/VMCore/PassManager.cpp:1.88Tue Dec 12 17:27:37 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:34:33 2006
@@ -149,6 +149,9 @@
 IndirectPassManagers.push_back(Manager);
   }
 
+  // Print passes managed by this top level manager.
+  void dumpPasses();
+
 private:
   
   /// Collection of pass managers
@@ -231,6 +234,21 @@
 
   unsigned getDepth() { return Depth; }
 
+  // Print list of passes that are last used by P.
+  void dumpLastUses(Pass *P, unsigned Offset) {
+
+std::vector LUses;
+
+assert (TPM && "Top Level Manager is missing");
+TPM->collectLastUses(LUses, P);
+
+for (std::vector::iterator I = LUses.begin(),
+   E = LUses.end(); I != E; ++I) {
+  llvm::cerr << "--" << std::string(Offset*2, ' ');
+  (*I)->dumpPassStructure(0);
+}
+  }
+
 protected:
 
   // Collection of pass whose last user asked this manager to claim
@@ -283,6 +301,16 @@
   bool doFinalization(Module &M);
   bool doFinalization(Function &F);
 
+  // Print passes managed by this manager
+  void dumpPassStructure(unsigned Offset) {
+llvm::cerr << std::string(Offset*2, ' ') << "BasicBLockPass Manager\n";
+for (std::vector::iterator I = passVectorBegin(),
+   E = passVectorEnd(); I != E; ++I)  {
+  (*I)->dumpPassStructure(Offset + 1);
+  dumpLastUses(*I, Offset+1);
+}
+  }
+
 };
 
 
//===--===//
@@ -349,6 +377,16 @@
 Info.setPreservesAll();
   }
 
+  // Print passes managed by this manager
+  void dumpPassStructure(unsigned Offset) {
+llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
+for (std::vector::iterator I = passVectorBegin(),
+   E = passVectorEnd(); I != E; ++I)  {
+  (*I)->dumpPassStructure(Offset + 1);
+  dumpLastUses(*I, Offset+1);
+}
+  }
+
 private:
   // Active Pass Managers
   BasicBlockPassManager_New *activeBBPassManager;
@@ -380,6 +418,16 @@
 Info.setPreservesAll();
   }
 
+  // Print passes managed by this manager
+  void dumpPassStructure(unsigned Offset) {
+llvm::cerr << std::string(Offset*2, ' ') << "ModulePass Manager\n";
+for (std::vector::iterator I = passVectorBegin(),
+   E = passVectorEnd(); I != E; ++I)  {
+  (*I)->dumpPassStructure(Offset + 1);
+  dumpLastUses(*I, Offset+1);
+}
+  }
+
 private:
   // Active Pass Manager
   FunctionPassManagerImpl_New *activeFunctionPassManager;
@@ -539,6 +587,20 @@
   return P;
 }
 
+// Print passes managed by this top level manager.
+void PMTopLevelManager::dumpPasses() {
+
+  // Print out the immutable passes
+  for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) {
+ImmutablePasses[i]->dumpPassStructure(0);
+  }
+  
+  for (std::vector::iterator I = PassManagers.begin(),
+ E = PassManagers.end(); I != E; ++I)
+(*I)->dumpPassStructure(1);
+
+}
+
 
//===--===//
 // PMDataManager implementation
 



___
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/sumarray-dbl.c

2006-12-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Vector:

sumarray-dbl.c updated: 1.1 -> 1.2
---
Log message:

Make this program return a consistent result value.


---
Diffs of the changes:  (+2 -1)

 sumarray-dbl.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c
diff -u llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c:1.1 
llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c:1.2
--- llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c:1.1  Thu Mar 30 
20:11:46 2006
+++ llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c  Tue Dec 12 
17:42:51 2006
@@ -7,7 +7,7 @@
 
 union Array TheArray;
 
-void main() {
+int main() {
   int i;
   v8sd sum = { 0, 0, 0, 0, 0, 0, 0, 0};
   D8V sumV;
@@ -19,4 +19,5 @@
 
   sumV.V = sum;
   printD8V(&sumV);
+  return 0;
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ConstantRange.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Analysis:

BasicAliasAnalysis.cpp updated: 1.93 -> 1.94
ConstantRange.cpp updated: 1.21 -> 1.22
ScalarEvolution.cpp updated: 1.71 -> 1.72
ScalarEvolutionExpander.cpp updated: 1.8 -> 1.9
---
Log message:

Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


---
Diffs of the changes:  (+42 -21)

 BasicAliasAnalysis.cpp  |8 
 ConstantRange.cpp   |8 
 ScalarEvolution.cpp |   21 -
 ScalarEvolutionExpander.cpp |   26 ++
 4 files changed, 42 insertions(+), 21 deletions(-)


Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.93 
llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.94
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.93   Wed Dec  6 19:30:31 2006
+++ llvm/lib/Analysis/BasicAliasAnalysis.cppTue Dec 12 17:36:14 2006
@@ -459,11 +459,11 @@
 if (Constant *C2 = dyn_cast(V2)) {
   // Sign extend the constants to long types, if necessary
   if (C1->getType()->getPrimitiveSizeInBits() < 64)
-C1 = ConstantExpr::getSignExtend(C1, Type::LongTy);
+C1 = ConstantExpr::getSExt(C1, Type::LongTy);
   else if (C1->getType() == Type::ULongTy)
 C1 = ConstantExpr::getBitCast(C1, Type::LongTy);
   if (C2->getType()->getPrimitiveSizeInBits() < 64)
-C2 = ConstantExpr::getSignExtend(C2, Type::LongTy);
+C2 = ConstantExpr::getSExt(C2, Type::LongTy);
   else if (C2->getType() == Type::ULongTy)
 C2 = ConstantExpr::getBitCast(C2, Type::LongTy);
   return C1 == C2;
@@ -555,11 +555,11 @@
   if (G1OC->getType() != G2OC->getType()) {
 // Sign extend both operands to long.
 if (G1OC->getType()->getPrimitiveSizeInBits() < 64)
-  G1OC = ConstantExpr::getSignExtend(G1OC, Type::LongTy);
+  G1OC = ConstantExpr::getSExt(G1OC, Type::LongTy);
 else if (G1OC->getType() == Type::ULongTy)
   G1OC = ConstantExpr::getBitCast(G1OC, Type::LongTy);
 if (G2OC->getType()->getPrimitiveSizeInBits() < 64)
-  G2OC = ConstantExpr::getSignExtend(G2OC, Type::LongTy);
+  G2OC = ConstantExpr::getSExt(G2OC, Type::LongTy);
 else if (G2OC->getType() == Type::ULongTy)
   G2OC = ConstantExpr::getBitCast(G2OC, Type::LongTy);
 GEP1Ops[FirstConstantOper] = G1OC;


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.21 
llvm/lib/Analysis/ConstantRange.cpp:1.22
--- llvm/lib/Analysis/ConstantRange.cpp:1.21Wed Dec  6 19:30:31 2006
+++ llvm/lib/Analysis/ConstantRange.cpp Tue Dec 12 17:36:14 2006
@@ -340,8 +340,8 @@
   Constant *Lower = getLower();
   Constant *Upper = getUpper();
 
-  return ConstantRange(ConstantExpr::getCast(Instruction::ZExt, Lower, Ty),
-   ConstantExpr::getCast(Instruction::ZExt, Upper, Ty));
+  return ConstantRange(ConstantExpr::getZExt(Lower, Ty),
+   ConstantExpr::getZExt(Upper, Ty));
 }
 
 /// truncate - Return a new range in the specified integer type, which must be
@@ -356,8 +356,8 @@
 return ConstantRange(getType());
 
   return ConstantRange(
-  ConstantExpr::getCast(Instruction::Trunc, getLower(), Ty),
-  ConstantExpr::getCast(Instruction::Trunc, getUpper(), Ty));
+  ConstantExpr::getTrunc(getLower(), Ty),
+  ConstantExpr::getTrunc(getUpper(), Ty));
 }
 
 


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.71 
llvm/lib/Analysis/ScalarEvolution.cpp:1.72
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.71  Tue Dec 12 03:17:50 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Tue Dec 12 17:36:14 2006
@@ -584,7 +584,7 @@
 SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const Type *Ty) {
   if (SCEVConstant *SC = dyn_cast(Op))
 return SCEVUnknown::get(
-ConstantExpr::getZeroExtend(SC->getValue(), Ty));
+ConstantExpr::getZExt(SC->getValue(), Ty));
 
   // FIXME: If the input value is a chrec scev, and we can prove that the value
   // did not overflow the old, smaller, value, we can zero extend all of the
@@ -2000,11 +2000,14 @@
   } else {
 SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L);
 if (SCEVConstant *SC = dyn_cast(OpV))
-  Operands.push_back(ConstantExpr::getCast(SC->getValue(),
-   Op->getType()));
+  Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(), 
+  Op->getType(), 
+  false));
 else if (SCEVUnknown *SU = dyn_cast(OpV)) {
   if (Constant *C = dyn_cast(SU->getValue()))
-Operands.

[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.89 -> 1.90
---
Log message:

Remove unused constructor.


---
Diffs of the changes:  (+0 -4)

 PassManager.cpp |4 
 1 files changed, 4 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.89 
llvm/lib/VMCore/PassManager.cpp:1.90
--- llvm/lib/VMCore/PassManager.cpp:1.89Tue Dec 12 17:34:33 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:51:31 2006
@@ -901,10 +901,6 @@
 // FunctionPassManager_New implementation
 
 /// Create new Function pass manager
-FunctionPassManager_New::FunctionPassManager_New() {
-  FPM = new FunctionPassManagerImpl_New(0);
-}
-
 FunctionPassManager_New::FunctionPassManager_New(ModuleProvider *P) {
   FPM = new FunctionPassManagerImpl_New(0);
   // FPM is the top level manager.



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/PassManager.h

2006-12-12 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.33 -> 1.34
---
Log message:

Implement PassManager_New destructors.


---
Diffs of the changes:  (+2 -1)

 PassManager.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.33 
llvm/include/llvm/PassManager.h:1.34
--- llvm/include/llvm/PassManager.h:1.33Fri Dec  8 12:57:16 2006
+++ llvm/include/llvm/PassManager.h Tue Dec 12 18:09:23 2006
@@ -97,6 +97,7 @@
 public:
 
   PassManager_New();
+  ~PassManager_New();
 
   /// add - Add a pass to the queue of passes to run.  This passes ownership of
   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
@@ -121,7 +122,7 @@
 public:
   FunctionPassManager_New(ModuleProvider *P);
   FunctionPassManager_New();
-  ~FunctionPassManager_New() { /* TODO */ };
+  ~FunctionPassManager_New();
  
   /// add - Add a pass to the queue of passes to run.  This passes
   /// ownership of the Pass to the PassManager.  When the



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.90 -> 1.91
---
Log message:

Implement PassManager_New destructors.


---
Diffs of the changes:  (+27 -2)

 PassManager.cpp |   29 +++--
 1 files changed, 27 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.90 
llvm/lib/VMCore/PassManager.cpp:1.91
--- llvm/lib/VMCore/PassManager.cpp:1.90Tue Dec 12 17:51:31 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 18:09:23 2006
@@ -126,6 +126,15 @@
   Pass *findAnalysisPass(AnalysisID AID);
 
   virtual ~PMTopLevelManager() {
+
+for (std::vector::iterator I = PassManagers.begin(),
+   E = PassManagers.end(); I != E; ++I)
+  delete *I;
+
+for (std::vector::iterator
+   I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I)
+  delete *I;
+
 PassManagers.clear();
   }
 
@@ -182,6 +191,15 @@
 initializeAnalysisInfo();
   }
 
+  virtual ~PMDataManager() {
+
+for (std::vector::iterator I = PassVector.begin(),
+   E = PassVector.end(); I != E; ++I)
+  delete *I;
+
+PassVector.clear();
+  }
+
   /// Return true IFF pass P's required analysis set does not required new
   /// manager.
   bool manageablePass(Pass *P);
@@ -914,6 +932,10 @@
   MP = P;
 }
 
+FunctionPassManager_New::~FunctionPassManager_New() {
+  delete FPM;
+}
+
 /// add - Add a pass to the queue of passes to run.  This passes
 /// ownership of the Pass to the PassManager.  When the
 /// PassManager_X is destroyed, the pass will be destroyed as well, so
@@ -1187,8 +1209,7 @@
 
 
//===--===//
 // PassManagerImpl implementation
-
-// PassManager_New implementation
+//
 /// Add P into active pass manager or use new module pass manager to
 /// manage it.
 bool PassManagerImpl_New::addPass(Pass *P) {
@@ -1232,6 +1253,10 @@
   PM->setTopLevelManager(PM);
 }
 
+PassManager_New::~PassManager_New() {
+  delete PM;
+}
+
 /// add - Add a pass to the queue of passes to run.  This passes ownership of
 /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
 /// will be destroyed as well, so there is no need to delete the pass.  This



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Pass.h PassAnalysisSupport.h

2006-12-12 Thread Devang Patel


Changes in directory llvm/include/llvm:

Pass.h updated: 1.57 -> 1.58
PassAnalysisSupport.h updated: 1.23 -> 1.24
---
Log message:

Move getAnalysis() and getAnalysisID() definitions from Pass.h to
PassAnalysisSupport.h


---
Diffs of the changes:  (+43 -33)

 Pass.h|   36 +++-
 PassAnalysisSupport.h |   40 
 2 files changed, 43 insertions(+), 33 deletions(-)


Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.57 llvm/include/llvm/Pass.h:1.58
--- llvm/include/llvm/Pass.h:1.57   Fri Dec  8 17:52:04 2006
+++ llvm/include/llvm/Pass.hTue Dec 12 18:23:44 2006
@@ -173,41 +173,11 @@
   /// getAnalysisUsage function.
   ///
   template
-  AnalysisType &getAnalysis() const {
-assert(Resolver && "Pass has not been inserted into a PassManager 
object!");
-const PassInfo *PI = getClassPassInfo();
-return getAnalysisID(PI);
-  }
+  AnalysisType &getAnalysis() const; // Defined in PassAnalysisSupport.h
 
   template
-  AnalysisType &getAnalysisID(const PassInfo *PI) const {
-assert(Resolver && "Pass has not been inserted into a PassManager 
object!");
-assert(PI && "getAnalysis for unregistered pass!");
-
-// PI *must* appear in AnalysisImpls.  Because the number of passes used
-// should be a small number, we just do a linear search over a (dense)
-// vector.
-Pass *ResultPass = 0;
-for (unsigned i = 0; ; ++i) {
-  assert(i != AnalysisImpls.size() &&
- "getAnalysis*() called on an analysis that was not "
- "'required' by pass!");
-  if (AnalysisImpls[i].first == PI) {
-ResultPass = AnalysisImpls[i].second;
-break;
-  }
-}
-
-// Because the AnalysisType may not be a subclass of pass (for
-// AnalysisGroups), we must use dynamic_cast here to potentially adjust the
-// return pointer (because the class may multiply inherit, once from pass,
-// once from AnalysisType).
-//
-AnalysisType *Result = dynamic_cast(ResultPass);
-assert(Result && "Pass does not implement interface required!");
-return *Result;
-  }
-
+  AnalysisType &getAnalysisID(const PassInfo *PI) const;
+
 private:
   template friend class PassManagerT;
   friend class ModulePassManager;


Index: llvm/include/llvm/PassAnalysisSupport.h
diff -u llvm/include/llvm/PassAnalysisSupport.h:1.23 
llvm/include/llvm/PassAnalysisSupport.h:1.24
--- llvm/include/llvm/PassAnalysisSupport.h:1.23Fri Dec  8 17:28:54 2006
+++ llvm/include/llvm/PassAnalysisSupport.h Tue Dec 12 18:23:44 2006
@@ -195,6 +195,46 @@
   return dynamic_cast(Resolver->getAnalysisToUpdate(PI));
 }
 
+/// getAnalysis() - This function is used by subclasses to get
+/// to the analysis information that they claim to use by overriding the
+/// getAnalysisUsage function.
+///
+template
+AnalysisType &Pass::getAnalysis() const {
+  assert(Resolver && "Pass has not been inserted into a PassManager object!");
+  const PassInfo *PI = getClassPassInfo();
+  return getAnalysisID(PI);
+}
+
+template
+AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const {
+  assert(Resolver && "Pass has not been inserted into a PassManager object!");
+  assert(PI && "getAnalysis for unregistered pass!");
+  
+  // PI *must* appear in AnalysisImpls.  Because the number of passes used
+  // should be a small number, we just do a linear search over a (dense)
+  // vector.
+  Pass *ResultPass = 0;
+  for (unsigned i = 0; ; ++i) {
+assert(i != AnalysisImpls.size() &&
+   "getAnalysis*() called on an analysis that was not "
+   "'required' by pass!");
+if (AnalysisImpls[i].first == PI) {
+  ResultPass = AnalysisImpls[i].second;
+  break;
+}
+  }
+  
+  // Because the AnalysisType may not be a subclass of pass (for
+  // AnalysisGroups), we must use dynamic_cast here to potentially adjust the
+  // return pointer (because the class may multiply inherit, once from pass,
+  // once from AnalysisType).
+  //
+  AnalysisType *Result = dynamic_cast(ResultPass);
+  assert(Result && "Pass does not implement interface required!");
+  return *Result;
+}
+
 } // End llvm namespace
 
 #endif



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.91 -> 1.92
---
Log message:

FunctionPassManager does not support runOnModule(). 


---
Diffs of the changes:  (+0 -7)

 PassManager.cpp |7 ---
 1 files changed, 7 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.91 
llvm/lib/VMCore/PassManager.cpp:1.92
--- llvm/lib/VMCore/PassManager.cpp:1.91Tue Dec 12 18:09:23 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 18:34:32 2006
@@ -945,13 +945,6 @@
   FPM->add(P);
 }
 
-/// Execute all of the passes scheduled for execution.  Keep
-/// track of whether any of the passes modifies the function, and if
-/// so, return true.
-bool FunctionPassManager_New::runOnModule(Module &M) {
-  return FPM->runOnModule(M);
-}
-
 /// run - Execute all of the passes scheduled for execution.  Keep
 /// track of whether any of the passes modifies the function, and if
 /// so, return true.



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/PassManager.h

2006-12-12 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.34 -> 1.35
---
Log message:

FunctionPassManager does not support runOnModule(). 


---
Diffs of the changes:  (+0 -5)

 PassManager.h |5 -
 1 files changed, 5 deletions(-)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.34 
llvm/include/llvm/PassManager.h:1.35
--- llvm/include/llvm/PassManager.h:1.34Tue Dec 12 18:09:23 2006
+++ llvm/include/llvm/PassManager.h Tue Dec 12 18:34:32 2006
@@ -131,11 +131,6 @@
   /// This implies that all passes MUST be allocated with 'new'.
   void add(Pass *P);
 
-  /// Execute all of the passes scheduled for execution.  Keep
-  /// track of whether any of the passes modifies the function, and if
-  /// so, return true.
-  bool runOnModule(Module &M);
-
   /// run - Execute all of the passes scheduled for execution.  Keep
   /// track of whether any of the passes modifies the function, and if
   /// so, return true.



___
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/LowerGC.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

LowerGC.cpp updated: 1.15 -> 1.16
---
Log message:

Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


---
Diffs of the changes:  (+1 -2)

 LowerGC.cpp |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/LowerGC.cpp
diff -u llvm/lib/Transforms/Scalar/LowerGC.cpp:1.15 
llvm/lib/Transforms/Scalar/LowerGC.cpp:1.16
--- llvm/lib/Transforms/Scalar/LowerGC.cpp:1.15 Sun Nov 26 19:05:10 2006
+++ llvm/lib/Transforms/Scalar/LowerGC.cpp  Tue Dec 12 18:50:17 2006
@@ -146,8 +146,7 @@
 if (Constant *C = dyn_cast(I->getOperand(OpNum)))
   I->setOperand(OpNum, ConstantExpr::getBitCast(C, Ty));
 else {
-  CastInst *CI = 
-CastInst::createInferredCast(I->getOperand(OpNum), Ty, "", I);
+  CastInst *CI = new BitCastInst(I->getOperand(OpNum), Ty, "", I);
   I->setOperand(OpNum, CI);
 }
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/LevelRaise.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms:

LevelRaise.cpp updated: 1.114 -> 1.115
---
Log message:

Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


---
Diffs of the changes:  (+2 -2)

 LevelRaise.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/LevelRaise.cpp
diff -u llvm/lib/Transforms/LevelRaise.cpp:1.114 
llvm/lib/Transforms/LevelRaise.cpp:1.115
--- llvm/lib/Transforms/LevelRaise.cpp:1.114Wed Dec  6 11:46:32 2006
+++ llvm/lib/Transforms/LevelRaise.cpp  Tue Dec 12 18:50:17 2006
@@ -258,8 +258,8 @@
   // The existing and new operand 0 types are different so we must
   // replace CI with a new CastInst so that we are assured to 
   // get the correct cast opcode.
-  CastInst *NewCI = CastInst::createInferredCast(
-GEP, CI->getType(), CI->getName(), CI);
+  CastInst *NewCI = new BitCastInst(GEP, CI->getType(), 
+CI->getName(), CI);
   CI->replaceAllUsesWith(NewCI);
   CI->eraseFromParent();
   CI = NewCI;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp TraceValues.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Instrumentation:

ProfilingUtils.cpp updated: 1.9 -> 1.10
TraceValues.cpp updated: 1.77 -> 1.78
---
Log message:

Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


---
Diffs of the changes:  (+3 -2)

 ProfilingUtils.cpp |1 +
 TraceValues.cpp|4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.9 
llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.10
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.9  Sun Nov 26 
19:05:10 2006
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp  Tue Dec 12 
18:50:17 2006
@@ -67,6 +67,7 @@
 } else {
   InitCall->setOperand(2, AI);
 }
+/* FALL THROUGH */
 
   case 1:
 AI = MainFn->arg_begin();


Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.77 
llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.78
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.77Sun Nov 26 
19:05:10 2006
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp Tue Dec 12 18:50:17 2006
@@ -281,7 +281,7 @@
 
   const Type *SBP = PointerType::get(Type::SByteTy);
   if (V->getType() != SBP)// Cast pointer to be sbyte*
-V = CastInst::createInferredCast(V, SBP, "RPSN_cast", InsertBefore);
+V = new BitCastInst(V, SBP, "RPSN_cast", InsertBefore);
 
   std::vector releaseArgs(1, V);
   new CallInst(ReleasePtrFunc, releaseArgs, "", InsertBefore);
@@ -293,7 +293,7 @@
  Function* RecordPtrFunc) {
 const Type *SBP = PointerType::get(Type::SByteTy);
   if (V->getType() != SBP) // Cast pointer to be sbyte*
-V = CastInst::createInferredCast(V, SBP, "RP_cast", InsertBefore);
+V = new BitCastInst(V, SBP, "RP_cast", InsertBefore);
 
   std::vector releaseArgs(1, V);
   new CallInst(RecordPtrFunc, releaseArgs, "", InsertBefore);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/projects/Stacker/lib/compiler:

StackerCompiler.cpp updated: 1.25 -> 1.26
---
Log message:

Change createInferredCast calls to more accurate cast creation calls.


---
Diffs of the changes:  (+18 -14)

 StackerCompiler.cpp |   32 ++--
 1 files changed, 18 insertions(+), 14 deletions(-)


Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.25 
llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.26
--- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.25 Wed Dec  6 
13:00:27 2006
+++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp  Tue Dec 12 
18:47:58 2006
@@ -367,7 +367,7 @@
 
 // Increment the loaded index value
 if ( ival == 0 ) ival = One;
-CastInst* caster = CastInst::createInferredCast( ival, Type::LongTy );
+CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::LongTy );
 bb->getInstList().push_back( caster );
 BinaryOperator* addop = BinaryOperator::create( Instruction::Add,
 loadop, caster);
@@ -388,7 +388,7 @@
 
 // Decrement the loaded index value
 if ( ival == 0 ) ival = One;
-CastInst* caster = CastInst::createInferredCast( ival, Type::LongTy );
+CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::LongTy );
 bb->getInstList().push_back( caster );
 BinaryOperator* subop = BinaryOperator::create( Instruction::Sub,
 loadop, caster);
@@ -422,7 +422,7 @@
 }
 else
 {
-CastInst* caster = CastInst::createInferredCast( index, Type::LongTy );
+CastInst* caster = CastInst::createSExtOrBitCast( index, Type::LongTy 
);
 bb->getInstList().push_back( caster );
 BinaryOperator* subop = BinaryOperator::create(
 Instruction::Sub, loadop, caster );
@@ -448,7 +448,11 @@
 get_stack_pointer( bb ) );
 
 // Cast the value to a long .. hopefully it works
-CastInst* cast_inst = CastInst::createInferredCast( val, Type::LongTy );
+Instruction::CastOps opcode = 
+   (isa(val->getType()) ? Instruction::PtrToInt :
+(val->getType()->getPrimitiveSizeInBits() < 64 ? Instruction::SExt :
+ Instruction::BitCast));
+CastInst* cast_inst = CastInst::create(opcode, val, Type::LongTy );
 bb->getInstList().push_back( cast_inst );
 
 // Store the value
@@ -523,7 +527,7 @@
 
 // Cast the integer to a sbyte*
 CastInst* caster = 
-  CastInst::createInferredCast( loader, PointerType::get(Type::SByteTy) );
+  new IntToPtrInst(loader, PointerType::get(Type::SByteTy));
 bb->getInstList().push_back( caster );
 
 // Decrement stack index
@@ -576,7 +580,7 @@
 
 // Cast the integer to a sbyte*
 CastInst* caster = 
-  CastInst::createInferredCast( loader, PointerType::get(Type::SByteTy) );
+  new IntToPtrInst(loader, PointerType::get(Type::SByteTy) );
 bb->getInstList().push_back( caster );
 
 // Return the value
@@ -1245,7 +1249,7 @@
 if (echo) bb->setName("SHL");
 LoadInst* op1 = cast(pop_integer(bb));
 LoadInst* op2 = cast(pop_integer(bb));
-CastInst* castop = CastInst::createInferredCast( op1, Type::UByteTy );
+CastInst* castop = new TruncInst( op1, Type::UByteTy );
 bb->getInstList().push_back( castop );
 ShiftInst* shlop = new ShiftInst( Instruction::Shl, op2, castop );
 bb->getInstList().push_back( shlop );
@@ -1257,7 +1261,7 @@
 if (echo) bb->setName("SHR");
 LoadInst* op1 = cast(pop_integer(bb));
 LoadInst* op2 = cast(pop_integer(bb));
-CastInst* castop = CastInst::createInferredCast( op1, Type::UByteTy );
+CastInst* castop = new TruncInst( op1, Type::UByteTy );
 bb->getInstList().push_back( castop );
 ShiftInst* shrop = new ShiftInst( Instruction::AShr, op2, castop );
 bb->getInstList().push_back( shrop );
@@ -1479,7 +1483,7 @@
 LoadInst* op1 = cast( pop_integer(bb) );
 
 // Make sure its a UIntTy
-CastInst* caster = CastInst::createInferredCast( op1, Type::UIntTy );
+CastInst* caster = CastInst::createTruncOrBitCast( op1, Type::UIntTy );
 bb->getInstList().push_back( caster );
 
 // Allocate the bytes
@@ -1507,7 +1511,7 @@
 if (echo) bb->setName("GET");
 // Get the character index
 LoadInst* op1 = cast( stack_top(bb) );
-CastInst* chr_idx = CastInst::createInferredCast( op1, Type::LongTy );
+CastInst* chr_idx = CastInst::createSExtOrBitCast( op1, Type::LongTy );
 bb->getInstList().push_back( chr_idx );
 
 // Get the String pointer
@@ -1522,7 +1526,7 @@
 // Get the value and push it
 LoadInst* loader = new LoadInst( gep );
 bb->getInstList().push_back( loader );
-CastInst* caster = CastInst::createInferredCast( loader, Type::IntTy );
+CastInst* caster = CastInst::createTruncOr

[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.329 -> 1.330
---
Log message:

Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


---
Diffs of the changes:  (+5 -5)

 SelectionDAGISel.cpp |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.329 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.330
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.329Tue Dec 12 
15:21:32 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Tue Dec 12 18:50:17 2006
@@ -3519,8 +3519,8 @@
   while (isa(InsertPt)) ++InsertPt;
   
   InsertedCast = 
-CastInst::createInferredCast(CI->getOperand(0), CI->getType(), "", 
- InsertPt);
+CastInst::create(CI->getOpcode(), CI->getOperand(0), CI->getType(), 
"", 
+ InsertPt);
   MadeChange = true;
 }
 
@@ -3559,8 +3559,8 @@
   // operand).
   if (CastInst *CI = dyn_cast(Ptr))
 if (CI->getParent() != BB && 
isa(CI->getOperand(0)->getType()))
-  Ptr = CastInst::createInferredCast(CI->getOperand(0), CI->getType(), "",
- InsertPt);
+  Ptr = CastInst::create(CI->getOpcode(), CI->getOperand(0), CI->getType(),
+ "", InsertPt);
   
   // Add the offset, cast it to the right type.
   Ptr = BinaryOperator::createAdd(Ptr, PtrOffset, "", InsertPt);
@@ -3702,7 +3702,7 @@
   // Ptr = Ptr + Idx * ElementSize;
   
   // Cast Idx to UIntPtrTy if needed.
-  Idx = CastInst::createInferredCast(Idx, UIntPtrTy, "", GEPI);
+  Idx = CastInst::createIntegerCast(Idx, UIntPtrTy, true/*SExt*/, "", 
GEPI);
   
   uint64_t ElementSize = TD->getTypeSize(Ty);
   // Mask off bits that should not be set.



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/IPO/IndMemRemoval.cpp RaiseAllocations.cpp SimplifyLibCalls.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/IPO:

IndMemRemoval.cpp updated: 1.7 -> 1.8
RaiseAllocations.cpp updated: 1.32 -> 1.33
SimplifyLibCalls.cpp updated: 1.74 -> 1.75
---
Log message:

Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


---
Diffs of the changes:  (+35 -32)

 IndMemRemoval.cpp|4 +--
 RaiseAllocations.cpp |8 +++
 SimplifyLibCalls.cpp |   55 ++-
 3 files changed, 35 insertions(+), 32 deletions(-)


Index: llvm/lib/Transforms/IPO/IndMemRemoval.cpp
diff -u llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.7 
llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.8
--- llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.7   Wed Dec  6 11:46:32 2006
+++ llvm/lib/Transforms/IPO/IndMemRemoval.cpp   Tue Dec 12 18:50:17 2006
@@ -74,8 +74,8 @@
  GlobalValue::LinkOnceLinkage, 
  "malloc_llvm_bounce", &M);
   BasicBlock* bb = new BasicBlock("entry",FN);
-  Instruction* c = 
-CastInst::createInferredCast(FN->arg_begin(), Type::UIntTy, "c", bb);
+  Instruction* c = CastInst::createIntegerCast(
+  FN->arg_begin(), Type::UIntTy, false, "c", bb);
   Instruction* a = new MallocInst(Type::SByteTy, c, "m", bb);
   new ReturnInst(a, bb);
   ++NumBounce;


Index: llvm/lib/Transforms/IPO/RaiseAllocations.cpp
diff -u llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.32 
llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.33
--- llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.32   Wed Dec  6 11:46:32 2006
+++ llvm/lib/Transforms/IPO/RaiseAllocations.cppTue Dec 12 18:50:17 2006
@@ -141,8 +141,8 @@
   // source size.
   if (Source->getType() != Type::UIntTy)
 Source = 
-  CastInst::createInferredCast(Source, Type::UIntTy,
-   "MallocAmtCast", I);
+  CastInst::createIntegerCast(Source, Type::UIntTy, false/*ZExt*/,
+  "MallocAmtCast", I);
 
   std::string Name(I->getName()); I->setName("");
   MallocInst *MI = new MallocInst(Type::SByteTy, Source, Name, I);
@@ -193,8 +193,8 @@
   //
   Value *Source = *CS.arg_begin();
   if (!isa(Source->getType()))
-Source = CastInst::createInferredCast(
-Source, PointerType::get(Type::SByteTy), "FreePtrCast", I);
+Source = new IntToPtrInst(Source, PointerType::get(Type::SByteTy), 
+  "FreePtrCast", I);
   new FreeInst(Source, I);
 
   // If the old instruction was an invoke, add an unconditional branch


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.74 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.75
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.74   Wed Dec  6 11:46:32 2006
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppTue Dec 12 18:50:17 2006
@@ -1009,7 +1009,8 @@
   Value *S2V = new LoadInst(Op2Cast, RHS->getName()+".val", CI);
   Value *RV = BinaryOperator::createSub(S1V, S2V, 
CI->getName()+".diff",CI);
   if (RV->getType() != CI->getType())
-RV = CastInst::createInferredCast(RV, CI->getType(), RV->getName(), 
CI);
+RV = CastInst::createIntegerCast(RV, CI->getType(), false, 
+ RV->getName(), CI);
   CI->replaceAllUsesWith(RV);
   CI->eraseFromParent();
   return true;
@@ -1037,8 +1038,8 @@
   CI->getName()+".d1", CI);
 Value *Or = BinaryOperator::createOr(D1, D2, CI->getName()+".res", CI);
 if (Or->getType() != CI->getType())
-  Or = CastInst::createInferredCast(Or, CI->getType(), Or->getName(), 
-CI);
+  Or = CastInst::createIntegerCast(Or, CI->getType(), false /*ZExt*/, 
+   Or->getName(), CI);
 CI->replaceAllUsesWith(Or);
 CI->eraseFromParent();
 return true;
@@ -1222,8 +1223,8 @@
 }
 
 // Cast dest to the right sized primitive and then load/store
-CastInst* DestCast = CastInst::createInferredCast(
-dest, PointerType::get(castType), dest->getName()+".cast", ci);
+CastInst* DestCast = new BitCastInst(dest, PointerType::get(castType), 
+ dest->getName()+".cast", ci);
 new StoreInst(ConstantInt::get(castType,fill_value),DestCast, ci);
 ci->eraseFromParent();
 return true;
@@ -1365,7 +1366,7 @@
 Function* putchar_func = SLC.get_putchar();
 if (!putchar_func)
   return false;
-CastInst* cast = CastInst::createInferredCast(
+CastInst* cast = CastInst::createSExtOrBitCast(
 ci->getOperand(2), Type::IntTy, CI->getName()+".int", ci);
 new CallInst(putchar_func, cast, "", ci);

[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp

2006-12-12 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Utils:

LowerAllocations.cpp updated: 1.66 -> 1.67
---
Log message:

Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


---
Diffs of the changes:  (+8 -9)

 LowerAllocations.cpp |   17 -
 1 files changed, 8 insertions(+), 9 deletions(-)


Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66 
llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.67
--- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66 Tue Dec 12 03:17:08 2006
+++ llvm/lib/Transforms/Utils/LowerAllocations.cpp  Tue Dec 12 18:50:17 2006
@@ -135,7 +135,8 @@
 } else {
   Value *Scale = MI->getOperand(0);
   if (Scale->getType() != IntPtrTy)
-Scale = CastInst::createInferredCast(Scale, IntPtrTy, "", I);
+Scale = CastInst::createIntegerCast(Scale, IntPtrTy, false 
/*ZExt*/,
+"", I);
 
   // Multiply it by the array size if necessary...
   MallocArg = BinaryOperator::create(Instruction::Mul, Scale,
@@ -149,13 +150,12 @@
   if (MallocFTy->getNumParams() > 0 || MallocFTy->isVarArg()) {
 if (MallocFTy->isVarArg()) {
   if (MallocArg->getType() != IntPtrTy)
-MallocArg = CastInst::createInferredCast(MallocArg, IntPtrTy, "", 
- I);
+MallocArg = CastInst::createIntegerCast(MallocArg, IntPtrTy, 
+false /*ZExt*/, "", I);
 } else if (MallocFTy->getNumParams() > 0 &&
MallocFTy->getParamType(0) != Type::UIntTy)
-  MallocArg = 
-CastInst::createInferredCast(MallocArg, MallocFTy->getParamType(0),
- "",I);
+  MallocArg = CastInst::createIntegerCast(
+  MallocArg, MallocFTy->getParamType(0), false/*ZExt*/, "",I);
 MallocArgs.push_back(MallocArg);
   }
 
@@ -170,7 +170,7 @@
   // Create a cast instruction to convert to the right type...
   Value *MCast;
   if (MCall->getType() != Type::VoidTy)
-MCast = CastInst::createInferredCast(MCall, MI->getType(), "", I);
+MCast = new BitCastInst(MCall, MI->getType(), "", I);
   else
 MCast = Constant::getNullValue(MI->getType());
 
@@ -187,8 +187,7 @@
 Value *MCast = FI->getOperand(0);
 if (FreeFTy->getNumParams() > 0 &&
 FreeFTy->getParamType(0) != MCast->getType())
-  MCast = CastInst::createInferredCast(MCast, 
FreeFTy->getParamType(0), 
-   "", I);
+  MCast = new BitCastInst(MCast, FreeFTy->getParamType(0), "", I);
 FreeArgs.push_back(MCast);
   }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/Makefile.config.in

2006-12-12 Thread Chris Lattner


Changes in directory llvm:

Makefile.config.in updated: 1.70 -> 1.71
---
Log message:

Fix a regression that completely broke make install.
Instead of installing into /usr/local/bin it would install into /usr/localbin


---
Diffs of the changes:  (+8 -8)

 Makefile.config.in |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/Makefile.config.in
diff -u llvm/Makefile.config.in:1.70 llvm/Makefile.config.in:1.71
--- llvm/Makefile.config.in:1.70Sat Dec  9 22:09:19 2006
+++ llvm/Makefile.config.in Tue Dec 12 19:15:18 2006
@@ -49,14 +49,14 @@
 PROJ_SRC_DIR:= $(shell cd $(LLVM_SRC_ROOT)/$(patsubst 
$(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))
 DESTDIR := @prefix@
 PROJ_prefix := $(DESTDIR)
-PROJ_bindir := $(DESTDIR)bin
-PROJ_libdir := $(DESTDIR)lib
-PROJ_datadir:= $(DESTDIR)share
-PROJ_docsdir:= $(DESTDIR)docs/llvm
-PROJ_etcdir := $(DESTDIR)etc/llvm
-PROJ_includedir := $(DESTDIR)include
-PROJ_infodir:= $(DESTDIR)info
-PROJ_mandir := $(DESTDIR)man
+PROJ_bindir := $(DESTDIR)/bin
+PROJ_libdir := $(DESTDIR)/lib
+PROJ_datadir:= $(DESTDIR)/share
+PROJ_docsdir:= $(DESTDIR)/docs/llvm
+PROJ_etcdir := $(DESTDIR)/etc/llvm
+PROJ_includedir := $(DESTDIR)/include
+PROJ_infodir:= $(DESTDIR)/info
+PROJ_mandir := $(DESTDIR)/man
 PROJ_VERSION:= $(LLVMVersion)
 else
 ifndef PROJ_SRC_ROOT



___
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/LegalizeDAG.cpp

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.436 -> 1.437
---
Log message:

Expand f32 / f64 to i32 / i64 conversion to soft-fp library calls.

---
Diffs of the changes:  (+23 -2)

 LegalizeDAG.cpp |   25 +++--
 1 files changed, 23 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.436 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.436 Tue Dec 12 16:19:28 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Tue Dec 12 19:57:55 2006
@@ -2860,8 +2860,29 @@
 break;
   }
   break;
-case Expand:
-  assert(0 && "Shouldn't need to expand other operators here!");
+case Expand: {
+  // Convert f32 / f64 to i32 / i64.
+  MVT::ValueType VT = Op.getValueType();
+  const char *FnName = 0;
+  switch (Node->getOpcode()) {
+  case ISD::FP_TO_SINT:
+if (Node->getOperand(0).getValueType() == MVT::f32)
+  FnName = (VT == MVT::i32) ? "__fixsfsi" : "__fixsfdi";
+else
+  FnName = (VT == MVT::i32) ? "__fixdfsi" : "__fixdfdi";
+break;
+  case ISD::FP_TO_UINT:
+if (Node->getOperand(0).getValueType() == MVT::f32)
+  FnName = (VT == MVT::i32) ? "__fixunssfsi" : "__fixunssfdi";
+else
+  FnName = (VT == MVT::i32) ? "__fixunsdfsi" : "__fixunsdfdi";
+break;
+  default: assert(0 && "Unreachable!");
+  }
+  SDOperand Dummy;
+  Result = ExpandLibCall(FnName, Node, Dummy);
+  break;
+}
 case Promote:
   Tmp1 = PromoteOp(Node->getOperand(0));
   Result = DAG.UpdateNodeOperands(Result, LegalizeOp(Tmp1));



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp

2006-12-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

ScalarReplAggregates.cpp updated: 1.56 -> 1.57
---
Log message:

revert my recent int<->fp and vector union promotion changes, they expose
obscure bugs affecting the X86 code generator.  I will reenable this 
when fixed.


---
Diffs of the changes:  (+53 -132)

 ScalarReplAggregates.cpp |  185 +--
 1 files changed, 53 insertions(+), 132 deletions(-)


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.56 
llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.57
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.56Mon Dec 11 
22:24:41 2006
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Dec 12 20:26:45 2006
@@ -419,64 +419,39 @@
 /// types are incompatible, return true, otherwise update Accum and return
 /// false.
 ///
-/// There are three cases we handle here:
-///   1) An effectively-integer union, where the pieces are stored into as
+/// There are two cases we handle here:
+///   1) An effectively integer union, where the pieces are stored into as
 ///  smaller integers (common with byte swap and other idioms).
-///   2) A union of vector types of the same size and potentially its elements.
-///  Here we turn element accesses into insert/extract element operations.
-///   3) A union of scalar types, such as int/float or int/pointer.  Here we
-///  merge together into integers, allowing the xform to work with #1 as
-///  well.
+///   2) A union of a vector and its elements.  Here we turn element accesses
+///  into insert/extract element operations.
 static bool MergeInType(const Type *In, const Type *&Accum,
 const TargetData &TD) {
   // If this is our first type, just use it.
   const PackedType *PTy;
   if (Accum == Type::VoidTy || In == Accum) {
 Accum = In;
-  } else if (In == Type::VoidTy) {
-// Noop.
   } else if (In->isIntegral() && Accum->isIntegral()) {   // integer union.
 // Otherwise pick whichever type is larger.
 if (In->getTypeID() > Accum->getTypeID())
   Accum = In;
   } else if (isa(In) && isa(Accum)) {
 // Pointer unions just stay as one of the pointers.
-  } else if (isa(In) || isa(Accum)) {
-if ((PTy = dyn_cast(Accum)) && 
-PTy->getElementType() == In) {
-  // Accum is a vector, and we are accessing an element: ok.
-} else if ((PTy = dyn_cast(In)) && 
-   PTy->getElementType() == Accum) {
-  // In is a vector, and accum is an element: ok, remember In.
-  Accum = In;
-} else if ((PTy = dyn_cast(In)) && isa(Accum) &&
-   PTy->getBitWidth() == cast(Accum)->getBitWidth()) {
-  // Two vectors of the same size: keep Accum.
-} else {
-  // Cannot insert an short into a <4 x int> or handle
-  // <2 x int> -> <4 x int>
-  return true;
-}
-  } else {
-// Pointer/FP/Integer unions merge together as integers.
-switch (Accum->getTypeID()) {
-case Type::PointerTyID: Accum = TD.getIntPtrType(); break;
-case Type::FloatTyID:   Accum = Type::UIntTy; break;
-case Type::DoubleTyID:  Accum = Type::ULongTy; break;
-default:
-  assert(Accum->isIntegral() && "Unknown FP type!");
-  break;
-}
-
-switch (In->getTypeID()) {
-case Type::PointerTyID: In = TD.getIntPtrType(); break;
-case Type::FloatTyID:   In = Type::UIntTy; break;
-case Type::DoubleTyID:  In = Type::ULongTy; break;
-default:
-  assert(In->isIntegral() && "Unknown FP type!");
-  break;
-}
+  } else if ((PTy = dyn_cast(Accum)) && 
+ PTy->getElementType() == In) {
+// Accum is a vector, and we are accessing an element: ok.
+  } else if ((PTy = dyn_cast(In)) && 
+ PTy->getElementType() == Accum) {
+// In is a vector, and accum is an element: ok, remember In.
+Accum = In;
+  } else if (isa(In) && Accum->isIntegral()) {
+// Pointer/Integer unions merge together as integers.
+return MergeInType(TD.getIntPtrType(), Accum, TD);
+  } else if (isa(Accum) && In->isIntegral()) {
+// Pointer/Integer unions merge together as integers.
+Accum = TD.getIntPtrType();
 return MergeInType(In, Accum, TD);
+  } else {
+return true;
   }
   return false;
 }
@@ -518,7 +493,8 @@
   
   if (MergeInType(SI->getOperand(0)->getType(), UsedType, TD))
 return 0;
-} else if (BitCastInst *CI = dyn_cast(User)) {
+} else if (CastInst *CI = dyn_cast(User)) {
+  if (!isa(CI->getType())) return 0;
   IsNotTrivial = true;
   const Type *SubTy = CanConvertToScalar(CI, IsNotTrivial);
   if (!SubTy || MergeInType(SubTy, UsedType, TD)) return 0;
@@ -632,54 +608,24 @@
   Value *NV = new LoadInst(NewAI, LI->getName(), LI);
   if (NV->getType() != LI->getType()) {
 if (const PackedType *PTy = dyn_cast(NV->getType())) {
-  // If the result alloca is a packed type, t

Re: [llvm-commits] SETCC Patches (For Review Only) #1: llvm-gcc

2006-12-12 Thread Reid Spencer
On Sun, 2006-12-10 at 18:03 -0800, Chris Lattner wrote:
> On Dec 10, 2006, at 3:43 PM, Reid Spencer wrote:
> > Here's the SETCC patch to convert SetCondInst (SetCC) instructions
> > into
> > ICmpInst. Here's somethings you should know about this patch:
> > 
> > 
> > 3. The SetCondInst instruction is still used for floating point
> > comparisons.
> 
> 
> Ok, this will be changed in the next patch?

Yes. This was done to minimize patch size, although I'm not sure it
helped that much.

> 
> 
> > 6. The llvm-gcc patch emits ICmp for integer/pointer and SetCC for
> > floating 
> >point. No FCmpInst instructions are emitted. We'll do that in the
> > next patch.
> 
> 
> Ok, sounds great.
> 
> 
> For the llvm-gcc patch:
> 
> 
>Value *EmitCompare(tree_node *exp, unsigned Opc, bool isUnordered);
> +  Value *EmitCompare(tree_node *exp, unsigned Opc);
> 
> 
> I don't like the subtle overloads here.  One way to fix this:
> 
> 
> +  case LT_EXPR: {
> +tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0));
> +if (!FLOAT_TYPE_P(Op0Ty))
> +  Result = 
> +EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? 
> +ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT);
> +else 
> +  Result = EmitCompare(exp, Instruction::SetLT, 0); 
> +break;
> +  }
> +  case LE_EXPR: {
> +tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0));
> +if (!FLOAT_TYPE_P(Op0Ty))
> +  Result = 
> +EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? 
> +ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE);
> +else 
> +  Result = EmitCompare(exp, Instruction::SetLE, 0); 
> +break;
> +  }
> 
> 
> This logic shouldn't be duplicated everywhere.  I much prefer that you
> do something like:
> 
> 
> case LT_EXPR:
>   Result = EmitCompare(exp, ICmpInst::ICMP_ULT,
> ICmpInst::ICMP_SLT, Instruction::SetLT, 0);
>   break;

That's really gross. One or two arguments will always be ignored
depending on whether it is a floating point or an integer compare. If
your objection is the overloading, how about EmitFPCompare and
EmitIntCompare?  If you want to shorten the logic in the switch cases we
could write an inline name EmitCompare to do what you suggested.

> 
> ... and move the code for determining which opcode to use into
> EmitCompare.  The same can be
> done for EmitMinMaxExpr.
> 
> 
> 
> 
> @@ -2261,8 +2319,8 @@
>Value *Op = Emit(TREE_OPERAND(exp, 0), 0);
>if (!Op->getType()->isFloatingPoint()) {
>  Instruction *OpN = BinaryOperator::createNeg(Op,
> Op->getName()+"neg",CurBB);
> -Value *Cmp = new SetCondInst(Instruction::SetGE, Op,
> OpN->getOperand(0),
> - "abscond", CurBB);
> +Value *Cmp = new ICmpInst(ICmpInst::ICMP_SGE, Op,
> OpN->getOperand(0), 
> +  "abscond", CurBB);
>  return new SelectInst(Cmp, Op, OpN, "abs", CurBB);
>} else {
>  // Turn FP abs into fabs/fabsf.
> 
> 
> This isn't right.  You need to emit a signed or unsigned comparison
> depending on TYPE_UNSIGNED.  It would make sense to just use a call to
> EmitCompare here and have it pick the right one.  I know that unsigned
> abs doesn't make much sense, but this is how expr.c handles it for
> GCC:
> 
> 
>   /* Unsigned abs is simply the operand.  Testing here means we
> don't
>  risk generating incorrect code below.  */
>   if (TYPE_UNSIGNED (type))
> return op0;
> 
Okay.

> 
> @@ -2464,8 +2542,13 @@
>LHS = NOOPCastToType(LHS, Ty);
>RHS = NOOPCastToType(RHS, Ty);
> 
>
> 
> 
> -  Value *Pred = new SetCondInst((Instruction::BinaryOps)CmpOpc, LHS,
> RHS,
> -"tmp", CurBB);
> +  Value *Pred;
> +  if (LHS->getType()->isFloatingPoint())
> +Pred = new SetCondInst((Instruction::BinaryOps)CmpOpc, LHS, RHS,
> +   "tmp", CurBB);
> +  else
> +Pred = new ICmpInst((ICmpInst::Predicate)CmpOpc, LHS, RHS, 
> + "tmp", CurBB);
>return new SelectInst(Pred, LHS, RHS,
>  TREE_CODE(exp) == MAX_EXPR ? "max" : "min",
> CurBB);
>  }
> 
> 
> Likewise this code is wrong (for max).  It should also just call
> EmitCompare.

Okay.
> 
> 
> -Chris

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Pass.h PassAnalysisSupport.h PassManager.h

2006-12-12 Thread Devang Patel


Changes in directory llvm/include/llvm:

Pass.h updated: 1.58 -> 1.59
PassAnalysisSupport.h updated: 1.24 -> 1.25
PassManager.h updated: 1.35 -> 1.36
---
Log message:

Add #ifdef switch toggle between old and new pass manager.  However, 
continue to use old pass manager at the moment. To use new manager
remove #define USE_OLD_PASSMANAGER 1 from Pass.h


---
Diffs of the changes:  (+53 -13)

 Pass.h|   10 ++
 PassAnalysisSupport.h |   28 ++--
 PassManager.h |   28 +---
 3 files changed, 53 insertions(+), 13 deletions(-)


Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.58 llvm/include/llvm/Pass.h:1.59
--- llvm/include/llvm/Pass.h:1.58   Tue Dec 12 18:23:44 2006
+++ llvm/include/llvm/Pass.hTue Dec 12 20:36:01 2006
@@ -36,6 +36,8 @@
 #include 
 #include 
 
+#define USE_OLD_PASSMANAGER 1
+
 namespace llvm {
 
 class Value;
@@ -203,7 +205,9 @@
   virtual bool runPass(Module &M) { return runOnModule(M); }
   virtual bool runPass(BasicBlock&) { return false; }
 
+#ifdef USE_OLD_PASSMANAGER
   virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU);
+#endif
 };
 
 
@@ -226,10 +230,12 @@
   ///
   virtual bool runOnModule(Module &M) { return false; }
 
+#ifdef USE_OLD_PASSMANAGER
 private:
   template friend class PassManagerT;
   friend class ModulePassManager;
   virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU);
+#endif
 };
 
 
//===--===//
@@ -269,6 +275,7 @@
   ///
   bool run(Function &F);
 
+#ifdef USE_OLD_PASSMANAGER
 protected:
   template friend class PassManagerT;
   friend class ModulePassManager;
@@ -276,6 +283,7 @@
   friend class BasicBlockPassManager;
   virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU);
   virtual void addToPassManager(FunctionPassManagerT *PM, AnalysisUsage &AU);
+#endif
 };
 
 
@@ -329,6 +337,7 @@
   virtual bool runPass(Module &M) { return false; }
   virtual bool runPass(BasicBlock &BB);
 
+#ifdef USE_OLD_PASSMANAGER
 private:
   template friend class PassManagerT;
   friend class FunctionPassManagerT;
@@ -338,6 +347,7 @@
   }
   virtual void addToPassManager(FunctionPassManagerT *PM, AnalysisUsage &AU);
   virtual void addToPassManager(BasicBlockPassManager *PM,AnalysisUsage &AU);
+#endif
 };
 
 /// If the user specifies the -time-passes argument on an LLVM tool command 
line


Index: llvm/include/llvm/PassAnalysisSupport.h
diff -u llvm/include/llvm/PassAnalysisSupport.h:1.24 
llvm/include/llvm/PassAnalysisSupport.h:1.25
--- llvm/include/llvm/PassAnalysisSupport.h:1.24Tue Dec 12 18:23:44 2006
+++ llvm/include/llvm/PassAnalysisSupport.h Tue Dec 12 20:36:01 2006
@@ -189,10 +189,19 @@
 ///
 template
 AnalysisType *Pass::getAnalysisToUpdate() const {
+#ifdef USE_OLD_PASSMANAGER
   assert(Resolver && "Pass not resident in a PassManager object!");
+#else
+  assert(Resolver_New && "Pass not resident in a PassManager object!");
+#endif
   const PassInfo *PI = getClassPassInfo();
   if (PI == 0) return 0;
+#ifdef USE_OLD_PASSMANAGER
   return dynamic_cast(Resolver->getAnalysisToUpdate(PI));
+#else
+  return dynamic_cast
+(Resolver_New->getAnalysisToUpdate(PI, true));
+#endif
 }
 
 /// getAnalysis() - This function is used by subclasses to get
@@ -201,15 +210,20 @@
 ///
 template
 AnalysisType &Pass::getAnalysis() const {
+#ifdef USE_OLD_PASSMANAGER
   assert(Resolver && "Pass has not been inserted into a PassManager object!");
+#else
+  assert(Resolver_New && "Pass has not been inserted into a PassManager 
object!");
+#endif
   const PassInfo *PI = getClassPassInfo();
   return getAnalysisID(PI);
 }
 
 template
 AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const {
-  assert(Resolver && "Pass has not been inserted into a PassManager object!");
   assert(PI && "getAnalysis for unregistered pass!");
+#ifdef USE_OLD_PASSMANAGER
+  assert(Resolver && "Pass has not been inserted into a PassManager object!");
   
   // PI *must* appear in AnalysisImpls.  Because the number of passes used
   // should be a small number, we just do a linear search over a (dense)
@@ -224,7 +238,17 @@
   break;
 }
   }
-  
+#else
+  assert(Resolver_New && "Pass has not been inserted into a PassManager 
object!");
+  // PI *must* appear in AnalysisImpls.  Because the number of passes used
+  // should be a small number, we just do a linear search over a (dense)
+  // vector.
+  Pass *ResultPass = Resolver_New->findImplPass(PI);
+  assert (ResultPass && 
+  "getAnalysis*() called on an analysis that was not "
+  "'required' by pass!");
+
+#endif
   // Because the AnalysisType may not be a subclass of pass (for
   // AnalysisGroups), we must use dynamic_cast here to potentially adjust the
   // return pointer (because the class may multiply inherit, once from pass,


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/Pass

[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.77 -> 1.78
PassManager.cpp updated: 1.92 -> 1.93
---
Log message:

Add #ifdef switch toggle between old and new pass manager.  However, 
continue to use old pass manager at the moment. To use new manager
remove #define USE_OLD_PASSMANAGER 1 from Pass.h


---
Diffs of the changes:  (+65 -37)

 Pass.cpp|   18 ++--
 PassManager.cpp |   84 
 2 files changed, 65 insertions(+), 37 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.77 llvm/lib/VMCore/Pass.cpp:1.78
--- llvm/lib/VMCore/Pass.cpp:1.77   Sun Dec 10 01:40:46 2006
+++ llvm/lib/VMCore/Pass.cppTue Dec 12 20:36:01 2006
@@ -14,7 +14,9 @@
 
//===--===//
 
 #include "llvm/PassManager.h"
+#ifdef USE_OLD_PASSMANAGER
 #include "PassManagerT.h" // PassManagerT implementation
+#endif
 #include "llvm/Module.h"
 #include "llvm/ModuleProvider.h"
 #include "llvm/ADT/STLExtras.h"
@@ -34,6 +36,7 @@
   P->Resolver = AR;
 }
 
+#ifdef USE_OLD_PASSMANAGER
 
//===--===//
 // PassManager implementation - The PassManager class is a simple Pimpl class
 // that wraps the PassManagerT template.
@@ -158,17 +161,24 @@
 cerr << "\n";
   }
 }
+#endif
 
 
//===--===//
 // Pass Implementation
 //
 
+#ifdef USE_OLD_PASSMANAGER
 void ModulePass::addToPassManager(ModulePassManager *PM, AnalysisUsage &AU) {
   PM->addPass(this, AU);
 }
+#endif
 
 bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
+#ifdef USE_OLD_PASSMANAGER
   return Resolver->getAnalysisToUpdate(AnalysisID) != 0;
+#else
+  return Resolver_New->getAnalysisToUpdate(AnalysisID, true) != 0;
+#endif
 }
 
 // dumpPassStructure - Implement the -debug-passes=Structure option
@@ -200,11 +210,12 @@
 
//===--===//
 // ImmutablePass Implementation
 //
+#ifdef USE_OLD_PASSMANAGER
 void ImmutablePass::addToPassManager(ModulePassManager *PM, 
  AnalysisUsage &AU) {
   PM->addPass(this, AU);
 }
-
+#endif
 
 
//===--===//
 // FunctionPass Implementation
@@ -233,6 +244,7 @@
   return Changed | doFinalization(*F.getParent());
 }
 
+#ifdef USE_OLD_PASSMANAGER
 void FunctionPass::addToPassManager(ModulePassManager *PM,
 AnalysisUsage &AU) {
   PM->addPass(this, AU);
@@ -242,6 +254,7 @@
 AnalysisUsage &AU) {
   PM->addPass(this, AU);
 }
+#endif
 
 
//===--===//
 // BasicBlockPass Implementation
@@ -271,6 +284,7 @@
   return Changed;
 }
 
+#ifdef USE_OLD_PASSMANAGER
 void BasicBlockPass::addToPassManager(FunctionPassManagerT *PM,
   AnalysisUsage &AU) {
   PM->addPass(this, AU);
@@ -280,7 +294,7 @@
   AnalysisUsage &AU) {
   PM->addPass(this, AU);
 }
-
+#endif
 
 
//===--===//
 // Pass Registration mechanism


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.92 
llvm/lib/VMCore/PassManager.cpp:1.93
--- llvm/lib/VMCore/PassManager.cpp:1.92Tue Dec 12 18:34:32 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 20:36:01 2006
@@ -84,6 +84,7 @@
 // ModulePassManagers.
 
//===--===//
 
+#ifndef USE_OLD_PASSMANAGER
 namespace llvm {
 
 class PMDataManager;
@@ -125,6 +126,10 @@
   /// then return NULL.
   Pass *findAnalysisPass(AnalysisID AID);
 
+  inline void clearManagers() { 
+PassManagers.clear();
+  }
+
   virtual ~PMTopLevelManager() {
 
 for (std::vector::iterator I = PassManagers.begin(),
@@ -291,16 +296,16 @@
 };
 
 
//===--===//
-// BasicBlockPassManager_New
+// BasicBlockPassManager
 //
-/// BasicBlockPassManager_New manages BasicBlockPass. It batches all the
+/// BasicBlockPassManager manages BasicBlockPass. It batches all the
 /// pass together and sequence them to process one basic block before
 /// processing next basic block.
-class BasicBlockPassManager_New : public PMDataManager, 
+class BasicBlockPassManager : public PMDataManager, 
   public FunctionPass {
 
 public:
-  BasicBlockPassManager_New(int D) : PMDataManager(D) { }
+  BasicBlockPassManager(int D) : PMDataManager(D) { }
 
   /// Add a pass into a passmanager queue. 
   bool addPass(Pass *p);
@@ -407,20 +412,20 @@
 
 private:
   // Active Pass Managers
-  BasicBlockPassManager_New *activeBBPassManager;
+  BasicBlock

[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.437 -> 1.438
---
Log message:

Expand fsqrt, fsin, and fcos to libcalls.

---
Diffs of the changes:  (+25 -10)

 LegalizeDAG.cpp |   35 +--
 1 files changed, 25 insertions(+), 10 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.438
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437 Tue Dec 12 19:57:55 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Tue Dec 12 20:38:13 2006
@@ -4951,23 +4951,38 @@
   case ISD::FP_ROUND:
 Lo = ExpandLibCall("__truncdfsf2", Node, Hi);
 break;
-  case ISD::SINT_TO_FP:
+  case ISD::SINT_TO_FP: {
+const char *FnName = 0;
 if (Node->getOperand(0).getValueType() == MVT::i64)
-  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatdisf" : "__floatdidf"),
- Node, Hi);
+  FnName = (VT == MVT::f32) ? "__floatdisf" : "__floatdidf";
 else
-  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatsisf" : "__floatsidf"),
- Node, Hi);
+  FnName = (VT == MVT::f32) ? "__floatsisf" : "__floatsidf";
+Lo = ExpandLibCall(FnName, Node, Hi);
 break;
-  case ISD::UINT_TO_FP:
+  }
+  case ISD::UINT_TO_FP: {
+const char *FnName = 0;
 if (Node->getOperand(0).getValueType() == MVT::i64)
-  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatundisf" : 
"__floatundidf"),
- Node, Hi);
+  FnName = (VT == MVT::f32) ? "__floatundisf" : "__floatundidf";
 else
-  Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatunsisf" : 
"__floatunsidf"),
- Node, Hi);
+  FnName = (VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf";
+Lo = ExpandLibCall(FnName, Node, Hi);
 break;
   }
+  case ISD::FSQRT:
+  case ISD::FSIN:
+  case ISD::FCOS: {
+const char *FnName = 0;
+switch(Node->getOpcode()) {
+case ISD::FSQRT: FnName = (VT == MVT::f32) ? "sqrtf" : "sqrt"; break;
+case ISD::FSIN:  FnName = (VT == MVT::f32) ? "sinf"  : "sin";  break;
+case ISD::FCOS:  FnName = (VT == MVT::f32) ? "cosf"  : "cos";  break;
+default: assert(0 && "Unreachable!");
+}
+Lo = ExpandLibCall(FnName, Node, Hi);
+break;
+  }
+  }
 
   // Make sure the resultant values have been legalized themselves, unless this
   // is a type that requires multi-step expansion.



___
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/LegalizeDAG.cpp

2006-12-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.438 -> 1.439
---
Log message:

Expand (f64 extload f32) to (f64 fp_ext (load f32)) if f64 type action is 
expand.

---
Diffs of the changes:  (+10 -0)

 LegalizeDAG.cpp |   10 ++
 1 files changed, 10 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.438 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.439
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.438 Tue Dec 12 20:38:13 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Tue Dec 12 21:19:57 2006
@@ -4547,6 +4547,16 @@
 std::swap(Lo, Hi);
 } else {
   MVT::ValueType EVT = LD->getLoadedVT();
+
+  if (VT == MVT::f64 && EVT == MVT::f32) {
+// f64 = EXTLOAD f32 should expand to LOAD, FP_EXTEND
+SDOperand Load = DAG.getLoad(EVT, Ch, Ptr, LD->getSrcValue(),
+ LD->getSrcValueOffset());
+// Remember that we legalized the chain.
+AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Load.getValue(1)));
+ExpandOp(DAG.getNode(ISD::FP_EXTEND, VT, Load), Lo, Hi);
+break;
+  }
 
   if (EVT == NVT)
 Lo = DAG.getLoad(NVT, Ch, Ptr, LD->getSrcValue(),



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] SETCC Patches (For Review Only) #1: llvm-gcc

2006-12-12 Thread Chris Lattner
>>
>> +  case LT_EXPR: {
>> +tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0));
>> +if (!FLOAT_TYPE_P(Op0Ty))
>> +  Result =
>> +EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ?
>> +ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT);
>> +else
>> +  Result = EmitCompare(exp, Instruction::SetLT, 0);
>> +break;
>> +  }
>> +  case LE_EXPR: {
>> +tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0));
>> +if (!FLOAT_TYPE_P(Op0Ty))
>> +  Result =
>> +EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ?
>> +ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE);
>> +else
>> +  Result = EmitCompare(exp, Instruction::SetLE, 0);
>> +break;
>> +  }
>>
>>
>> This logic shouldn't be duplicated everywhere.  I much prefer that  
>> you
>> do something like:
>>
>>
>> case LT_EXPR:
>>   Result = EmitCompare(exp, ICmpInst::ICMP_ULT,
>> ICmpInst::ICMP_SLT, Instruction::SetLT, 0);
>>   break;
>
> That's really gross. One or two arguments will always be ignored
> depending on whether it is a floating point or an integer compare. If
> your objection is the overloading, how about EmitFPCompare and
> EmitIntCompare?  If you want to shorten the logic in the switch  
> cases we
> could write an inline name EmitCompare to do what you suggested.

I don't understand, why is that gross?  Basically EmitCompare will  
have this at the top:

Value *EmitCompare(tree exp, unsigned UIOpc, SIOpc, FPOpc, ...) {
   tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0));
   unsigned Predicate = FPOpc;
   if (!FLOAT_TYPE_P(Op0Ty))
 Predicate = TYPE_UNSIGNED(Op0Ty) ? UIOpc : SIOpc;


This doesn't seem gross.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

2006-12-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.171 -> 1.172
---
Log message:

Reject attempts to define intrinsics.  This fixes PR1047: 
http://llvm.org/PR1047  and
Regression/Verifier/2006-12-12-IntrinsicDefine.ll


---
Diffs of the changes:  (+7 -0)

 Verifier.cpp |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.171 llvm/lib/VMCore/Verifier.cpp:1.172
--- llvm/lib/VMCore/Verifier.cpp:1.171  Thu Dec  7 17:41:45 2006
+++ llvm/lib/VMCore/Verifier.cppTue Dec 12 22:30:37 2006
@@ -112,6 +112,7 @@
 bool runOnFunction(Function &F) {
   // Get dominator information if we are being run by PassManager
   if (RealPass) EF = &getAnalysis();
+  
   visit(F);
   InstsInThisBlock.clear();
 
@@ -333,6 +334,12 @@
   F.getReturnType() == Type::VoidTy,
   "Functions cannot return aggregate values!", &F);
 
+  // Verify that this function (which has a body) is not named "llvm.*".  It
+  // is not legal to define intrinsics.
+  if (F.getName().size() >= 5)
+Assert1(F.getName().substr(0, 5) != "llvm.",
+"llvm intrinsics cannot be defined!", &F);
+  
   // Check that this function meets the restrictions on this calling 
convention.
   switch (F.getCallingConv()) {
   default:



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll

2006-12-12 Thread Chris Lattner


Changes in directory llvm/test/Regression/Verifier:

2006-12-12-IntrinsicDefine.ll added (r1.1)
---
Log message:

New testcase for PR1047: http://llvm.org/PR1047 


---
Diffs of the changes:  (+7 -0)

 2006-12-12-IntrinsicDefine.ll |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll
diff -c /dev/null 
llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll:1.1
*** /dev/null   Tue Dec 12 22:30:28 2006
--- llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll Tue Dec 12 
22:30:18 2006
***
*** 0 
--- 1,7 
+ ; RUN: not llvm-as < %s
+ ; PR1047
+ 
+ void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint) {
+ entry:
+   ret void
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

2006-12-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.172 -> 1.173
---
Log message:

only check non-external functions


---
Diffs of the changes:  (+6 -6)

 Verifier.cpp |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.172 llvm/lib/VMCore/Verifier.cpp:1.173
--- llvm/lib/VMCore/Verifier.cpp:1.172  Tue Dec 12 22:30:37 2006
+++ llvm/lib/VMCore/Verifier.cppTue Dec 12 22:45:46 2006
@@ -334,12 +334,6 @@
   F.getReturnType() == Type::VoidTy,
   "Functions cannot return aggregate values!", &F);
 
-  // Verify that this function (which has a body) is not named "llvm.*".  It
-  // is not legal to define intrinsics.
-  if (F.getName().size() >= 5)
-Assert1(F.getName().substr(0, 5) != "llvm.",
-"llvm intrinsics cannot be defined!", &F);
-  
   // Check that this function meets the restrictions on this calling 
convention.
   switch (F.getCallingConv()) {
   default:
@@ -371,6 +365,12 @@
}
 
   if (!F.isExternal()) {
+// Verify that this function (which has a body) is not named "llvm.*".  It
+// is not legal to define intrinsics.
+if (F.getName().size() >= 5)
+  Assert1(F.getName().substr(0, 5) != "llvm.",
+  "llvm intrinsics cannot be defined!", &F);
+
 verifySymbolTable(F.getSymbolTable());
 
 // Check the entry node



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/lib/Transforms/IPO/IndMemRemoval.cpp RaiseAllocations.cpp SimplifyLibCalls.cpp

2006-12-12 Thread Chris Lattner
> @@ -1738,16 +1739,16 @@
>  }
>
>  // isdigit(c)   -> (unsigned)c - '0' <= 9
> -CastInst* cast = CastInst::createInferredCast(ci->getOperand(1),
> -Type::UIntTy, ci->getOperand(1)->getName()+".uint", ci);
> +CastInst* cast = CastInst::createIntegerCast(ci->getOperand(1),
> +Type::UIntTy, false/*ZExt*/, ci->getOperand(1)->getName() 
> +".uint", ci);
>  BinaryOperator* sub_inst = BinaryOperator::createSub(cast,
>  ConstantInt::get(Type::UIntTy,0x30),
>  ci->getOperand(1)->getName()+".sub",ci);
>  SetCondInst* setcond_inst = new SetCondInst 
> (Instruction::SetLE,sub_inst,
>  ConstantInt::get(Type::UIntTy,9),
>  ci->getOperand(1)->getName()+".cmp",ci);
> -CastInst* c2 = CastInst::createInferredCast(
> -setcond_inst, Type::IntTy, ci->getOperand(1)->getName() 
> +".isdigit", ci);
> +CastInst* c2 = new SExtInst(setcond_inst, Type::IntTy,
> +ci->getOperand(1)->getName()+".isdigit", ci);

This should be a zext instruction not sext.  isdigit returns 0/1 not  
0/-1.


> @@ -1870,10 +1870,11 @@
>
>  Function *F = SLC.getModule()->getOrInsertFunction(CTTZName,  
> ArgType,
> ArgType,  
> NULL);
> -Value *V = CastInst::createInferredCast(
> -TheCall->getOperand(1), ArgType, "tmp", TheCall);
> +Value *V = CastInst::createIntegerCast(TheCall->getOperand(1),  
> ArgType,
> +   false/*ZExt*/, "tmp",  
> TheCall);
>  Value *V2 = new CallInst(F, V, "tmp", TheCall);
> -V2 = CastInst::createInferredCast(V2, Type::IntTy, "tmp",  
> TheCall);
> +V2 = CastInst::createIntegerCast(V2, Type::IntTy, true/*SExt*/,
> + "tmp", TheCall);

This should be zext, not sext.

Why did you choose sext for these?


>  V2 = BinaryOperator::createAdd(V2, ConstantInt::get 
> (Type::IntTy, 1),
> "tmp", TheCall);
>  Value *Cond =
> @@ -2116,9 +2117,11 @@
>  /// inserting the cast before IP, and return the cast.
>  /// @brief Cast a value to a "C" string.
>  Value *CastToCStr(Value *V, Instruction &IP) {
> +  assert(V->getType()->getTypeID() == Type::PointerTyID &&
> + "Can't cast non-pointer type to C string type");

isa(V->getType()) please.

Thanks Reid,

-Chris



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ConstantRange.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp

2006-12-12 Thread Chris Lattner
> --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.8 Wed Dec  6  
> 19:30:31 2006
> +++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Tue Dec 12  
> 17:36:14 2006
> @@ -20,9 +20,27 @@
>  /// InsertCastOfTo - Insert a cast of V to the specified type,  
> doing what
>  /// we can to share the casts.
>  Value *SCEVExpander::InsertCastOfTo(Value *V, const Type *Ty) {
> +  // Compute the Cast opcode to use
> +  Instruction::CastOps opcode = Instruction::BitCast;
> +  if (Ty->isIntegral()) {
> +if (V->getType()->getTypeID() == Type::PointerTyID)
> +  opcode = Instruction::PtrToInt;
> +else {
> +  unsigned SrcBits = V->getType()->getPrimitiveSizeInBits();
> +  unsigned DstBits = Ty->getPrimitiveSizeInBits();
> +  opcode = (SrcBits > DstBits ? Instruction::Trunc :
> +(SrcBits == DstBits ? Instruction::BitCast :
> + (V->getType()->isSigned() ? Instruction::SExt :
> +  Instruction::ZExt)));
> +}

This code is not good, you shouldn't look at the type of the value.

InsertCastOfTo is called in two places: LoopStrengthReduce.cpp:1124  
(in which case it is a truncate, maybe a bitcast) and at :213.  The  
call in 213 is in getCastedVersionOf, which is called at :256 (in  
which case it should be ptrtoint) and :271 (in which case it should  
be sext or bitcast).  Please pass down the correct opcode from these  
callers.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h

2006-12-12 Thread Evan Cheng


Changes in directory llvm/include/llvm/Target:

TargetLowering.h updated: 1.92 -> 1.93
---
Log message:

Update comments.

---
Diffs of the changes:  (+4 -3)

 TargetLowering.h |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Target/TargetLowering.h
diff -u llvm/include/llvm/Target/TargetLowering.h:1.92 
llvm/include/llvm/Target/TargetLowering.h:1.93
--- llvm/include/llvm/Target/TargetLowering.h:1.92  Wed Dec 13 00:09:03 2006
+++ llvm/include/llvm/Target/TargetLowering.h   Wed Dec 13 00:12:35 2006
@@ -168,9 +168,10 @@
 
   /// getTypeToTransformTo - For types supported by the target, this is an
   /// identity function.  For types that must be promoted to larger types, this
-  /// returns the larger type to promote to.  For types that are larger than 
the
-  /// largest integer register, this contains one step in the expansion to get
-  /// to the smaller register.
+  /// returns the larger type to promote to.  For integer types that are larger
+  /// than the largest integer register, this contains one step in the 
expansion
+  /// to get to the smaller register. For illegal floating point types, this
+  /// returns the integer type to transform to.
   MVT::ValueType getTypeToTransformTo(MVT::ValueType VT) const {
 return TransformToType[VT];
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h

2006-12-12 Thread Evan Cheng


Changes in directory llvm/include/llvm/Target:

TargetLowering.h updated: 1.91 -> 1.92
---
Log message:

Update comments.

---
Diffs of the changes:  (+3 -3)

 TargetLowering.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Target/TargetLowering.h
diff -u llvm/include/llvm/Target/TargetLowering.h:1.91 
llvm/include/llvm/Target/TargetLowering.h:1.92
--- llvm/include/llvm/Target/TargetLowering.h:1.91  Sun Dec 10 17:12:42 2006
+++ llvm/include/llvm/Target/TargetLowering.h   Wed Dec 13 00:09:03 2006
@@ -338,9 +338,9 @@
   }
 
   /// getNumElements - Return the number of registers that this ValueType will
-  /// eventually require.  This is always one for all non-integer types, is
-  /// one for any types promoted to live in larger registers, but may be more
-  /// than one for types (like i64) that are split into pieces.
+  /// eventually require.  This is one for any types promoted to live in larger
+  /// registers, but may be more than one for types (like i64) that are split
+  /// into pieces.
   unsigned getNumElements(MVT::ValueType VT) const {
 return NumElementsForVT[VT];
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2006-12-12 Thread Chris Lattner

This code (around line 2173):

   CastInst *BoolCast = 0;
   if (CastInst *CI = dyn_cast(I.getOperand(0)))
 if (CI->getOperand(0)->getType() == Type::BoolTy)
   BoolCast = CI;
   if (!BoolCast)
 if (CastInst *CI = dyn_cast(I.getOperand(1)))
   if (CI->getOperand(0)->getType() == Type::BoolTy)
 BoolCast = CI;

Should *only* allow zext from bool (not any cast).  This is a serious  
bug from the original cast patch.


> @@ -2190,7 +2193,7 @@
>SCOpTy- 
> >getPrimitiveSizeInBits()-1);
>  if (SCIOp0->getType()->isUnsigned()) {
>const Type *NewTy = SCIOp0->getType()->getSignedVersion();
> -  SCIOp0 = InsertCastBefore(SCIOp0, NewTy, I);
> +  SCIOp0 = InsertCastBefore(Instruction::BitCast, SCIOp0,  
> NewTy, I);
>  }

This cast be removed now that ashr is signless.


> @@ -2863,12 +2872,14 @@
>Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS);
>Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask);
>if (CI == AndRHS) {  // Masking out bits shifted in.
> +// (Val ashr C1) & C2 -> (Val lshr C1) & C2
>  // Make the argument unsigned.
>  Value *ShVal = Op->getOperand(0);
>  ShVal = InsertNewInstBefore(new ShiftInst 
> (Instruction::LShr, ShVal,
>OpRHS, Op- 
> >getName()),
>  TheAnd);
> -Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal- 
> >getType());
> +Value *AndRHS2 = ConstantExpr::getBitCast(AndRHS, ShVal- 
> >getType());
> +

This cast looks completely dead, if so, it should just be removed.

> @@ -2897,9 +2908,9 @@
>  InsertNewInstBefore(Add, IB);
>  // Convert to unsigned for the comparison.
>  const Type *UnsType = Add->getType()->getUnsignedVersion();
> -Value *OffsetVal = InsertCastBefore(Add, UnsType, IB);
> +Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add,  
> UnsType, IB);
>  AddCST = ConstantExpr::getAdd(AddCST, Hi);
> -AddCST = ConstantExpr::getCast(AddCST, UnsType);
> +AddCST = ConstantExpr::getBitCast(AddCST, UnsType);
>  return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST);

If only we had signless comparisons! :-)

> @@ -3917,11 +3930,11 @@
>for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, + 
> +GTI) {
>  Value *Op = GEP->getOperand(i);
>  uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) &  
> PtrSizeMask;
> -Constant *Scale = ConstantExpr::getCast(ConstantInt::get 
> (UIntPtrTy, Size),
> +Constant *Scale = ConstantExpr::getBitCast(ConstantInt::get 
> (UIntPtrTy, Size),
>  SIntPtrTy);

This doesn't fit in 80 columns.  Further, you can just use:

> Constant *Scale = ConstantInt::get(SIntPtrTy, Size);

Now that Constant[SU]Int got merged into ConstantInt.


This code:
   // Check to see if there is a noop-cast between the shift  
and the and.
   if (!Shift) {
 if (CastInst *CI = dyn_cast(LHSI->getOperand(0)))
   if (CI->getOperand(0)->getType()->isIntegral() &&
   CI->getOperand(0)->getType()- 
 >getPrimitiveSizeInBits() ==
  CI->getType()->getPrimitiveSizeInBits())
 Shift = dyn_cast(CI->getOperand(0));
   }

Should check for bitcast with integral src/dest instead of checking  
sizes etc.


This code:

   // Make sure we insert a logical shift.
   Constant *NewAndCST = AndCST;
   if (AndCST->getType()->isSigned())
 NewAndCST = ConstantExpr::getBitCast(AndCST,
   AndCST->getType()- 
 >getUnsignedVersion());
   NS = new ShiftInst(Instruction::LShr, NewAndCST,
  Shift->getOperand(1), "tmp");

You can drop the cast now that the shift is signless.


The two casts here can be eliminated now that shifts are signless:

 // (X >>s C1) << C2  where C1 > C2  === (X >>s (C1-C2)) & mask
 Op = InsertCastBefore(Instruction::BitCast, Mask,
   I.getType()->getSignedVersion(), I);
 Instruction *Shift =
   new ShiftInst(ShiftOp->getOpcode(), Op,
 ConstantInt::get(Type::UByteTy, ShiftAmt1- 
ShiftAmt2));
 InsertNewInstBefore(Shift, I);

 C = ConstantIntegral::getAllOnesValue(Shift->getType());
 C = ConstantExpr::getShl(C, Op1);
 Mask = BinaryOperator::createAnd(Shift, C, Op->getName() 
+".mask");
 InsertNewInstBefore(Mask, I);
 return CastInst::create(Instruction::BitCast, Mask, I.getType 
());



> @@ -5874,10 +5893,15 @@
>if (DestBitSize == SrcBitSize ||
>!ValueRequiresCast(Op1, DestTy,TD) ||
>!ValueRequiresCast(Op0, DestTy, TD)) {
> -Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI);
> -

Re: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2006-12-12 Thread Chris Lattner
On Dec 12, 2006, at 3:36 PM, Reid Spencer wrote:
> @@ -3286,7 +3281,8 @@
> Op1C- 
> >getOperand(0),
> I.getName());
>  InsertNewInstBefore(NewOp, I);
> -return CastInst::createInferredCast(NewOp, I.getType());
> +return CastInst::createIntegerCast(NewOp, I.getType(),
> +   SrcTy->isSigned());
>}
>  }
>}
> @@ -3690,7 +3686,8 @@
>Op1C- 
> >getOperand(0),
>I.getName());
>  InsertNewInstBefore(NewOp, I);
> -return CastInst::createInferredCast(NewOp, I.getType());
> +return CastInst::createIntegerCast(NewOp, I.getType(),
> +   SrcTy->isSigned());
>}
>}
>
> @@ -3871,7 +3868,8 @@
> Op1C- 
> >getOperand(0),
> I.getName());
>  InsertNewInstBefore(NewOp, I);
> -return CastInst::createInferredCast(NewOp, I.getType());
> +return CastInst::createIntegerCast(NewOp, I.getType(),
> +   SrcTy->isSigned());
>}
>}

These three all point out serious bugs.  The code looks like this for  
each:

   // fold (and (cast A), (cast B)) -> (cast (and A, B))
   if (CastInst *Op1C = dyn_cast(Op1)) {
 if (CastInst *Op0C = dyn_cast(Op0)) {
   const Type *SrcTy = Op0C->getOperand(0)->getType();
   if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy- 
 >isIntegral() &&
   // Only do this if the casts both really cause code to be  
generated.
   ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) &&
   ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) {
 Instruction *NewOp = BinaryOperator::createAnd(Op0C- 
 >getOperand(0),
Op1C- 
 >getOperand(0),
I.getName());
 InsertNewInstBefore(NewOp, I);
 return CastInst::createIntegerCast(NewOp, I.getType(),
SrcTy->isSigned());
   }
 }
   }

This xform used to be safe before the cast patch, but now can turn  
stuff like:

   (and (sext A), (zext B))

into:

   (sext (and A, B))

which is very wrong (again, never use SrcTy->isSigned!).

All three of these cases should verify that Op1C->getOpcode() == Op2C- 
 >getOpcode(), and it should use the opcode in the inserted cast.   
That is, either of these are allowed:

   (and (sext A), (sext B)) -> (sext (and A, B))
   (and (zext A), (zext B)) -> (zext (and A, B))

but no mixing.

> @@ -5392,8 +5389,7 @@
>
>Value *Op = ShiftOp->getOperand(0);
>if (isShiftOfSignedShift != isSignedShift)
> -Op = InsertNewInstBefore(
> -   CastInst::createInferredCast(Op, I.getType(),  
> "tmp"), I);
> +Op = InsertNewInstBefore(new BitCastInst(Op, I.getType(),  
> "tmp"), I);

This cast can be removed, now that shifts are signless.

> @@ -5681,7 +5677,7 @@
>  /// evaluate the expression.
>  Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type  
> *Ty) {
>if (Constant *C = dyn_cast(V))
> -return ConstantExpr::getCast(C, Ty);
> +return ConstantExpr::getIntegerCast(C, Ty, C->getType()- 
> >isSigned());

This looks extremely unsafe.  Why is it ok?

> @@ -7950,13 +7943,20 @@
>  // the same size.  Instead of casting the pointer before  
> the store, cast
>  // the value to be stored.
>  Value *NewCast;
> -if (Constant *C = dyn_cast(SI.getOperand(0)))
> -  NewCast = ConstantExpr::getCast(C, SrcPTy);
> +Instruction::CastOps opcode = Instruction::BitCast;
> +Value *SIOp0 = SI.getOperand(0);
> +if (SrcPTy->getTypeID() == Type::PointerTyID) {

isa(SrcPTy)

> +  if (SIOp0->getType()->isIntegral())
> +opcode = Instruction::IntToPtr;
> +} else if (SrcPTy->isIntegral()) {
> +  if (SIOp0->getType()->getTypeID() == Type::PointerTyID)

isa

-Chris

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits