[llvm-commits] [patch] call libc memcpy/memset for big arrays

2007-08-24 Thread Rafael Espindola
Currently we expand a memcpy/memset node to a call to the libc implementation if

  if ((Align & 3) != 0 ||
  (I && I->getValue() < Subtarget->getMinRepStrSizeThreshold())) {

Shouldn't this be a ">". The libc memcpy/memset are very fast for big arrays.

If I compile

---
#include 
void f1(long *a, long *b) {
  memcpy(a, b, 8 * 16);
}

void f2(long *a, long *b) {
  memcpy(a, b, 8 * 32);
}
---

with gcc 4.2 (-O2), it will call memcpy for f2 and not for f1.

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047
Index: lib/Target/X86/X86ISelLowering.cpp
===
--- lib/Target/X86/X86ISelLowering.cpp	(revision 41327)
+++ lib/Target/X86/X86ISelLowering.cpp	(working copy)
@@ -3753,10 +3753,10 @@
   if (Align == 0) Align = 1;
 
   ConstantSDNode *I = dyn_cast(Op.getOperand(3));
-  // If not DWORD aligned, call memset if size is less than the threshold.
+  // If not DWORD aligned or size is more than the threshold, call memset.
   // It knows how to align to the right boundary first.
   if ((Align & 3) != 0 ||
-  (I && I->getValue() < Subtarget->getMinRepStrSizeThreshold())) {
+  (I && I->getValue() > Subtarget->getMinRepStrSizeThreshold())) {
 MVT::ValueType IntPtr = getPointerTy();
 const Type *IntPtrTy = getTargetData()->getIntPtrType();
 TargetLowering::ArgListTy Args; 
@@ -3909,10 +3909,10 @@
   if (Align == 0) Align = 1;
 
   ConstantSDNode *I = dyn_cast(Op.getOperand(3));
-  // If not DWORD aligned, call memcpy if size is less than the threshold.
+  // If not DWORD aligned or size is more than the threshold, call memcpy.
   // It knows how to align to the right boundary first.
   if ((Align & 3) != 0 ||
-  (I && I->getValue() < Subtarget->getMinRepStrSizeThreshold())) {
+  (I && I->getValue() > Subtarget->getMinRepStrSizeThreshold())) {
 MVT::ValueType IntPtr = getPointerTy();
 TargetLowering::ArgListTy Args;
 TargetLowering::ArgListEntry Entry;
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [patch] fix the alignment of i64 and f64 on linux x86-64

2007-08-24 Thread Rafael Espindola
According to table 3.1 of http://www.x86-64.org/documentation/abi.pdf,
the i64 and f64 types should have 8 byte alignment.

The attached patch changes this for targets that are not darwin.

OK to commit?

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047
Index: lib/Target/X86/X86Subtarget.h
===
--- lib/Target/X86/X86Subtarget.h	(revision 41327)
+++ lib/Target/X86/X86Subtarget.h	(working copy)
@@ -145,12 +145,18 @@
 
   std::string getDataLayout() const {
 const char *p;
-if (is64Bit())
-  p = "e-p:64:64-f64:32:64-i64:32:64-f80:128:128";
-else if (isTargetDarwin())
-  p = "e-p:32:32-f64:32:64-i64:32:64-f80:128:128";
-else
-  p = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32";
+if (is64Bit()) {
+  if (isTargetDarwin())
+p = "e-p:64:64-f64:32:64-i64:32:64-f80:128:128";
+  else
+p = "e-p:64:64-f64:64:64-i64:64:64-f80:128:128";
+}
+else {
+  if (isTargetDarwin())
+p = "e-p:32:32-f64:32:64-i64:32:64-f80:128:128";
+  else
+p = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32";
+}
 return std::string(p);
   }
 
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-08-24 Thread Chris Lattner
Author: lattner
Date: Fri Aug 24 10:17:59 2007
New Revision: 41359

URL: http://llvm.org/viewvc/llvm-project?rev=41359&view=rev
Log:
add a note

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

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

==
--- llvm/trunk/lib/Target/X86/README-SSE.txt (original)
+++ llvm/trunk/lib/Target/X86/README-SSE.txt Fri Aug 24 10:17:59 2007
@@ -630,3 +630,17 @@
 ret
 
 //===-===//
+
+We should materialize vecetor constants like "all ones" and "signbit" with 
+code like:
+
+ cmpeqps xmm1, xmm1   ; xmm1 = all-ones
+
+and:
+ cmpeqps xmm1, xmm1   ; xmm1 = all-ones
+ psrlq   xmm1, 31 ; xmm1 = all 1000...
+
+instead of using a load from the constant pool.  The later is important for
+ABS/NEG/copysign etc.
+
+//===-===//


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


[llvm-commits] [llvm] r41360 - /llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp

2007-08-24 Thread Chris Lattner
Author: lattner
Date: Fri Aug 24 11:00:15 2007
New Revision: 41360

URL: http://llvm.org/viewvc/llvm-project?rev=41360&view=rev
Log:
Disable EH generation until PPC works 100%.

Modified:
llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=41360&r1=41359&r2=41360&view=diff

==
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Fri Aug 24 11:00:15 2007
@@ -59,7 +59,7 @@
   UsedDirective = "\t.no_dead_strip\t";
   WeakRefDirective = "\t.weak_reference\t";
   HiddenDirective = "\t.private_extern\t";
-  SupportsExceptionHandling = true;
+  SupportsExceptionHandling = false;
 
   DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
   DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";


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


[llvm-commits] [llvm] r41365 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp

2007-08-24 Thread Devang Patel
Author: dpatel
Date: Fri Aug 24 14:32:26 2007
New Revision: 41365

URL: http://llvm.org/viewvc/llvm-project?rev=41365&view=rev
Log:
Fix regression that I caused yesterday night while adding logic to select 
appropriate split condition branch.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Fri Aug 24 14:32:26 2007
@@ -903,7 +903,7 @@
 A_ActiveBranch = A_BR->getSuccessor(1);
 A_InactiveBranch = A_BR->getSuccessor(0);
   }
-  A_BR->setUnconditionalDest(A_BR->getSuccessor(0));
+  A_BR->setUnconditionalDest(A_ActiveBranch);
   removeBlocks(A_InactiveBranch, L, A_ActiveBranch);
 
   //[*] Eliminate split condition's inactive branch in from BLoop.
@@ -918,7 +918,7 @@
 B_ActiveBranch = B_BR->getSuccessor(0);
 B_InactiveBranch = B_BR->getSuccessor(1);
   }
-  B_BR->setUnconditionalDest(B_BR->getSuccessor(1));
+  B_BR->setUnconditionalDest(B_ActiveBranch);
   removeBlocks(B_InactiveBranch, BLoop, B_ActiveBranch);
 
   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] r41367 - /llvm-gcc-4.2/trunk/gcc/ada/lang-specs.h

2007-08-24 Thread Duncan Sands
Author: baldrick
Date: Fri Aug 24 15:12:43 2007
New Revision: 41367

URL: http://llvm.org/viewvc/llvm-project?rev=41367&view=rev
Log:
Teach the Ada front-end about llvm options.

Modified:
llvm-gcc-4.2/trunk/gcc/ada/lang-specs.h

Modified: llvm-gcc-4.2/trunk/gcc/ada/lang-specs.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ada/lang-specs.h?rev=41367&r1=41366&r2=41367&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/ada/lang-specs.h (original)
+++ llvm-gcc-4.2/trunk/gcc/ada/lang-specs.h Fri Aug 24 15:12:43 2007
@@ -37,6 +37,8 @@
 %{nostdlib*}\
 -dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
 %{O*} %{W*} %{w} %{p} %{pg:-p} %{a} %{f*} %{d*} %{g*&m*} %1\
+"/* LLVM LOCAL */"\
+%(llvm_options) \
 %{!S:%{o*:%w%*-gnatO}} \
 %i %{S:%W{o*}%{!o*:-o %b.s}} \
 %{gnatc*|gnats*: -o %j} %{-param*} \


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


[llvm-commits] [llvm] r41371 - in /llvm/trunk: include/llvm/InstrTypes.h include/llvm/Instructions.h lib/VMCore/Instructions.cpp

2007-08-24 Thread Chris Lattner
Author: lattner
Date: Fri Aug 24 15:48:18 2007
New Revision: 41371

URL: http://llvm.org/viewvc/llvm-project?rev=41371&view=rev
Log:
sink clone() down the class hierarchy from CmpInst into ICmpInst/FCmpInst.
This eliminates a conditional on that path, and ensures ICmpInst/FCmpInst
both have an out-of-line virtual method to home the class.

Modified:
llvm/trunk/include/llvm/InstrTypes.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=41371&r1=41370&r2=41371&view=diff

==
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Fri Aug 24 15:48:18 2007
@@ -494,9 +494,6 @@
  Value *S2, const std::string &Name, 
  BasicBlock *InsertAtEnd);
 
-  /// @brief Implement superclass method.
-  virtual CmpInst *clone() const;
-
   /// @brief Get the opcode casted to the right type
   OtherOps getOpcode() const {
 return static_cast(Instruction::getOpcode());

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

==
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Fri Aug 24 15:48:18 2007
@@ -603,6 +603,8 @@
 std::swap(Ops[0], Ops[1]);
   }
 
+  virtual ICmpInst *clone() const;
+
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ICmpInst *) { return true; }
   static inline bool classof(const Instruction *I) {
@@ -725,6 +727,8 @@
 std::swap(Ops[0], Ops[1]);
   }
 
+  virtual FCmpInst *clone() const;
+
   /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const FCmpInst *) { return true; }
   static inline bool classof(const Instruction *I) {

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=41371&r1=41370&r2=41371&view=diff

==
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Fri Aug 24 15:48:18 2007
@@ -2595,8 +2595,11 @@
   return create(getOpcode(), Ops[0], Ops[1]);
 }
 
-CmpInst* CmpInst::clone() const {
-  return create(getOpcode(), getPredicate(), Ops[0], Ops[1]);
+FCmpInst* FCmpInst::clone() const {
+  return new FCmpInst(getPredicate(), Ops[0], Ops[1]);
+}
+ICmpInst* ICmpInst::clone() const {
+  return new ICmpInst(getPredicate(), Ops[0], Ops[1]);
 }
 
 MallocInst *MallocInst::clone()   const { return new MallocInst(*this); }


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


[llvm-commits] [llvm] r41372 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp

2007-08-24 Thread Dale Johannesen
Author: johannes
Date: Fri Aug 24 15:59:15 2007
New Revision: 41372

URL: http://llvm.org/viewvc/llvm-project?rev=41372&view=rev
Log:
Use APFloat internally for ConstantFPSDNode.


Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=41372&r1=41371&r2=41372&view=diff

==
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Aug 24 15:59:15 2007
@@ -23,6 +23,7 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/iterator"
+#include "llvm/ADT/APFloat.h"
 #include "llvm/CodeGen/ValueTypes.h"
 #include "llvm/Support/DataTypes.h"
 #include 
@@ -1144,17 +1145,17 @@
 };
 
 class ConstantFPSDNode : public SDNode {
-  double Value;
+  APFloat Value;
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
 protected:
   friend class SelectionDAG;
   ConstantFPSDNode(bool isTarget, double val, MVT::ValueType VT)
 : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP,
- getSDVTList(VT)), Value(val) {
+ getSDVTList(VT)), Value(APFloat(val)) {
   }
 public:
 
-  double getValue() const { return Value; }
+  double getValue() const { return Value.convertToDouble(); }
 
   /// isExactlyValue - We don't rely on operator== working on double values, as
   /// it returns true for things that are clearly not equal, like -0.0 and 0.0.

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Aug 24 15:59:15 
2007
@@ -49,7 +49,7 @@
 /// As such, this method can be used to do an exact bit-for-bit comparison of
 /// two floating point values.
 bool ConstantFPSDNode::isExactlyValue(double V) const {
-  return DoubleToBits(V) == DoubleToBits(Value);
+  return Value == APFloat(V);
 }
 
 
//===--===//


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


[llvm-commits] [llvm] r41378 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Support/APFloat.cpp lib/VMCore/Constants.cpp

2007-08-24 Thread Dale Johannesen
Author: johannes
Date: Fri Aug 24 17:09:56 2007
New Revision: 41378

URL: http://llvm.org/viewvc/llvm-project?rev=41378&view=rev
Log:
Poison APFloat::operator==.  Replace existing uses with bitwiseIsEqual.
This means backing out the preceding change to Constants.cpp, alas.


Modified:
llvm/trunk/include/llvm/ADT/APFloat.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/Support/APFloat.cpp
llvm/trunk/lib/VMCore/Constants.cpp

Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=41378&r1=41377&r2=41378&view=diff

==
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Fri Aug 24 17:09:56 2007
@@ -187,17 +187,17 @@
 double convertToDouble() const;
 float convertToFloat() const;
 
+/* The definition of equality is not straightforward for floating point,
+   so we won't use operator==.  Use one of the following, or write
+   whatever it is you really mean. */
+bool operator==(const APFloat &) const; // DO NOT IMPLEMENT
+
 /* IEEE comparison with another floating point number (QNaNs
compare unordered, 0==-0). */
 cmpResult compare(const APFloat &) const;
 
 /* Bitwise comparison for equality (QNaNs compare equal, 0!=-0). */
-bool operator==(const APFloat &) const;
-
-/* Inversion of the preceding. */
-inline bool operator!=(const APFloat &RHS) const { 
-  return !((*this)==RHS); 
-}
+bool bitwiseIsEqual(const APFloat &) const;
 
 /* Simple queries.  */
 fltCategory getCategory() const { return category; }

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Aug 24 17:09:56 
2007
@@ -49,7 +49,7 @@
 /// As such, this method can be used to do an exact bit-for-bit comparison of
 /// two floating point values.
 bool ConstantFPSDNode::isExactlyValue(double V) const {
-  return Value == APFloat(V);
+  return Value.bitwiseIsEqual(APFloat(V));
 }
 
 
//===--===//

Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=41378&r1=41377&r2=41378&view=diff

==
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Fri Aug 24 17:09:56 2007
@@ -276,7 +276,7 @@
 }
 
 bool
-APFloat::operator==(const APFloat &rhs) const {
+APFloat::bitwiseIsEqual(const APFloat &rhs) const {
   if (this == &rhs)
 return true;
   if (semantics != rhs.semantics ||

Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=41378&r1=41377&r2=41378&view=diff

==
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Fri Aug 24 17:09:56 2007
@@ -248,19 +248,30 @@
 }
 
 bool ConstantFP::isExactlyValue(double V) const {
-  return Val == APFloat(V);
+  return Val.bitwiseIsEqual(APFloat(V));
 }
 
 namespace {
   struct DenseMapAPFloatKeyInfo {
-static inline APFloat getEmptyKey() { 
-  return APFloat(APFloat::Bogus,1);
+struct KeyTy {
+  APFloat val;
+  KeyTy(const APFloat& V) : val(V){}
+  KeyTy(const KeyTy& that) : val(that.val) {}
+  bool operator==(const KeyTy& that) const {
+return this->val.bitwiseIsEqual(that.val);
+  }
+  bool operator!=(const KeyTy& that) const {
+return !this->operator==(that);
+  }
+};
+static inline KeyTy getEmptyKey() { 
+  return KeyTy(APFloat(APFloat::Bogus,1));
 }
-static inline APFloat getTombstoneKey() { 
-  return APFloat(APFloat::Bogus,2); 
+static inline KeyTy getTombstoneKey() { 
+  return KeyTy(APFloat(APFloat::Bogus,2)); 
 }
-static unsigned getHashValue(const APFloat &Key) {
-  return Key.getHashValue();
+static unsigned getHashValue(const KeyTy &Key) {
+  return Key.val.getHashValue();
 }
 static bool isPod() { return false; }
   };
@@ -268,21 +279,21 @@
 
 // ConstantFP::get() implementation...
 //
-typedef DenseMap FPMapTy;
 
 static ManagedStatic FPConstants;
 
 ConstantFP *ConstantFP::get(const Type *Ty, double V) {
   if (Ty == Type::FloatTy) {
-APFloat Key(APFloat((float)V));
+DenseMapAPFloatKeyInfo::KeyTy Key(APFloat((float)V));
 ConstantFP *&Slot = (*FPConstants)[Key];
 if (Slot) return Slot

Re: [llvm-commits] [llvm] r41378 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Support/APFloat.cpp lib/VMCore/Constants.cpp

2007-08-24 Thread Chris Lattner
>
> +/* The definition of equality is not straightforward for  
> floating point,
> +   so we won't use operator==.  Use one of the following, or  
> write
> +   whatever it is you really mean. */
> +bool operator==(const APFloat &) const; // DO NOT IMPLEMENT

Hey Dale,

I think that you can just remove this and the compiler will give you  
a compile-time error if you try to use it.  If you define it like  
this, you just get a link-time error.

-Chris



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


[llvm-commits] [llvm] r41380 - /llvm/trunk/docs/LinkTimeOptimization.html

2007-08-24 Thread Tanya Lattner
Author: tbrethou
Date: Fri Aug 24 18:23:23 2007
New Revision: 41380

URL: http://llvm.org/viewvc/llvm-project?rev=41380&view=rev
Log:
Rename llvm-gcc4 to llvm-gcc.

Modified:
llvm/trunk/docs/LinkTimeOptimization.html

Modified: llvm/trunk/docs/LinkTimeOptimization.html
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LinkTimeOptimization.html?rev=41380&r1=41379&r2=41380&view=diff

==
--- llvm/trunk/docs/LinkTimeOptimization.html (original)
+++ llvm/trunk/docs/LinkTimeOptimization.html Fri Aug 24 18:23:23 2007
@@ -85,7 +85,7 @@
   The following example illustrates the advantages of LTO's integrated
   approach and clean interface. This example requires a system linker which
   supports LTO through the interface described in this document.  Here,
-  llvm-gcc4 transparently invokes system linker. 
+  llvm-gcc transparently invokes system linker. 
   
  Input source file a.c is compiled into LLVM bitcode form.
  Input source file main.c is compiled into native object code.
@@ -131,9 +131,9 @@
 }
 
 --- command lines ---
-$ llvm-gcc4 --emit-llvm -c a.c -o a.o  # <-- a.o is LLVM bitcode file
-$ llvm-gcc4 -c main.c -o main.o # <-- main.o is native object file
-$ llvm-gcc4 a.o main.o -o main # <-- standard link command without any 
modifications
+$ llvm-gcc --emit-llvm -c a.c -o a.o  # <-- a.o is LLVM bitcode file
+$ llvm-gcc -c main.c -o main.o # <-- main.o is native object file
+$ llvm-gcc a.o main.o -o main # <-- standard link command without any 
modifications
 
   In this example, the linker recognizes that foo2() is an 
   externally visible symbol defined in LLVM bitcode file. This information 


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


[llvm-commits] CVS: llvm-www/InTheNews.html

2007-08-24 Thread Tanya Lattner


Changes in directory llvm-www:

InTheNews.html updated: 1.21 -> 1.22
---
Log message:

Fix broken link.


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

 InTheNews.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-www/InTheNews.html
diff -u llvm-www/InTheNews.html:1.21 llvm-www/InTheNews.html:1.22
--- llvm-www/InTheNews.html:1.21Sat Jun  2 18:15:32 2007
+++ llvm-www/InTheNews.html Fri Aug 24 18:30:36 2007
@@ -36,7 +36,7 @@
 http://www.automotivedesignline.com/news/197000935;jsessionid=TU3SEN4OSVORYQSNDLQCKH0CJUNN2JVN";>2007-01-22,
 Automotive Design Line, "Hardware generation method anticipates design 
   reuse" (LLVM used in AH IR compiler flow), K.C. Krishnadas.
-http://lca2007.linux.org.au/talk/27";>2007-01-15,
+http://lca2007.linux.org.au/talk/27.html";>2007-01-15,
 Linux.conf.au, "The ARM Backend Of LLVM", Rafael Espindola.
 http://www.leonard-ritter.com/lunar_goes_llvm";>2007-01-13,
 Leonard Ritter Blog, "Lunar goes LLVM", Leonard Ritter.
@@ -108,6 +108,6 @@
   http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
 
-  Last modified: $Date: 2007/06/02 23:15:32 $
+  Last modified: $Date: 2007/08/24 23:30:36 $
 
 



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


Re: [llvm-commits] [llvm] r41378 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Support/APFloat.cpp lib/VMCore/Constants.cpp

2007-08-24 Thread Dale Johannesen

On Aug 24, 2007, at 4:03 PM, Chris Lattner wrote:

>>
>> +/* The definition of equality is not straightforward for
>> floating point,
>> +   so we won't use operator==.  Use one of the following, or
>> write
>> +   whatever it is you really mean. */
>> +bool operator==(const APFloat &) const; // DO NOT IMPLEMENT
>
> Hey Dale,
>
> I think that you can just remove this and the compiler will give you
> a compile-time error if you try to use it.  If you define it like
> this, you just get a link-time error.

Yep, and the linker error message doesn't tell you where the  
reference is coming from (I'm speaking from experience).  I mostly  
did it this way because I see about 40 other places it was done this  
way, and I  do see the utility as a statement of intent.  Why is this  
one different?

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


Re: [llvm-commits] [llvm] r41378 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Support/APFloat.cpp lib/VMCore/Constants.cpp

2007-08-24 Thread Chris Lattner

On Aug 24, 2007, at 4:38 PM, Dale Johannesen wrote:

>
> On Aug 24, 2007, at 4:03 PM, Chris Lattner wrote:
>
>>>
>>> +/* The definition of equality is not straightforward for
>>> floating point,
>>> +   so we won't use operator==.  Use one of the following, or
>>> write
>>> +   whatever it is you really mean. */
>>> +bool operator==(const APFloat &) const; // DO NOT IMPLEMENT
>>
>> Hey Dale,
>>
>> I think that you can just remove this and the compiler will give you
>> a compile-time error if you try to use it.  If you define it like
>> this, you just get a link-time error.
>
> Yep, and the linker error message doesn't tell you where the
> reference is coming from (I'm speaking from experience).  I mostly
> did it this way because I see about 40 other places it was done this
> way, and I  do see the utility as a statement of intent.  Why is this
> one different?

The difference here is that C++ compilers automatically synthesis  
copy ctors and default ctors and operator=, but they don't do the  
same for operator==.  To disable these automatically generated  
members, you have to "define" them, and put them in the private part  
of the class (so any users will get compile-time access violation  
errors as well as link errors).

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


Re: [llvm-commits] [llvm] r41378 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Support/APFloat.cpp lib/VMCore/Constants.cpp

2007-08-24 Thread Dale Johannesen

On Aug 24, 2007, at 4:40 PM, Chris Lattner wrote:
>>> I think that you can just remove this and the compiler will give you
>>> a compile-time error if you try to use it.  If you define it like
>>> this, you just get a link-time error.
>>
>> Yep, and the linker error message doesn't tell you where the
>> reference is coming from (I'm speaking from experience).  I mostly
>> did it this way because I see about 40 other places it was done this
>> way, and I  do see the utility as a statement of intent.  Why is this
>> one different?
>
> The difference here is that C++ compilers automatically synthesis
> copy ctors and default ctors and operator=, but they don't do the
> same for operator==.  To disable these automatically generated
> members, you have to "define" them, and put them in the private part
> of the class (so any users will get compile-time access violation
> errors as well as link errors).

Still learning that language.  OK then, I'll comment  it out.

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


Re: [llvm-commits] [llvm] r41378 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Support/APFloat.cpp lib/VMCore/Constants.cpp

2007-08-24 Thread Chris Lattner
>> The difference here is that C++ compilers automatically synthesis
>> copy ctors and default ctors and operator=, but they don't do the
>> same for operator==.  To disable these automatically generated
>> members, you have to "define" them, and put them in the private part
>> of the class (so any users will get compile-time access violation
>> errors as well as link errors).
>
> Still learning that language.  OK then, I'll comment  it out.

Not a big deal.  Thanks Dale!

-Chris

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


[llvm-commits] [llvm] r41381 - /llvm/trunk/CREDITS.TXT

2007-08-24 Thread Neil Booth
Author: neil
Date: Fri Aug 24 19:31:24 2007
New Revision: 41381

URL: http://llvm.org/viewvc/llvm-project?rev=41381&view=rev
Log:
Add self

Modified:
llvm/trunk/CREDITS.TXT

Modified: llvm/trunk/CREDITS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=41381&r1=41380&r2=41381&view=diff

==
--- llvm/trunk/CREDITS.TXT (original)
+++ llvm/trunk/CREDITS.TXT Fri Aug 24 19:31:24 2007
@@ -30,6 +30,10 @@
 E: [EMAIL PROTECTED]
 D: ET-Forest implementation.
 
+N: Neil Booth
+E: [EMAIL PROTECTED]
+D: APFloat implementation.
+
 N: Misha Brukman
 E: [EMAIL PROTECTED]
 W: http://misha.brukman.net


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


[llvm-commits] [llvm] r41382 - /llvm/trunk/CREDITS.TXT

2007-08-24 Thread Neil Booth
Author: neil
Date: Fri Aug 24 19:36:22 2007
New Revision: 41382

URL: http://llvm.org/viewvc/llvm-project?rev=41382&view=rev
Log:
Test

Modified:
llvm/trunk/CREDITS.TXT

Modified: llvm/trunk/CREDITS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=41382&r1=41381&r2=41382&view=diff

==
--- llvm/trunk/CREDITS.TXT (original)
+++ llvm/trunk/CREDITS.TXT Fri Aug 24 19:36:22 2007
@@ -32,7 +32,7 @@
 
 N: Neil Booth
 E: [EMAIL PROTECTED]
-D: APFloat implementation.
+D: APFloat implementation.  
 
 N: Misha Brukman
 E: [EMAIL PROTECTED]


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


[llvm-commits] [llvm] r41383 - /llvm/trunk/include/llvm/ADT/APFloat.h

2007-08-24 Thread Dale Johannesen
Author: johannes
Date: Fri Aug 24 19:40:41 2007
New Revision: 41383

URL: http://llvm.org/viewvc/llvm-project?rev=41383&view=rev
Log:
Comment out declaration of operator== (undefined).


Modified:
llvm/trunk/include/llvm/ADT/APFloat.h

Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=41383&r1=41382&r2=41383&view=diff

==
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Fri Aug 24 19:40:41 2007
@@ -190,7 +190,7 @@
 /* The definition of equality is not straightforward for floating point,
so we won't use operator==.  Use one of the following, or write
whatever it is you really mean. */
-bool operator==(const APFloat &) const; // DO NOT IMPLEMENT
+// bool operator==(const APFloat &) const; // DO NOT IMPLEMENT
 
 /* IEEE comparison with another floating point number (QNaNs
compare unordered, 0==-0). */


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


[llvm-commits] [llvm] r41384 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/PowerPC/PPCISel

2007-08-24 Thread Chris Lattner
Author: lattner
Date: Fri Aug 24 19:47:38 2007
New Revision: 41384

URL: http://llvm.org/viewvc/llvm-project?rev=41384&view=rev
Log:
rename isOperandValidForConstraint to LowerAsmOperandForConstraint, 
changing the interface to allow for future changes.


Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h

Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=41384&r1=41383&r2=41384&view=diff

==
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Fri Aug 24 19:47:38 2007
@@ -907,12 +907,11 @@
  MVT::ValueType VT) const;
   
   
-  /// isOperandValidForConstraint - Return the specified operand (possibly
-  /// modified) if the specified SDOperand is valid for the specified target
-  /// constraint letter, otherwise return null.
-  virtual SDOperand 
-isOperandValidForConstraint(SDOperand Op, char ConstraintLetter,
-SelectionDAG &DAG);
+  /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
+  /// vector.  If it is invalid, don't add anything to Ops.
+  virtual void LowerAsmOperandForConstraint(SDOperand Op, char 
ConstraintLetter,
+std::vector &Ops,
+SelectionDAG &DAG);
   
   
//======//
   // Scheduler hooks

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Aug 24 
19:47:38 2007
@@ -3623,20 +3623,20 @@
 assert(!OpInfo.isIndirect && 
"Don't know how to handle indirect other inputs yet!");
 
-InOperandVal = TLI.isOperandValidForConstraint(InOperandVal,
-   
OpInfo.ConstraintCode[0],
-   DAG);
-if (!InOperandVal.Val) {
+std::vector Ops;
+TLI.LowerAsmOperandForConstraint(InOperandVal, 
OpInfo.ConstraintCode[0],
+ Ops, DAG);
+if (Ops.empty()) {
   cerr << "Invalid operand for inline asm constraint '"
<< OpInfo.ConstraintCode << "'!\n";
   exit(1);
 }
 
 // Add information to the INLINEASM node to know about this input.
-unsigned ResOpType = 3 /*IMM*/ | (1 << 3);
+unsigned ResOpType = 3 /*IMM*/ | (Ops.size() << 3);
 AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType, 
 TLI.getPointerTy()));
-AsmNodeOperands.push_back(InOperandVal);
+AsmNodeOperands.insert(AsmNodeOperands.end(), Ops.begin(), Ops.end());
 break;
   } else if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
 assert(OpInfo.isIndirect && "Operand must be indirect to be a mem!");

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Aug 24 19:47:38 
2007
@@ -1354,12 +1354,12 @@
   return C_Unknown;
 }
 
-/// isOperandValidForConstraint - Return the specified operand (possibly
-/// modified) if the specified SDOperand is valid for the specified target
-/// constraint letter, otherwise return null.
-SDOperand TargetLowering::isOperandValidForConstraint(SDOperand Op,
-  char ConstraintLetter,
-  SelectionDAG &DAG) {
+/// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
+/// vector.  If it is invalid, don't add anything to Ops.
+void TargetLowering::LowerAsmOperandForConstraint(SDOperand Op,
+  char ConstraintLetter,
+  s

[llvm-commits] [llvm] r41385 - /llvm/trunk/lib/CodeGen/DwarfWriter.cpp

2007-08-24 Thread Bill Wendling
Author: void
Date: Fri Aug 24 19:51:55 2007
New Revision: 41385

URL: http://llvm.org/viewvc/llvm-project?rev=41385&view=rev
Log:
The personality function might need to be declared as:

.set  Lset0,___gxx_personality_v0-.
.long Lset0

on some targets. Make it so!

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

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

==
--- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Fri Aug 24 19:51:55 2007
@@ -2803,11 +2803,24 @@
   Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4);
   Asm->EOL("Personality (pcrel sdata4)");
   
-  O << TAI->getData32bitsDirective();
-  Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
-  O << "-" << TAI->getPCSymbol();
-  Asm->EOL("Personality");
-  
+  if (TAI->needsSet()) {
+O << "\t.set\t";
+PrintLabelName("set", SetCounter);
+O << ",";
+Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
+O << "-" << TAI->getPCSymbol();
+Asm->EOL("Set Personality");
+O << TAI->getData32bitsDirective();
+PrintLabelName("set", SetCounter);
+Asm->EOL("Personality");
+++SetCounter;
+  } else {
+O << TAI->getData32bitsDirective();
+Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
+O << "-" << TAI->getPCSymbol();
+Asm->EOL("Personality");
+  }
+
   Asm->EmitULEB128Bytes(DW_EH_PE_pcrel);
   Asm->EOL("LSDA Encoding (pcrel)");
   Asm->EmitULEB128Bytes(DW_EH_PE_pcrel);


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


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

2007-08-24 Thread Chris Lattner
Author: lattner
Date: Fri Aug 24 19:53:07 2007
New Revision: 41386

URL: http://llvm.org/viewvc/llvm-project?rev=41386&view=rev
Log:
Teach the dag scheduler to handle inline asm nodes with multi-value immediate 
operands.

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

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Fri Aug 24 19:53:07 2007
@@ -753,15 +753,16 @@
   }
   break;
 case 3: { // Immediate.
-  assert(NumVals == 1 && "Unknown immediate value!");
-  if (ConstantSDNode 
*CS=dyn_cast(Node->getOperand(i))){
-MI->addImmOperand(CS->getValue());
-  } else {
-GlobalAddressSDNode *GA = 
-  cast(Node->getOperand(i));
-MI->addGlobalAddressOperand(GA->getGlobal(), GA->getOffset());
+  for (; NumVals; --NumVals, ++i) {
+if (ConstantSDNode *CS =
+   dyn_cast(Node->getOperand(i))) {
+  MI->addImmOperand(CS->getValue());
+} else {
+  GlobalAddressSDNode *GA = 
+  cast(Node->getOperand(i));
+  MI->addGlobalAddressOperand(GA->getGlobal(), GA->getOffset());
+}
   }
-  ++i;
   break;
 }
 case 4:  // Addressing mode.


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


[llvm-commits] [llvm] r41387 - in /llvm/trunk: lib/Transforms/Scalar/LoopIndexSplit.cpp test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll

2007-08-24 Thread Devang Patel
Author: dpatel
Date: Fri Aug 24 19:56:38 2007
New Revision: 41387

URL: http://llvm.org/viewvc/llvm-project?rev=41387&view=rev
Log:
While calculating upper loop bound for first loop and lower loop bound for 
second loop, take care of edge cases.

Added:
llvm/trunk/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Fri Aug 24 19:56:38 2007
@@ -58,7 +58,8 @@
 class SplitInfo {
 public:
   SplitInfo() : SplitValue(NULL), SplitCondition(NULL), 
-UseTrueBranchFirst(true) {}
+UseTrueBranchFirst(true), A_ExitValue(NULL), 
+B_StartValue(NULL) {}
 
   // Induction variable's range is split at this value.
   Value *SplitValue;
@@ -69,11 +70,20 @@
   // True if after loop index split, first loop will execute split 
condition's
   // true branch.
   bool UseTrueBranchFirst;
+
+  // Exit value for first loop after loop split.
+  Value *A_ExitValue;
+
+  // Start value for second loop after loop split.
+  Value *B_StartValue;
+
   // Clear split info.
   void clear() {
 SplitValue = NULL;
 SplitCondition = NULL;
 UseTrueBranchFirst = true;
+A_ExitValue = NULL;
+B_StartValue = NULL;
   }
 
 };
@@ -112,6 +122,10 @@
 /// split loop using given split condition.
 bool safeSplitCondition(SplitInfo &SD);
 
+/// calculateLoopBounds - ALoop exit value and BLoop start values are 
calculated
+/// based on split value. 
+void calculateLoopBounds(SplitInfo &SD);
+
 /// splitLoop - Split current loop L in two loops using split information
 /// SD. Update dominator information. Maintain LCSSA form.
 bool splitLoop(SplitInfo &SD);
@@ -295,7 +309,14 @@
   ICmpInst *CI = dyn_cast(BR->getCondition());
   if (!CI)
 return;
-  
+
+  // FIXME 
+  if (CI->getPredicate() == ICmpInst::ICMP_SGT
+  || CI->getPredicate() == ICmpInst::ICMP_UGT
+  || CI->getPredicate() == ICmpInst::ICMP_SGE
+  || CI->getPredicate() == ICmpInst::ICMP_UGE)
+return;
+
   ExitCondition = CI;
 
   // Exit condition's one operand is loop invariant exit value and second 
@@ -747,6 +768,207 @@
   return false;
 }
 
+/// calculateLoopBounds - ALoop exit value and BLoop start values are 
calculated
+/// based on split value. 
+void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
+
+  ICmpInst::Predicate SP = SD.SplitCondition->getPredicate();
+  const Type *Ty = SD.SplitValue->getType();
+  bool Sign = ExitCondition->isSignedPredicate();
+  BasicBlock *Preheader = L->getLoopPreheader();
+  Instruction *PHTerminator = Preheader->getTerminator();
+
+  // Initially use split value as upper loop bound for first loop and lower 
loop
+  // bound for second loop.
+  Value *AEV = SD.SplitValue;
+  Value *BSV = SD.SplitValue;
+
+  switch (ExitCondition->getPredicate()) {
+  case ICmpInst::ICMP_SGT:
+  case ICmpInst::ICMP_UGT:
+  case ICmpInst::ICMP_SGE:
+  case ICmpInst::ICMP_UGE:
+  default:
+assert (0 && "Unexpected exit condition predicate");
+
+  case ICmpInst::ICMP_SLT:
+  case ICmpInst::ICMP_ULT:
+{
+  switch (SP) {
+  case ICmpInst::ICMP_SLT:
+  case ICmpInst::ICMP_ULT:
+//
+// for (i = LB; i < UB; ++i) { if (i < SV) A; else B; }
+//
+// is transformed into
+// AEV = BSV = SV
+// for (i = LB; i < min(UB, AEV); ++i)
+//A;
+// for (i = max(LB, BSV); i < UB; ++i);
+//B;
+break;
+  case ICmpInst::ICMP_SLE:
+  case ICmpInst::ICMP_ULE:
+{
+  //
+  // for (i = LB; i < UB; ++i) { if (i <= SV) A; else B; }
+  //
+  // is transformed into
+  //
+  // AEV = SV + 1
+  // BSV = SV + 1
+  // for (i = LB; i < min(UB, AEV); ++i) 
+  //   A;
+  // for (i = max(LB, BSV); i < UB; ++i) 
+  //   B;
+  BSV = BinaryOperator::createAdd(SD.SplitValue,
+  ConstantInt::get(Ty, 1, Sign),
+  "lsplit.add", PHTerminator);
+  AEV = BSV;
+}
+break;
+  case ICmpInst::ICMP_SGE:
+  case ICmpInst::ICMP_UGE: 
+//
+// for (i = LB; i < UB; ++i) { if (i >= SV) A; else B; }
+// 
+// is transformed into
+// AEV = BSV = SV
+// for (i = LB; i < min(UB, AEV); ++i)
+//B;
+// for (i = max(BSV, LB); i < UB; ++i)
+//A;
+break;

[llvm-commits] [llvm] r41388 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/Generic/asm-large-immediate.ll

2007-08-24 Thread Chris Lattner
Author: lattner
Date: Fri Aug 24 20:00:22 2007
New Revision: 41388

URL: http://llvm.org/viewvc/llvm-project?rev=41388&view=rev
Log:
Allow target constants to be illegal types.  The target should
know how to handle them.  This fixes 
test/CodeGen/Generic/asm-large-immediate.ll

Added:
llvm/trunk/test/CodeGen/Generic/asm-large-immediate.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Aug 24 20:00:22 2007
@@ -457,6 +457,8 @@
   // If this is an illegal scalar, expand it into its two component
   // pieces.
   SDOperand X, Y;
+  if (Op.getOpcode() == ISD::TargetConstant)
+break;  // Allow illegal target nodes.
   ExpandOp(Op, X, Y);
 } else if (MVT::getVectorNumElements(VT) == 1) {
   // If this is an illegal single element vector, convert it to a
@@ -644,6 +646,9 @@
 /// is legal, recursively ensuring that the operands' operations remain
 /// legal.
 SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
+  if (Op.getOpcode() == ISD::TargetConstant) // Allow illegal target nodes.
+return Op;
+  
   assert(isTypeLegal(Op.getValueType()) &&
  "Caller should expand or promote operands that are not legal!");
   SDNode *Node = Op.Val;

Added: llvm/trunk/test/CodeGen/Generic/asm-large-immediate.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/asm-large-immediate.ll?rev=41388&view=auto

==
--- llvm/trunk/test/CodeGen/Generic/asm-large-immediate.ll (added)
+++ llvm/trunk/test/CodeGen/Generic/asm-large-immediate.ll Fri Aug 24 20:00:22 
2007
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc | grep 68719476738
+
+define void @test() {
+entry:
+tail call void asm sideeffect "/* result: ${0:c} */", 
"i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 )
+ret void
+}
+


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


[llvm-commits] [llvm] r41389 - in /llvm/trunk: lib/Transforms/Scalar/LoopIndexSplit.cpp test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll

2007-08-24 Thread Devang Patel
Author: dpatel
Date: Fri Aug 24 20:09:14 2007
New Revision: 41389

URL: http://llvm.org/viewvc/llvm-project?rev=41389&view=rev
Log:
Constant split values needs upper bound and lower bound check, just like any 
other split value.

Added:
llvm/trunk/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Fri Aug 24 20:09:14 2007
@@ -946,12 +946,6 @@
   // values in original loop's preheader.
   //  A_ExitValue = min(SplitValue, OrignalLoopExitValue)
   //  B_StartValue = max(SplitValue, OriginalLoopStartValue)
-  if (isa(SD.SplitValue)) {
-SD.A_ExitValue = AEV;
-SD.B_StartValue = BSV;
-return;
-  }
-
   Value *C1 = new ICmpInst(Sign ?
ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
AEV,

Added: llvm/trunk/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll?rev=41389&view=auto

==
--- llvm/trunk/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll (added)
+++ llvm/trunk/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll Fri Aug 
24 20:09:14 2007
@@ -0,0 +1,52 @@
+; Split loop. Split value is a constant and greater then exit value. 
+; Check whether optimizer inserts proper checkfor split value or not.
+; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | grep select
+
[EMAIL PROTECTED] = external global i32 ;  [#uses=2]
+
+define void @foobar(i32 %a, i32 %b) {
+entry:
+   br label %bb
+
+bb:; preds = %cond_next16, %entry
+   %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ]   
;  [#uses=5]
+   %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ]  
;  [#uses=3]
+   %tmp1 = icmp slt i32 %i.01.0, 500   ;  [#uses=1]
+   br i1 %tmp1, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb
+   %tmp4 = tail call i32 @foo( i32 %i.01.0 )   ;  
[#uses=1]
+   %tmp6 = add i32 %tmp4, %tsum.18.0   ;  [#uses=2]
+   %tmp914 = load i32* @k, align 4 ;  [#uses=1]
+   %tmp1015 = icmp eq i32 %tmp914, 0   ;  [#uses=1]
+   br i1 %tmp1015, label %cond_next16, label %cond_true13
+
+cond_false:; preds = %bb
+   %tmp8 = tail call i32 @bar( i32 %i.01.0 )   ;  
[#uses=0]
+   %tmp9 = load i32* @k, align 4   ;  [#uses=1]
+   %tmp10 = icmp eq i32 %tmp9, 0   ;  [#uses=1]
+   br i1 %tmp10, label %cond_next16, label %cond_true13
+
+cond_true13:   ; preds = %cond_false, %cond_true
+   %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false 
];  [#uses=1]
+   %tmp15 = tail call i32 @bar( i32 %i.01.0 )  ;  
[#uses=0]
+   br label %cond_next16
+
+cond_next16:   ; preds = %cond_false, %cond_true, %cond_true13
+   %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, 
%cond_true ], [ %tsum.18.0, %cond_false ] ;  [#uses=2]
+   %tmp18 = add i32 %i.01.0, 1 ;  [#uses=3]
+   %tmp21 = icmp slt i32 %tmp18, 100   ;  [#uses=1]
+   br i1 %tmp21, label %bb, label %bb24
+
+bb24:  ; preds = %cond_next16
+   %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ;  
[#uses=1]
+   %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ]   
;  [#uses=1]
+   %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa )
;  [#uses=0]
+   ret void
+}
+
+declare i32 @foo(i32)
+
+declare i32 @bar(i32)
+
+declare i32 @t(i32, i32)


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


Re: [llvm-commits] [patch] call libc memcpy/memset for big arrays

2007-08-24 Thread Chris Lattner

On Aug 24, 2007, at 4:44 AM, Rafael Espindola wrote:

> Currently we expand a memcpy/memset node to a call to the libc  
> implementation if
>
>   if ((Align & 3) != 0 ||
>   (I && I->getValue() < Subtarget->getMinRepStrSizeThreshold())) {
>
> Shouldn't this be a ">". The libc memcpy/memset are very fast for  
> big arrays.

Yep, that makes sense to me! Please commit.

Dale, please review the commit when you get a chance,

-Chris

> If I compile
>
> ---
> #include 
> void f1(long *a, long *b) {
>   memcpy(a, b, 8 * 16);
> }
>
> void f2(long *a, long *b) {
>   memcpy(a, b, 8 * 32);
> }
> ---
>
> with gcc 4.2 (-O2), it will call memcpy for f2 and not for f1.
>
> Cheers,
> -- 
> Rafael Avila de Espindola
>
> Google Ireland Ltd.
> Gordon House
> Barrow Street
> Dublin 4
> Ireland
>
> Registered in Dublin, Ireland
> Registration Number: 368047
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] [llvm] r41394 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp

2007-08-24 Thread Devang Patel
Author: dpatel
Date: Fri Aug 24 21:39:24 2007
New Revision: 41394

URL: http://llvm.org/viewvc/llvm-project?rev=41394&view=rev
Log:
Move exit condition and exit branch from exiting block into loop header and 
dominator info. This avoid execution of dead iteration. Loop is already filter 
in the beginning such that this change is safe.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Fri Aug 24 21:39:24 2007
@@ -126,6 +126,24 @@
 /// based on split value. 
 void calculateLoopBounds(SplitInfo &SD);
 
+/// updatePHINodes - CFG has been changed. 
+/// Before 
+///   - ExitBB's single predecessor was Latch
+///   - Latch's second successor was Header
+/// Now
+///   - ExitBB's single predecessor was Header
+///   - Latch's one and only successor was Header
+///
+/// Update ExitBB PHINodes' to reflect this change.
+void updatePHINodes(BasicBlock *ExitBB, BasicBlock *Latch, 
+BasicBlock *Header,
+PHINode *IV, Instruction *IVIncrement);
+
+/// moveExitCondition - Move exit condition EC into split condition block 
CondBB.
+void moveExitCondition(BasicBlock *CondBB, BasicBlock *ActiveBB,
+   BasicBlock *ExitBB, ICmpInst *EC, ICmpInst *SC,
+   PHINode *IV, Instruction *IVAdd, Loop *LP);
+
 /// splitLoop - Split current loop L in two loops using split information
 /// SD. Update dominator information. Maintain LCSSA form.
 bool splitLoop(SplitInfo &SD);
@@ -987,6 +1005,7 @@
   //[*] Clone loop.
   DenseMap ValueMap;
   Loop *BLoop = CloneLoop(L, LPM, LI, ValueMap, this);
+  Loop *ALoop = L;
   BasicBlock *B_Header = BLoop->getHeader();
 
   //[*] ALoop's exiting edge BLoop's header.
@@ -1110,5 +1129,141 @@
   B_BR->setUnconditionalDest(B_ActiveBranch);
   removeBlocks(B_InactiveBranch, BLoop, B_ActiveBranch);
 
+  BasicBlock *A_Header = L->getHeader();
+  if (A_ExitingBlock == A_Header)
+return true;
+
+  //[*] Move exit condition into split condition block to avoid
+  //executing dead loop iteration.
+  ICmpInst *B_ExitCondition = cast(ValueMap[ExitCondition]);
+  Instruction *B_IndVarIncrement = 
cast(ValueMap[IndVarIncrement]);
+  ICmpInst *B_SplitCondition = cast(ValueMap[SD.SplitCondition]);
+
+  moveExitCondition(A_SplitCondBlock, A_ActiveBranch, A_ExitBlock, 
ExitCondition,
+SD.SplitCondition, IndVar, IndVarIncrement, ALoop);
+
+  moveExitCondition(B_SplitCondBlock, B_ActiveBranch, B_ExitBlock, 
B_ExitCondition,
+B_SplitCondition, B_IndVar, B_IndVarIncrement, BLoop);
+
   return true;
 }
+
+// moveExitCondition - Move exit condition EC into split condition block 
CondBB.
+void LoopIndexSplit::moveExitCondition(BasicBlock *CondBB, BasicBlock 
*ActiveBB,
+   BasicBlock *ExitBB, ICmpInst *EC, 
ICmpInst *SC,
+   PHINode *IV, Instruction *IVAdd, Loop 
*LP) {
+
+  BasicBlock *ExitingBB = EC->getParent();
+  Instruction *CurrentBR = CondBB->getTerminator();
+
+  // Move exit condition into split condition block.
+  EC->moveBefore(CurrentBR);
+  EC->setOperand(ExitValueNum == 0 ? 1 : 0, IV);
+
+  // Move exiting block's branch into split condition block. Update its branch
+  // destination.
+  BranchInst *ExitingBR = cast(ExitingBB->getTerminator());
+  ExitingBR->moveBefore(CurrentBR);
+  if (ExitingBR->getSuccessor(0) == ExitBB)
+ExitingBR->setSuccessor(1, ActiveBB);
+  else
+ExitingBR->setSuccessor(0, ActiveBB);
+
+  // Remove split condition and current split condition branch.
+  SC->eraseFromParent();
+  CurrentBR->eraseFromParent();
+
+  // Connect exiting block to split condition block.
+  new BranchInst(CondBB, ExitingBB);
+
+  // Update PHINodes
+  updatePHINodes(ExitBB, ExitingBB, CondBB, IV, IVAdd);
+
+  // Fix dominator info.
+  // ExitBB is now dominated by CondBB
+  DT->changeImmediateDominator(ExitBB, CondBB);
+  DF->changeImmediateDominator(ExitBB, CondBB, DT);
+  
+  // Basicblocks dominated by ActiveBB may have ExitingBB or
+  // a basic block outside the loop in their DF list. If so,
+  // replace it with CondBB.
+  DomTreeNode *Node = DT->getNode(ActiveBB);
+  for (df_iterator DI = df_begin(Node), DE = df_end(Node);
+   DI != DE; ++DI) {
+BasicBlock *BB = DI->getBlock();
+DominanceFrontier::iterator BBDF = DF->find(BB);
+DominanceFrontier::DomSetType::iterator DomSetI = BBDF->second.begin();
+DominanceFrontier::DomSetType::iterator DomSetE = BBDF->second.end();
+while (DomSetI 

Re: [llvm-commits] [patch] call libc memcpy/memset for big arrays

2007-08-24 Thread Dale Johannesen

On Aug 24, 2007, at 6:15 PM, Chris Lattner wrote:

>
> On Aug 24, 2007, at 4:44 AM, Rafael Espindola wrote:
>
>> Currently we expand a memcpy/memset node to a call to the libc
>> implementation if
>>
>>   if ((Align & 3) != 0 ||
>>   (I && I->getValue() < Subtarget->getMinRepStrSizeThreshold 
>> ())) {
>>
>> Shouldn't this be a ">". The libc memcpy/memset are very fast for
>> big arrays.

Do you have data to support this?  It is dependent on the OS (well  
libc really) and target CPU for sure.

> Yep, that makes sense to me! Please commit.
>
> Dale, please review the commit when you get a chance,

Intuitively it looks OK.  I'd like to see numbers, but I doubt that  
spending a lot of time on this is productive.

I've spent way too much time playing with the heuristics for memcpy  
expansion.  My firmest conclusion is that, whatever the compiler  
does, somebody will supply an example where it is better to do  
something else.:)

The situation is especially bad on x86 since different things are  
optimal for different CPUs, and compiled code will typically run on  
more than one CPU.  Here are some numbers from the last time I looked  
at it:  http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01614.html
On that CPU and OS (Darwin 10.4, IIRC), it was never right to use rep/ 
mov, and the library function didn't look too good compared to  
repeated lod/sto.   ymmv.

> -Chris
>
>> If I compile
>>
>> ---
>> #include 
>> void f1(long *a, long *b) {
>>   memcpy(a, b, 8 * 16);
>> }
>>
>> void f2(long *a, long *b) {
>>   memcpy(a, b, 8 * 32);
>> }
>> ---
>>
>> with gcc 4.2 (-O2), it will call memcpy for f2 and not for f1.
>>
>> Cheers,
>> -- 
>> Rafael Avila de Espindola
>>
>> Google Ireland Ltd.
>> Gordon House
>> Barrow Street
>> Dublin 4
>> Ireland
>>
>> Registered in Dublin, Ireland
>> Registration Number: 368047
>> 
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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