Re: [llvm-commits] [llvm] r45130 - in /llvm/trunk: lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/CellSPU/SPUInstrInfo.cpp lib/Target/CellSPU/SPUInstrInfo.td

2007-12-18 Thread Evan Cheng
Hi Scott,

There are some compilation warnings. Please fix!

SPUISelLowering.cpp: In function 'llvm::SDOperand  
LowerEXTRACT_VECTOR_ELT(llvm::SDOperand, llvm::SelectionDAG&)':
SPUISelLowering.cpp:2103: warning: 'prefslot_begin' may be used  
uninitialized in this function
SPUISelLowering.cpp:2103: warning: 'prefslot_end' may be used  
uninitialized in this function
SPUISelLowering.cpp: In function 'llvm::SDOperand LowerBUILD_VECTOR 
(llvm::SDOperand, llvm::SelectionDAG&)':
SPUISelLowering.cpp:1685: warning: 'val' may be used uninitialized in  
this function
SPUISelLowering.cpp: In function 'llvm::SDOperand LowerLOAD 
(llvm::SDOperand, llvm::SelectionDAG&, const llvm::SPUSubtarget*)':
SPUISelLowering.cpp:559: warning: 'NewOpC' may be used uninitialized  
in this function

Thanks,

Evan

On Dec 17, 2007, at 2:32 PM, Scott Michel wrote:

> Author: pingbak
> Date: Mon Dec 17 16:32:34 2007
> New Revision: 45130
>
> URL: http://llvm.org/viewvc/llvm-project?rev=45130&view=rev
> Log:
> - Restore some i8 functionality in CellSPU
> - New test case: nand.ll
>
> Added:
> llvm/trunk/test/CodeGen/CellSPU/nand.ll
> Modified:
> llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp
> llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
> llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
> llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td
> llvm/trunk/lib/Target/CellSPU/SPUOperands.td
> llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp
> llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.td
> llvm/trunk/test/CodeGen/CellSPU/and_ops.ll
>
> Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ 
> CellSPU/SPUISelDAGToDAG.cpp?rev=45130&r1=45129&r2=45130&view=diff
>
> == 
> 
> --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original)
> +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Mon Dec 17  
> 16:32:34 2007
> @@ -63,6 +63,13 @@
>}
>  #endif
>
> +  //! ConstantSDNode predicate for i32 unsigned 10-bit immediate  
> values
> +  bool
> +  isI32IntU10Immediate(ConstantSDNode *CN)
> +  {
> +return isU10Constant((int) CN->getValue());
> +  }
> +
>//! ConstantSDNode predicate for i16 sign-extended, 10-bit  
> immediate values
>bool
>isI16IntS10Immediate(ConstantSDNode *CN)
>
> Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ 
> CellSPU/SPUISelLowering.cpp?rev=45130&r1=45129&r2=45130&view=diff
>
> == 
> 
> --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Dec 17  
> 16:32:34 2007
> @@ -119,11 +119,13 @@
>// Set up the SPU's register classes:
>// NOTE: i8 register class is not registered because we cannot  
> determine when
>// we need to zero or sign extend for custom-lowered loads and  
> stores.
> -  addRegisterClass(MVT::i16, SPU::R16CRegisterClass);
> -  addRegisterClass(MVT::i32, SPU::R32CRegisterClass);
> -  addRegisterClass(MVT::i64, SPU::R64CRegisterClass);
> -  addRegisterClass(MVT::f32, SPU::R32FPRegisterClass);
> -  addRegisterClass(MVT::f64, SPU::R64FPRegisterClass);
> +  // NOTE: Ignore the previous note. For now. :-)
> +  addRegisterClass(MVT::i8,   SPU::R8CRegisterClass);
> +  addRegisterClass(MVT::i16,  SPU::R16CRegisterClass);
> +  addRegisterClass(MVT::i32,  SPU::R32CRegisterClass);
> +  addRegisterClass(MVT::i64,  SPU::R64CRegisterClass);
> +  addRegisterClass(MVT::f32,  SPU::R32FPRegisterClass);
> +  addRegisterClass(MVT::f64,  SPU::R64FPRegisterClass);
>addRegisterClass(MVT::i128, SPU::GPRCRegisterClass);
>
>// SPU has no sign or zero extended loads for i1, i8, i16:
> @@ -925,7 +927,7 @@
>  }
>  case MVT::i8:
>if (!isVarArg && ArgRegIdx < NumArgRegs) {
> -unsigned VReg = RegMap->createVirtualRegister 
> (&SPU::R16CRegClass);
> +unsigned VReg = RegMap->createVirtualRegister 
> (&SPU::R8CRegClass);
>  MF.addLiveIn(ArgRegs[ArgRegIdx], VReg);
>  ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::i8);
>  ++ArgRegIdx;
>
> Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ 
> CellSPU/SPUInstrInfo.cpp?rev=45130&r1=45129&r2=45130&view=diff
>
> == 
> 
> --- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp (original)
> +++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp Mon Dec 17  
> 16:32:34 2007
> @@ -54,11 +54,11 @@
>case SPU::ORIr64:
>case SPU::ORHIv8i16:
>case SPU::ORHIr16:
> -// case SPU::ORHI1To2:
> +  case SPU::ORHI1To2:
>case SPU::ORBIv16i8:
> -//case SPU::ORBIr8:
> +  case SPU::ORBIr8:
>case SPU::ORI2To4:
> -// case SPU::ORI1To4:
> +  case SPU::ORI1To4

[llvm-commits] [llvm] r45157 - in /llvm/trunk: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp test/CodeGen/X86/2007-12-16-BURRSchedCrash.ll

2007-12-18 Thread Evan Cheng
Author: evancheng
Date: Tue Dec 18 02:42:10 2007
New Revision: 45157

URL: http://llvm.org/viewvc/llvm-project?rev=45157&view=rev
Log:
FIX for PR1799: When a load is unfolded from an instruction, check if it is a 
new node. If not, do not create a new SUnit.

Added:
llvm/trunk/test/CodeGen/X86/2007-12-16-BURRSchedCrash.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=45157&r1=45156&r2=45157&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Dec 18 
02:42:10 2007
@@ -429,21 +429,9 @@
 DAG.ReplaceAllUsesOfValueWith(SDOperand(SU->Node, OldNumVals-1),
   SDOperand(LoadNode, 1));
 
-SUnit *LoadSU = NewSUnit(LoadNode);
 SUnit *NewSU = NewSUnit(N);
-SUnitMap[LoadNode].push_back(LoadSU);
 SUnitMap[N].push_back(NewSU);
-const TargetInstrDescriptor *TID = &TII->get(LoadNode->getTargetOpcode());
-for (unsigned i = 0; i != TID->numOperands; ++i) {
-  if (TID->getOperandConstraint(i, TOI::TIED_TO) != -1) {
-LoadSU->isTwoAddress = true;
-break;
-  }
-}
-if (TID->Flags & M_COMMUTABLE)
-  LoadSU->isCommutable = true;
-
-TID = &TII->get(N->getTargetOpcode());
+const TargetInstrDescriptor *TID = &TII->get(N->getTargetOpcode());
 for (unsigned i = 0; i != TID->numOperands; ++i) {
   if (TID->getOperandConstraint(i, TOI::TIED_TO) != -1) {
 NewSU->isTwoAddress = true;
@@ -452,13 +440,30 @@
 }
 if (TID->Flags & M_COMMUTABLE)
   NewSU->isCommutable = true;
-
 // FIXME: Calculate height / depth and propagate the changes?
-LoadSU->Depth = NewSU->Depth = SU->Depth;
-LoadSU->Height = NewSU->Height = SU->Height;
-ComputeLatency(LoadSU);
+NewSU->Depth = SU->Depth;
+NewSU->Height = SU->Height;
 ComputeLatency(NewSU);
 
+// LoadNode may already exist. This can happen when there is another
+// load from the same location and producing the same type of value
+// but it has different alignment or volatileness.
+bool isNewLoad = true;
+SUnit *LoadSU;
+DenseMap >::iterator SMI =
+  SUnitMap.find(LoadNode);
+if (SMI != SUnitMap.end()) {
+  LoadSU = SMI->second.front();
+  isNewLoad = false;
+} else {
+  LoadSU = NewSUnit(LoadNode);
+  SUnitMap[LoadNode].push_back(LoadSU);
+
+  LoadSU->Depth = SU->Depth;
+  LoadSU->Height = SU->Height;
+  ComputeLatency(LoadSU);
+}
+
 SUnit *ChainPred = NULL;
 SmallVector ChainSuccs;
 SmallVector LoadPreds;
@@ -484,12 +489,14 @@
 }
 
 SU->removePred(ChainPred, true, false);
-LoadSU->addPred(ChainPred, true, false);
+if (isNewLoad)
+  LoadSU->addPred(ChainPred, true, false);
 for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
   SDep *Pred = &LoadPreds[i];
   SU->removePred(Pred->Dep, Pred->isCtrl, Pred->isSpecial);
-  LoadSU->addPred(Pred->Dep, Pred->isCtrl, Pred->isSpecial,
-  Pred->Reg, Pred->Cost);
+  if (isNewLoad)
+LoadSU->addPred(Pred->Dep, Pred->isCtrl, Pred->isSpecial,
+Pred->Reg, Pred->Cost);
 }
 for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
   SDep *Pred = &NodePreds[i];
@@ -506,12 +513,15 @@
 for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
   SDep *Succ = &ChainSuccs[i];
   Succ->Dep->removePred(SU, Succ->isCtrl, Succ->isSpecial);
-  Succ->Dep->addPred(LoadSU, Succ->isCtrl, Succ->isSpecial,
- Succ->Reg, Succ->Cost);
+  if (isNewLoad)
+Succ->Dep->addPred(LoadSU, Succ->isCtrl, Succ->isSpecial,
+   Succ->Reg, Succ->Cost);
 } 
-NewSU->addPred(LoadSU, false, false);
+if (isNewLoad)
+  NewSU->addPred(LoadSU, false, false);
 
-AvailableQueue->addNode(LoadSU);
+if (isNewLoad)
+  AvailableQueue->addNode(LoadSU);
 AvailableQueue->addNode(NewSU);
 
 ++NumUnfolds;
@@ -519,8 +529,8 @@
 if (NewSU->NumSuccsLeft == 0) {
   NewSU->isAvailable = true;
   return NewSU;
-} else
-  SU = NewSU;
+}
+SU = NewSU;
   }
 
   DOUT << "Duplicating SU # " << SU->NodeNum << "\n";

Added: llvm/trunk/test/CodeGen/X86/2007-12-16-BURRSchedCrash.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-12-16-BURRSchedCrash.ll?rev=45157&view=auto

==
--- llvm/trunk/test/CodeGen/X86/2007-12-16-BURRSchedCrash.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2007-12-16-BURRSchedCrash.ll Tue Dec 18 
02:42:10 2007
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | llc -mtriple=i686-pc-

[llvm-commits] [llvm] r45158 - in /llvm/trunk: lib/Target/README.txt lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

2007-12-18 Thread Christopher Lamb
Author: clamb
Date: Tue Dec 18 03:34:41 2007
New Revision: 45158

URL: http://llvm.org/viewvc/llvm-project?rev=45158&view=rev
Log:
Fold certain additions through selects (and their compares) so as to eliminate 
subtractions. This code is often produced by the SMAX expansion in SCEV.

This implements test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

Added:
llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll
Modified:
llvm/trunk/lib/Target/README.txt
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Target/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=45158&r1=45157&r2=45158&view=diff

==
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Tue Dec 18 03:34:41 2007
@@ -464,21 +464,3 @@
 }
 
 //===-===//
-
-This code is often produced by the SMAX expansion in SCEV:
-
-define i32 @foo(i32 %a) {
-entry:
-%tmp15 = sub i32 99, %a ;  [#uses=2]
-%tmp16 = icmp slt i32 %tmp15, 0 ;  [#uses=1]
-%smax = select i1 %tmp16, i32 0, i32 %tmp15 ;  
[#uses=1]
-%tmp12 = add i32 %smax, %a  ;  [#uses=1]
-%tmp13 = add i32 %tmp12, 1  ;  [#uses=1]
-ret i32 %tmp13
-}
-
-Note that the tmp12 add can be pushed through the select operands, turning
-it into a "select %tmp16, %a, 99".  We apparently already do this in dag 
-combine because it isn't present in X86 output.
-
-//===-===//

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45158&r1=45157&r2=45158&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 18 
03:34:41 2007
@@ -2130,6 +2130,67 @@
   return new PtrToIntInst(I2, CI->getType());
 }
   }
+  
+  // add (select (icmp 0 (sub m A)) X Y) A ->
+  //   add (select (icmp A m) X Y) A
+  // 
+  // add (select X 0 (sub n A)) A ->
+  //  select X A n ->
+  {
+SelectInst *SI = dyn_cast(LHS);
+Value *Other = RHS;
+if (!SI) {
+  SI = dyn_cast(RHS);
+  Other = LHS;
+}
+if (SI) {
+  Value *TV = SI->getTrueValue();
+  Value *FV = SI->getFalseValue();
+  Value *A;
+
+  // Can we fold the add into the argument of the compare?
+  Value *Cond = SI->getCondition();
+  if (ICmpInst *IC = dyn_cast(Cond)) {
+Value *ICOp0 = IC->getOperand(0);
+Value *ICOp1 = IC->getOperand(1);
+ConstantInt *C3, *C4;
+
+// Check both arguments of the compare for a matching subtract.
+if (match(ICOp0, m_ConstantInt(C3)) && C3->getValue() == 0 &&
+match(ICOp1, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
+A == Other) {
+  // We managed to fold the add into the RHS of the select condition.
+  Cond = new ICmpInst(IC->getPredicate(), A, C4, "asis", SI);
+} else if (match(ICOp1, m_ConstantInt(C3)) && C3->getValue() == 0 &&
+match(ICOp0, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
+A == Other) {
+  // We managed to fold the add into the LHS of the select condition.
+  Cond = new ICmpInst(IC->getPredicate(), C4, A, "asis", SI);
+}
+  }
+
+  // Can we fold the add into the argument of the select?
+  // We check both true and false select arguments for a matching subtract.
+  ConstantInt *C1, *C2;
+  if (match(FV, m_ConstantInt(C1)) && C1->getValue() == 0 &&
+  match(TV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
+  A == Other) {
+// We managed to fold the add into the true select value,
+// picking up a simplified condition, if available.
+return new SelectInst(Cond, C2, A, "adselsub");
+  } else if (match(TV, m_ConstantInt(C1)) && C1->getValue() == 0 && 
+ match(FV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
+ A == Other) {
+// We managed to fold the add into the false select value,
+// picking up a simplified condition, if available.
+return new SelectInst(Cond, A, C2, "adselsub");
+  } else if (Cond != SI->getCondition()) {
+// We only managed to fold the add into the select condition.
+SI->setOperand(0, Cond);
+Changed = true;
+  }
+}
+  }
 
   return Changed ? &I : 0;
 }

Added: llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll?rev=45158&view=auto


Re: [llvm-commits] [llvm] r45108 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Transforms/Utils/InlineFunction.cpp lib/VMCore/Verifier.cpp test/CodeGen/Generic/2007-12-17-InvokeA

2007-12-18 Thread Duncan Sands
> Woot, thanks Duncan.  Please update langref if it says invoke (asm)  
> is invalid.

It doesn't.

Ciao,

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


Re: [llvm-commits] [llvm] r45141 - /llvm/trunk/lib/Target/README.txt

2007-12-18 Thread Christopher Lamb
Hopefully fixed by http://lists.cs.uiuc.edu/pipermail/llvm-commits/ 
Week-of-Mon-20071217/056446.html


This is my first attempt hacking on Transforms, so some of the idioms  
were a little new to me. Hope the patch looks OK! =)


On Dec 17, 2007, at 5:19 PM, Chris Lattner wrote:


Author: lattner
Date: Mon Dec 17 19:19:18 2007
New Revision: 45141

URL: http://llvm.org/viewvc/llvm-project?rev=45141&view=rev
Log:
add a missed case.

Modified:
llvm/trunk/lib/Target/README.txt

Modified: llvm/trunk/lib/Target/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ 
README.txt?rev=45141&r1=45140&r2=45141&view=diff


== 


--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Mon Dec 17 19:19:18 2007
@@ -464,3 +464,21 @@
 }

 // 
===--- 
--===//

+
+This code is often produced by the SMAX expansion in SCEV:
+
+define i32 @foo(i32 %a) {
+entry:
+%tmp15 = sub i32 99, %a ;  [#uses=2]
+%tmp16 = icmp slt i32 %tmp15, 0 ;  [#uses=1]
+%smax = select i1 %tmp16, i32 0, i32 %tmp15 ;  
 [#uses=1]

+%tmp12 = add i32 %smax, %a  ;  [#uses=1]
+%tmp13 = add i32 %tmp12, 1  ;  [#uses=1]
+ret i32 %tmp13
+}
+
+Note that the tmp12 add can be pushed through the select operands,  
turning
+it into a "select %tmp16, %a, 99".  We apparently already do this  
in dag

+combine because it isn't present in X86 output.
+
+// 
===--- 
--===//



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


--
Christopher Lamb



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


[llvm-commits] [llvm] r45159 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

2007-12-18 Thread Christopher Lamb
Author: clamb
Date: Tue Dec 18 03:45:40 2007
New Revision: 45159

URL: http://llvm.org/viewvc/llvm-project?rev=45159&view=rev
Log:
Fix typos.

Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45159&r1=45158&r2=45159&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 18 
03:45:40 2007
@@ -2135,7 +2135,7 @@
   //   add (select (icmp A m) X Y) A
   // 
   // add (select X 0 (sub n A)) A ->
-  //  select X A n ->
+  //  select X A n
   {
 SelectInst *SI = dyn_cast(LHS);
 Value *Other = RHS;

Modified: llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll?rev=45159&r1=45158&r2=45159&view=diff

==
--- llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll Tue Dec 
18 03:45:40 2007
@@ -35,4 +35,4 @@
 %smax = select i1 %tmp16, i32 0, i32 %tmp15 ;  
[#uses=1]
 %tmp12 = add i32 %smax, %a  ;  [#uses=1]
 ret i32 %tmp12
-}
\ No newline at end of file
+}


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


[llvm-commits] [llvm] r45160 - in /llvm/trunk: include/llvm/Function.h include/llvm/Instructions.h include/llvm/Support/CallSite.h lib/Transforms/IPO/PruneEH.cpp lib/Transforms/Scalar/InstructionCombi

2007-12-18 Thread Duncan Sands
Author: baldrick
Date: Tue Dec 18 03:59:50 2007
New Revision: 45160

URL: http://llvm.org/viewvc/llvm-project?rev=45160&view=rev
Log:
Rename isNoReturn to doesNotReturn, and isNoUnwind to
doesNotThrow.

Modified:
llvm/trunk/include/llvm/Function.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/Support/CallSite.h
llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/Function.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=45160&r1=45159&r2=45160&view=diff

==
--- llvm/trunk/include/llvm/Function.h (original)
+++ llvm/trunk/include/llvm/Function.h Tue Dec 18 03:59:50 2007
@@ -166,12 +166,12 @@
   }
 
   /// @brief Determine if the function cannot return.
-  bool isNoReturn() const {
+  bool doesNotReturn() const {
 return paramHasAttr(0, ParamAttr::NoReturn);
   }
 
   /// @brief Determine if the function cannot unwind.
-  bool isNoUnwind() const {
+  bool doesNotThrow() const {
 return paramHasAttr(0, ParamAttr::NoUnwind);
   }
 

Modified: llvm/trunk/include/llvm/Instructions.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=45160&r1=45159&r2=45160&view=diff

==
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Dec 18 03:59:50 2007
@@ -940,12 +940,12 @@
   }
 
   /// @brief Determine if the call cannot return.
-  bool isNoReturn() const {
+  bool doesNotReturn() const {
 return paramHasAttr(0, ParamAttr::NoReturn);
   }
 
   /// @brief Determine if the call cannot unwind.
-  bool isNoUnwind() const {
+  bool doesNotThrow() const {
 return paramHasAttr(0, ParamAttr::NoUnwind);
   }
 
@@ -1744,12 +1744,12 @@
   }
 
   /// @brief Determine if the call cannot return.
-  bool isNoReturn() const {
+  bool doesNotReturn() const {
 return paramHasAttr(0, ParamAttr::NoReturn);
   }
 
   /// @brief Determine if the call cannot unwind.
-  bool isNoUnwind() const {
+  bool doesNotThrow() const {
 return paramHasAttr(0, ParamAttr::NoUnwind);
   }
 

Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=45160&r1=45159&r2=45160&view=diff

==
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Tue Dec 18 03:59:50 2007
@@ -74,7 +74,7 @@
   bool onlyReadsMemory() const;
 
   /// @brief Determine if the call cannot unwind.
-  bool isNoUnwind() const;
+  bool doesNotThrow() const;
 
   /// getType - Return the type of the instruction that generated this call 
site
   ///

Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=45160&r1=45159&r2=45160&view=diff

==
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Tue Dec 18 03:59:50 2007
@@ -74,11 +74,11 @@
   SCCMightUnwind = true;
   SCCMightReturn = true;
 } else if (F->isDeclaration()) {
-  SCCMightUnwind |= !F->isNoUnwind();
-  SCCMightReturn |= !F->isNoReturn();
+  SCCMightUnwind |= !F->doesNotThrow();
+  SCCMightReturn |= !F->doesNotReturn();
 } else {
-  bool CheckUnwind = !SCCMightUnwind && !F->isNoUnwind();
-  bool CheckReturn = !SCCMightReturn && !F->isNoReturn();
+  bool CheckUnwind = !SCCMightUnwind && !F->doesNotThrow();
+  bool CheckReturn = !SCCMightReturn && !F->doesNotReturn();
 
   if (!CheckUnwind && !CheckReturn)
 continue;
@@ -98,7 +98,7 @@
 if (CheckUnwind && !SCCMightUnwind)
   for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; 
++I)
 if (CallInst *CI = dyn_cast(I)) {
-  if (CI->isNoUnwind()) {
+  if (CI->doesNotThrow()) {
 // This call cannot throw.
   } else if (Function *Callee = CI->getCalledFunction()) {
 CallGraphNode *CalleeNode = CG[Callee];
@@ -155,7 +155,7 @@
   bool MadeChange = false;
   for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
 if (InvokeInst *II = dyn_cast(BB->getTerminator()))
-  if (II->isNoUnwind()) {
+  if (II->doesNotThrow()) {
 SmallVector Args(II->op_begin()+3, II->op_end());
 // Insert a call instruction before the invoke.
 CallInst *Call = new CallInst(II->getCalledValue(),
@@ -187,7 +187,7 @@
 
 for (BasicBlock::i

Re: [llvm-commits] [llvm] r45108 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Transforms/Utils/InlineFunction.cpp lib/VMCore/Verifier.cpp test/CodeGen/Generic/2007-12-17-InvokeA

2007-12-18 Thread Duncan Sands
> Woot, thanks Duncan.  Please update langref if it says invoke (asm)  
> is invalid.

It doesn't.

Ciao,

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


[llvm-commits] [llvm] r45161 - /llvm/trunk/lib/Target/X86/README.txt

2007-12-18 Thread Chris Lattner
Author: lattner
Date: Tue Dec 18 10:48:14 2007
New Revision: 45161

URL: http://llvm.org/viewvc/llvm-project?rev=45161&view=rev
Log:
add an obvious load folding missed optzn.

Modified:
llvm/trunk/lib/Target/X86/README.txt

Modified: llvm/trunk/lib/Target/X86/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=45161&r1=45160&r2=45161&view=diff

==
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Tue Dec 18 10:48:14 2007
@@ -1552,3 +1552,24 @@
 andl$65535, %eax
 ret
 
+//===-===//
+
+We're missing an obvious fold of a load into imul:
+
+int test(long a, long b) { return a * b; } 
+
+LLVM produces:
+_test:
+movl4(%esp), %ecx
+movl8(%esp), %eax
+imull   %ecx, %eax
+ret
+
+vs:
+_test:
+movl8(%esp), %eax
+imull   4(%esp), %eax
+ret
+
+//===-===//
+


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


[llvm-commits] [llvm] r45162 - /llvm/trunk/include/llvm/Bitcode/Serialize.h

2007-12-18 Thread Ted Kremenek
Author: kremenek
Date: Tue Dec 18 12:25:55 2007
New Revision: 45162

URL: http://llvm.org/viewvc/llvm-project?rev=45162&view=rev
Log:
Added some sectioning comments to Serialize.h.
Added additional serialization functors for use with std::foreach.

Modified:
llvm/trunk/include/llvm/Bitcode/Serialize.h

Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialize.h?rev=45162&r1=45161&r2=45162&view=diff

==
--- llvm/trunk/include/llvm/Bitcode/Serialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialize.h Tue Dec 18 12:25:55 2007
@@ -33,39 +33,41 @@
 public:
   explicit Serializer(BitstreamWriter& stream);
   ~Serializer();
+
+  //====//
+  // Template-based dispatch to emit arbitrary types.
+  //====//
   
-  template 
+  template  
   inline void Emit(const T& X) { SerializeTrait::Emit(*this,X); }
   
-  template 
-  struct Emitter {
-Serializer &S;
-
-Emitter(Serializer& s) : S(s) {}
-void operator()(const T& x) const { S.Emit(x); }
-  };
-  
-  template 
-  Emitter MakeEmitter() { return Emitter(*this); }
+  //====//
+  // Methods to emit primitive types.
+  //====//  
   
   void EmitInt(uint64_t X);
   void EmitSInt(int64_t X);
   
-  void EmitBool(bool X) { EmitInt(X); }
+  inline void EmitBool(bool X) { EmitInt(X); }
   void EmitCStr(const char* beg, const char* end);
   void EmitCStr(const char* cstr);
   
   void EmitPtr(const void* ptr) { EmitInt(getPtrId(ptr)); }
   
   template 
-  void EmitRef(const T& ref) { EmitPtr(&ref); }
+  inline void EmitRef(const T& ref) { EmitPtr(&ref); }
   
   template 
-  void EmitOwnedPtr(T* ptr) {
+  inline void EmitOwnedPtr(T* ptr) {
 EmitPtr(ptr);
 if (ptr) SerializeTrait::Emit(*this,*ptr);
   }
   
+  
+  //====//
+  // Batch emission of pointers.
+  //====//
+
   template 
   void BatchEmitOwnedPtrs(T1* p1, T2* p2) {
 EmitPtr(p1);
@@ -135,6 +137,61 @@
 if (p2) SerializeTrait::Emit(*this,*p2);
 if (p3) SerializeTrait::Emit(*this,*p3);
   }
+  
+  //====//
+  // Emitter Functors
+  //====//
+  
+  template 
+  struct Emitter0 {
+Serializer& S;
+Emitter0(Serializer& s) : S(s) {}
+void operator()(const T& x) const {
+  SerializeTrait::Emit(S,x);
+}
+  };
+  
+  template 
+  struct Emitter1 {
+Serializer& S;
+Arg1 A1;
+
+Emitter1(Serializer& s, Arg1 a1) : S(s), A1(a1) {}
+void operator()(const T& x) const {
+  SerializeTrait::Emit(S,x,A1);
+}
+  };
+  
+  template 
+  struct Emitter2 {
+Serializer& S;
+Arg1 A1;
+Arg2 A2;
+
+Emitter2(Serializer& s, Arg1 a1, Arg2 a2) : S(s), A1(a1), A2(a2) {}
+void operator()(const T& x) const {
+  SerializeTrait::Emit(S,x,A1,A2);
+}
+  };
+  
+  template 
+  Emitter0 MakeEmitter() {
+return Emitter0(*this);
+  }
+  
+  template 
+  Emitter1 MakeEmitter(Arg1 a1) {
+return Emitter1(*this,a1);
+  }
+  
+  template 
+  Emitter2 MakeEmitter(Arg1 a1, Arg2 a2) {
+return Emitter2(*this,a1,a2);
+  }
+  
+  //====//
+  // Misc. query and block/record manipulation methods.
+  //====//  
 
   bool isRegistered(const void* p) const;
   


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


Re: [llvm-commits] [llvm] r45158 - in /llvm/trunk: lib/Target/README.txt lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

2007-12-18 Thread Chris Lattner

On Dec 18, 2007, at 1:34 AM, Christopher Lamb wrote:

> Author: clamb
> Date: Tue Dec 18 03:34:41 2007
> New Revision: 45158
>
> URL: http://llvm.org/viewvc/llvm-project?rev=45158&view=rev
> Log:
> Fold certain additions through selects (and their compares) so as  
> to eliminate subtractions. This code is often produced by the SMAX  
> expansion in SCEV.
>
> This implements test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

Nice! Thanks for tackling this,

> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp  
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue  
> Dec 18 03:34:41 2007
> @@ -2130,6 +2130,67 @@
>return new PtrToIntInst(I2, CI->getType());
>  }
>}
> +
> +  // add (select (icmp 0 (sub m A)) X Y) A ->
> +  //   add (select (icmp A m) X Y) A

I'm not sure this is right: the idea is that this pushes the added  
value into the selected value, not into the compare:

   add (select cond 0 (sub m A)) A -> (select cond A m)

right?  We don't want to change the compare, because then a different  
value is picked.

-Chris

> +  //
> +  // add (select X 0 (sub n A)) A ->
> +  //  select X A n
> +  {
> +SelectInst *SI = dyn_cast(LHS);
> +Value *Other = RHS;
> +if (!SI) {
> +  SI = dyn_cast(RHS);
> +  Other = LHS;
> +}
> +if (SI) {
> +  Value *TV = SI->getTrueValue();
> +  Value *FV = SI->getFalseValue();
> +  Value *A;
> +
> +  // Can we fold the add into the argument of the compare?
> +  Value *Cond = SI->getCondition();
> +  if (ICmpInst *IC = dyn_cast(Cond)) {
> +Value *ICOp0 = IC->getOperand(0);
> +Value *ICOp1 = IC->getOperand(1);
> +ConstantInt *C3, *C4;
> +
> +// Check both arguments of the compare for a matching  
> subtract.
> +if (match(ICOp0, m_ConstantInt(C3)) && C3->getValue() == 0 &&
> +match(ICOp1, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
> +A == Other) {
> +  // We managed to fold the add into the RHS of the select  
> condition.
> +  Cond = new ICmpInst(IC->getPredicate(), A, C4, "asis", SI);
> +} else if (match(ICOp1, m_ConstantInt(C3)) && C3->getValue 
> () == 0 &&
> +match(ICOp0, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
> +A == Other) {
> +  // We managed to fold the add into the LHS of the select  
> condition.
> +  Cond = new ICmpInst(IC->getPredicate(), C4, A, "asis", SI);
> +}
> +  }
> +
> +  // Can we fold the add into the argument of the select?
> +  // We check both true and false select arguments for a  
> matching subtract.
> +  ConstantInt *C1, *C2;
> +  if (match(FV, m_ConstantInt(C1)) && C1->getValue() == 0 &&
> +  match(TV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
> +  A == Other) {
> +// We managed to fold the add into the true select value,
> +// picking up a simplified condition, if available.
> +return new SelectInst(Cond, C2, A, "adselsub");
> +  } else if (match(TV, m_ConstantInt(C1)) && C1->getValue() ==  
> 0 &&
> + match(FV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
> + A == Other) {
> +// We managed to fold the add into the false select value,
> +// picking up a simplified condition, if available.
> +return new SelectInst(Cond, A, C2, "adselsub");
> +  } else if (Cond != SI->getCondition()) {
> +// We only managed to fold the add into the select condition.
> +SI->setOperand(0, Cond);
> +Changed = true;
> +  }
> +}
> +  }
>
>return Changed ? &I : 0;
>  }
>
> Added: llvm/trunk/test/Transforms/InstCombine/2007-12-18- 
> AddSelCmpSub.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ 
> InstCombine/2007-12-18-AddSelCmpSub.ll?rev=45158&view=auto
>
> == 
> 
> --- llvm/trunk/test/Transforms/InstCombine/2007-12-18- 
> AddSelCmpSub.ll (added)
> +++ llvm/trunk/test/Transforms/InstCombine/2007-12-18- 
> AddSelCmpSub.ll Tue Dec 18 03:34:41 2007
> @@ -0,0 +1,38 @@
> +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {sub}
> +
> +define i32 @foo(i32 %a) {
> +entry:
> +%tmp15 = sub i32 99, %a ;  [#uses=2]
> +%tmp16 = icmp slt i32 %tmp15, 0 ;  [#uses=1]
> +%smax = select i1 %tmp16, i32 0, i32 %tmp15 ;  
>  [#uses=1]
> +%tmp12 = add i32 %smax, %a  ;  [#uses=1]
> +%tmp13 = add i32 %tmp12, 1  ;  [#uses=1]
> +ret i32 %tmp13
> +}
> +
> +define i32 @bar(i32 %a) {
> +entry:
> +%tmp15 = sub i32 99, %a ;  [#uses=2]
> +%tmp16 = icmp slt i32 %tmp15, 0 ;  [#uses=1]
> +%smax = select i1 %tmp16, i32 0, i32 %tmp15 ;  
>  [#uses=1]
> +%tmp12 = add i32 %smax, %a  ;  [#uses=1]
> +ret i32 %tmp12
> +}
> +
> +de

[llvm-commits] [llvm] r45163 - in /llvm/trunk: include/llvm/InlineAsm.h lib/VMCore/InlineAsm.cpp

2007-12-18 Thread Chris Lattner
Author: lattner
Date: Tue Dec 18 13:04:24 2007
New Revision: 45163

URL: http://llvm.org/viewvc/llvm-project?rev=45163&view=rev
Log:
remove a dead annotation

Modified:
llvm/trunk/include/llvm/InlineAsm.h
llvm/trunk/lib/VMCore/InlineAsm.cpp

Modified: llvm/trunk/include/llvm/InlineAsm.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=45163&r1=45162&r2=45163&view=diff

==
--- llvm/trunk/include/llvm/InlineAsm.h (original)
+++ llvm/trunk/include/llvm/InlineAsm.h Tue Dec 18 13:04:24 2007
@@ -132,7 +132,4 @@
 
 } // End llvm namespace
 
-// Make sure the InlineAsm.cpp file is linked when this one is #included.
-FORCE_DEFINING_FILE_TO_BE_LINKED(InlineAsm)
-
 #endif

Modified: llvm/trunk/lib/VMCore/InlineAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/InlineAsm.cpp?rev=45163&r1=45162&r2=45163&view=diff

==
--- llvm/trunk/lib/VMCore/InlineAsm.cpp (original)
+++ llvm/trunk/lib/VMCore/InlineAsm.cpp Tue Dec 18 13:04:24 2007
@@ -212,4 +212,3 @@
   return true;
 }
 
-DEFINING_FILE_FOR(InlineAsm)


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


[llvm-commits] [llvm] r45164 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

2007-12-18 Thread Evan Cheng
Author: evancheng
Date: Tue Dec 18 13:06:30 2007
New Revision: 45164

URL: http://llvm.org/viewvc/llvm-project?rev=45164&view=rev
Log:
Also print alignment and volatileness.

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=45164&r1=45163&r2=45164&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Dec 18 13:06:30 
2007
@@ -3939,6 +3939,15 @@
   } else if (const VTSDNode *N = dyn_cast(this)) {
 cerr << ":" << MVT::getValueTypeString(N->getVT());
   } else if (const LoadSDNode *LD = dyn_cast(this)) {
+const Value *SrcValue = LD->getSrcValue();
+int SrcOffset = LD->getSrcValueOffset();
+cerr << " <";
+if (SrcValue)
+  cerr << SrcValue;
+else
+  cerr << "null";
+cerr << ":" << SrcOffset << ">";
+
 bool doExt = true;
 switch (LD->getExtensionType()) {
 default: doExt = false; break;
@@ -3958,16 +3967,19 @@
 const char *AM = getIndexedModeName(LD->getAddressingMode());
 if (*AM)
   cerr << " " << AM;
-
-const Value *SrcValue = LD->getSrcValue();
-int SrcOffset = LD->getSrcValueOffset();
+if (LD->isVolatile())
+  cerr << " ";
+cerr << " alignment=" << LD->getAlignment();
+  } else if (const StoreSDNode *ST = dyn_cast(this)) {
+const Value *SrcValue = ST->getSrcValue();
+int SrcOffset = ST->getSrcValueOffset();
 cerr << " <";
 if (SrcValue)
   cerr << SrcValue;
 else
   cerr << "null";
 cerr << ":" << SrcOffset << ">";
-  } else if (const StoreSDNode *ST = dyn_cast(this)) {
+
 if (ST->isTruncatingStore())
   cerr << " getStoredVT()) << ">";
@@ -3975,15 +3987,9 @@
 const char *AM = getIndexedModeName(ST->getAddressingMode());
 if (*AM)
   cerr << " " << AM;
-
-const Value *SrcValue = ST->getSrcValue();
-int SrcOffset = ST->getSrcValueOffset();
-cerr << " <";
-if (SrcValue)
-  cerr << SrcValue;
-else
-  cerr << "null";
-cerr << ":" << SrcOffset << ">";
+if (ST->isVolatile())
+  cerr << " ";
+cerr << " alignment=" << ST->getAlignment();
   }
 }
 


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


[llvm-commits] [llvm] r45165 - in /llvm/trunk: include/llvm/InlineAsm.h include/llvm/System/Mutex.h include/llvm/System/Path.h include/llvm/System/TimeValue.h lib/System/Mutex.cpp lib/System/Path.cpp

2007-12-18 Thread Chris Lattner
Author: lattner
Date: Tue Dec 18 13:15:48 2007
New Revision: 45165

URL: http://llvm.org/viewvc/llvm-project?rev=45165&view=rev
Log:
remove obviously dead uses of IncludeFile.

Modified:
llvm/trunk/include/llvm/InlineAsm.h
llvm/trunk/include/llvm/System/Mutex.h
llvm/trunk/include/llvm/System/Path.h
llvm/trunk/include/llvm/System/TimeValue.h
llvm/trunk/lib/System/Mutex.cpp
llvm/trunk/lib/System/Path.cpp
llvm/trunk/lib/System/TimeValue.cpp

Modified: llvm/trunk/include/llvm/InlineAsm.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=45165&r1=45164&r2=45165&view=diff

==
--- llvm/trunk/include/llvm/InlineAsm.h (original)
+++ llvm/trunk/include/llvm/InlineAsm.h Tue Dec 18 13:15:48 2007
@@ -17,7 +17,6 @@
 #define LLVM_INLINEASM_H
 
 #include "llvm/Value.h"
-#include "llvm/System/IncludeFile.h"
 #include 
 
 namespace llvm {

Modified: llvm/trunk/include/llvm/System/Mutex.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Mutex.h?rev=45165&r1=45164&r2=45165&view=diff

==
--- llvm/trunk/include/llvm/System/Mutex.h (original)
+++ llvm/trunk/include/llvm/System/Mutex.h Tue Dec 18 13:15:48 2007
@@ -14,8 +14,6 @@
 #ifndef LLVM_SYSTEM_MUTEX_H
 #define LLVM_SYSTEM_MUTEX_H
 
-#include "llvm/System/IncludeFile.h"
-
 namespace llvm
 {
   namespace sys
@@ -83,6 +81,4 @@
   }
 }
 
-FORCE_DEFINING_FILE_TO_BE_LINKED(SystemMutex)
-
 #endif

Modified: llvm/trunk/include/llvm/System/Path.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=45165&r1=45164&r2=45165&view=diff

==
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Tue Dec 18 13:15:48 2007
@@ -15,7 +15,6 @@
 #define LLVM_SYSTEM_PATH_H
 
 #include "llvm/System/TimeValue.h"
-#include "llvm/System/IncludeFile.h"
 #include 
 #include 
 #include 
@@ -655,5 +654,4 @@
 
 }
 
-FORCE_DEFINING_FILE_TO_BE_LINKED(SystemPath)
 #endif

Modified: llvm/trunk/include/llvm/System/TimeValue.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/TimeValue.h?rev=45165&r1=45164&r2=45165&view=diff

==
--- llvm/trunk/include/llvm/System/TimeValue.h (original)
+++ llvm/trunk/include/llvm/System/TimeValue.h Tue Dec 18 13:15:48 2007
@@ -12,7 +12,6 @@
 
//===--===//
 
 #include "llvm/Support/DataTypes.h"
-#include "llvm/System/IncludeFile.h"
 #include 
 
 #ifndef LLVM_SYSTEM_TIMEVALUE_H
@@ -380,6 +379,4 @@
 }
 }
 
-FORCE_DEFINING_FILE_TO_BE_LINKED(SystemTimeValue)
-
 #endif

Modified: llvm/trunk/lib/System/Mutex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Mutex.cpp?rev=45165&r1=45164&r2=45165&view=diff

==
--- llvm/trunk/lib/System/Mutex.cpp (original)
+++ llvm/trunk/lib/System/Mutex.cpp Tue Dec 18 13:15:48 2007
@@ -159,4 +159,3 @@
 #endif
 #endif
 
-DEFINING_FILE_FOR(SystemMutex)

Modified: llvm/trunk/lib/System/Path.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Path.cpp?rev=45165&r1=45164&r2=45165&view=diff

==
--- llvm/trunk/lib/System/Path.cpp (original)
+++ llvm/trunk/lib/System/Path.cpp Tue Dec 18 13:15:48 2007
@@ -181,4 +181,3 @@
 #include "Win32/Path.inc"
 #endif
 
-DEFINING_FILE_FOR(SystemPath)

Modified: llvm/trunk/lib/System/TimeValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/TimeValue.cpp?rev=45165&r1=45164&r2=45165&view=diff

==
--- llvm/trunk/lib/System/TimeValue.cpp (original)
+++ llvm/trunk/lib/System/TimeValue.cpp Tue Dec 18 13:15:48 2007
@@ -56,4 +56,3 @@
 #include "Win32/TimeValue.inc"
 #endif
 
-DEFINING_FILE_FOR(SystemTimeValue)


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


[llvm-commits] [llvm] r45166 - /llvm/trunk/utils/buildit/build_llvm

2007-12-18 Thread Bill Wendling
Author: void
Date: Tue Dec 18 13:21:52 2007
New Revision: 45166

URL: http://llvm.org/viewvc/llvm-project?rev=45166&view=rev
Log:
Ignore shell scripts when doing "dsymutil" call.

Modified:
llvm/trunk/utils/buildit/build_llvm

Modified: llvm/trunk/utils/buildit/build_llvm
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=45166&r1=45165&r2=45166&view=diff

==
--- llvm/trunk/utils/buildit/build_llvm (original)
+++ llvm/trunk/utils/buildit/build_llvm Tue Dec 18 13:21:52 2007
@@ -201,7 +201,8 @@
 rm -rf * || exit 1
 
 # Generate .dSYM files
-find $DEST_DIR -perm -0111 -type f -print | xargs -n 1 -P ${SYSCTL} dsymutil
+find $DEST_DIR -perm -0111 -type f ! \( -name '*.la' -o -name gccas -o -name 
gccld -o -name llvm-config \) -print \
+| xargs -n 1 -P ${SYSCTL} dsymutil
 
 # Save .dSYM files and .a archives
 cd $DEST_DIR || exit 1


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


[llvm-commits] [llvm] r45167 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/X86/2007-12-18-LoadCSEBug.ll

2007-12-18 Thread Evan Cheng
Author: evancheng
Date: Tue Dec 18 13:38:14 2007
New Revision: 45167

URL: http://llvm.org/viewvc/llvm-project?rev=45167&view=rev
Log:
Fix PR1872: SrcValue and SrcValueOffset should not be used to compute load / 
store node id.

Added:
llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=45167&r1=45166&r2=45167&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Dec 18 13:38:14 
2007
@@ -372,8 +372,6 @@
 ID.AddInteger(LD->getAddressingMode());
 ID.AddInteger(LD->getExtensionType());
 ID.AddInteger((unsigned int)(LD->getLoadedVT()));
-ID.AddPointer(LD->getSrcValue());
-ID.AddInteger(LD->getSrcValueOffset());
 ID.AddInteger(LD->getAlignment());
 ID.AddInteger(LD->isVolatile());
 break;
@@ -383,8 +381,6 @@
 ID.AddInteger(ST->getAddressingMode());
 ID.AddInteger(ST->isTruncatingStore());
 ID.AddInteger((unsigned int)(ST->getStoredVT()));
-ID.AddPointer(ST->getSrcValue());
-ID.AddInteger(ST->getSrcValueOffset());
 ID.AddInteger(ST->getAlignment());
 ID.AddInteger(ST->isVolatile());
 break;
@@ -639,16 +635,12 @@
 ID.AddInteger(LD->getAddressingMode());
 ID.AddInteger(LD->getExtensionType());
 ID.AddInteger((unsigned int)(LD->getLoadedVT()));
-ID.AddPointer(LD->getSrcValue());
-ID.AddInteger(LD->getSrcValueOffset());
 ID.AddInteger(LD->getAlignment());
 ID.AddInteger(LD->isVolatile());
   } else if (const StoreSDNode *ST = dyn_cast(N)) {
 ID.AddInteger(ST->getAddressingMode());
 ID.AddInteger(ST->isTruncatingStore());
 ID.AddInteger((unsigned int)(ST->getStoredVT()));
-ID.AddPointer(ST->getSrcValue());
-ID.AddInteger(ST->getSrcValueOffset());
 ID.AddInteger(ST->getAlignment());
 ID.AddInteger(ST->isVolatile());
   }
@@ -2330,8 +2322,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(ISD::NON_EXTLOAD);
   ID.AddInteger((unsigned int)VT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2385,8 +2375,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(ExtType);
   ID.AddInteger((unsigned int)EVT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2413,8 +2401,6 @@
   ID.AddInteger(AM);
   ID.AddInteger(LD->getExtensionType());
   ID.AddInteger((unsigned int)(LD->getLoadedVT()));
-  ID.AddPointer(LD->getSrcValue());
-  ID.AddInteger(LD->getSrcValueOffset());
   ID.AddInteger(LD->getAlignment());
   ID.AddInteger(LD->isVolatile());
   void *IP = 0;
@@ -2454,8 +2440,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(false);
   ID.AddInteger((unsigned int)VT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2502,8 +2486,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(1);
   ID.AddInteger((unsigned int)SVT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2529,8 +2511,6 @@
   ID.AddInteger(AM);
   ID.AddInteger(ST->isTruncatingStore());
   ID.AddInteger((unsigned int)(ST->getStoredVT()));
-  ID.AddPointer(ST->getSrcValue());
-  ID.AddInteger(ST->getSrcValueOffset());
   ID.AddInteger(ST->getAlignment());
   ID.AddInteger(ST->isVolatile());
   void *IP = 0;

Added: llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll?rev=45167&view=auto

==
--- llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll Tue Dec 18 13:38:14 
2007
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep {(%esp)} | count 2
+; PR1872
+
+   %struct.c34007g__designated___XUB = type { i32, i32, i32, i32 }
+   %struct.c34007g__pkg__parent = type { i32*, 
%struct.c34007g__designated___XUB* }
+
+define void @_ada_c34007g() {
+entry:
+   %x8 = alloca %struct.c34007g__pkg__parent, align 8  ; 
<%struct.c34007g__pkg__parent*> [#uses=2]
+   %tmp1272 = getelementptr %struct.c34007g__pkg__parent* %x8, i32 0, i32 
0;  [#uses=1]
+   %x82167 = bitcast %struct.c34007g__pkg__parent* %x8 to i64* 
;  [#uses=1]
+   br i1 true, label %bb4668, label %bb848
+
+bb4668:; preds = %bb4648
+   %tmp5464 = load i64* %x82167, align 8   ;  [#uses=1]
+   %tmp5467 = icmp ne i64 0, %tmp5464 

[llvm-commits] [llvm] r45168 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Unix/Path.inc lib/System/Win32/Path.inc

2007-12-18 Thread Ted Kremenek
Author: kremenek
Date: Tue Dec 18 13:46:22 2007
New Revision: 45168

URL: http://llvm.org/viewvc/llvm-project?rev=45168&view=rev
Log:
Added "isDirectory" method to llvm::sys::Path.

Modified:
llvm/trunk/include/llvm/System/Path.h
llvm/trunk/lib/System/Unix/Path.inc
llvm/trunk/lib/System/Win32/Path.inc

Modified: llvm/trunk/include/llvm/System/Path.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=45168&r1=45167&r2=45168&view=diff

==
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Tue Dec 18 13:46:22 2007
@@ -321,7 +321,7 @@
   /// shared library.
   /// @brief Determine if the path reference a dynamic library.
   bool isDynamicLibrary() const;
-
+
   /// This function determines if the path name references an existing file
   /// or directory in the file system.
   /// @returns true if the pathname references an existing file or
@@ -330,6 +330,12 @@
   /// the file system.
   bool exists() const;
 
+  /// This function determines if the path name refences an 
+  /// existing directory.
+  /// @returns true if the pathname references an existing directory.
+  /// @brief Determins if the path is a directory in the file system.
+  bool isDirectory() const;
+
   /// This function determines if the path name references a readable file
   /// or directory in the file system. This function checks for
   /// the existence and readability (by the current program) of the file

Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=45168&r1=45167&r2=45168&view=diff

==
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Tue Dec 18 13:46:22 2007
@@ -289,6 +289,14 @@
 }
 
 bool
+Path::isDirectory() const {
+  struct stat buf;
+  if (0 != stat(path.c_str(), &buf))
+return false;
+  return buf.st_mode & S_IFDIR ? true : false;
+}
+
+bool
 Path::canRead() const {
   return 0 == access(path.c_str(), F_OK | R_OK );
 }

Modified: llvm/trunk/lib/System/Win32/Path.inc
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=45168&r1=45167&r2=45168&view=diff

==
--- llvm/trunk/lib/System/Win32/Path.inc (original)
+++ llvm/trunk/lib/System/Win32/Path.inc Tue Dec 18 13:46:22 2007
@@ -254,6 +254,13 @@
 }
 
 bool
+Path::isDirectory() const {
+  DWORD attr = GetFileAttributes(path.c_str());
+  return (attr != INVALID_FILE_ATTRIBUTES) &&
+ (attr & FILE_ATTRIBUTE_DIRECTORY);
+}
+
+bool
 Path::canRead() const {
   // FIXME: take security attributes into account.
   DWORD attr = GetFileAttributes(path.c_str());


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


Re: [llvm-commits] [llvm] r45158 - in /llvm/trunk: lib/Target/README.txt lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

2007-12-18 Thread Christopher Lamb


On Dec 18, 2007, at 10:55 AM, Chris Lattner wrote:



On Dec 18, 2007, at 1:34 AM, Christopher Lamb wrote:


Author: clamb
Date: Tue Dec 18 03:34:41 2007
New Revision: 45158

URL: http://llvm.org/viewvc/llvm-project?rev=45158&view=rev
Log:
Fold certain additions through selects (and their compares) so as
to eliminate subtractions. This code is often produced by the SMAX
expansion in SCEV.

This implements test/Transforms/InstCombine/2007-12-18- 
AddSelCmpSub.ll


Nice! Thanks for tackling this,


--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
(original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue
Dec 18 03:34:41 2007
@@ -2130,6 +2130,67 @@
   return new PtrToIntInst(I2, CI->getType());
 }
   }
+
+  // add (select (icmp 0 (sub m A)) X Y) A ->
+  //   add (select (icmp A m) X Y) A


I'm not sure this is right: the idea is that this pushes the added
value into the selected value, not into the compare:

   add (select cond 0 (sub m A)) A -> (select cond A m)

right?  We don't want to change the compare, because then a different
value is picked.


I don't believe a different value is picked:

0 cond x - y
0 + y cond x - y + y
y cond x

However, (cmp 0 (sub m A)) -> (cmp A m) simply folds the subtract  
away and into the compare, it has nothing to do with the transform  
rooted at the add, so it probably should be done somewhere else if  
it's valuable.



+  //
+  // add (select X 0 (sub n A)) A ->
+  //  select X A n
+  {
+SelectInst *SI = dyn_cast(LHS);
+Value *Other = RHS;
+if (!SI) {
+  SI = dyn_cast(RHS);
+  Other = LHS;
+}
+if (SI) {
+  Value *TV = SI->getTrueValue();
+  Value *FV = SI->getFalseValue();
+  Value *A;
+
+  // Can we fold the add into the argument of the compare?
+  Value *Cond = SI->getCondition();
+  if (ICmpInst *IC = dyn_cast(Cond)) {
+Value *ICOp0 = IC->getOperand(0);
+Value *ICOp1 = IC->getOperand(1);
+ConstantInt *C3, *C4;
+
+// Check both arguments of the compare for a matching
subtract.
+if (match(ICOp0, m_ConstantInt(C3)) && C3->getValue() ==  
0 &&

+match(ICOp1, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
+A == Other) {
+  // We managed to fold the add into the RHS of the select
condition.
+  Cond = new ICmpInst(IC->getPredicate(), A, C4, "asis",  
SI);

+} else if (match(ICOp1, m_ConstantInt(C3)) && C3->getValue
() == 0 &&
+match(ICOp0, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
+A == Other) {
+  // We managed to fold the add into the LHS of the select
condition.
+  Cond = new ICmpInst(IC->getPredicate(), C4, A, "asis",  
SI);

+}
+  }
+
+  // Can we fold the add into the argument of the select?
+  // We check both true and false select arguments for a
matching subtract.
+  ConstantInt *C1, *C2;
+  if (match(FV, m_ConstantInt(C1)) && C1->getValue() == 0 &&
+  match(TV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
+  A == Other) {
+// We managed to fold the add into the true select value,
+// picking up a simplified condition, if available.
+return new SelectInst(Cond, C2, A, "adselsub");
+  } else if (match(TV, m_ConstantInt(C1)) && C1->getValue() ==
0 &&
+ match(FV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
+ A == Other) {
+// We managed to fold the add into the false select value,
+// picking up a simplified condition, if available.
+return new SelectInst(Cond, A, C2, "adselsub");
+  } else if (Cond != SI->getCondition()) {
+// We only managed to fold the add into the select  
condition.

+SI->setOperand(0, Cond);
+Changed = true;
+  }
+}
+  }

   return Changed ? &I : 0;
 }

Added: llvm/trunk/test/Transforms/InstCombine/2007-12-18-
AddSelCmpSub.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/
InstCombine/2007-12-18-AddSelCmpSub.ll?rev=45158&view=auto

= 
=


--- llvm/trunk/test/Transforms/InstCombine/2007-12-18-
AddSelCmpSub.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2007-12-18-
AddSelCmpSub.ll Tue Dec 18 03:34:41 2007
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {sub}
+
+define i32 @foo(i32 %a) {
+entry:
+%tmp15 = sub i32 99, %a ;  [#uses=2]
+%tmp16 = icmp slt i32 %tmp15, 0 ;  [#uses=1]
+%smax = select i1 %tmp16, i32 0, i32 %tmp15 ;
 [#uses=1]
+%tmp12 = add i32 %smax, %a  ;  [#uses=1]
+%tmp13 = add i32 %tmp12, 1  ;  [#uses=1]
+ret i32 %tmp13
+}
+
+define i32 @bar(i32 %a) {
+entry:
+%tmp15 = sub i32 99, %a ;  [#uses=2]
+%tmp16 = icmp slt i32 %tmp15, 0 ;  [#uses=1]
+%smax = select i1 %tmp16, i32 0, i32 %tmp15 ;
 

[llvm-commits] [llvm] r45169 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

2007-12-18 Thread Christopher Lamb
Author: clamb
Date: Tue Dec 18 14:30:28 2007
New Revision: 45169

URL: http://llvm.org/viewvc/llvm-project?rev=45169&view=rev
Log:
Remove an orthogonal transformation of the selection condition from my most 
recent submission.

Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45169&r1=45168&r2=45169&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 18 
14:30:28 2007
@@ -2131,9 +2131,6 @@
 }
   }
   
-  // add (select (icmp 0 (sub m A)) X Y) A ->
-  //   add (select (icmp A m) X Y) A
-  // 
   // add (select X 0 (sub n A)) A ->
   //  select X A n
   {
@@ -2147,27 +2144,6 @@
   Value *TV = SI->getTrueValue();
   Value *FV = SI->getFalseValue();
   Value *A;
-
-  // Can we fold the add into the argument of the compare?
-  Value *Cond = SI->getCondition();
-  if (ICmpInst *IC = dyn_cast(Cond)) {
-Value *ICOp0 = IC->getOperand(0);
-Value *ICOp1 = IC->getOperand(1);
-ConstantInt *C3, *C4;
-
-// Check both arguments of the compare for a matching subtract.
-if (match(ICOp0, m_ConstantInt(C3)) && C3->getValue() == 0 &&
-match(ICOp1, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
-A == Other) {
-  // We managed to fold the add into the RHS of the select condition.
-  Cond = new ICmpInst(IC->getPredicate(), A, C4, "asis", SI);
-} else if (match(ICOp1, m_ConstantInt(C3)) && C3->getValue() == 0 &&
-match(ICOp0, m_Sub(m_ConstantInt(C4), m_Value(A))) &&
-A == Other) {
-  // We managed to fold the add into the LHS of the select condition.
-  Cond = new ICmpInst(IC->getPredicate(), C4, A, "asis", SI);
-}
-  }
 
   // Can we fold the add into the argument of the select?
   // We check both true and false select arguments for a matching subtract.
@@ -2177,17 +2153,13 @@
   A == Other) {
 // We managed to fold the add into the true select value,
 // picking up a simplified condition, if available.
-return new SelectInst(Cond, C2, A, "adselsub");
+return new SelectInst(SI->getCondition(), C2, A);
   } else if (match(TV, m_ConstantInt(C1)) && C1->getValue() == 0 && 
  match(FV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
  A == Other) {
 // We managed to fold the add into the false select value,
 // picking up a simplified condition, if available.
-return new SelectInst(Cond, A, C2, "adselsub");
-  } else if (Cond != SI->getCondition()) {
-// We only managed to fold the add into the select condition.
-SI->setOperand(0, Cond);
-Changed = true;
+return new SelectInst(SI->getCondition(), A, C2);
   }
 }
   }

Modified: llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll?rev=45169&r1=45168&r2=45169&view=diff

==
--- llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll Tue Dec 
18 14:30:28 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {sub}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add} | count 1
 
 define i32 @foo(i32 %a) {
 entry:
@@ -19,15 +19,6 @@
 ret i32 %tmp12
 }
 
-define i32 @baz(i32 %a) {
-entry:
-%tmp15 = sub i32 99, %a ;  [#uses=1]
-%tmp16 = icmp slt i32 %tmp15, 0 ;  [#uses=1]
-%smax = select i1 %tmp16, i32 0, i32 42 ;  [#uses=1]
-%tmp12 = add i32 %smax, %a  ;  [#uses=1]
-ret i32 %tmp12
-}
-
 define i32 @fun(i32 %a) {
 entry:
 %tmp15 = sub i32 99, %a ;  [#uses=1]


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


[llvm-commits] [llvm] r45170 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

2007-12-18 Thread Christopher Lamb
Author: clamb
Date: Tue Dec 18 14:33:11 2007
New Revision: 45170

URL: http://llvm.org/viewvc/llvm-project?rev=45170&view=rev
Log:
Fix comments

Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45170&r1=45169&r2=45170&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 18 
14:33:11 2007
@@ -2151,14 +2151,12 @@
   if (match(FV, m_ConstantInt(C1)) && C1->getValue() == 0 &&
   match(TV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
   A == Other) {
-// We managed to fold the add into the true select value,
-// picking up a simplified condition, if available.
+// We managed to fold the add into the true select value.
 return new SelectInst(SI->getCondition(), C2, A);
   } else if (match(TV, m_ConstantInt(C1)) && C1->getValue() == 0 && 
  match(FV, m_Sub(m_ConstantInt(C2), m_Value(A))) &&
  A == Other) {
-// We managed to fold the add into the false select value,
-// picking up a simplified condition, if available.
+// We managed to fold the add into the false select value.
 return new SelectInst(SI->getCondition(), A, C2);
   }
 }


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


[llvm-commits] [llvm] r45172 - /llvm/trunk/lib/CodeGen/AsmPrinter.cpp

2007-12-18 Thread Anton Korobeynikov
Author: asl
Date: Tue Dec 18 14:53:41 2007
New Revision: 45172

URL: http://llvm.org/viewvc/llvm-project?rev=45172&view=rev
Log:
Support more insane CEP's in AsmPrinter (Yes, PyPy folks do really use them).

Modified:
llvm/trunk/lib/CodeGen/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=45172&r1=45171&r2=45172&view=diff

==
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Dec 18 14:53:41 2007
@@ -773,9 +773,32 @@
 }
 case Instruction::Add:
 case Instruction::Sub:
+case Instruction::And:
+case Instruction::Or:
+case Instruction::Xor:
   O << "(";
   EmitConstantValueOnly(CE->getOperand(0));
-  O << (Opcode==Instruction::Add ? ") + (" : ") - (");
+  O << ")";
+  switch (Opcode) {
+  case Instruction::Add:
+   O << " + ";
+   break;
+  case Instruction::Sub:
+   O << " - ";
+   break;
+  case Instruction::And:
+   O << " & ";
+   break;
+  case Instruction::Or:
+   O << " | ";
+   break;
+  case Instruction::Xor:
+   O << " ^ ";
+   break;
+  default:
+   break;
+  }
+  O << "(";
   EmitConstantValueOnly(CE->getOperand(1));
   O << ")";
   break;


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


[llvm-commits] [llvm] r45178 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp

2007-12-18 Thread Bill Wendling
Author: void
Date: Tue Dec 18 15:38:04 2007
New Revision: 45178

URL: http://llvm.org/viewvc/llvm-project?rev=45178&view=rev
Log:
Add debugging info. Use the newly created "hasUnmodelledSideEffects" method.

Modified:
llvm/trunk/lib/CodeGen/MachineLICM.cpp

Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=45178&r1=45177&r2=45178&view=diff

==
--- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 18 15:38:04 2007
@@ -103,25 +103,6 @@
   return LI->getLoopFor(BB) != CurLoop;
 }
 
-/// CanHoistInst - Checks that this instructions is one that can be hoisted
-/// out of the loop. I.e., it has no side effects, isn't a control flow
-/// instr, etc.
-///
-bool CanHoistInst(MachineInstr &I) const {
-#ifndef NDEBUG
-  DEBUG({
-  DOUT << "--- Checking if we can hoist " << I << "\n";
-  if (I.getInstrDescriptor()->ImplicitUses)
-DOUT << "  * Instruction has implicit uses.\n";
-  else if (!TII->isTriviallyReMaterializable(&I))
-DOUT << "  * Instruction has side effects.\n";
-});
-#endif
-  // Don't hoist if this instruction implicitly reads physical registers.
-  if (I.getInstrDescriptor()->ImplicitUses) return false;
-  return TII->isTriviallyReMaterializable(&I);
-}
-
 /// IsLoopInvariantInst - Returns true if the instruction is loop
 /// invariant. I.e., all virtual register operands are defined outside of
 /// the loop, physical registers aren't accessed (explicitly or 
implicitly),
@@ -272,13 +253,46 @@
 /// instruction is hoistable.
 /// 
 bool MachineLICM::IsLoopInvariantInst(MachineInstr &I) {
-  if (!CanHoistInst(I)) return false;
+  DEBUG({
+  DOUT << "--- Checking if we can hoist " << I;
+  if (I.getInstrDescriptor()->ImplicitUses) {
+DOUT << "  * Instruction has implicit uses:\n";
+
+const TargetMachine &TM = CurMF->getTarget();
+const MRegisterInfo *MRI = TM.getRegisterInfo();
+const unsigned *ImpUses = I.getInstrDescriptor()->ImplicitUses;
+
+for (; *ImpUses; ++ImpUses)
+  DOUT << "  -> " << MRI->getName(*ImpUses) << "\n";
+  }
+
+  if (I.getInstrDescriptor()->ImplicitDefs) {
+DOUT << "  * Instruction has implicit defines:\n";
+
+const TargetMachine &TM = CurMF->getTarget();
+const MRegisterInfo *MRI = TM.getRegisterInfo();
+const unsigned *ImpDefs = I.getInstrDescriptor()->ImplicitDefs;
+
+for (; *ImpDefs; ++ImpDefs)
+  DOUT << "  -> " << MRI->getName(*ImpDefs) << "\n";
+  }
+
+  if (TII->hasUnmodelledSideEffects(&I))
+DOUT << "  * Instruction has side effects.\n";
+});
+
+#if 0
+  // FIXME: Don't hoist if this instruction implicitly reads physical 
registers.
+  if (I.getInstrDescriptor()->ImplicitUses ||
+  I.getInstrDescriptor()->ImplicitDefs)
+return false;
+#endif
 
   // The instruction is loop invariant if all of its operands are 
loop-invariant
   for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
 const MachineOperand &MO = I.getOperand(i);
 
-if (!MO.isRegister() || !MO.isUse())
+if (!(MO.isRegister() && MO.getReg() && MO.isUse()))
   continue;
 
 unsigned Reg = MO.getReg();
@@ -295,6 +309,9 @@
   return false;
   }
 
+  // Don't hoist something that has side effects.
+  if (TII->hasUnmodelledSideEffects(&I)) return false;
+
   // If we got this far, the instruction is loop invariant!
   return true;
 }


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


[llvm-commits] [llvm-gcc-4.2] r45181 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

2007-12-18 Thread Dale Johannesen
Author: johannes
Date: Tue Dec 18 16:01:38 2007
New Revision: 45181

URL: http://llvm.org/viewvc/llvm-project?rev=45181&view=rev
Log:
Fix an ICE from testsuite.


Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45181&r1=45180&r2=45181&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Tue Dec 18 16:01:38 2007
@@ -301,8 +301,11 @@
   TREE_CODE(type) == POINTER_TYPE ||
   TREE_CODE(type) == REFERENCE_TYPE) && "not a sequential type!");
   // This relies on gcc types with constant size mapping to LLVM types with the
-  // same size.
-  return !VOID_TYPE_P(TREE_TYPE(type)) && isInt64(TYPE_SIZE(TREE_TYPE(type)), 
true);
+  // same size.  It is possible for the component type not to have a size:
+  // struct foo;  extern foo bar[];
+  return !VOID_TYPE_P(TREE_TYPE(type)) &&
+ (!TYPE_SIZE(TREE_TYPE(type)) || 
+isInt64(TYPE_SIZE(TREE_TYPE(type)), true));
 }
 
 /// isArrayCompatible - Return true if the specified gcc array or pointer type


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


[llvm-commits] [llvm] r45182 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Unix/Path.inc lib/System/Win32/Path.inc

2007-12-18 Thread Ted Kremenek
Author: kremenek
Date: Tue Dec 18 16:07:33 2007
New Revision: 45182

URL: http://llvm.org/viewvc/llvm-project?rev=45182&view=rev
Log:
Added "GetCurrentDirectory()" to sys::Path.

Modified:
llvm/trunk/include/llvm/System/Path.h
llvm/trunk/lib/System/Unix/Path.inc
llvm/trunk/lib/System/Win32/Path.inc

Modified: llvm/trunk/include/llvm/System/Path.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=45182&r1=45181&r2=45182&view=diff

==
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Tue Dec 18 16:07:33 2007
@@ -148,6 +148,11 @@
   /// constructor must provide the same result as GetRootDirectory.
   /// @brief Construct a path to the current user's "home" directory
   static Path GetUserHomeDirectory();
+  
+  /// Construct a path to the current directory for the current process.
+  /// @returns The current working directory.
+  /// @brief Returns the current working directory.
+  static Path GetCurrentDirectory();
 
   /// Return the suffix commonly used on file names that contain a shared
   /// object, shared archive, or dynamic link library. Such files are

Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=45182&r1=45181&r2=45182&view=diff

==
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Tue Dec 18 16:07:33 2007
@@ -250,6 +250,16 @@
   return GetRootDirectory();
 }
 
+Path
+Path::GetCurrentDirectory() {
+  char pathname[MAXPATHLEN];
+  if (!getcwd(pathname,MAXPATHLEN)) {
+assert (false && "Could not query current working directory.");
+return Path("");
+  }
+  
+  return Path(pathname);
+}
 
 std::string
 Path::getBasename() const {

Modified: llvm/trunk/lib/System/Win32/Path.inc
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=45182&r1=45181&r2=45182&view=diff

==
--- llvm/trunk/lib/System/Win32/Path.inc (original)
+++ llvm/trunk/lib/System/Win32/Path.inc Tue Dec 18 16:07:33 2007
@@ -222,6 +222,15 @@
   }
   return GetRootDirectory();
 }
+
+Path
+Path::GetCurrentDirectory() {
+  char pathname[MAX_PATH];
+  GetCurrentDirectory(pathname,MAX_PATH);
+  return Path(pathname);  
+}
+
+
 // FIXME: the above set of functions don't map to Windows very well.
 
 


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


[llvm-commits] [llvm] r45173 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

2007-12-18 Thread Christopher Lamb
Author: clamb
Date: Tue Dec 18 15:32:20 2007
New Revision: 45173

URL: http://llvm.org/viewvc/llvm-project?rev=45173&view=rev
Log:
Fold subtracts into integer compares vs. zero. This improves generate code for 
this case on X86 
from
_foo:
movl$99, %ecx
movl4(%esp), %eax
subl%eax, %ecx
xorl%edx, %edx
testl   %ecx, %ecx
cmovs   %edx, %eax
ret

to
_foo:
xorl%ecx, %ecx
movl4(%esp), %eax
cmpl$99, %eax
cmovg   %ecx, %eax
ret

Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45173&r1=45172&r2=45173&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 18 
15:32:20 2007
@@ -4793,7 +4793,24 @@
 
   if (isa(Op1))  // X icmp undef -> undef
 return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty));
-
+
+  // (icmp cond (sub m A) 0) ->
+  //   (icmp cond m A)
+  {
+ConstantInt *C1, *C2;
+Value *A;
+// Check both arguments of the compare for a matching subtract.
+if (match(Op0, m_ConstantInt(C1)) && C1->getValue() == 0 &&
+match(Op1, m_Sub(m_ConstantInt(C2), m_Value(A {
+  // We managed to fold the add into the RHS of the select condition.
+  return new ICmpInst(I.getPredicate(), A, C2);
+} else if (match(Op1, m_ConstantInt(C1)) && C1->getValue() == 0 &&
+   match(Op0, m_Sub(m_ConstantInt(C2), m_Value(A {
+  // We managed to fold the add into the LHS of the select condition.
+  return new ICmpInst(I.getPredicate(), C2, A);
+}
+  }
+  
   // icmp ,  - Global/Stack value
   // addresses never equal each other!  We already know that Op0 != Op1.
   if ((isa(Op0) || isa(Op0) ||


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


[llvm-commits] [llvm] r45186 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-12-18 Thread Evan Cheng
Author: evancheng
Date: Tue Dec 18 19:34:38 2007
New Revision: 45186

URL: http://llvm.org/viewvc/llvm-project?rev=45186&view=rev
Log:
Don't leave newly created nodes around if it turns out they are not needed.

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=45186&r1=45185&r2=45186&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Dec 18 19:34:38 2007
@@ -1446,7 +1446,8 @@
 TLI.isOperationLegal(LoOpt.getOpcode(), LoOpt.getValueType())) {
   RetVal = true;
   DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), LoOpt);
-}
+} else
+  DAG.DeleteNode(Lo.Val);
   }
 
   if (HiExists) {
@@ -1457,7 +1458,8 @@
 TLI.isOperationLegal(HiOpt.getOpcode(), HiOpt.getValueType())) {
   RetVal = true;
   DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), HiOpt);
-}
+} else
+  DAG.DeleteNode(Hi.Val);
   }
 
   return RetVal;


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


[llvm-commits] [llvm-gcc-4.2] r45185 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

2007-12-18 Thread Dale Johannesen
Author: johannes
Date: Tue Dec 18 19:31:25 2007
New Revision: 45185

URL: http://llvm.org/viewvc/llvm-project?rev=45185&view=rev
Log:
Allow calls to reference types.  From gcc testsuite.


Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45185&r1=45184&r2=45185&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Dec 18 19:31:25 2007
@@ -2169,7 +2169,8 @@
   Value *Callee = Emit(TREE_OPERAND(exp, 0), 0);
 
   assert(TREE_TYPE (TREE_OPERAND (exp, 0)) &&
- TREE_CODE(TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
+ (TREE_CODE(TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE ||
+  TREE_CODE(TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE) 
  && "Not calling a function pointer?");
   tree function_type = TREE_TYPE(TREE_TYPE (TREE_OPERAND (exp, 0)));
   unsigned CallingConv;


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


[llvm-commits] [llvm] r45187 - /llvm/trunk/docs/LangRef.html

2007-12-18 Thread Chris Lattner
Author: lattner
Date: Tue Dec 18 23:04:11 2007
New Revision: 45187

URL: http://llvm.org/viewvc/llvm-project?rev=45187&view=rev
Log:
fix more table abuses.

Modified:
llvm/trunk/docs/LangRef.html

Modified: llvm/trunk/docs/LangRef.html
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=45187&r1=45186&r2=45187&view=diff

==
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Tue Dec 18 23:04:11 2007
@@ -1108,31 +1108,31 @@
 Examples:
 
   
-
-  [40 x i32 ]
-  [41 x i32 ]
-  [40 x i8]
-
-
-  Array of 40 32-bit integer values.
-  Array of 41 32-bit integer values.
-  Array of 40 8-bit integer values.
-
+[40 x i32]
+Array of 40 32-bit integer values.
+  
+  
+[41 x i32]
+Array of 41 32-bit integer values.
+  
+  
+[4 x i8]
+Array of 4 8-bit integer values.
   
 
 Here are some examples of multidimensional arrays:
 
   
-
-  [3 x [4 x i32]]
-  [12 x [10 x float]]
-  [2 x [3 x [4 x i16]]]
-
-
-  3x4 array of 32-bit integer values.
-  12x10 array of single precision floating point values.
-  2x3x4 array of 16-bit integer  values.
-
+[3 x [4 x i32]]
+3x4 array of 32-bit integer values.
+  
+  
+[12 x [10 x float]]
+12x10 array of single precision floating point 
values.
+  
+  
+[2 x [3 x [4 x i16]]]
+2x3x4 array of 16-bit integer  values.
   
 
 
@@ -1239,7 +1239,7 @@
 < { i32, i32, i32 } >
 A triple of three i32 values
   
-  < { float, i32 (i32) * } >
+  < { float, i32 (i32)* } >
 A pair, where the first element is a float and 
the
   second element is a pointer to a
   function that takes an i32, returning
@@ -1262,20 +1262,20 @@
 Examples:
 
   
-
-  [4x i32]*
-  i32 (i32 *) *
-   i32 addrspace(5)*
-
-
-  A pointer to array of
-  four i32 values
-  A pointer to a [4x i32]*
+A pointer to array of four i32 values.
+  
+  
+i32 (i32 *) *
+ A pointer to a function that takes an i32*, returning an
-  i32.
-   A pointer to an i32 
value that resides 
-   in address space 5.
-
+  i32.
+  
+  
+i32 addrspace(5)*
+A pointer to an i32 
value
+ that resides in address space #5.
   
 
 
@@ -1307,16 +1307,16 @@
 
 
   
-
-  <4 x i32>
-  <8 x float>
-  <2 x i64>
-
-
-  Vector of 4 32-bit integer values.
-  Vector of 8 floating-point values.
-  Vector of 2 64-bit integer values.
-
+<4 x i32>
+Vector of 4 32-bit integer values.
+  
+  
+<8 x float>
+Vector of 8 32-bit floating-point values.
+  
+  
+<2 x i64>
+Vector of 2 64-bit integer values.
   
 
 
@@ -1342,12 +1342,8 @@
 
 
   
-
-  opaque
-
-
-  An opaque type.
-
+opaque
+An opaque type.
   
 
 


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


[llvm-commits] [llvm] r45190 - /llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td

2007-12-18 Thread Bill Wendling
Author: void
Date: Wed Dec 19 00:07:48 2007
New Revision: 45190

URL: http://llvm.org/viewvc/llvm-project?rev=45190&view=rev
Log:
Mark the "isRemat" instruction as never having side effects.

Modified:
llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td

Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=45190&r1=45189&r2=45190&view=diff

==
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Wed Dec 19 00:07:48 2007
@@ -687,7 +687,7 @@
  "subfic $rD, $rA, $imm", IntGeneral,
  [(set GPRC:$rD, (subc immSExt16:$imm, GPRC:$rA))]>;
 
-let isReMaterializable = 1 in {
+let isReMaterializable = 1, neverHasSideEffects = 1 in {
   def LI  : DForm_2_r0<14, (outs GPRC:$rD), (ins symbolLo:$imm),
"li $rD, $imm", IntGeneral,
[(set GPRC:$rD, immSExt16:$imm)]>;


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


[llvm-commits] [llvm] r45192 - /llvm/trunk/utils/emacs/tablegen-mode.el

2007-12-18 Thread Bill Wendling
Author: void
Date: Wed Dec 19 00:20:05 2007
New Revision: 45192

URL: http://llvm.org/viewvc/llvm-project?rev=45192&view=rev
Log:
Modified to support comments better.

Modified:
llvm/trunk/utils/emacs/tablegen-mode.el

Modified: llvm/trunk/utils/emacs/tablegen-mode.el
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/tablegen-mode.el?rev=45192&r1=45191&r2=45192&view=diff

==
--- llvm/trunk/utils/emacs/tablegen-mode.el (original)
+++ llvm/trunk/utils/emacs/tablegen-mode.el Wed Dec 19 00:20:05 2007
@@ -1,15 +1,12 @@
 ;; Maintainer:  The LLVM team, http://llvm.org/
 ;; Description: Major mode for TableGen description files (part of LLVM 
project)
-;; Updated: 2007-03-26
+;; Updated: 2007-12-18
 
 (require 'comint)
 (require 'custom)
 (require 'ansi-color)
 
 ;; Create mode-specific tables.
-(defvar tablegen-mode-syntax-table nil
-  "Syntax table used while in TableGen mode.")
-
 (defvar td-decorators-face 'td-decorators-face
   "Face method decorators.")
 (make-face 'td-decorators-face)
@@ -25,7 +22,7 @@
 )
 (list
  ;; Comments
- '("\/\/" . font-lock-comment-face)
+;; '("\/\/" . font-lock-comment-face)
  ;; Strings
  '("\"[^\"]+\"" . font-lock-string-face)
  ;; Hex constants
@@ -51,44 +48,36 @@
 ;; Shamelessly ripped from jasmin.el
 ;; URL: http://www.neilvandyke.org/jasmin-emacs/jasmin.el
 
-(if (not tablegen-mode-syntax-table)
-(progn
-  (setq tablegen-mode-syntax-table (make-syntax-table))
-  (mapcar (function
-   (lambda (n)
- (modify-syntax-entry (aref n 0)
-  (aref n 1)
-  tablegen-mode-syntax-table)))
-  '(
-;; whitespace (` ')
-[?\^m " "]
-[?\f  " "]
-[?\n  " "]
-[?\t  " "]
-[?\   " "]
-;; word constituents (`w')
-[?\%  "w"]
-;;[?_  "w  "]
-;; comments
-[?\;  "< "]
-[?\n  "> "]
-;;[?\r  "> "]
-;;[?\^m "> "]
-;; symbol constituents (`_')
-;; punctuation (`.')
-;; open paren (`(')
-[?\(  "("]
-[?\[  "("]
-[?\{  "("]
-[?\<  "("]
-;; close paren (`)')
-[?\)  ")"]
-[?\]  ")"]
-[?\}  ")"]
-[?\>  ")"]
-;; string quote ('"')
-[?\"  "\""]
-
+(defvar tablegen-mode-syntax-table nil
+  "Syntax table used in `tablegen-mode' buffers.")
+(when (not tablegen-mode-syntax-table)
+  (setq tablegen-mode-syntax-table (make-syntax-table))
+  ;; whitespace (` ')
+  (modify-syntax-entry ?\   " "  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\t  " "  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\r  " "  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\n  " "  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\f  " "  tablegen-mode-syntax-table)
+  ;; word constituents (`w')
+  (modify-syntax-entry ?\%  "w"  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\_  "w"  tablegen-mode-syntax-table)
+  ;; comments
+  (modify-syntax-entry ?/   ". 124b" tablegen-mode-syntax-table)
+  (modify-syntax-entry ?*   ". 23"   tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\n  "> b"tablegen-mode-syntax-table)
+  ;; open paren (`(')
+  (modify-syntax-entry ?\(  "("  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\[  "("  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\{  "("  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\<  "("  tablegen-mode-syntax-table)
+  ;; close paren (`)')
+  (modify-syntax-entry ?\)  ")"  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\]  ")"  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\}  ")"  tablegen-mode-syntax-table)
+  (modify-syntax-entry ?\>  ")"  tablegen-mode-syntax-table)
+  ;; string quote ('"')
+  (modify-syntax-entry ?\"  "\"" tablegen-mode-syntax-table)
+  )
 
 ;; - Abbrev table -
 
@@ -112,19 +101,19 @@
   Runs tablegen-mode-hook on startup."
   (interactive)
   (kill-all-local-variables)
-  (use-local-map tablegen-mode-map) ; Provides the local keymap.
-  (setq major-mode 'tablegen-mode)  
-
+  (use-local-map tablegen-mode-map)  ; Provides the local keymap.
   (make-local-variable 'font-lock-defaults)
-  (setq major-mode 'tablegen-mode   ; This is how describe-mode
-;   finds the doc string to print.
-   mode-name "TableGen"; This name goes into the modeline.
-   font-lock-defaults `(tablegen-font-lock-keywords

Re: [llvm-commits] [llvm-gcc-4.2] r45181 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

2007-12-18 Thread Duncan Sands
PS:

>TREE_CODE(type) == POINTER_TYPE ||
>TREE_CODE(type) == REFERENCE_TYPE) && "not a sequential type!");
>// This relies on gcc types with constant size mapping to LLVM types with 
> the
> -  // same size.
> -  return !VOID_TYPE_P(TREE_TYPE(type)) && 
> isInt64(TYPE_SIZE(TREE_TYPE(type)), true);
> +  // same size.  It is possible for the component type not to have a size:
> +  // struct foo;  extern foo bar[];
> +  return !VOID_TYPE_P(TREE_TYPE(type)) &&
> + (!TYPE_SIZE(TREE_TYPE(type)) || 
> +isInt64(TYPE_SIZE(TREE_TYPE(type)), true));
>  }

does the !TYPE_SIZE test also catch !VOID_TYPE_P case?
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc-4.2] r45185 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

2007-12-18 Thread Duncan Sands
Hi Dale,

>assert(TREE_TYPE (TREE_OPERAND (exp, 0)) &&
> - TREE_CODE(TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
> + (TREE_CODE(TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE ||
> +  TREE_CODE(TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE) 
>   && "Not calling a function pointer?");
>tree function_type = TREE_TYPE(TREE_TYPE (TREE_OPERAND (exp, 0)));

for a reference type will function_type get the type of the function?

Thanks,

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


Re: [llvm-commits] [llvm-gcc-4.2] r45181 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

2007-12-18 Thread Duncan Sands
Hi Dale,

> Fix an ICE from testsuite.

what was the failing test?

Thanks,

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


[llvm-commits] [llvm] r45196 - in /llvm/trunk: lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/CellSPU/SPUInstrInfo.cpp lib/Target/CellSPU/SPUInstrInfo.td lib/

2007-12-18 Thread Scott Michel
Author: pingbak
Date: Wed Dec 19 01:35:06 2007
New Revision: 45196

URL: http://llvm.org/viewvc/llvm-project?rev=45196&view=rev
Log:
Add new immed16.ll test case, fix CellSPU errata to make test case work.

Added:
llvm/trunk/test/CodeGen/CellSPU/immed16.ll
Modified:
llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp
llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td
llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp

Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=45196&r1=45195&r2=45196&view=diff

==
--- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Wed Dec 19 01:35:06 2007
@@ -597,7 +597,7 @@
 int FI = cast(N)->getIndex();
 SDOperand TFI = CurDAG->getTargetFrameIndex(FI, SPUtli.getPointerTy());
 
-DEBUG(cerr << "SPUDAGToDAGISel: Replacing FrameIndex with AI32 TFI, 0\n");
+DEBUG(cerr << "SPUDAGToDAGISel: Replacing FrameIndex with AI32 , 0\n");
 return CurDAG->SelectNodeTo(N, SPU::AIr32, Op.getValueType(), TFI,
CurDAG->getTargetConstant(0, MVT::i32));
   } else if (Opc == SPUISD::LDRESULT) {

Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=45196&r1=45195&r2=45196&view=diff

==
--- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Dec 19 01:35:06 2007
@@ -670,6 +670,11 @@
 SDOperand ptrOp;
 int offset;
 
+if (basep.getOpcode() == ISD::FrameIndex) {
+  // FrameIndex nodes are always properly aligned. Really.
+  return SDOperand();
+}
+
 if (basep.getOpcode() == ISD::ADD) {
   const ConstantSDNode *CN = 
cast(basep.Val->getOperand(1));
   assert(CN != NULL
@@ -694,13 +699,10 @@
   stVecVT = MVT::v16i8;
 vecVT = MVT::getVectorType(VT, (128 / MVT::getSizeInBits(VT)));
 
-// Realign the pointer as a D-Form address (ptrOp is the pointer,
-// to force a register load with the address; basep is the actual
-// dform addr offs($reg).
-ptrOp = DAG.getNode(SPUISD::DFormAddr, PtrVT, ptrOp,
-  DAG.getConstant(0, PtrVT));
-basep = DAG.getNode(SPUISD::DFormAddr, PtrVT, 
-   ptrOp, DAG.getConstant((offset & ~0xf), PtrVT));
+// Realign the pointer as a D-Form address (ptrOp is the pointer, basep is
+// the actual dform addr offs($reg).
+basep = DAG.getNode(SPUISD::DFormAddr, PtrVT, ptrOp,
+DAG.getConstant((offset & ~0xf), PtrVT));
 
 // Create the 16-byte aligned vector load
 SDOperand alignLoad =

Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp?rev=45196&r1=45195&r2=45196&view=diff

==
--- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp Wed Dec 19 01:35:06 2007
@@ -62,7 +62,6 @@
   case SPU::AHIvec:
   case SPU::AHIr16:
   case SPU::AIvec:
-  case SPU::AIr32:
 assert(MI.getNumOperands() == 3 &&
MI.getOperand(0).isRegister() &&
MI.getOperand(1).isRegister() &&
@@ -74,6 +73,19 @@
   return true;
 }
 break;
+  case SPU::AIr32:
+assert(MI.getNumOperands() == 3 &&
+   "wrong number of operands to AIr32");
+if (MI.getOperand(0).isRegister() &&
+(MI.getOperand(1).isRegister() ||
+ MI.getOperand(1).isFrameIndex()) &&
+(MI.getOperand(2).isImmediate() &&
+ MI.getOperand(2).getImmedValue() == 0)) {
+  sourceReg = MI.getOperand(1).getReg();
+  destReg = MI.getOperand(0).getReg();
+  return true;
+}
+break;
 #if 0
   case SPU::ORIf64:
   case SPU::ORIf32:

Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td?rev=45196&r1=45195&r2=45196&view=diff

==
--- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Wed Dec 19 01:35:06 2007
@@ -3476,10 +3476,8 @@
 
 // Force load of global address to a register. These forms show up in
 // SPUISD::DFormAddr pseudo instructions:
-/*
 def : Pat<(add tglobaladdr:$in, 0), (ILAlsa tglobaladdr:$in)>;
 def : Pat<(add tconstpool:$in, 0),  (ILAlsa tglobaladdr:$in)>;
 def : Pat<(add tjumptable:$in, 0),  (ILAlsa tglobaladdr:$in)>;
- */
 // Instrinsics:

[llvm-commits] [llvm] r45197 - in /llvm/trunk/lib/CodeGen: DwarfWriter.cpp MachineModuleInfo.cpp SelectionDAG/SelectionDAGISel.cpp

2007-12-18 Thread Duncan Sands
Author: baldrick
Date: Wed Dec 19 01:36:31 2007
New Revision: 45197

URL: http://llvm.org/viewvc/llvm-project?rev=45197&view=rev
Log:
The C++ exception handling personality function wants
to know about calls that cannot throw ('nounwind'):
if such a call does throw for some reason then the
personality will terminate the program.  The distinction
between an ordinary call and a nounwind call is that
an ordinary call gets an entry in the exception table
but a nounwind call does not.  This patch sets up the
exception table appropriately.  One oddity is that
I've chosen to bracket nounwind calls with labels (like
invokes) - the other choice would have been to bracket
ordinary calls with labels.  While bracketing
ordinary calls is more natural (because bracketing
by labels would then correspond exactly to getting an
entry in the exception table), I didn't do it because
introducing labels impedes some optimizations and I'm
guessing that ordinary calls occur more often than
nounwind calls.  This fixes the gcc filter2 eh test,
at least at -O0 (the inliner needs some tweaking at
higher optimization levels).

Modified:
llvm/trunk/lib/CodeGen/DwarfWriter.cpp
llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=45197&r1=45196&r2=45197&view=diff

==
--- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Wed Dec 19 01:36:31 2007
@@ -3013,8 +3013,10 @@
 
   /// CallSiteEntry - Structure describing an entry in the call-site table.
   struct CallSiteEntry {
+// The 'try-range' is BeginLabel .. EndLabel.
 unsigned BeginLabel; // zero indicates the start of the function.
 unsigned EndLabel;   // zero indicates the end of the function.
+// The landing pad starts at PadLabel.
 unsigned PadLabel;   // zero indicates that there is no landing pad.
 unsigned Action;
   };
@@ -3113,13 +3115,21 @@
   SizeActions += SizeSiteActions;
 }
 
-// Compute the call-site table.  Entries must be ordered by address.
+// Compute the call-site table.  The entry for an invoke has a try-range
+// containing the call, a non-zero landing pad and an appropriate action.
+// The entry for an ordinary call has a try-range containing the call and
+// zero for the landing pad and the action.  Calls marked 'nounwind' have
+// no entry and must not be contained in the try-range of any entry - they
+// form gaps in the table.  Entries must be ordered by try-range address.
 SmallVector CallSites;
 
 RangeMapType PadMap;
+// Invokes and nounwind calls have entries in PadMap (due to being 
bracketed
+// by try-range labels when lowered).  Ordinary calls do not, so 
appropriate
+// try-ranges for them need be deduced.
 for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
   const LandingPadInfo *LandingPad = LandingPads[i];
-  for (unsigned j=0, E = LandingPad->BeginLabels.size(); j != E; ++j) {
+  for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) {
 unsigned BeginLabel = LandingPad->BeginLabels[j];
 assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!");
 PadRange P = { i, j };
@@ -3127,27 +3137,39 @@
   }
 }
 
-bool MayThrow = false;
+// The end label of the previous invoke or nounwind try-range.
 unsigned LastLabel = 0;
+
+// Whether there is a potentially throwing instruction (currently this 
means
+// an ordinary call) between the end of the previous try-range and now.
+bool SawPotentiallyThrowing = false;
+
+// Whether the last callsite entry was for an invoke.
+bool PreviousIsInvoke = false;
+
 const TargetInstrInfo *TII = MF->getTarget().getInstrInfo();
+
+// Visit all instructions in order of address.
 for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
  I != E; ++I) {
   for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end();
MI != E; ++MI) {
 if (MI->getOpcode() != TargetInstrInfo::LABEL) {
-  MayThrow |= TII->isCall(MI->getOpcode());
+  SawPotentiallyThrowing |= TII->isCall(MI->getOpcode());
   continue;
 }
 
 unsigned BeginLabel = MI->getOperand(0).getImmedValue();
 assert(BeginLabel && "Invalid label!");
 
+// End of the previous try-range?
 if (BeginLabel == LastLabel)
-  MayThrow = false;
+  SawPotentiallyThrowing = false;
 
+// Beginning of a new try-range?
 RangeMapType::iterator L = PadMap.find(BeginLabel);
-
 if (L == PadMap.end())
+  // Nope, it was just some random label.
   continue;
 
 PadRange P = L->second;
@@ -3159,36 +3181,43 @@