[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

2006-10-15 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelDAGToDAG.cpp updated: 1.119 -> 1.120
---
Log message:

SelectScalarSSELoad should call CanBeFoldedBy as well.

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

 X86ISelDAGToDAG.cpp |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.119 
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.120
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.119   Sat Oct 14 03:33:25 2006
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Oct 16 01:34:55 2006
@@ -147,7 +147,8 @@
 SDOperand &Index, SDOperand &Disp);
 bool SelectLEAAddr(SDOperand N, SDOperand &Base, SDOperand &Scale,
SDOperand &Index, SDOperand &Disp);
-bool SelectScalarSSELoad(SDOperand N, SDOperand &Base, SDOperand &Scale,
+bool SelectScalarSSELoad(SDOperand Root, SDOperand Pred,
+ SDOperand N, SDOperand &Base, SDOperand &Scale,
  SDOperand &Index, SDOperand &Disp,
  SDOperand &InChain, SDOperand &OutChain);
 bool TryFoldLoad(SDOperand P, SDOperand N,
@@ -804,13 +805,16 @@
 /// SelectScalarSSELoad - Match a scalar SSE load.  In particular, we want to
 /// match a load whose top elements are either undef or zeros.  The load flavor
 /// is derived from the type of N, which is either v4f32 or v2f64.
-bool X86DAGToDAGISel::SelectScalarSSELoad(SDOperand N, SDOperand &Base,
+bool X86DAGToDAGISel::SelectScalarSSELoad(SDOperand Root, SDOperand Pred,
+  SDOperand N, SDOperand &Base,
   SDOperand &Scale, SDOperand &Index,
   SDOperand &Disp, SDOperand &InChain,
   SDOperand &OutChain) {
   if (N.getOpcode() == ISD::SCALAR_TO_VECTOR) {
 InChain = N.getOperand(0).getValue(1);
-if (ISD::isNON_EXTLoad(InChain.Val) && InChain.getValue(0).hasOneUse()) {
+if (ISD::isNON_EXTLoad(InChain.Val) &&
+InChain.getValue(0).hasOneUse() &&
+CanBeFoldedBy(N.Val, Pred.Val, Root.Val)) {
   LoadSDNode *LD = cast(InChain);
   if (!SelectAddr(LD->getBasePtr(), Base, Scale, Index, Disp))
 return false;



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


[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

2006-10-15 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.275 -> 1.276
---
Log message:

Avoid getting into an infinite loop when -disable-x86-shuffle-opti is specified.

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

 X86ISelLowering.cpp |   20 
 1 files changed, 12 insertions(+), 8 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.275 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.276
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.275   Fri Oct 13 16:14:26 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Oct 16 01:36:00 2006
@@ -3413,7 +3413,7 @@
 // FIXME: we can do the same for v4f32 case when we know both parts of
 // the lower half come from scalar_to_vector (loadf32). We should do
 // that in post legalizer dag combiner with target specific hooks.
-if (MVT::isInteger(EVT) && (NonZeros & (0x3 << 2)) == 0)
+if (!NoShuffleOpti && MVT::isInteger(EVT) && (NonZeros & (0x3 << 2)) == 0)
   return V[0];
 MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems);
 MVT::ValueType EVT = MVT::getVectorBaseType(MaskVT);
@@ -3466,6 +3466,8 @@
   unsigned NumElems = PermMask.getNumOperands();
   bool V1IsUndef = V1.getOpcode() == ISD::UNDEF;
   bool V2IsUndef = V2.getOpcode() == ISD::UNDEF;
+  bool V1IsSplat = false;
+  bool V2IsSplat = false;
 
   if (isUndefShuffle(Op.Val))
 return DAG.getNode(ISD::UNDEF, VT);
@@ -3492,8 +3494,8 @@
 ShouldXformToMOVLP(V1.Val, V2.Val, PermMask.Val))
   return CommuteVectorShuffle(Op, DAG);
 
-bool V1IsSplat = isSplatVector(V1.Val);
-bool V2IsSplat = isSplatVector(V2.Val);
+V1IsSplat = isSplatVector(V1.Val);
+V2IsSplat = isSplatVector(V2.Val);
 if ((V1IsSplat || V1IsUndef) && !(V2IsSplat || V2IsUndef)) {
   Op = CommuteVectorShuffle(Op, DAG);
   V1 = Op.getOperand(0);
@@ -3519,12 +3521,14 @@
   }
   return Op;
 }
+  }
 
-if (X86::isUNPCKL_v_undef_Mask(PermMask.Val) ||
-X86::isUNPCKLMask(PermMask.Val) ||
-X86::isUNPCKHMask(PermMask.Val))
-  return Op;
+  if (X86::isUNPCKL_v_undef_Mask(PermMask.Val) ||
+  X86::isUNPCKLMask(PermMask.Val) ||
+  X86::isUNPCKHMask(PermMask.Val))
+return Op;
 
+  if (!NoShuffleOpti) {
 if (V2IsSplat) {
   // Normalize mask so all entries that point to V2 points to its first
   // element then try to match unpck{h|l} again. If match, return a 
@@ -3543,7 +3547,7 @@
   }
 
   // Normalize the node to match x86 shuffle ops if needed
-  if (V2.getOpcode() != ISD::UNDEF)
+  if (!NoShuffleOpti && V2.getOpcode() != ISD::UNDEF)
 if (isCommutedSHUFP(PermMask.Val)) {
   Op = CommuteVectorShuffle(Op, DAG);
   V1 = Op.getOperand(0);



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


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

2006-10-15 Thread Evan Cheng


Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.271 -> 1.272
---
Log message:

Passing isel root and use operands to ComplexPattern functions, these should do 
the usual load folding checks as well.

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

 DAGISelEmitter.cpp |   42 --
 1 files changed, 28 insertions(+), 14 deletions(-)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.271 
llvm/utils/TableGen/DAGISelEmitter.cpp:1.272
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.271Sat Oct 14 03:30:15 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp  Mon Oct 16 01:33:44 2006
@@ -2199,9 +2199,9 @@
   /// EmitMatchCode - Emit a matcher for N, going to the label for PatternNo
   /// if the match fails. At this point, we already know that the opcode for N
   /// matches, and the SDNode for the result has the RootName specified name.
-  void EmitMatchCode(TreePatternNode *Root, TreePatternNode *N,
- TreePatternNode *P, const std::string &RootName,
- const std::string &ChainSuffix, bool &FoundChain) {
+  void EmitMatchCode(TreePatternNode *N, TreePatternNode *P,
+ const std::string &RootName, const std::string 
&ChainSuffix,
+ bool &FoundChain) {
 bool isRoot = (P == NULL);
 // Emit instruction predicates. Each predicate is just a string for now.
 if (isRoot) {
@@ -2283,12 +2283,22 @@
   //  /[YY]
   //  | ^
   // [XX]---|
-  const SDNodeInfo &PInfo = ISE.getSDNodeInfo(P->getOperator());
-  if (P != Root ||
+  bool NeedCheck = false;
+  if (P != Pattern)
+NeedCheck = true;
+  else {
+const SDNodeInfo &PInfo = ISE.getSDNodeInfo(P->getOperator());
+NeedCheck =
+  P->getOperator() == ISE.get_intrinsic_void_sdnode() ||
+  P->getOperator() == ISE.get_intrinsic_w_chain_sdnode() ||
+  P->getOperator() == ISE.get_intrinsic_wo_chain_sdnode() ||
   PInfo.getNumOperands() > 1 ||
   PInfo.hasProperty(SDNPHasChain) ||
   PInfo.hasProperty(SDNPInFlag) ||
-  PInfo.hasProperty(SDNPOptInFlag)) {
+  PInfo.hasProperty(SDNPOptInFlag);
+  }
+
+  if (NeedCheck) {
 std::string ParentName(RootName.begin(), RootName.end()-1);
 emitCheck("CanBeFoldedBy(" + RootName + ".Val, " + ParentName +
   ".Val, N.Val)");
@@ -2359,7 +2369,7 @@
   emitCheck(MaskPredicate + RootName + "0, cast(" +
 RootName + "1), " + itostr(II->getValue()) + ")");
   
-  EmitChildMatchCode(Root, N->getChild(0), N, RootName + utostr(0),
+  EmitChildMatchCode(N->getChild(0), N, RootName + utostr(0),
  ChainSuffix + utostr(0), FoundChain);
   return;
 }
@@ -2370,7 +2380,7 @@
   emitInit("SDOperand " + RootName + utostr(OpNo) + " = " +
RootName + ".getOperand(" +utostr(OpNo) + ");");
 
-  EmitChildMatchCode(Root, N->getChild(i), N, RootName + utostr(OpNo),
+  EmitChildMatchCode(N->getChild(i), N, RootName + utostr(OpNo),
  ChainSuffix + utostr(OpNo), FoundChain);
 }
 
@@ -2401,15 +2411,15 @@
 }
   }
 
-  void EmitChildMatchCode(TreePatternNode *Root, TreePatternNode *Child,
-  TreePatternNode *Parent, const std::string &RootName,
+  void EmitChildMatchCode(TreePatternNode *Child, TreePatternNode *Parent,
+  const std::string &RootName,
   const std::string &ChainSuffix, bool &FoundChain) {
 if (!Child->isLeaf()) {
   // If it's not a leaf, recursively match.
   const SDNodeInfo &CInfo = ISE.getSDNodeInfo(Child->getOperator());
   emitCheck(RootName + ".getOpcode() == " +
 CInfo.getEnumName());
-  EmitMatchCode(Root, Child, Parent, RootName, ChainSuffix, FoundChain);
+  EmitMatchCode(Child, Parent, RootName, ChainSuffix, FoundChain);
   if (NodeHasProperty(Child, SDNPHasChain, ISE))
 FoldedChains.push_back(std::make_pair(RootName, 
CInfo.getNumResults()));
 } else {
@@ -2457,7 +2467,12 @@
 emitCode("SDOperand " + ChainName + ";");
   }
   
-  std::string Code = Fn + "(" + RootName;
+  std::string Code = Fn + "(";
+  if (CP->hasProperty(SDNPHasChain)) {
+std::string ParentName(RootName.begin(), RootName.end()-1);
+Code += "N, " + ParentName + ", ";
+  }
+  Code += RootName;
   for (unsigned i = 0; i < NumOps; i++)
 Code += ", CPTmp" + utostr(i);
   if (CP->hasProperty(SDNPHasChain))
@@ -3099,8 +3114,7 @@
 
   // Emit the matcher, capturing named arguments in VariableMap.
   bool FoundChain = false;
-

[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

2006-10-15 Thread Chris Lattner


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.264 -> 1.265
---
Log message:

Produce a useful error message for Regression/Verifier/2006-10-15-AddrLabel.ll


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

 llvmAsmParser.y |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.264 
llvm/lib/AsmParser/llvmAsmParser.y:1.265
--- llvm/lib/AsmParser/llvmAsmParser.y:1.264Mon Oct  9 12:36:59 2006
+++ llvm/lib/AsmParser/llvmAsmParser.y  Sun Oct 15 18:26:46 2006
@@ -1296,6 +1296,8 @@
 CHECK_FOR_ERROR
   }
   | UpRTypes '*' { // Pointer type?
+if (*$1 == Type::LabelTy)
+  GEN_ERROR("Cannot form a pointer to a basic block");
 $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1)));
 delete $1;
 CHECK_FOR_ERROR



___
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-10-15-AddrLabel.ll

2006-10-15 Thread Chris Lattner


Changes in directory llvm/test/Regression/Verifier:

2006-10-15-AddrLabel.ll added (r1.1)
---
Log message:

testcase that causes the asmparser to assert


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

 2006-10-15-AddrLabel.ll |9 +
 1 files changed, 9 insertions(+)


Index: llvm/test/Regression/Verifier/2006-10-15-AddrLabel.ll
diff -c /dev/null llvm/test/Regression/Verifier/2006-10-15-AddrLabel.ll:1.1
*** /dev/null   Sun Oct 15 18:26:38 2006
--- llvm/test/Regression/Verifier/2006-10-15-AddrLabel.ll   Sun Oct 15 
18:26:28 2006
***
*** 0 
--- 1,9 
+ ; RUN: not llvm-as %s -o /dev/null -f &&
+ ; RUN: llvm-as %s -o /dev/null -f 2>&1 | grep 'Cannot form'
+ 
+ int %main() {
+  %foo  = call sbyte* %llvm.stacksave()
+  %foop = cast sbyte* %foo to label*
+  %nret = load label* %foop
+  br label %nret;
+ }



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


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

2006-10-15 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.146 -> 1.147
---
Log message:

label* is not a valid type, add an assertion.


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

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


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.146 llvm/lib/VMCore/Type.cpp:1.147
--- llvm/lib/VMCore/Type.cpp:1.146  Thu Sep 28 18:45:00 2006
+++ llvm/lib/VMCore/Type.cppSun Oct 15 18:21:12 2006
@@ -1204,6 +1204,7 @@
   assert(ValueType && "Can't get a pointer to  type!");
   assert(ValueType != Type::VoidTy &&
  "Pointer to void is not valid, use sbyte* instead!");
+  assert(ValueType != Type::LabelTy && "Pointer to label is not valid!");
   PointerValType PVT(ValueType);
 
   PointerType *PT = PointerTypes->get(PVT);



___
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-10-15 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.518 -> 1.519
---
Log message:

fix a buggy check that accidentally disabled this xform


---
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.518 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.519
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.518   Thu Oct  5 
01:55:50 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Oct 15 17:42:15 2006
@@ -1973,7 +1973,7 @@
   // -(X sdiv C)  -> (X sdiv -C)
   if (Op1I->getOpcode() == Instruction::Div)
 if (ConstantSInt *CSI = dyn_cast(Op0))
-  if (CSI->isNullValue())
+  if (!CSI->isNullValue())
 if (Constant *DivRHS = dyn_cast(Op1I->getOperand(1)))
   return BinaryOperator::createDiv(Op1I->getOperand(0),
ConstantExpr::getNeg(DivRHS));



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


[llvm-commits] CVS: llvm/docs/LangRef.html

2006-10-15 Thread Chris Lattner


Changes in directory llvm/docs:

LangRef.html updated: 1.157 -> 1.158
---
Log message:

clarify


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

 LangRef.html |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.157 llvm/docs/LangRef.html:1.158
--- llvm/docs/LangRef.html:1.157Thu Sep 14 13:23:26 2006
+++ llvm/docs/LangRef.html  Sun Oct 15 15:05:59 2006
@@ -3181,8 +3181,9 @@
 Overview:
 
 
-The 'llvm.returnaddress' intrinsic returns a target-specific value
-indicating the return address of the current function or one of its callers.
+The 'llvm.returnaddress' intrinsic attempts to compute a 
+target-specific value indicating the return address of the current function 
+or one of its callers.
 
 
 Arguments:
@@ -3225,8 +3226,8 @@
 Overview:
 
 
-The 'llvm.frameaddress' intrinsic returns the target-specific frame
-pointer value for the specified stack frame.
+The 'llvm.frameaddress' intrinsic attempts to return the 
+target-specific frame pointer value for the specified stack frame.
 
 
 Arguments:
@@ -3909,7 +3910,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2006/09/14 18:23:26 $
+  Last modified: $Date: 2006/10/15 20:05:59 $
 
 
 



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