[llvm-commits] [llvm] r43381 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp

2007-10-26 Thread Anton Korobeynikov
Author: asl
Date: Fri Oct 26 04:13:24 2007
New Revision: 43381

URL: http://llvm.org/viewvc/llvm-project?rev=43381view=rev
Log:
Fix off-by-one stack offset computations (dwarf information) for callee-saved
registers in case, when FP pointer was eliminated. This should fixes misc. 
random
EH-related crahses, when stuff is compiled with -fomit-frame-pointer.
Thanks Duncan for nailing this bug!

Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=43381r1=43380r2=43381view=diff

==
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Oct 26 04:13:24 2007
@@ -1816,10 +1816,11 @@
MFI-getObjectOffset(CSI[I].getFrameIdx()));
 
 // Calculate offsets
+int64_t saveAreaOffset = (hasFP(MF) ? 3 : 2)*stackGrowth;
 for (unsigned I = 0, E = CSI.size(); I!=E; ++I) {
   int64_t Offset = MFI-getObjectOffset(CSI[I].getFrameIdx());
   unsigned Reg = CSI[I].getReg();
-  Offset = (MaxOffset-Offset+3*stackGrowth);
+  Offset = (MaxOffset-Offset+saveAreaOffset);
   MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
   MachineLocation CSSrc(Reg);
   Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc));


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


[llvm-commits] [llvm] r43384 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-10-26 Thread Evan Cheng
Author: evancheng
Date: Fri Oct 26 12:24:46 2007
New Revision: 43384

URL: http://llvm.org/viewvc/llvm-project?rev=43384view=rev
Log:
Fix a crash. Make sure TLI is not null.

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

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43384r1=43383r2=43384view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Oct 26 12:24:46 
2007
@@ -972,7 +972,7 @@
 AM.Scale = Scale;
 
 // If load[imm+r*scale] is illegal, bail out.
-if (!TLI-isLegalAddressingMode(AM, AccessTy))
+if (TLI  !TLI-isLegalAddressingMode(AM, AccessTy))
   return false;
   }
   return true;


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


[llvm-commits] [poolalloc] r43388 - /poolalloc/trunk/configure

2007-10-26 Thread John Criswell
Author: criswell
Date: Fri Oct 26 13:31:24 2007
New Revision: 43388

URL: http://llvm.org/viewvc/llvm-project?rev=43388view=rev
Log:
Updated configure script for Andrew's latest changes.

Modified:
poolalloc/trunk/configure

Modified: poolalloc/trunk/configure
URL: 
http://llvm.org/viewvc/llvm-project/poolalloc/trunk/configure?rev=43388r1=43387r2=43388view=diff

==
--- poolalloc/trunk/configure (original)
+++ poolalloc/trunk/configure Fri Oct 26 13:31:24 2007
@@ -1318,32 +1318,6 @@
 LLVM_SRC_ROOT=`(cd $srcdir/../..; pwd)`
 LLVM_OBJ_ROOT=`(cd ../..; pwd)`
 
-ac_aux_dir=
-for ac_dir in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf; do
-  if test -f $ac_dir/install-sh; then
-ac_aux_dir=$ac_dir
-ac_install_sh=$ac_aux_dir/install-sh -c
-break
-  elif test -f $ac_dir/install.sh; then
-ac_aux_dir=$ac_dir
-ac_install_sh=$ac_aux_dir/install.sh -c
-break
-  elif test -f $ac_dir/shtool; then
-ac_aux_dir=$ac_dir
-ac_install_sh=$ac_aux_dir/shtool install -c
-break
-  fi
-done
-if test -z $ac_aux_dir; then
-  { { echo $as_me:$LINENO: error: cannot find install-sh or install.sh in 
$LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf 5
-echo $as_me: error: cannot find install-sh or install.sh in 
$LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf 2;}
-   { (exit 1); exit 1; }; }
-fi
-ac_config_guess=$SHELL $ac_aux_dir/config.guess
-ac_config_sub=$SHELL $ac_aux_dir/config.sub
-ac_configure=$SHELL $ac_aux_dir/configure # This should be Cygnus configure.
-
-
 
 # Check whether --with-llvmsrc or --without-llvmsrc was given.
 if test ${with_llvmsrc+set} = set; then
@@ -1368,6 +1342,32 @@
 
 
 
+ac_aux_dir=
+for ac_dir in $LLVM_SRC/autoconf $srcdir/$LLVM_SRC/autoconf; do
+  if test -f $ac_dir/install-sh; then
+ac_aux_dir=$ac_dir
+ac_install_sh=$ac_aux_dir/install-sh -c
+break
+  elif test -f $ac_dir/install.sh; then
+ac_aux_dir=$ac_dir
+ac_install_sh=$ac_aux_dir/install.sh -c
+break
+  elif test -f $ac_dir/shtool; then
+ac_aux_dir=$ac_dir
+ac_install_sh=$ac_aux_dir/shtool install -c
+break
+  fi
+done
+if test -z $ac_aux_dir; then
+  { { echo $as_me:$LINENO: error: cannot find install-sh or install.sh in 
$LLVM_SRC/autoconf $srcdir/$LLVM_SRC/autoconf 5
+echo $as_me: error: cannot find install-sh or install.sh in 
$LLVM_SRC/autoconf $srcdir/$LLVM_SRC/autoconf 2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess=$SHELL $ac_aux_dir/config.guess
+ac_config_sub=$SHELL $ac_aux_dir/config.sub
+ac_configure=$SHELL $ac_aux_dir/configure # This should be Cygnus configure.
+
+
 
 
   ac_config_files=$ac_config_files Makefile.common


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


[llvm-commits] [poolalloc] r43389 - in /poolalloc/trunk/lib: Makefile PoolAllocate/AccessTrace.cpp PoolAllocate/PointerCompress.cpp PoolAllocate/PoolAllocate.cpp PoolAllocate/PoolOptimize.cpp PoolAllo

2007-10-26 Thread Andrew Lenharth
Author: alenhar2
Date: Fri Oct 26 13:31:29 2007
New Revision: 43389

URL: http://llvm.org/viewvc/llvm-project?rev=43389view=rev
Log:
Poolalloc, now with less bitrot, thanks Torvald Riegel

Modified:
poolalloc/trunk/lib/Makefile
poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp
poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp
poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

Modified: poolalloc/trunk/lib/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/Makefile?rev=43389r1=43388r2=43389view=diff

==
--- poolalloc/trunk/lib/Makefile (original)
+++ poolalloc/trunk/lib/Makefile Fri Oct 26 13:31:29 2007
@@ -6,6 +6,6 @@
 #
 # List all of the subdirectories that we will compile.
 #
-PARALLEL_DIRS=DSA
+PARALLEL_DIRS=DSA PoolAllocate
 
 include $(LEVEL)/Makefile.common

Modified: poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp?rev=43389r1=43388r2=43389view=diff

==
--- poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp Fri Oct 26 13:31:29 2007
@@ -32,6 +32,8 @@
 const Type *VoidPtrTy;
   public:
 
+PoolAccessTrace() : ModulePass((intptr_t)ID) {}
+
 bool runOnModule(Module M);
 
 void getAnalysisUsage(AnalysisUsage AU) const;
@@ -39,6 +41,7 @@
 const DSGraph getGraphForFunc(PA::FuncInfo *FI) const {
   return ECG-getDSGraph(FI-F);
 }
+static char ID;
 
   private:
 void InitializeLibraryFunctions(Module M);
@@ -46,6 +49,7 @@
   PA::FuncInfo *FI, DSGraph DSG);
   };
 
+  char PoolAccessTrace::ID = 0;
   RegisterPassPoolAccessTrace
   X(poolaccesstrace, Instrument program to print trace of accesses);
 }
@@ -90,7 +94,8 @@
 PD = Constant::getNullValue(VoidPtrTy);
 
   // Insert the trace call.
-  new CallInst(PoolAccessTraceFn, Ptr, PD, , I);
+  Value *Opts[2] = {Ptr, PD};
+  new CallInst(PoolAccessTraceFn, Opts, Opts + 2, , I);
 }
 
 bool PoolAccessTrace::runOnModule(Module M) {

Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
URL: 
http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=43389r1=43388r2=43389view=diff

==
--- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Fri Oct 26 13:31:29 
2007
@@ -117,7 +117,9 @@
   public:
 Constant *PoolInitPC, *PoolDestroyPC, *PoolAllocPC;
 typedef std::mapconst DSNode*, CompressedPoolInfo PoolInfoMap;
+static char ID;
 
+PointerCompress() : ModulePass((intptr_t)ID) {}
 /// NoArgFunctionsCalled - When we are walking the call graph, keep track 
of
 /// which functions are called that don't need their prototype to be
 /// changed.
@@ -162,6 +164,7 @@
  Function F, DSGraph DSG, PA::FuncInfo *FI);
   };
 
+  char PointerCompress::ID = 0;
   RegisterPassPointerCompress
   X(pointercompress, Compress type-safe data structures);
 }
@@ -285,7 +288,8 @@
 
 // Get the pool base pointer.
 Constant *Zero = Constant::getNullValue(Type::Int32Ty);
-Value *BasePtrPtr = new GetElementPtrInst(getPoolDesc(), Zero, Zero,
+Value *Opts[2] = {Zero, Zero};
+Value *BasePtrPtr = new GetElementPtrInst(getPoolDesc(), Opts, Opts + 2,
   poolbaseptrptr, I);
 return new LoadInst(BasePtrPtr, poolbaseptr, I);
   } else {
@@ -296,7 +300,8 @@
   BasicBlock::iterator IP = I.getParent()-getParent()-begin()-begin();
   while (isaAllocaInst(IP)) ++IP;
   Constant *Zero = Constant::getNullValue(Type::Int32Ty);
-  Value *BasePtrPtr = new GetElementPtrInst(getPoolDesc(), Zero, Zero,
+  Value *Opts[2] = {Zero, Zero};
+  Value *BasePtrPtr = new GetElementPtrInst(getPoolDesc(), Opts, Opts + 2,
 poolbaseptrptr, IP);
   PoolBase = new LoadInst(BasePtrPtr, poolbaseptr, IP);
 }
@@ -864,7 +869,7 @@
   Ops.push_back(ConstantInt::get(Type::Int32Ty,
  PA::Heuristic::getRecommendedAlignment(PI-getNewType(), TD)));
   // TODO: Compression could reduce the alignment restriction for the pool!
-  Value *PB = new CallInst(PtrComp.PoolInitPC, Ops[0], Ops.size(), , CI);
+  Value *PB = new CallInst(PtrComp.PoolInitPC, Ops.begin(), Ops.end(), , 
CI);
 
   if (!DisablePoolBaseASR) { // Load the pool base immediately.
 PB-setName(CI.getOperand(1)-getName()+.poolbase);
@@ -906,7 +911,8 @@
   Size = BinaryOperator::createMul(Size, NewSize, newbytes, CI);
 }
 
-  Value *NC = new 

[llvm-commits] [llvm-gcc-4.0] r43393 - /llvm-gcc-4.0/trunk/gcc/c-common.c

2007-10-26 Thread Dale Johannesen
Author: johannes
Date: Fri Oct 26 15:15:55 2007
New Revision: 43393

URL: http://llvm.org/viewvc/llvm-project?rev=43393view=rev
Log:
Fix warning and LOCAL comment location.  Cosmetic.


Modified:
llvm-gcc-4.0/trunk/gcc/c-common.c

Modified: llvm-gcc-4.0/trunk/gcc/c-common.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-common.c?rev=43393r1=43392r2=43393view=diff

==
--- llvm-gcc-4.0/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.0/trunk/gcc/c-common.c Fri Oct 26 15:15:55 2007
@@ -7669,10 +7669,10 @@
   if (TREE_CODE (arg) == VAR_DECL
   TREE_STATIC (arg)
 /* APPLE LOCAL begin LLVM */
-/* DECL_RTL does not get set for LLVM 
+/* DECL_RTL does not get set for LLVM */
 /*MEM_P (DECL_RTL (arg))*/
-/* APPLE LOCAL end LLVM */
  )
+/* APPLE LOCAL end LLVM */
{
  /* See assemble_name for details.  */
  const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (arg));


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


[llvm-commits] [llvm-gcc-4.0] r43392 - in /llvm-gcc-4.0/trunk/gcc: c-common.c config/i386/i386.c

2007-10-26 Thread Dale Johannesen
Author: johannes
Date: Fri Oct 26 14:59:04 2007
New Revision: 43392

URL: http://llvm.org/viewvc/llvm-project?rev=43392view=rev
Log:
LLVM does not compute DECL_RTL; remove checks for
it in a couple places in inline asm handling.


Modified:
llvm-gcc-4.0/trunk/gcc/c-common.c
llvm-gcc-4.0/trunk/gcc/config/i386/i386.c

Modified: llvm-gcc-4.0/trunk/gcc/c-common.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-common.c?rev=43392r1=43391r2=43392view=diff

==
--- llvm-gcc-4.0/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.0/trunk/gcc/c-common.c Fri Oct 26 14:59:04 2007
@@ -7668,7 +7668,11 @@
 variable.  */
   if (TREE_CODE (arg) == VAR_DECL
   TREE_STATIC (arg)
-  MEM_P (DECL_RTL (arg)))
+/* APPLE LOCAL begin LLVM */
+/* DECL_RTL does not get set for LLVM 
+/*MEM_P (DECL_RTL (arg))*/
+/* APPLE LOCAL end LLVM */
+ )
{
  /* See assemble_name for details.  */
  const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (arg));

Modified: llvm-gcc-4.0/trunk/gcc/config/i386/i386.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/i386.c?rev=43392r1=43391r2=43392view=diff

==
--- llvm-gcc-4.0/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.0/trunk/gcc/config/i386/i386.c Fri Oct 26 14:59:04 2007
@@ -19719,7 +19719,11 @@
 }
   if (TREE_CODE (v) == VAR_DECL
TREE_STATIC (v)
-   MEM_P (DECL_RTL (v)))
+/* APPLE LOCAL begin LLVM */
+/* DECL_RTL is not set for LLVM */
+/*   MEM_P (DECL_RTL (v))*/
+ )
+/* APPLE LOCAL end LLVM */
 return true;
   if ((TREE_CODE (v) == MINUS_EXPR
|| TREE_CODE (v) == PLUS_EXPR)


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


[llvm-commits] [llvm-gcc-4.0] r43394 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp

2007-10-26 Thread Bill Wendling
Author: void
Date: Fri Oct 26 15:20:29 2007
New Revision: 43394

URL: http://llvm.org/viewvc/llvm-project?rev=43394view=rev
Log:
There are situations where the source and destination alignments differ. This
can cause havoc with memcpy. In this case, memcpy is using the alignment of the
source pointer and assuming that the destination pointer has the same
alignment. Fix this by copying the source pointer node and adjusting the
alignment to the minimum of the two alignments.


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

Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43394r1=43393r2=43394view=diff

==
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Fri Oct 26 15:20:29 2007
@@ -3020,8 +3020,26 @@
   Emit(TREE_OPERAND(exp, 1), LV.Ptr);
   EmitAggregateCopy(DestLoc, LV.Ptr, TREE_TYPE(exp), isVolatile, false,
 Alignment);
-} else if (!isVolatile  TREE_CODE(TREE_OPERAND(exp, 0))!=RESULT_DECL) {
-  Emit(TREE_OPERAND(exp, 1), LV.Ptr);
+} else if (!isVolatile  TREE_CODE(TREE_OPERAND(exp, 0)) != RESULT_DECL) {
+  // At this point, Alignment is the alignment of the destination
+  // pointer. It may not match the alignment of the source pointer. So, we
+  // need to make sure that it's has at least its alignment.
+  tree new_exp = copy_node(TREE_OPERAND(exp, 1));
+  unsigned NewAlignment = expr_align(new_exp) / 8;
+  Alignment = (Alignment  NewAlignment) ? Alignment : NewAlignment;
+  TYPE_ALIGN(TREE_TYPE(new_exp)) = Alignment;
+ 
+  switch (TREE_CODE(new_exp)) {
+  case VAR_DECL:
+  case PARM_DECL:
+  case RESULT_DECL:
+   DECL_ALIGN (new_exp) = Alignment * 8;
+   break;
+  default:
+   break;
+  }
+ 
+  Emit(new_exp, LV.Ptr);
 } else {
   // Need to do a volatile store into TREE_OPERAND(exp, 1).  To do this, we
   // emit it into a temporary memory location, then do a volatile copy into


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


[llvm-commits] [llvm-gcc-4.2] r43395 - in /llvm-gcc-4.2/trunk/gcc: c-common.c config/i386/i386.c

2007-10-26 Thread Dale Johannesen
Author: johannes
Date: Fri Oct 26 15:22:52 2007
New Revision: 43395

URL: http://llvm.org/viewvc/llvm-project?rev=43395view=rev
Log:
Remove checks for DECL_RTL a couple places in
inline asm handling; llvm doesn't set that.


Modified:
llvm-gcc-4.2/trunk/gcc/c-common.c
llvm-gcc-4.2/trunk/gcc/config/i386/i386.c

Modified: llvm-gcc-4.2/trunk/gcc/c-common.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=43395r1=43394r2=43395view=diff

==
--- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.c Fri Oct 26 15:22:52 2007
@@ -7980,7 +7980,11 @@
 variable.  */
   if (TREE_CODE (arg) == VAR_DECL
   TREE_STATIC (arg)
-  MEM_P (DECL_RTL (arg)))
+/* APPLE LOCAL begin LLVM */
+/* DECL_RTL does not get set for LLVM */
+/*MEM_P (DECL_RTL (arg))*/
+ )
+/* APPLE LOCAL end LLVM */
{
  /* See assemble_name for details.  */
  const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (arg));

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=43395r1=43394r2=43395view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Fri Oct 26 15:22:52 2007
@@ -20543,7 +20543,11 @@
 }
   if (TREE_CODE (v) == VAR_DECL
TREE_STATIC (v)
-   MEM_P (DECL_RTL (v)))
+/* APPLE LOCAL begin LLVM */
+/* DECL_RTL is not set for LLVM */
+/* MEM_P (DECL_RTL (v))*/
+ )
+/* APPLE LOCAL end LLVM */
 {
   note_alternative_entry_points ();
   return true;


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


[llvm-commits] [llvm] r43396 - in /llvm/trunk/include/llvm/Bitcode: Deserialize.h Serialization.h

2007-10-26 Thread Ted Kremenek
Author: kremenek
Date: Fri Oct 26 15:23:27 2007
New Revision: 43396

URL: http://llvm.org/viewvc/llvm-project?rev=43396view=rev
Log:
Added default implementation of SerializeTrait that dispatches to
calling member functions of the target type to perform type-specific
serialization.
 
Added version of ReadPtr that allows passing references to uintptr_t
(useful for smart pointers).

Modified:
llvm/trunk/include/llvm/Bitcode/Deserialize.h
llvm/trunk/include/llvm/Bitcode/Serialization.h

Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=43396r1=43395r2=43396view=diff

==
--- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Fri Oct 26 15:23:27 2007
@@ -99,7 +99,9 @@
 return x;
   }
   
-  void ReadPtr(void* PtrRef);  
+  void ReadPtr(void* PtrRef);
+  void ReadPtr(uintptr_t PtrRef) { ReadPtr(reinterpret_castvoid*(PtrRef)); 
}
+  
   void RegisterPtr(unsigned PtrId, void* Ptr);
 
 

Modified: llvm/trunk/include/llvm/Bitcode/Serialization.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialization.h?rev=43396r1=43395r2=43396view=diff

==
--- llvm/trunk/include/llvm/Bitcode/Serialization.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialization.h Fri Oct 26 15:23:27 2007
@@ -19,6 +19,28 @@
 
 namespace llvm {
   
+/// SerializeTrait - SerializeTrait bridges between the Serializer/Deserializer
+///  and the functions that serialize objects of specific types.  The default
+///  behavior is to call static methods of the class for the object being
+///  serialized, but this behavior can be changed by specializing this
+///  template.  Classes only need to implement the methods corresponding
+///  to the serialization scheme they want to support.  For example, Read
+///  and ReadVal correspond to different deserialization schemes which make
+///  sense for different types; a class need only implement one of them.
+///  Serialization and deserialization of pointers are specially handled
+///  by the Serializer and Deserializer using the EmitOwnedPtr, etc. methods.
+///  To serialize the actual object referred to by a pointer, the class
+///  of the object either must implement the methods called by the default
+///  behavior of SerializeTrait, or specialize SerializeTrait.  This latter
+///  is useful when one cannot add methods to an existing class (for example).
+template typename T
+struct SerializeTrait {
+  static inline void Emit(Serializer S, const T X) { X.Emit(S); }
+  static inline void Read(Deserializer D, T X) { X.Read(D); }
+  static inline T ReadVal(Deserializer D) { T::ReadVal(D); }
+  static inline T* Materialize(Deserializer D) { T::Materialize(D); }
+};
+
 #define SERIALIZE_INT_TRAIT(TYPE)\
 template  struct SerializeTraitTYPE {\
   static void Emit(Serializer S, TYPE X);\


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


Re: [llvm-commits] [llvm] r43398 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll

2007-10-26 Thread Bill Wendling
On 10/26/07, Bill Wendling [EMAIL PROTECTED] wrote:
 Author: void
 Date: Fri Oct 26 15:24:42 2007
 New Revision: 43398

 URL: http://llvm.org/viewvc/llvm-project?rev=43398view=rev
 Log:
 - XFAIL 2007-10-23-UnalignedMemcpy.ll because llc has a bug that crashes on
   unaligned pointers.

Explanation: Chris is looking into the problem with llc crashing on
invalid code. That's why I XFAILed this one instead of removing it.

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


[llvm-commits] [llvm] r43400 - /llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll

2007-10-26 Thread Bill Wendling
Author: void
Date: Fri Oct 26 15:34:37 2007
New Revision: 43400

URL: http://llvm.org/viewvc/llvm-project?rev=43400view=rev
Log:
On second thought. Remove this as it should never be generated in the first
place.

Removed:
llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll

Removed: llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll?rev=43399view=auto

==
--- llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll (removed)
@@ -1,14 +0,0 @@
-; RUN: llvm-as  %s | llc -mtriple=powerpc64-apple-darwin9 -o - | grep memcpy
-; XFAIL: *
-
[EMAIL PROTECTED] = external constant [33 x i8] ; [33 x i8]* [#uses=1]
-
-define void @Bork() {
-entry:
-%Qux = alloca [33 x i8] ; [33 x i8]* [#uses=1]
-%Qux1 = bitcast [33 x i8]* %Qux to i8*  ; i8* [#uses=1]
-call void @llvm.memcpy.i64( i8* %Qux1, i8* getelementptr ([33 x i8]* 
@C.0.1173, i32 0, i32 0), i64 33, i32 8 )
-ret void
-}
-
-declare void @llvm.memcpy.i64(i8*, i8*, i64, i32)


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


[llvm-commits] [llvm] r43402 - /llvm/trunk/include/llvm/ADT/APSInt.h

2007-10-26 Thread Ted Kremenek
Author: kremenek
Date: Fri Oct 26 15:44:02 2007
New Revision: 43402

URL: http://llvm.org/viewvc/llvm-project?rev=43402view=rev
Log:
Fixed incorrect path name in preamble (comment) of header file.

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

Modified: llvm/trunk/include/llvm/ADT/APSInt.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=43402r1=43401r2=43402view=diff

==
--- llvm/trunk/include/llvm/ADT/APSInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APSInt.h Fri Oct 26 15:44:02 2007
@@ -1,4 +1,4 @@
-//===-- llvm/Support/APSInt.h - Arbitrary Precision Signed Int -*- C++ 
-*--===//
+//===-- llvm/ADT/APSInt.h - Arbitrary Precision Signed Int -*- C++ 
-*--===//
 //
 // The LLVM Compiler Infrastructure
 //


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


[llvm-commits] [llvm] r43398 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll

2007-10-26 Thread Bill Wendling
Author: void
Date: Fri Oct 26 15:24:42 2007
New Revision: 43398

URL: http://llvm.org/viewvc/llvm-project?rev=43398view=rev
Log:
- Remove the hacky code that forces a memcpy. Alignment is taken care of in the
  FE.
- Explicitly pass in the alignment of the load  store.
- XFAIL 2007-10-23-UnalignedMemcpy.ll because llc has a bug that crashes on
  unaligned pointers.

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct 26 
15:24:42 2007
@@ -4329,14 +4329,6 @@
   }
 }
 
-// The lowered load/store instructions from/to the stack frame can be
-// unaligned depending on whether it's accessed off sp or fp. If this 
is
-// the case, then just use the memcpy library call.
-if (Op1.getOpcode() == ISD::FrameIndex ||
-Op2.getOpcode() == ISD::FrameIndex)
-  if (Size-getValue() % Align != 0)
-break;
-
 for (unsigned i = 0; i  NumMemOps; i++) {
   MVT::ValueType VT = MemOps[i];
   unsigned VTSize = MVT::getSizeInBits(VT) / 8;
@@ -4351,13 +4343,13 @@
I.getOperand(1), DstOff);
   } else {
 Value = DAG.getLoad(VT, getRoot(),
-getMemBasePlusOffset(Op2, SrcOff, DAG, TLI),
-I.getOperand(2), SrcOff);
+getMemBasePlusOffset(Op2, SrcOff, DAG, TLI),
+I.getOperand(2), SrcOff, false, Align);
 Chain = Value.getValue(1);
 Store =
   DAG.getStore(Chain, Value,
getMemBasePlusOffset(Op1, DstOff, DAG, TLI),
-   I.getOperand(1), DstOff);
+   I.getOperand(1), DstOff, false, Align);
   }
   OutChains.push_back(Store);
   SrcOff += VTSize;

Modified: llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll?rev=43398r1=43397r2=43398view=diff

==
--- llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2007-10-23-UnalignedMemcpy.ll Fri Oct 26 
15:24:42 2007
@@ -1,4 +1,5 @@
 ; RUN: llvm-as  %s | llc -mtriple=powerpc64-apple-darwin9 -o - | grep memcpy
+; XFAIL: *
 
 @C.0.1173 = external constant [33 x i8] ; [33 x i8]* [#uses=1]
 


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


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

2007-10-26 Thread Bill Wendling
Author: void
Date: Fri Oct 26 15:27:28 2007
New Revision: 43399

URL: http://llvm.org/viewvc/llvm-project?rev=43399view=rev
Log:
Port of r43394:
There are situations where the source and destination alignments differ. This
can cause havoc with memcpy. In this case, memcpy is using the alignment of the
source pointer and assuming that the destination pointer has the same
alignment. Fix this by copying the source pointer node and adjusting the
alignment to the minimum of the two alignments.


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=43399r1=43398r2=43399view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Oct 26 15:27:28 2007
@@ -2541,7 +2541,25 @@
   EmitAggregateCopy(DestLoc, LV.Ptr, TREE_TYPE(exp), isVolatile, false,
 Alignment);
 } else if (!isVolatile  TREE_CODE(TREE_OPERAND(exp, 0))!=RESULT_DECL) {
-  Emit(TREE_OPERAND(exp, 1), LV.Ptr);
+  // At this point, Alignment is the alignment of the destination
+  // pointer. It may not match the alignment of the source pointer. So, we
+  // need to make sure that it's has at least its alignment.
+  tree new_exp = copy_node(TREE_OPERAND(exp, 1));
+  unsigned NewAlignment = expr_align(new_exp) / 8;
+  Alignment = (Alignment  NewAlignment) ? Alignment : NewAlignment;
+  TYPE_ALIGN(TREE_TYPE(new_exp)) = Alignment;
+ 
+  switch (TREE_CODE(new_exp)) {
+  case VAR_DECL:
+  case PARM_DECL:
+  case RESULT_DECL:
+   DECL_ALIGN (new_exp) = Alignment * 8;
+   break;
+  default:
+   break;
+  }
+ 
+  Emit(new_exp, LV.Ptr);
 } else {
   // Need to do a volatile store into TREE_OPERAND(exp, 1).  To do this, we
   // emit it into a temporary memory location, then do a volatile copy into


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


[llvm-commits] [llvm] r43401 - /llvm/trunk/include/llvm/ADT/APInt.h

2007-10-26 Thread Ted Kremenek
Author: kremenek
Date: Fri Oct 26 15:42:45 2007
New Revision: 43401

URL: http://llvm.org/viewvc/llvm-project?rev=43401view=rev
Log:
Fixed incorrect path name in preamble (comment) of header file.

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

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=43401r1=43400r2=43401view=diff

==
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Fri Oct 26 15:42:45 2007
@@ -1,4 +1,4 @@
-//===-- llvm/Support/APInt.h - For Arbitrary Precision Integer -*- C++ 
-*--===//
+//===-- llvm/ADT/APInt.h - For Arbitrary Precision Integer -*- C++ 
-*--===//
 //
 // The LLVM Compiler Infrastructure
 //


___
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] r43399 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

2007-10-26 Thread Duncan Sands
Hi Bill, I must say that I don't like this patch at all.  Is there
no better way?  I started to work on something better myself, but
unfortunately on my machine (x86-32) the testcase doesn't lead to
a memcpy with llvm-gcc-4.2 at all, only a memset.  Can you please
suggest a testcase that shows the problem with x86-32 linux.

Thanks,

Duncan.

PS: Don't the other two branches of the if statement need the same
treatment?

___
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] r43399 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

2007-10-26 Thread Bill Wendling
Hi Duncan,

 Hi Bill, I must say that I don't like this patch at all.  Is there
 no better way?

I'm open to suggestions. :-) What part do you object to? I reasoned
that we needed to make the memcpy intrinsic have the correct
alignment. It is getting its alignment information from the source
pointer's alignment, but this could conflict with the destination's
alignment.

 I started to work on something better myself, but
 unfortunately on my machine (x86-32) the testcase doesn't lead to
 a memcpy with llvm-gcc-4.2 at all, only a memset.  Can you please
 suggest a testcase that shows the problem with x86-32 linux.

I've only seen this problem on PPC64. In particular, it's writing this
information into the redzone because this is a leaf function, and
thus the destination may be unaligned.

 PS: Don't the other two branches of the if statement need the same
 treatment?

Possibly...I'll see if I can come up with a testcase for them that fails.

-bw
___
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] r43399 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

2007-10-26 Thread Duncan Sands
  Hi Bill, I must say that I don't like this patch at all.  Is there
  no better way?
 
 I'm open to suggestions. :-) What part do you object to?

All of it!  But let's not go there :)

 I've only seen this problem on PPC64. In particular, it's writing this
 information into the redzone because this is a leaf function, and
 thus the destination may be unaligned.

Can you please send me the gcc tree dumps, and also what debug_tree
gives for the modify_expr.

Thanks,

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


[llvm-commits] [llvm] r43405 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Bitcode/Reader/DeserializeAPInt.cpp lib/Bitcode/Writer/SerializeAPInt.cpp

2007-10-26 Thread Ted Kremenek
Author: kremenek
Date: Fri Oct 26 16:50:10 2007
New Revision: 43405

URL: http://llvm.org/viewvc/llvm-project?rev=43405view=rev
Log:
Added serialization support for APInt.

Added:
llvm/trunk/lib/Bitcode/Reader/DeserializeAPInt.cpp
llvm/trunk/lib/Bitcode/Writer/SerializeAPInt.cpp
Modified:
llvm/trunk/include/llvm/ADT/APInt.h

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=43405r1=43404r2=43405view=diff

==
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Fri Oct 26 16:50:10 2007
@@ -16,6 +16,7 @@
 #define LLVM_APINT_H
 
 #include llvm/Support/DataTypes.h
+#include llvm/Bitcode/SerializationFwd.h
 #include cassert
 #include string
 
@@ -203,6 +204,16 @@
 
   /// @brief Destructor.
   ~APInt();
+  
+  /// Default constructor that creates an uninitialized APInt.  This is useful
+  ///  for object deserialization (pair this with the static method Read).
+  explicit APInt() {}
+  
+  /// @brief Used by the Bitcode serializer to emit APInts to Bitcode.
+  void Emit(Serializer S) const;
+  
+  /// @brief Used by the Bitcode deserializer to deserialize APInts.
+  void Read(Deserializer D);
 
   /// @}
   /// @name Value Tests

Added: llvm/trunk/lib/Bitcode/Reader/DeserializeAPInt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/DeserializeAPInt.cpp?rev=43405view=auto

==
--- llvm/trunk/lib/Bitcode/Reader/DeserializeAPInt.cpp (added)
+++ llvm/trunk/lib/Bitcode/Reader/DeserializeAPInt.cpp Fri Oct 26 16:50:10 2007
@@ -0,0 +1,33 @@
+//===-- DeserializeAPInt.cpp - Deserialization for APInts --*- C++ 
-*--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Ted Kremenek and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file implements deserialization of APInts.
+//
+//===--===//
+
+#include llvm/ADT/APInt.h
+#include llvm/Bitcode/Deserialize.h
+#include cassert
+
+using namespace llvm;
+
+void APInt::Read(Deserializer D) {
+  BitWidth = D.ReadInt();
+  
+  if (isSingleWord())
+VAL = D.ReadInt();
+  else {
+uint32_t NumWords = D.ReadInt();
+assert (NumWords  1);
+pVal = new uint64_t[NumWords];
+assert (pVal  Allocation in deserialization of APInt failed.);
+for (unsigned i = 0; i  NumWords; ++i)
+  pVal[i] = D.ReadInt();
+  }
+}

Added: llvm/trunk/lib/Bitcode/Writer/SerializeAPInt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/SerializeAPInt.cpp?rev=43405view=auto

==
--- llvm/trunk/lib/Bitcode/Writer/SerializeAPInt.cpp (added)
+++ llvm/trunk/lib/Bitcode/Writer/SerializeAPInt.cpp Fri Oct 26 16:50:10 2007
@@ -0,0 +1,31 @@
+//===-- SerializeAPInt.cpp - Serialization for APInts --*- C++ 
-*--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Ted Kremenek and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file implements serialization of APInts.
+//
+//===--===//
+
+#include llvm/ADT/APInt.h
+#include llvm/Bitcode/Serialize.h
+#include cassert
+
+using namespace llvm;
+
+void APInt::Emit(Serializer S) const {
+  S.EmitInt(BitWidth);
+
+  if (isSingleWord())
+S.EmitInt(VAL);
+  else {
+uint32_t NumWords = getNumWords();
+S.EmitInt(NumWords);
+for (unsigned i = 0; i  NumWords; ++i)
+  S.EmitInt(pVal[i]);
+  }
+}


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


[llvm-commits] [llvm] r43406 - /llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj

2007-10-26 Thread Ted Kremenek
Author: kremenek
Date: Fri Oct 26 16:53:37 2007
New Revision: 43406

URL: http://llvm.org/viewvc/llvm-project?rev=43406view=rev
Log:
Added SerializeAPInt.cpp and DeserializeAPInt.cpp to the XCode project.

Modified:
llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj

Modified: llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj?rev=43406r1=43405r2=43406view=diff

==
--- llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj (original)
+++ llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Fri Oct 26 16:53:37 2007
@@ -65,6 +65,8 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+   354CF6D10CD299440059AF3E /* DeserializeAPInt.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DeserializeAPInt.cpp; sourceTree = group; };
+   354CF6D20CD2994D0059AF3E /* SerializeAPInt.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = SerializeAPInt.cpp; sourceTree = group; };
35A9CDED0CD0F6AF008ABC1D /* Deserialize.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
Deserialize.h; sourceTree = group; };
35A9CDEE0CD0F6AF008ABC1D /* Serialization.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
Serialization.h; sourceTree = group; };
35A9CDEF0CD0F6AF008ABC1D /* Serialize.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
Serialize.h; sourceTree = group; };
@@ -1104,6 +1106,7 @@
9F68EB050C77AD2C004AA152 /* Reader */ = {
isa = PBXGroup;
children = (
+   354CF6D10CD299440059AF3E /* 
DeserializeAPInt.cpp */,
35A9CDF00CD0F6D5008ABC1D /* Deserialize.cpp */,
9F68EB060C77AD2C004AA152 /* BitcodeReader.cpp 
*/,
9F68EB070C77AD2C004AA152 /* BitcodeReader.h */,
@@ -1114,6 +1117,7 @@
9F68EB110C77AD2C004AA152 /* Writer */ = {
isa = PBXGroup;
children = (
+   354CF6D20CD2994D0059AF3E /* SerializeAPInt.cpp 
*/,
9FD3E5920CA012B300E54D15 /* BitWriter.cpp */,
9F68EB120C77AD2C004AA152 /* BitcodeWriter.cpp 
*/,
9F68EB130C77AD2C004AA152 /* 
BitcodeWriterPass.cpp */,


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


[llvm-commits] [llvm] r43408 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-10-26 Thread Evan Cheng
Author: evancheng
Date: Fri Oct 26 18:08:19 2007
New Revision: 43408

URL: http://llvm.org/viewvc/llvm-project?rev=43408view=rev
Log:
A number of LSR fixes:
- ChangeCompareStride only reuse stride that is larger than current stride. It
  will let the general reuse mechanism to try to reuse a smaller stride.
- Watch out for multiplication overflow in ChangeCompareStride.
- Replace std::set with SmallPtrSet.

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

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43408r1=43407r2=43408view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Oct 26 18:08:19 
2007
@@ -31,6 +31,7 @@
 #include llvm/Transforms/Utils/BasicBlockUtils.h
 #include llvm/Transforms/Utils/Local.h
 #include llvm/Target/TargetData.h
+#include llvm/ADT/SmallPtrSet.h
 #include llvm/ADT/Statistic.h
 #include llvm/Support/Debug.h
 #include llvm/Support/Compiler.h
@@ -135,7 +136,7 @@
 
 /// DeadInsts - Keep track of instructions we may have made dead, so that
 /// we can remove them after we are done working.
-std::setInstruction* DeadInsts;
+SmallPtrSetInstruction*,16 DeadInsts;
 
 /// TLI - Keep a pointer of a TargetLowering to consult for determining
 /// transformation profitability.
@@ -169,7 +170,7 @@
 Value *getCastedVersionOf(Instruction::CastOps opcode, Value *V);
 private:
 bool AddUsersIfInteresting(Instruction *I, Loop *L,
-   std::setInstruction* Processed);
+   SmallPtrSetInstruction*,16 Processed);
 SCEVHandle GetExpressionSCEV(Instruction *E, Loop *L);
 ICmpInst *ChangeCompareStride(Loop *L, ICmpInst *Cond,
   IVStrideUse* CondUse,
@@ -191,7 +192,7 @@
 void StrengthReduceStridedIVUsers(const SCEVHandle Stride,
   IVUsersOfOneStride Uses,
   Loop *L, bool isOnlyStride);
-void DeleteTriviallyDeadInstructions(std::setInstruction* Insts);
+void DeleteTriviallyDeadInstructions(SmallPtrSetInstruction*,16 Insts);
   };
   char LoopStrengthReduce::ID = 0;
   RegisterPassLoopStrengthReduce X(loop-reduce, Loop Strength Reduction);
@@ -223,10 +224,10 @@
 /// specified set are trivially dead, delete them and see if this makes any of
 /// their operands subsequently dead.
 void LoopStrengthReduce::
-DeleteTriviallyDeadInstructions(std::setInstruction* Insts) {
+DeleteTriviallyDeadInstructions(SmallPtrSetInstruction*,16 Insts) {
   while (!Insts.empty()) {
 Instruction *I = *Insts.begin();
-Insts.erase(Insts.begin());
+Insts.erase(I);
 if (isInstructionTriviallyDead(I)) {
   for (unsigned i = 0, e = I-getNumOperands(); i != e; ++i)
 if (Instruction *U = dyn_castInstruction(I-getOperand(i)))
@@ -409,10 +410,10 @@
 /// reducible SCEV, recursively add its users to the IVUsesByStride set and
 /// return true.  Otherwise, return false.
 bool LoopStrengthReduce::AddUsersIfInteresting(Instruction *I, Loop *L,
-std::setInstruction* Processed) 
{
+  SmallPtrSetInstruction*,16 Processed) 
{
   if (!I-getType()-isInteger()  !isaPointerType(I-getType()))
   return false;   // Void and FP expressions cannot be reduced.
-  if (!Processed.insert(I).second)
+  if (!Processed.insert(I))
 return true;// Instruction already handled.
   
   // Get the symbolic expression for this instruction.
@@ -1470,16 +1471,16 @@
   if (!C) return Cond;
 
   ICmpInst::Predicate Predicate = Cond-getPredicate();
-  bool isSigned = ICmpInst::isSignedPredicate(Predicate);
   int64_t CmpSSInt = SC-getValue()-getSExtValue();
   int64_t CmpVal = C-getValue().getSExtValue();
-  uint64_t SignBit = 1ULL  (C-getValue().getBitWidth()-1);
+  unsigned BitWidth = C-getValue().getBitWidth();
+  uint64_t SignBit = 1ULL  (BitWidth-1);
+  const Type *CmpTy = C-getType();
+  const Type *NewCmpTy = NULL;
   int64_t NewCmpVal = CmpVal;
   SCEVHandle *NewStride = NULL;
   Value *NewIncV = NULL;
   int64_t Scale = 1;
-  const Type *CmpTy = C-getType();
-  const Type *NewCmpTy = NULL;
 
   // Look for a suitable stride / iv as replacement.
   std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare());
@@ -1489,18 +1490,23 @@
 if (!isaSCEVConstant(SI-first))
   continue;
 int64_t SSInt = castSCEVConstant(SI-first)-getValue()-getSExtValue();
-if (abs(SSInt)  abs(CmpSSInt)  (CmpSSInt % SSInt) == 0) {
-  Scale = CmpSSInt / SSInt;
-  NewCmpVal = CmpVal / Scale;
-} else if (abs(SSInt)  abs(CmpSSInt)  (SSInt % CmpSSInt) == 0) {
-  Scale = SSInt / CmpSSInt;
-  NewCmpVal = CmpVal * 

[llvm-commits] [llvm-gcc-4.0] r43410 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp

2007-10-26 Thread Bill Wendling
Author: void
Date: Fri Oct 26 18:30:22 2007
New Revision: 43410

URL: http://llvm.org/viewvc/llvm-project?rev=43410view=rev
Log:
Reverting patch as it doesn't appear that this happens with TOT

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

Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43410r1=43409r2=43410view=diff

==
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Fri Oct 26 18:30:22 2007
@@ -3021,25 +3021,7 @@
   EmitAggregateCopy(DestLoc, LV.Ptr, TREE_TYPE(exp), isVolatile, false,
 Alignment);
 } else if (!isVolatile  TREE_CODE(TREE_OPERAND(exp, 0)) != RESULT_DECL) {
-  // At this point, Alignment is the alignment of the destination
-  // pointer. It may not match the alignment of the source pointer. So, we
-  // need to make sure that it's has at least its alignment.
-  tree new_exp = copy_node(TREE_OPERAND(exp, 1));
-  unsigned NewAlignment = expr_align(new_exp) / 8;
-  Alignment = (Alignment  NewAlignment) ? Alignment : NewAlignment;
-  TYPE_ALIGN(TREE_TYPE(new_exp)) = Alignment;
- 
-  switch (TREE_CODE(new_exp)) {
-  case VAR_DECL:
-  case PARM_DECL:
-  case RESULT_DECL:
-   DECL_ALIGN (new_exp) = Alignment * 8;
-   break;
-  default:
-   break;
-  }
- 
-  Emit(new_exp, LV.Ptr);
+  Emit(TREE_OPERAND(exp, 1), LV.Ptr);
 } else {
   // Need to do a volatile store into TREE_OPERAND(exp, 1).  To do this, we
   // emit it into a temporary memory location, then do a volatile copy into


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


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

2007-10-26 Thread Bill Wendling
Author: void
Date: Fri Oct 26 18:31:40 2007
New Revision: 43411

URL: http://llvm.org/viewvc/llvm-project?rev=43411view=rev
Log:
Reverting r43399 because it doesn't appear to happen with TOT anymore

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=43411r1=43410r2=43411view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Oct 26 18:31:40 2007
@@ -2541,25 +2541,7 @@
   EmitAggregateCopy(DestLoc, LV.Ptr, TREE_TYPE(exp), isVolatile, false,
 Alignment);
 } else if (!isVolatile  TREE_CODE(TREE_OPERAND(exp, 0))!=RESULT_DECL) {
-  // At this point, Alignment is the alignment of the destination
-  // pointer. It may not match the alignment of the source pointer. So, we
-  // need to make sure that it's has at least its alignment.
-  tree new_exp = copy_node(TREE_OPERAND(exp, 1));
-  unsigned NewAlignment = expr_align(new_exp) / 8;
-  Alignment = (Alignment  NewAlignment) ? Alignment : NewAlignment;
-  TYPE_ALIGN(TREE_TYPE(new_exp)) = Alignment;
- 
-  switch (TREE_CODE(new_exp)) {
-  case VAR_DECL:
-  case PARM_DECL:
-  case RESULT_DECL:
-   DECL_ALIGN (new_exp) = Alignment * 8;
-   break;
-  default:
-   break;
-  }
- 
-  Emit(new_exp, LV.Ptr);
+  Emit(TREE_OPERAND(exp, 1), LV.Ptr);
 } else {
   // Need to do a volatile store into TREE_OPERAND(exp, 1).  To do this, we
   // emit it into a temporary memory location, then do a volatile copy into


___
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] r43399 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

2007-10-26 Thread Bill Wendling
On 10/26/07, Duncan Sands [EMAIL PROTECTED] wrote:
   Hi Bill, I must say that I don't like this patch at all.  Is there
   no better way?
 
  I'm open to suggestions. :-) What part do you object to?

 All of it!  But let's not go there :)

  I've only seen this problem on PPC64. In particular, it's writing this
  information into the redzone because this is a leaf function, and
  thus the destination may be unaligned.

 Can you please send me the gcc tree dumps, and also what debug_tree
 gives for the modify_expr.

I'm no longer able to reproduce it with TOT minus my patch. I reverted
the patches to llvm-convert.cpp in 4.0 and 4.2. I'm going to add a
test to make sure that this continues to work.

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


[llvm-commits] [llvm] r43412 - /llvm/trunk/test/CFrontend/unaligned-memcpy.c

2007-10-26 Thread Bill Wendling
Author: void
Date: Fri Oct 26 18:43:35 2007
New Revision: 43412

URL: http://llvm.org/viewvc/llvm-project?rev=43412view=rev
Log:
Test to make sure that if we have an unaligned memcpy, it will still compile.


Added:
llvm/trunk/test/CFrontend/unaligned-memcpy.c

Added: llvm/trunk/test/CFrontend/unaligned-memcpy.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/unaligned-memcpy.c?rev=43412view=auto

==
--- llvm/trunk/test/CFrontend/unaligned-memcpy.c (added)
+++ llvm/trunk/test/CFrontend/unaligned-memcpy.c Fri Oct 26 18:43:35 2007
@@ -0,0 +1,5 @@
+// RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llc
+
+void bork() {
+  char Qux[33] = {0};
+}


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


[llvm-commits] [llvm] r43413 - /llvm/trunk/include/llvm/Bitcode/Serialization.h

2007-10-26 Thread Ted Kremenek
Author: kremenek
Date: Fri Oct 26 18:44:59 2007
New Revision: 43413

URL: http://llvm.org/viewvc/llvm-project?rev=43413view=rev
Log:
Fixed bug where default SerializeTrait::Materialize would not return the 
materialized object pointer.

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

Modified: llvm/trunk/include/llvm/Bitcode/Serialization.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialization.h?rev=43413r1=43412r2=43413view=diff

==
--- llvm/trunk/include/llvm/Bitcode/Serialization.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialization.h Fri Oct 26 18:44:59 2007
@@ -38,7 +38,7 @@
   static inline void Emit(Serializer S, const T X) { X.Emit(S); }
   static inline void Read(Deserializer D, T X) { X.Read(D); }
   static inline T ReadVal(Deserializer D) { T::ReadVal(D); }
-  static inline T* Materialize(Deserializer D) { T::Materialize(D); }
+  static inline T* Materialize(Deserializer D) { return T::Materialize(D); }
 };
 
 #define SERIALIZE_INT_TRAIT(TYPE)\


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


[llvm-commits] [llvm-gcc-4.0] r43415 - /llvm-gcc-4.0/trunk/gcc/config/i386/i386.c

2007-10-26 Thread Dale Johannesen
Author: johannes
Date: Fri Oct 26 19:26:49 2007
New Revision: 43415

URL: http://llvm.org/viewvc/llvm-project?rev=43415view=rev
Log:
(inline asm) comment out one more place 
DECL_RTL is referenced


Modified:
llvm-gcc-4.0/trunk/gcc/config/i386/i386.c

Modified: llvm-gcc-4.0/trunk/gcc/config/i386/i386.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/i386.c?rev=43415r1=43414r2=43415view=diff

==
--- llvm-gcc-4.0/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.0/trunk/gcc/config/i386/i386.c Fri Oct 26 19:26:49 2007
@@ -19711,8 +19711,12 @@
   v = TREE_OPERAND (v, 0);
   if (TREE_CODE (v) == VAR_DECL
   TREE_STATIC (v)
-  MEM_P (DECL_RTL (v)))
-return true;
+/* APPLE LOCAL begin LLVM */
+/* DECL_RTL is not set for LLVM */
+/* MEM_P (DECL_RTL (v))*/
+ )
+/* APPLE LOCAL end LLVM */
+return true;
   if (TREE_CODE (v) == LABEL_DECL)
return true;
   return false;


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


[llvm-commits] [llvm-gcc-4.2] r43416 - /llvm-gcc-4.2/trunk/gcc/config/i386/i386.c

2007-10-26 Thread Dale Johannesen
Author: johannes
Date: Fri Oct 26 19:38:33 2007
New Revision: 43416

URL: http://llvm.org/viewvc/llvm-project?rev=43416view=rev
Log:
(inline asm) one more place DECL_RTL is used


Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/i386.c

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=43416r1=43415r2=43416view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Fri Oct 26 19:38:33 2007
@@ -20532,7 +20532,11 @@
   v = TREE_OPERAND (v, 0);
   if (TREE_CODE (v) == VAR_DECL
   TREE_STATIC (v)
-  MEM_P (DECL_RTL (v)))
+/* APPLE LOCAL begin LLVM */
+/* DECL_RTL is not set for LLVM */
+/* MEM_P (DECL_RTL (v))*/
+ )
+/* APPLE LOCAL end LLVM */
{
  note_alternative_entry_points ();
  return true;


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