[llvm-commits] [llvm-gcc-4.2] r46205 - /llvm-gcc-4.2/trunk/gcc/llvm-abi.h

2008-01-21 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 21 02:39:31 2008
New Revision: 46205

URL: http://llvm.org/viewvc/llvm-project?rev=46205&view=rev
Log:
Remove extra tokens at end of #ifndef directive.

Modified:
llvm-gcc-4.2/trunk/gcc/llvm-abi.h

Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=46205&r1=46204&r2=46205&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Mon Jan 21 02:39:31 2008
@@ -123,7 +123,7 @@
 // LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR - Return true if this aggregate
 // value should be passed by value, i.e. passing its address with the byval
 // attribute bit set. The default is false.
-#ifndef LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X)
+#ifndef LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR
 #define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X) \
 false
 #endif
@@ -132,7 +132,7 @@
 // value should be passed in a mixture of integer, floating point, and vector
 // registers. The routine should also return by reference a vector of the
 // types of the registers being used. The default is false.
-#ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, E)
+#ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS
 #define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, E) \
 false
 #endif


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


[llvm-commits] [llvm] r46206 - /llvm/trunk/lib/VMCore/Instructions.cpp

2008-01-21 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 21 05:27:55 2008
New Revision: 46206

URL: http://llvm.org/viewvc/llvm-project?rev=46206&view=rev
Log:
Be consistent with other attribute methods, and
check the callee also if it is known.

Modified:
llvm/trunk/lib/VMCore/Instructions.cpp

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

==
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jan 21 05:27:55 2008
@@ -406,7 +406,13 @@
 
 /// @brief Determine if any call argument is an aggregate passed by value.
 bool CallInst::hasByValArgument() const {
-  return ParamAttrs && ParamAttrs->hasAttrSomewhere(ParamAttr::ByVal);
+  if (ParamAttrs && ParamAttrs->hasAttrSomewhere(ParamAttr::ByVal))
+return true;
+  // Be consistent with other methods and check the callee too.
+  if (const Function *F = getCalledFunction())
+if (const ParamAttrsList *PAL = F->getParamAttrs())
+  return PAL->hasAttrSomewhere(ParamAttr::ByVal);
+  return false;
 }
 
 void CallInst::setDoesNotThrow(bool doesNotThrow) {


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


[llvm-commits] [llvm] r46207 - /llvm/trunk/lib/VMCore/ParameterAttributes.cpp

2008-01-21 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 21 05:28:49 2008
New Revision: 46207

URL: http://llvm.org/viewvc/llvm-project?rev=46207&view=rev
Log:
Check that sret is only used on pointers to types
with a size, like byval.

Modified:
llvm/trunk/lib/VMCore/ParameterAttributes.cpp

Modified: llvm/trunk/lib/VMCore/ParameterAttributes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ParameterAttributes.cpp?rev=46207&r1=46206&r2=46207&view=diff

==
--- llvm/trunk/lib/VMCore/ParameterAttributes.cpp (original)
+++ llvm/trunk/lib/VMCore/ParameterAttributes.cpp Mon Jan 21 05:28:49 2008
@@ -202,8 +202,8 @@
 
   if (const PointerType *PTy = dyn_cast(Ty)) {
 if (!PTy->getElementType()->isSized())
-  // The byval attribute only applies to pointers to types with a size.
-  Incompatible |= ParamAttr::ByVal;
+  // The byval and sret attributes only apply to pointers to sized types.
+  Incompatible |= ByVal | StructRet;
   } else {
 // Attributes that only apply to pointers.
 Incompatible |= ByVal | Nest | NoAlias | StructRet;


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


[llvm-commits] [llvm-gcc-4.2] r46208 - in /llvm-gcc-4.2/branches/release_22: build_gcc gcc/version.c

2008-01-21 Thread Tanya Lattner
Author: tbrethou
Date: Mon Jan 21 13:24:54 2008
New Revision: 46208

URL: http://llvm.org/viewvc/llvm-project?rev=46208&view=rev
Log:
Fix LLVM_VERSION_INFO so we get the correct version of llvm when building with 
this option.

Modified:
llvm-gcc-4.2/branches/release_22/build_gcc
llvm-gcc-4.2/branches/release_22/gcc/version.c

Modified: llvm-gcc-4.2/branches/release_22/build_gcc
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/release_22/build_gcc?rev=46208&r1=46207&r2=46208&view=diff

==
--- llvm-gcc-4.2/branches/release_22/build_gcc (original)
+++ llvm-gcc-4.2/branches/release_22/build_gcc Mon Jan 21 13:24:54 2008
@@ -181,7 +181,7 @@
 if [ "$ENABLE_LLVM" == true ]; then
   # Build llvm-gcc in 'dylib mode'.
   MAKEFLAGS="$MAKEFLAGS BUILD_LLVM_INTO_A_DYLIB=1"
-  MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_GCC_SUBMIT_VERSION"
+  MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_SUBMIT_VERSION"
 fi
 # LLVM LOCAL end
 

Modified: llvm-gcc-4.2/branches/release_22/gcc/version.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/release_22/gcc/version.c?rev=46208&r1=46207&r2=46208&view=diff

==
--- llvm-gcc-4.2/branches/release_22/gcc/version.c (original)
+++ llvm-gcc-4.2/branches/release_22/gcc/version.c Mon Jan 21 13:24:54 2008
@@ -9,7 +9,15 @@
the revision of your modified compiler.  */
 
 /* APPLE LOCAL begin Apple version */
-#define VERSUFFIX "(llvm) (Based on Apple Inc. build 5546)"
+#ifdef ENABLE_LLVM
+#ifdef LLVM_VERSION_INFO
+#define VERSUFFIX " (Based on Apple Inc. build 5546) (LLVM build " 
LLVM_VERSION_INFO ")"
+#else
+#define VERSUFFIX " (Based on Apple Inc. build 5546) (LLVM build)"
+#endif
+#else
+#define VERSUFFIX " (Based on Apple Inc. build 5546)"
+#endif
 /* APPLE LOCAL end Apple version */
 
 /* This is the location of the online document giving instructions for


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


[llvm-commits] [llvm] r46209 - /llvm/trunk/test/CFrontend/2008-01-21-PackedBitFields.c

2008-01-21 Thread Devang Patel
Author: dpatel
Date: Mon Jan 21 13:28:13 2008
New Revision: 46209

URL: http://llvm.org/viewvc/llvm-project?rev=46209&view=rev
Log:
New test.

Added:
llvm/trunk/test/CFrontend/2008-01-21-PackedBitFields.c

Added: llvm/trunk/test/CFrontend/2008-01-21-PackedBitFields.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-21-PackedBitFields.c?rev=46209&view=auto

==
--- llvm/trunk/test/CFrontend/2008-01-21-PackedBitFields.c (added)
+++ llvm/trunk/test/CFrontend/2008-01-21-PackedBitFields.c Mon Jan 21 13:28:13 
2008
@@ -0,0 +1,7 @@
+// RUN: %llvmgcc %s -S -o -
+
+typedef double Al1Double __attribute__((aligned(1)));
+struct x { int a:23; Al1Double v; };
+struct x X = { 5, 3.0 };
+double foo() { return X.v; }
+


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


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

2008-01-21 Thread Devang Patel
Author: dpatel
Date: Mon Jan 21 13:29:51 2008
New Revision: 46210

URL: http://llvm.org/viewvc/llvm-project?rev=46210&view=rev
Log:
Used packed struct for

typedef double Al1Double __attribute__((aligned(1)));
struct x { int a:23; Al1Double v; };

test case : 
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080121/057396.html

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

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

==
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jan 21 13:29:51 2008
@@ -1260,6 +1260,8 @@
 ExtraBitsAvailable = E;
   }
 
+  bool isPacked() { return Packed; }
+
   void markAsPacked() {
 Packed = true;
   }
@@ -1793,7 +1795,15 @@
 // ordering.  Therefore convert to a packed struct and try again.
 Info.convertToPacked();
 DecodeStructFields(Field, Info);
-  } else 
+  } 
+  else if (TYPE_USER_ALIGN(TREE_TYPE(Field))
+   && DECL_ALIGN_UNIT(Field) != Info.getTypeAlignment(Ty)
+   && !Info.isPacked()) {
+// If Field has user defined alignment and it does not match Ty alignment
+// then convert to a packed struct and try again.
+Info.convertToPacked();
+DecodeStructFields(Field, Info);
+  } else
 // At this point, we know that adding the element will happen at the right
 // offset.  Add it.
 Info.addElement(Ty, StartOffsetInBytes, Info.getTypeSize(Ty));


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


[llvm-commits] [llvm-gcc-4.2] r46211 - in /llvm-gcc-4.2/trunk: build_gcc gcc/version.c

2008-01-21 Thread Tanya Lattner
Author: tbrethou
Date: Mon Jan 21 14:07:27 2008
New Revision: 46211

URL: http://llvm.org/viewvc/llvm-project?rev=46211&view=rev
Log:
Fix LLVM_VERSION_INFO so we get the correct version of llvm when building with 
this option.

Modified:
llvm-gcc-4.2/trunk/build_gcc
llvm-gcc-4.2/trunk/gcc/version.c

Modified: llvm-gcc-4.2/trunk/build_gcc
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=46211&r1=46210&r2=46211&view=diff

==
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Mon Jan 21 14:07:27 2008
@@ -181,7 +181,7 @@
 if [ "$ENABLE_LLVM" == true ]; then
   # Build llvm-gcc in 'dylib mode'.
   MAKEFLAGS="$MAKEFLAGS BUILD_LLVM_INTO_A_DYLIB=1"
-  MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_GCC_SUBMIT_VERSION"
+  MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_SUBMIT_VERSION"
 fi
 # LLVM LOCAL end
 

Modified: llvm-gcc-4.2/trunk/gcc/version.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/version.c?rev=46211&r1=46210&r2=46211&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/version.c (original)
+++ llvm-gcc-4.2/trunk/gcc/version.c Mon Jan 21 14:07:27 2008
@@ -9,7 +9,15 @@
the revision of your modified compiler.  */
 
 /* APPLE LOCAL begin Apple version */
-#define VERSUFFIX "(llvm) (Based on Apple Inc. build 5546)"
+#ifdef ENABLE_LLVM
+#ifdef LLVM_VERSION_INFO
+#define VERSUFFIX " (Based on Apple Inc. build 5546) (LLVM build " 
LLVM_VERSION_INFO ")"
+#else
+#define VERSUFFIX " (Based on Apple Inc. build 5546) (LLVM build)"
+#endif
+#else
+#define VERSUFFIX " (Based on Apple Inc. build 5546)"
+#endif
 /* APPLE LOCAL end Apple version */
 
 /* This is the location of the online document giving instructions for


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


[llvm-commits] [llvm] r46213 - /llvm/branches/release_22/lib/Transforms/Scalar/CodeGenPrepare.cpp

2008-01-21 Thread Tanya Lattner
Author: tbrethou
Date: Mon Jan 21 14:43:02 2008
New Revision: 46213

URL: http://llvm.org/viewvc/llvm-project?rev=46213&view=rev
Log:
Merge from mainline.
Make sure the caller doesn't use freed memory.
Fixes PR1935.

Modified:
llvm/branches/release_22/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/branches/release_22/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_22/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=46213&r1=46212&r2=46213&view=diff

==
--- llvm/branches/release_22/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/branches/release_22/lib/Transforms/Scalar/CodeGenPrepare.cpp Mon Jan 
21 14:43:02 2008
@@ -401,8 +401,10 @@
   }
   
   // If we removed all uses, nuke the cast.
-  if (CI->use_empty())
+  if (CI->use_empty()) {
 CI->eraseFromParent();
+MadeChange = true;
+  }
   
   return MadeChange;
 }


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


[llvm-commits] [llvm] r46214 - /llvm/branches/release_22/lib/Target/X86/X86AsmPrinter.cpp

2008-01-21 Thread Tanya Lattner
Author: tbrethou
Date: Mon Jan 21 14:45:28 2008
New Revision: 46214

URL: http://llvm.org/viewvc/llvm-project?rev=46214&view=rev
Log:
Merge from mainline.
Honour ByVal parameter attribute for name decoration.

Modified:
llvm/branches/release_22/lib/Target/X86/X86AsmPrinter.cpp

Modified: llvm/branches/release_22/lib/Target/X86/X86AsmPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_22/lib/Target/X86/X86AsmPrinter.cpp?rev=46214&r1=46213&r2=46214&view=diff

==
--- llvm/branches/release_22/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/branches/release_22/lib/Target/X86/X86AsmPrinter.cpp Mon Jan 21 
14:45:28 2008
@@ -25,6 +25,7 @@
 #include "llvm/Constants.h"
 #include "llvm/Module.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/ParameterAttributes.h"
 #include "llvm/Type.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/Mangler.h"
@@ -48,11 +49,19 @@
 return Info;
   }
 
+  unsigned argNum = 1;
   for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
-   AI != AE; ++AI)
+   AI != AE; ++AI, ++argNum) {
+const Type* Ty = AI->getType();
+
+// 'Dereference' type in case of byval parameter attribute
+if (F->paramHasAttr(argNum, ParamAttr::ByVal))
+  Ty = cast(Ty)->getElementType();
+
 // Size should be aligned to DWORD boundary
-Size += ((TD->getABITypeSize(AI->getType()) + 3)/4)*4;
-  
+Size += ((TD->getABITypeSize(Ty) + 3)/4)*4;
+  }
+
   // We're not supporting to huge arguments :)
   Info.setBytesToPopOnReturn((unsigned int)Size);
   return Info;


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


[llvm-commits] [llvm] r46215 - /llvm/branches/release_22/lib/Target/X86/X86CallingConv.td

2008-01-21 Thread Tanya Lattner
Author: tbrethou
Date: Mon Jan 21 14:47:24 2008
New Revision: 46215

URL: http://llvm.org/viewvc/llvm-project?rev=46215&view=rev
Log:
Merge from mainline.
Need to handle any 'nest' parameter before integer
parameters, since otherwise it won't be passed in
the right register.  With this change trampolines
work on x86-64 (thanks to Luke Guest for providing
access to an x86-64 box).

Modified:
llvm/branches/release_22/lib/Target/X86/X86CallingConv.td

Modified: llvm/branches/release_22/lib/Target/X86/X86CallingConv.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_22/lib/Target/X86/X86CallingConv.td?rev=46215&r1=46214&r2=46215&view=diff

==
--- llvm/branches/release_22/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/branches/release_22/lib/Target/X86/X86CallingConv.td Mon Jan 21 
14:47:24 2008
@@ -101,7 +101,10 @@
 
   // Promote i8/i16 arguments to i32.
   CCIfType<[i8, i16], CCPromoteToType>,
-  
+
+  // The 'nest' parameter, if any, is passed in R10.
+  CCIfNest>,
+
   // The first 6 integer arguments are passed in integer registers.
   CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D, R9D]>>,
   CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8 , R9 ]>>,
@@ -114,9 +117,6 @@
   CCIfType<[v8i8, v4i16, v2i32, v1i64],
   CCAssignToReg<[RDI, RSI, RDX, RCX, R8 , R9 ]>>,
 
-  // The 'nest' parameter, if any, is passed in R10.
-  CCIfNest>,
-
   // Integer/FP values get stored in stack slots that are 8 bytes in size and
   // 8-byte aligned if there are no more registers to hold them.
   CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>,
@@ -140,7 +140,10 @@
 
   // Promote i8/i16 arguments to i32.
   CCIfType<[i8, i16], CCPromoteToType>,
-  
+
+  // The 'nest' parameter, if any, is passed in R10.
+  CCIfNest>,
+
   // The first 6 integer arguments are passed in integer registers.
   CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D]>>,
   CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>,
@@ -153,9 +156,6 @@
   CCIfType<[v8i8, v4i16, v2i32, v1i64],
   CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>,
 
-  // The 'nest' parameter, if any, is passed in R10.
-  CCIfNest>,
-
   // Integer/FP values get stored in stack slots that are 8 bytes in size and
   // 8-byte aligned if there are no more registers to hold them.
   CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>,


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


[llvm-commits] [llvm] r46216 - /llvm/trunk/lib/VMCore/ParameterAttributes.cpp

2008-01-21 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 21 15:37:41 2008
New Revision: 46216

URL: http://llvm.org/viewvc/llvm-project?rev=46216&view=rev
Log:
It turns out that in C++ it is legal to declare functions
that return an opaque type by value, as long as you don't
call it or provide a body (you can take the address of it).
So it is wrong to insist that sret parameters not be an
opaque*.  And I guess it is really up to codegen to complain
if someone tries to call such a function.  I'm also removing
the analogous check from byval parameters, since I don't
see why we shouldn't allow them as long as no-one tries to
call the function or give it a body.

Modified:
llvm/trunk/lib/VMCore/ParameterAttributes.cpp

Modified: llvm/trunk/lib/VMCore/ParameterAttributes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ParameterAttributes.cpp?rev=46216&r1=46215&r2=46216&view=diff

==
--- llvm/trunk/lib/VMCore/ParameterAttributes.cpp (original)
+++ llvm/trunk/lib/VMCore/ParameterAttributes.cpp Mon Jan 21 15:37:41 2008
@@ -200,14 +200,9 @@
 // Attributes that only apply to integers.
 Incompatible |= SExt | ZExt;
 
-  if (const PointerType *PTy = dyn_cast(Ty)) {
-if (!PTy->getElementType()->isSized())
-  // The byval and sret attributes only apply to pointers to sized types.
-  Incompatible |= ByVal | StructRet;
-  } else {
+  if (!isa(Ty))
 // Attributes that only apply to pointers.
 Incompatible |= ByVal | Nest | NoAlias | StructRet;
-  }
 
   return Incompatible;
 }


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


[llvm-commits] [llvm] r46217 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

2008-01-21 Thread Owen Anderson
Author: resistor
Date: Mon Jan 21 16:01:01 2008
New Revision: 46217

URL: http://llvm.org/viewvc/llvm-project?rev=46217&view=rev
Log:
Improve a few comments.

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

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=46217&r1=46216&r2=46217&view=diff

==
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Mon Jan 21 16:01:01 2008
@@ -550,7 +550,9 @@
 for (DomForestNode::iterator CI = DFNode->begin(), CE = DFNode->end();
  CI != CE; ++CI) {
   DomForestNode* child = *CI;   
-
+  
+  // If the current node is live-out of the defining block of one of its
+  // children, insert a copy for it
   if (isLiveOut(DFNode->getReg(),
   MRI.getVRegDef(child->getReg())->getParent(), MRI, LV)) {
 // Insert copies for parent
@@ -565,6 +567,9 @@
 PHIUnion.erase(SrcReg);
   }
 }
+  
+  // If a node is live-in to the defining block of one of its children, but
+  // not live-out, then we need to scan that block for local interferences.
   } else if (isLiveIn(DFNode->getReg(),
   MRI.getVRegDef(child->getReg())->getParent(),
   MRI, LV) ||


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


[llvm-commits] [llvm-gcc-4.2] r46219 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-21 Thread Dale Johannesen
Author: johannes
Date: Mon Jan 21 16:03:58 2008
New Revision: 46219

URL: http://llvm.org/viewvc/llvm-project?rev=46219&view=rev
Log:
Fix 2 testsuite crashes where initializer size
was != size of its type.


Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=46219&r1=46218&r2=46219&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jan 21 16:03:58 2008
@@ -10567,7 +10567,10 @@
   obstack_free (&util_obstack, util_firstobj);
 
   /* Set offset.  */
-  ivar = tree_cons (NULL_TREE, byte_position (field_decl), ivar);
+/* LLVM LOCAL begin make initializer size match type size */
+  ivar = tree_cons (NULL_TREE, convert (integer_type_node,
+byte_position (field_decl)), ivar);
+/* LLVM LOCAL end */
   initlist = tree_cons (NULL_TREE,
objc_build_constructor (type, nreverse (ivar)),
initlist);
@@ -10836,8 +10839,13 @@
   decl = start_var_decl (type, synth_id_with_class_suffix
   (name, objc_implementation_context));
 
+  /* LLVM LOCAL begin make initializer size match type size */
   /* APPLE LOCAL ObjC new abi */
-  initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, init_val));
+  initlist = build_tree_list (NULL_TREE, build_int_cst (newabi 
+? NULL_TREE
+: ptr_type_node,
+init_val));
+  /* LLVM LOCAL end */
   initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, size), initlist);
   initlist = tree_cons (NULL_TREE, list, initlist);
 


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


[llvm-commits] [llvm] r46218 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

2008-01-21 Thread Owen Anderson
Author: resistor
Date: Mon Jan 21 16:03:00 2008
New Revision: 46218

URL: http://llvm.org/viewvc/llvm-project?rev=46218&view=rev
Log:
Clarify a deviation from the original algorithm.

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

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=46218&r1=46217&r2=46218&view=diff

==
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Mon Jan 21 16:03:00 2008
@@ -552,7 +552,10 @@
   DomForestNode* child = *CI;   
   
   // If the current node is live-out of the defining block of one of its
-  // children, insert a copy for it
+  // children, insert a copy for it.  NOTE: The paper actually calls for
+  // a more elaborate heuristic for determining whether to insert copies
+  // for the child or the parent.  In the interest of simplicity, we're
+  // just always choosing the parent.
   if (isLiveOut(DFNode->getReg(),
   MRI.getVRegDef(child->getReg())->getParent(), MRI, LV)) {
 // Insert copies for parent


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


[llvm-commits] [llvm] r46220 - /llvm/trunk/test/CFrontend/2008-01-21-PackedStructField.c

2008-01-21 Thread Devang Patel
Author: dpatel
Date: Mon Jan 21 16:15:58 2008
New Revision: 46220

URL: http://llvm.org/viewvc/llvm-project?rev=46220&view=rev
Log:
New test.

Added:
llvm/trunk/test/CFrontend/2008-01-21-PackedStructField.c

Added: llvm/trunk/test/CFrontend/2008-01-21-PackedStructField.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-21-PackedStructField.c?rev=46220&view=auto

==
--- llvm/trunk/test/CFrontend/2008-01-21-PackedStructField.c (added)
+++ llvm/trunk/test/CFrontend/2008-01-21-PackedStructField.c Mon Jan 21 
16:15:58 2008
@@ -0,0 +1,5 @@
+// RUN: %llvmgcc %s -S -o -
+
+struct X { long double b; unsigned char c; double __attribute__((packed)) d; };
+struct X x = { 3.0L, 5, 3.0 };
+


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


[llvm-commits] [llvm-gcc-4.2] r46221 - in /llvm-gcc-4.2/trunk/gcc: llvm-internal.h llvm-types.cpp

2008-01-21 Thread Devang Patel
Author: dpatel
Date: Mon Jan 21 16:19:26 2008
New Revision: 46221

URL: http://llvm.org/viewvc/llvm-project?rev=46221&view=rev
Log:
Instead of converting llvm struct as packed llvm struct on the fly
(through converToPacked()), redecode struct fields again after
marking struct as packed struct.

This fixes 
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080121/057406.html

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

Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=46221&r1=46220&r2=46221&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Jan 21 16:19:26 2008
@@ -172,7 +172,7 @@
   const Type *ConvertRECORD(tree_node *type, tree_node *orig_type);
   const Type *ConvertUNION(tree_node *type, tree_node *orig_type);
   void SetFieldIndex(tree_node *field_decl, unsigned int Index);
-  void DecodeStructFields(tree_node *Field, StructTypeConversionInfo &Info);
+  bool DecodeStructFields(tree_node *Field, StructTypeConversionInfo &Info);
   void DecodeStructBitField(tree_node *Field, StructTypeConversionInfo &Info);
 };
 

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

==
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jan 21 16:19:26 2008
@@ -1509,37 +1509,9 @@
 
   void addNewBitField(unsigned Size, unsigned FirstUnallocatedByte);
 
-  void convertToPacked();
-  
   void dump() const;
 };
 
-// LLVM disagrees as to where to put field natural field ordering.
-// ordering.  Therefore convert to a packed struct.
-void StructTypeConversionInfo::convertToPacked() {
-  assert (!Packed && "Packing a packed struct!");
-  Packed = true;
-  
-  // Fill the padding that existed from alignment restrictions
-  // with byte arrays to ensure the same layout when converting
-  // to a packed struct.
-  for (unsigned x = 1; x < ElementOffsetInBytes.size(); ++x) {
-if (ElementOffsetInBytes[x-1] + ElementSizeInBytes[x-1]
-< ElementOffsetInBytes[x]) {
-  uint64_t padding = ElementOffsetInBytes[x]
-- ElementOffsetInBytes[x-1] - ElementSizeInBytes[x-1];
-  const Type *Pad = Type::Int8Ty;
-  Pad = ArrayType::get(Pad, padding);
-  ElementOffsetInBytes.insert(ElementOffsetInBytes.begin() + x,
-  ElementOffsetInBytes[x-1] +
-  ElementSizeInBytes[x-1]);
-  ElementSizeInBytes.insert(ElementSizeInBytes.begin() + x, padding);
-  Elements.insert(Elements.begin() + x, Pad);
-  PaddingElement.insert(PaddingElement.begin() + x, true);
-}
-  }
-}
-
 // Add new element which is a bit field. Size is not the size of bit filed,
 // but size of bits required to determine type of new Field which will be
 // used to access this bit field.
@@ -1765,17 +1737,18 @@
 
 /// DecodeStructFields - This method decodes the specified field, if it is a
 /// FIELD_DECL, adding or updating the specified StructTypeConversionInfo to
-/// reflect it.  
-void TypeConverter::DecodeStructFields(tree Field,
+/// reflect it.  Return tree if field is decoded correctly. Otherwise return
+/// false.
+bool TypeConverter::DecodeStructFields(tree Field,
StructTypeConversionInfo &Info) {
   if (TREE_CODE(Field) != FIELD_DECL ||
   TREE_CODE(DECL_FIELD_OFFSET(Field)) != INTEGER_CST)
-return;
+return true;
 
   // Handle bit-fields specially.
   if (isBitfield(Field)) {
 DecodeStructBitField(Field, Info);
-return;
+return true;
   }
 
   Info.allFieldsAreNotBitFields();
@@ -1793,20 +1766,19 @@
   if (!Info.ResizeLastElementIfOverlapsWith(StartOffsetInBytes, Field, Ty)) {
 // LLVM disagrees as to where this field should go in the natural field
 // ordering.  Therefore convert to a packed struct and try again.
-Info.convertToPacked();
-DecodeStructFields(Field, Info);
+return false;
   } 
   else if (TYPE_USER_ALIGN(TREE_TYPE(Field))
&& DECL_ALIGN_UNIT(Field) != Info.getTypeAlignment(Ty)
&& !Info.isPacked()) {
 // If Field has user defined alignment and it does not match Ty alignment
 // then convert to a packed struct and try again.
-Info.convertToPacked();
-DecodeStructFields(Field, Info);
+return false;
   } else
 // At this point, we know that adding the element will happen at the right
 // offset.  Add it.
 Info.addElement(Ty, StartOffsetInBytes, Info.getTypeSize(Ty));
+  return true;
 }
 
 /// DecodeStru

[llvm-commits] [llvm] r46222 - /llvm/trunk/include/llvm/CodeGen/MachineRelocation.h

2008-01-21 Thread Chris Lattner
Author: lattner
Date: Mon Jan 21 16:27:27 2008
New Revision: 46222

URL: http://llvm.org/viewvc/llvm-project?rev=46222&view=rev
Log:
Fix the failures in the PPC JIT by marking relocation entries for
external symbols (e.g. 'fmod') as needing a stub.  This regression
was introduced by Evan's jit patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071231/056749.html

With this fixed, the two ExecutionEngine failures are passing on ppc,
and the ppc jit works on freebench and olden.

This should be pulled into the 2.2 release branch.

Modified:
llvm/trunk/include/llvm/CodeGen/MachineRelocation.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineRelocation.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRelocation.h?rev=46222&r1=46221&r2=46222&view=diff

==
--- llvm/trunk/include/llvm/CodeGen/MachineRelocation.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRelocation.h Mon Jan 21 16:27:27 2008
@@ -141,7 +141,7 @@
 Result.ConstantVal = cst;
 Result.TargetReloType = RelocationType;
 Result.AddrType = isExtSym;
-Result.NeedStub = false;
+Result.NeedStub = true;
 Result.GOTRelative = GOTrelative;
 Result.Target.ExtSym = ES;
 return Result;


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


Re: [llvm-commits] [llvm] r46216 - /llvm/trunk/lib/VMCore/ParameterAttributes.cpp

2008-01-21 Thread Chris Lattner
On Jan 21, 2008, at 1:37 PM, Duncan Sands wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=46216&view=rev
> Log:
> It turns out that in C++ it is legal to declare functions
> that return an opaque type by value, as long as you don't
> call it or provide a body (you can take the address of it).
> So it is wrong to insist that sret parameters not be an
> opaque*.  And I guess it is really up to codegen to complain
> if someone tries to call such a function.  I'm also removing
> the analogous check from byval parameters, since I don't
> see why we shouldn't allow them as long as no-one tries to
> call the function or give it a body.

Makes sense, thanks Duncan,

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


[llvm-commits] [llvm] r46223 - /llvm/trunk/utils/TableGen/Record.h

2008-01-21 Thread Anton Korobeynikov
Author: asl
Date: Mon Jan 21 16:30:26 2008
New Revision: 46223

URL: http://llvm.org/viewvc/llvm-project?rev=46223&view=rev
Log:
Provide iterator access to ListInit contents

Modified:
llvm/trunk/utils/TableGen/Record.h

Modified: llvm/trunk/utils/TableGen/Record.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=46223&r1=46222&r2=46223&view=diff

==
--- llvm/trunk/utils/TableGen/Record.h (original)
+++ llvm/trunk/utils/TableGen/Record.h Mon Jan 21 16:30:26 2008
@@ -643,6 +643,17 @@
   virtual Init *resolveReferences(Record &R, const RecordVal *RV);
 
   virtual std::string getAsString() const;
+
+  typedef std::vector::iterator   iterator;
+  typedef std::vector::const_iterator const_iterator;
+
+  inline iterator   begin()   { return Values.begin(); }
+  inline const_iterator begin() const { return Values.begin(); }
+  inline iterator   end  ()   { return Values.end();   }
+  inline const_iterator end  () const { return Values.end();   }
+
+  inline size_t size () const { return Values.size();  }
+  inline bool   empty() const { return Values.empty(); }
 };
 
 /// BinOpInit - !op (X, Y) - Combine two inits.


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


[llvm-commits] [llvm] r46224 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

2008-01-21 Thread Ted Kremenek
Author: kremenek
Date: Mon Jan 21 16:33:30 2008
New Revision: 46224

URL: http://llvm.org/viewvc/llvm-project?rev=46224&view=rev
Log:
Replaced (FoldingSet) profiling of ImutAVLTree with a hashing based scheme. The
problem was that we previously hashed based on the pointers of the left and
right children, but this is bogus: we can easily have different trees that
represent the same set. Now we use a hashing based scheme that compares the
*contents* of the trees, but not without having to do a full scan of a tree. The
only caveat is that with hashing is that we may have collisions, which result in
two different trees being falsely labeled as equivalent. If this becomes a
problem, we can add extra data to the profile to hopefully resolve most
collisions.

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

Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=46224&r1=46223&r2=46224&view=diff

==
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Jan 21 16:33:30 2008
@@ -198,6 +198,7 @@
   ImutAVLTree* Right;
   unsigned Height;
   value_type   Value;
+  unsigned Hash;
   
   //======//  
   // Profiling or FoldingSet.
@@ -205,22 +206,38 @@
 
 private:
 
+  static inline
+  unsigned ComputeHash(ImutAVLTree* L, ImutAVLTree* R, value_type_ref V) {
+FoldingSetNodeID ID;
+
+ID.AddInteger(L ? L->ComputeHash() : 0);
+ImutInfo::Profile(ID,V);
+ID.AddInteger(R ? R->ComputeHash() : 0);
+
+return ID.ComputeHash();
+  }
+  
+  inline unsigned ComputeHash() {
+if (!isMutable() && Hash) return Hash;
+Hash = ComputeHash(getSafeLeft(), getRight(), getValue());
+return Hash;
+  }
+  
   /// Profile - Generates a FoldingSet profile for a tree node before it is
   ///   created.  This is used by the ImutAVLFactory when creating
   ///   trees.
   static inline
   void Profile(FoldingSetNodeID& ID, ImutAVLTree* L, ImutAVLTree* R,
-   value_type_ref V) {
-ID.AddPointer(L);
-ID.AddPointer(R);
-ImutInfo::Profile(ID,V);
+   value_type_ref V) {
+
+ID.AddInteger(ComputeHash(L, R, V));
   }
   
 public:
 
   /// Profile - Generates a FoldingSet profile for an existing tree node.
   void Profile(FoldingSetNodeID& ID) {
-Profile(ID,getSafeLeft(),getRight(),getValue());
+ID.AddInteger(ComputeHash());
   }
   
   //======//
@@ -235,7 +252,7 @@
   ///   ImutAVLFactory.
   ImutAVLTree(ImutAVLTree* l, ImutAVLTree* r, value_type_ref v, unsigned 
height)
   : Left(reinterpret_cast(l) | Mutable),
-  Right(r), Height(height), Value(v) {}
+Right(r), Height(height), Value(v), Hash(0) {}
   
   
   /// isMutable - Returns true if the left and right subtree references


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


Re: [llvm-commits] [llvm] r46224 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

2008-01-21 Thread Chris Lattner
On Jan 21, 2008, at 2:33 PM, Ted Kremenek wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=46224&view=rev
> Log:
> Replaced (FoldingSet) profiling of ImutAVLTree with a hashing based  
> scheme. The
> problem was that we previously hashed based on the pointers of the  
> left and
> right children, but this is bogus: we can easily have different  
> trees that
> represent the same set. Now we use a hashing based scheme that  
> compares the
> *contents* of the trees, but not without having to do a full scan of  
> a tree. The
> only caveat is that with hashing is that we may have collisions,  
> which result in
> two different trees being falsely labeled as equivalent. If this  
> becomes a
> problem, we can add extra data to the profile to hopefully resolve  
> most
> collisions.

I don't think this works Ted: collisions *will* cause the tree to be  
corrupt, and you can't guarantee that they won't happen.  I don't  
think this is valid for all clients of the data structure.

-Chris

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


[llvm-commits] [llvm] r46225 - /llvm/branches/release_22/include/llvm/CodeGen/MachineRelocation.h

2008-01-21 Thread Tanya Lattner
Author: tbrethou
Date: Mon Jan 21 16:45:15 2008
New Revision: 46225

URL: http://llvm.org/viewvc/llvm-project?rev=46225&view=rev
Log:
Merge from mainline.
Fix the failures in the PPC JIT by marking relocation entries for
external symbols (e.g. 'fmod') as needing a stub.  This regression
was introduced by Evan's jit patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071231/056749.html

With this fixed, the two ExecutionEngine failures are passing on ppc,
and the ppc jit works on freebench and olden.

Modified:
llvm/branches/release_22/include/llvm/CodeGen/MachineRelocation.h

Modified: llvm/branches/release_22/include/llvm/CodeGen/MachineRelocation.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_22/include/llvm/CodeGen/MachineRelocation.h?rev=46225&r1=46224&r2=46225&view=diff

==
--- llvm/branches/release_22/include/llvm/CodeGen/MachineRelocation.h (original)
+++ llvm/branches/release_22/include/llvm/CodeGen/MachineRelocation.h Mon Jan 
21 16:45:15 2008
@@ -141,7 +141,7 @@
 Result.ConstantVal = cst;
 Result.TargetReloType = RelocationType;
 Result.AddrType = isExtSym;
-Result.NeedStub = false;
+Result.NeedStub = true;
 Result.GOTRelative = GOTrelative;
 Result.Target.ExtSym = ES;
 return Result;


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


[llvm-commits] [llvm] r46226 - /llvm/trunk/include/llvm/ADT/FoldingSet.h

2008-01-21 Thread Ted Kremenek
Author: kremenek
Date: Mon Jan 21 16:49:22 2008
New Revision: 46226

URL: http://llvm.org/viewvc/llvm-project?rev=46226&view=rev
Log:
Added "clear" method to FoldingSetNodeID to allow a FoldingSetNodeID object
to be reused to compute multiple object profiles.

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

Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=46226&r1=46225&r2=46226&view=diff

==
--- llvm/trunk/include/llvm/ADT/FoldingSet.h (original)
+++ llvm/trunk/include/llvm/ADT/FoldingSet.h Mon Jan 21 16:49:22 2008
@@ -208,6 +208,10 @@
   void AddAPFloat(const APFloat& apf);
   void AddString(const std::string &String);
   
+  /// clear - Clear the accumulated profile, allowing this FoldingSetNodeID
+  ///  object to be used to compute a new profile.
+  inline void clear() { Bits.clear(); }
+  
   /// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used
   ///  to lookup the node in the FoldingSetImpl.
   unsigned ComputeHash() const;


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


[llvm-commits] [llvm] r46227 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

2008-01-21 Thread Ted Kremenek
Author: kremenek
Date: Mon Jan 21 16:50:37 2008
New Revision: 46227

URL: http://llvm.org/viewvc/llvm-project?rev=46227&view=rev
Log:
Adjusted ImutAVLTree::ComputeHash to compute a hash value that is based on a
clearer sequence of hashing compositions.

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

Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=46227&r1=46226&r2=46227&view=diff

==
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Jan 21 16:50:37 2008
@@ -210,11 +210,24 @@
   unsigned ComputeHash(ImutAVLTree* L, ImutAVLTree* R, value_type_ref V) {
 FoldingSetNodeID ID;
 
-ID.AddInteger(L ? L->ComputeHash() : 0);
+if (L) ID.AddInteger(L->ComputeHash());
 ImutInfo::Profile(ID,V);
-ID.AddInteger(R ? R->ComputeHash() : 0);
 
-return ID.ComputeHash();
+// Compute the "intermediate" hash.  Basically, we want the net profile to
+// be:  H(H(H(H(H(item0),item1),item2)...),itemN), where
+//  H(item) is the hash of the data item and H(hash,item) is a hash
+//  of the last item hash and the the next item.
+
+unsigned X = ID.ComputeHash();
+ID.clear();
+
+if (R) {
+  ID.AddInteger(X);
+  ID.AddInteger(R->ComputeHash());
+  X = ID.ComputeHash();
+}
+
+return X;
   }
   
   inline unsigned ComputeHash() {


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


[llvm-commits] [llvm] r46228 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

2008-01-21 Thread Ted Kremenek
Author: kremenek
Date: Mon Jan 21 16:51:35 2008
New Revision: 46228

URL: http://llvm.org/viewvc/llvm-project?rev=46228&view=rev
Log:
Moved method call within a conditional branch because its effects will
be ignored on the false branch.

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

Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=46228&r1=46227&r2=46228&view=diff

==
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Jan 21 16:51:35 2008
@@ -219,9 +219,9 @@
 //  of the last item hash and the the next item.
 
 unsigned X = ID.ComputeHash();
-ID.clear();
 
 if (R) {
+  ID.clear();
   ID.AddInteger(X);
   ID.AddInteger(R->ComputeHash());
   X = ID.ComputeHash();


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


[llvm-commits] [llvm] r46229 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

2008-01-21 Thread Ted Kremenek
Author: kremenek
Date: Mon Jan 21 16:54:46 2008
New Revision: 46229

URL: http://llvm.org/viewvc/llvm-project?rev=46229&view=rev
Log:
Fixed buggy caching of the hash value of an ImutAVLTree node.

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

Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=46229&r1=46228&r2=46229&view=diff

==
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Jan 21 16:54:46 2008
@@ -231,9 +231,12 @@
   }
   
   inline unsigned ComputeHash() {
-if (!isMutable() && Hash) return Hash;
-Hash = ComputeHash(getSafeLeft(), getRight(), getValue());
-return Hash;
+if (Hash) return Hash;
+
+unsigned X = ComputeHash(getSafeLeft(), getRight(), getValue());
+if (!isMutable()) Hash = X;
+
+return X;
   }
   
   /// Profile - Generates a FoldingSet profile for a tree node before it is


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


Re: [llvm-commits] [llvm] r46224 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

2008-01-21 Thread Ted Kremenek

On Jan 21, 2008, at 2:36 PM, Chris Lattner wrote:

> On Jan 21, 2008, at 2:33 PM, Ted Kremenek wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=46224&view=rev
>> Log:
>> Replaced (FoldingSet) profiling of ImutAVLTree with a hashing based
>> scheme. The
>> problem was that we previously hashed based on the pointers of the
>> left and
>> right children, but this is bogus: we can easily have different
>> trees that
>> represent the same set. Now we use a hashing based scheme that
>> compares the
>> *contents* of the trees, but not without having to do a full scan of
>> a tree. The
>> only caveat is that with hashing is that we may have collisions,
>> which result in
>> two different trees being falsely labeled as equivalent. If this
>> becomes a
>> problem, we can add extra data to the profile to hopefully resolve
>> most
>> collisions.
>
> I don't think this works Ted: collisions *will* cause the tree to be
> corrupt, and you can't guarantee that they won't happen.  I don't
> think this is valid for all clients of the data structure.

I agree that it doesn't work for all clients.  I'll come up with  
something more sound that works for all clients, while providing  
something like the hashing scheme that is much quicker but doesn't  
provide the same guarantees.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46236 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-21 Thread Dale Johannesen
Author: johannes
Date: Mon Jan 21 19:29:51 2008
New Revision: 46236

URL: http://llvm.org/viewvc/llvm-project?rev=46236&view=rev
Log:
Back out one of previous changes for Obj-C++; it
handles the issue differently in the C++ FE code.
Fix another type/initializer mismatch in INSTANCE_VARIABLES.


Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=46236&r1=46235&r2=46236&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jan 21 19:29:51 2008
@@ -10456,6 +10456,8 @@
 {
   tree initlist = NULL_TREE;
   int val;
+  /* LLVM LOCAL make sizes add up right */
+  int skipped = 0;
 
   do {
 tree ivar = NULL_TREE;
@@ -10463,8 +10465,12 @@
 /* Unnamed bitfields are ignored. */
 if (!DECL_NAME (field_decl))
   {
-do
+/* LLVM LOCAL begin make sizes add up right */
+do {
   field_decl = TREE_CHAIN (field_decl);
+  skipped++;
+}
+/* LLVM LOCAL end */
 while (field_decl && TREE_CODE (field_decl) != FIELD_DECL);
 continue;
   }
@@ -10522,6 +10528,26 @@
   }
   while (field_decl);
 
+#ifndef OBJCPLUS
+  /* LLVM LOCAL begin make sizes add up right.  The size in 'type' counted
+ any unnamed bitfields that we skipped above; add null nodes at the
+ end of the list to compensate. */
+  while (skipped--)
+{
+  tree ivar = NULL_TREE;
+  ivar = tree_cons (NULL_TREE, build_int_cst (ptr_type_node, 0), ivar);
+  ivar = tree_cons (NULL_TREE, build_int_cst (string_type_node, 0), ivar);
+  ivar = tree_cons (NULL_TREE, build_int_cst (string_type_node, 0), ivar);
+  ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+  ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+
+  initlist = tree_cons (NULL_TREE, 
+objc_build_constructor (type, nreverse(ivar)),
+initlist);
+}
+  /* LLVM LOCAL end */
+#endif
+
   return objc_build_constructor (build_array_type (type, 0),
 nreverse (initlist));
 }
@@ -10841,9 +10867,13 @@
 
   /* LLVM LOCAL begin make initializer size match type size */
   /* APPLE LOCAL ObjC new abi */
-  initlist = build_tree_list (NULL_TREE, build_int_cst (newabi 
-? NULL_TREE
-: ptr_type_node,
+  initlist = build_tree_list (NULL_TREE, build_int_cst (
+#ifdef OBJCPLUS
+  NULL_TREE,
+#else
+  newabi ? NULL_TREE : ptr_type_node,
+#endif
+
 init_val));
   /* LLVM LOCAL end */
   initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, size), initlist);


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


[llvm-commits] [llvm-gcc-4.2] r46239 - in /llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg: next-runtime-1-64bit.m next-runtime-1.m objc-gc-section-1.m objc-gc-section-2.m objc2-protocol-enc-1.m symtab-1-64b

2008-01-21 Thread Dale Johannesen
Author: johannes
Date: Mon Jan 21 20:15:50 2008
New Revision: 46239

URL: http://llvm.org/viewvc/llvm-project?rev=46239&view=rev
Log:
Upgrade some testcases that scan-assembler to accept
functionally equivalent syntax produced by llvm.


Modified:
llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1-64bit.m
llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m
llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-1.m
llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-2.m
llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-enc-1.m
llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m
llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1.m

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1-64bit.m
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1-64bit.m?rev=46239&r1=46238&r2=46239&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1-64bit.m (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1-64bit.m Mon Jan 21 
20:15:50 2008
@@ -14,4 +14,5 @@
 - (void)boo { }
 @end
 
-/* { dg-final { scan-assembler "L_OBJC_MODULES:\n\[ \t\]*\.quad\t7\n" } } */
+/* LLVM LOCAL accept llvm syntax */
+/* { dg-final { scan-assembler "L_OBJC_MODULES:.*\n\[ \t\]*\.quad\t7\n" } } */

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m?rev=46239&r1=46238&r2=46239&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m Mon Jan 21 
20:15:50 2008
@@ -20,4 +20,5 @@
 @end
 
 /* APPLE LOCAL radar 4585769 */
-/* { dg-final { scan-assembler "L_OBJC_MODULES:\n\[ \t\]*\.long\t7\n" } } */
+/* LLVM LOCAL accept llvm syntax */
+/* { dg-final { scan-assembler "L_OBJC_MODULES:.*\n\[ \t\]*\.long\t7\n" } } */

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-1.m
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-1.m?rev=46239&r1=46238&r2=46239&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-1.m (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-1.m Mon Jan 21 
20:15:50 2008
@@ -9,6 +9,7 @@
 @end
 @implementation  INTF
 @end
-/* { dg-final { scan-assembler ".section __OBJC, __image_info" } } */
-/* { dg-final { scan-assembler "L_OBJC_IMAGE_INFO:\n\t.space 8" } } */
-
+/* LLVM LOCAL begin llvm syntax */
+/* { dg-final { scan-assembler ".section __OBJC,.*__image_info" } } */
+/* { dg-final { scan-assembler "L_OBJC_IMAGE_INFO:.*\n\t.space( |\t)8" } } */
+/* LLVM LOCAL end */

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-2.m
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-2.m?rev=46239&r1=46238&r2=46239&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-2.m (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-section-2.m Mon Jan 21 
20:15:50 2008
@@ -8,5 +8,7 @@
 @end
 @implementation  INTF
 @end
-/* { dg-final { scan-assembler ".section __OBJC, __image_info" } } */
-/* { dg-final { scan-assembler "L_OBJC_IMAGE_INFO:\n\t.long\t0\n\t.long\t6" } 
} */
+/* LLVM LOCAL begin accept llvm syntax */
+/* { dg-final { scan-assembler ".section __OBJC,.*__image_info" } } */
+/* { dg-final { scan-assembler 
"L_OBJC_IMAGE_INFO:.*\n\t(.long\t0|.space\t4)\n\t.long\t6" } } */
+/* LLVM LOCAL end */

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-enc-1.m
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-enc-1.m?rev=46239&r1=46238&r2=46239&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-enc-1.m (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-enc-1.m Mon Jan 21 
20:15:50 2008
@@ -28,9 +28,10 @@
 @dynamic x, xy, xyz, fooxyz;
 @end
 
-
-/* { dg-final { scan-assembler "[EMAIL PROTECTED].*" } } */
-/* { dg-final { scan-assembler "[EMAIL PROTECTED].*" } } */
+/* LLVM LOCAL begin accept llvm syntax (asciz) */
+/* { dg-final { scan-assembler "[EMAIL PROTECTED].*" } } */
+/* { dg-final { scan-assembler "[EMAIL PROTECTED].*" } } */
+/* LLVM LOCAL end */
 
 /**
 This protocol should generate the following metadata:

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m?rev=46239&r1=46238&r2=46239&view=diff

===

[llvm-commits] [llvm-gcc-4.2] r46240 - in /llvm-gcc-4.2/trunk/gcc: java/lang.c stub-c.c

2008-01-21 Thread Eric Christopher
Author: echristo
Date: Mon Jan 21 21:06:28 2008
New Revision: 46240

URL: http://llvm.org/viewvc/llvm-project?rev=46240&view=rev
Log:
Fix normal configure bootstrap. Remove unnecessary local code. Update stub-c.c 
for changes.

Modified:
llvm-gcc-4.2/trunk/gcc/java/lang.c
llvm-gcc-4.2/trunk/gcc/stub-c.c

Modified: llvm-gcc-4.2/trunk/gcc/java/lang.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/java/lang.c?rev=46240&r1=46239&r2=46240&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/java/lang.c (original)
+++ llvm-gcc-4.2/trunk/gcc/java/lang.c Mon Jan 21 21:06:28 2008
@@ -139,7 +139,7 @@
 /* int flag_optimize_sci = 0;  */
 
 /* Don't attempt to verify invocations.  */
-int flag_verify_invocations = 0; 
+int flag_verify_invocations = 0;
 
 /* When nonzero, print extra version information.  */
 static int v_flag = 0;
@@ -342,7 +342,7 @@
 case OPT_version:
   v_flag = 1;
   break;
-  
+
 default:
   if (cl_options[code].flags & CL_Java)
break;
@@ -798,103 +798,9 @@
 }
 /* APPLE LOCAL end AltiVec */
 
-/* APPLE LOCAL begin constant cfstrings */
-enum { blabla } c_language;
-const char *constant_string_class_name = "die die";
-int flag_weak = 1;
-int parse_in = 0;
-void build_stmt (void);
-void build_stmt (void) { abort (); }
-void store_init_value(void);
-void store_init_value(void) { abort (); }
-/* APPLE LOCAL end constant cfstrings */
-
 /* APPLE LOCAL disable_typechecking_for_spec_flag */
 int disable_typechecking_for_spec_flag = 0;
 
-/* APPLE LOCAL begin CW asm blocks */
-/* Dummies needed because we use them from cpplib, yuck.  */
-int flag_iasm_blocks;
-int iasm_state;
-bool iasm_in_operands;
-void build_modify_expr (void);
-void iasm_addr (void);
-void iasm_build_bracket (void);
-void build_function_call (void);
-void iasm_get_register_var (void);
-bool iasm_is_pseudo (void);
-void iasm_for_constraint (void);
-void iasm_print_operand (void);
-void iasm_force_constraint (void);
-void pointer_int_sum (void);
-tree decl_attributes (tree *tp, tree p, int s);
-void build_modify_expr (void) { abort (); }
-void iasm_addr (void) { abort (); }
-void iasm_build_bracket (void) { abort (); }
-void build_function_call (void) { abort (); }
-void iasm_get_register_var (void) { abort (); }
-bool iasm_is_pseudo (void) { abort (); }
-void iasm_for_constraint (void) { abort (); }
-void iasm_print_operand (void) { abort (); }
-void iasm_force_constraint (void) { abort (); }
-void pointer_int_sum (void) { abort (); }
-tree decl_attributes (tree *ARG_UNUSED (tp),
- tree ARG_UNUSED (p),
- int ARG_UNUSED (s))
-{
-  abort ();
-}
-/* APPLE LOCAL end CW asm blocks */
-
-/* APPLE LOCAL begin 4174833 */
-tree objc_is_class_name (tree);
-
-tree
-objc_is_class_name (tree ARG_UNUSED (arg))
-{
-  return 0;
-}
-
-bool objc_method_decl (enum tree_code ARG_UNUSED (opcode));
-bool 
-objc_method_decl (enum tree_code ARG_UNUSED (opcode))
-{
-  return false;
-}
-/* APPLE LOCAL end 4174833 */
-/* APPLE LOCAL begin radar 4441049 */
-tree objc_v2_bitfield_ivar_bitpos (tree);
-
-tree
-objc_v2_bitfield_ivar_bitpos (tree ARG_UNUSED (exp))
-{
-  return 0;
-}
-
-tree objc_v2_component_ref_field_offset (tree);
-
-tree
-objc_v2_component_ref_field_offset (tree ARG_UNUSED (exp))
-{
-  return 0;
-}
-/* APPLE LOCAL end radar 4441049 */ 
-/* APPLE LOCAL begin fariborz 2996215 */
-tree objc_create_init_utf16_var (void);
-tree
-objc_create_init_utf16_var (void)
-{
-  return NULL;
-}
-
-bool objc_anonymous_local_objc_name (const char * ARG_UNUSED (name));
-bool
-objc_anonymous_local_objc_name (const char * ARG_UNUSED (name))
-{
-  return false;
-}
-/* APPLE LOCAL end fariborz 2996215 */
-
 /* Every call to a static constructor has an associated boolean
variable which is in the outermost scope of the calling method.
This variable is used to avoid multiple calls to the static

Modified: llvm-gcc-4.2/trunk/gcc/stub-c.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/stub-c.c?rev=46240&r1=46239&r2=46240&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/stub-c.c (original)
+++ llvm-gcc-4.2/trunk/gcc/stub-c.c Mon Jan 21 21:06:28 2008
@@ -31,6 +31,7 @@
 enum iasm_states iasm_state ATTRIBUTE_WEAK;
 bool iasm_in_operands ATTRIBUTE_WEAK;
 int flag_iasm_blocks ATTRIBUTE_WEAK;
+int parse_in ATTRIBUTE_WEAK;
 
 
 tree iasm_addr (tree) ATTRIBUTE_WEAK;


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


[llvm-commits] [llvm-gcc-4.2] r46242 - /llvm-gcc-4.2/trunk/gcc/autom4te.cache/

2008-01-21 Thread Eric Christopher
Author: echristo
Date: Mon Jan 21 21:08:19 2008
New Revision: 46242

URL: http://llvm.org/viewvc/llvm-project?rev=46242&view=rev
Log:
Actually do it this time.

Removed:
llvm-gcc-4.2/trunk/gcc/autom4te.cache/

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


[llvm-commits] [llvm] r46243 - /llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp

2008-01-21 Thread Chris Lattner
Author: lattner
Date: Mon Jan 21 22:47:47 2008
New Revision: 46243

URL: http://llvm.org/viewvc/llvm-project?rev=46243&view=rev
Log:
Trivial patch to fix two warnings, please pull into llvm 2.2

Modified:
llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=46243&r1=46242&r2=46243&view=diff

==
--- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Mon Jan 21 22:47:47 2008
@@ -292,6 +292,9 @@
 FPOffset = NumBytes;
 RAOffset = 0;
 NumBytes += 4;
+  } else {
+// No calls and no fp.
+RAOffset = FPOffset = 0;
   }
 
   MFI->setObjectOffset(MFI->CreateStackObject(4,4), FPOffset);


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


[llvm-commits] [llvm] r46244 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-01-21-MulTrunc.ll

2008-01-21 Thread Nick Lewycky
Author: nicholas
Date: Mon Jan 21 23:08:48 2008
New Revision: 46244

URL: http://llvm.org/viewvc/llvm-project?rev=46244&view=rev
Log:
Multiply can be evaluated in a different type, so long as the target type has
a smaller bitwidth.

Added:
llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

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

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 21 
23:08:48 2008
@@ -6512,6 +6512,15 @@
CanEvaluateInDifferentType(I->getOperand(1), Ty, CastOpc,
   NumCastsRemoved);
 
+  case Instruction::Mul:
+break;
+// A multiply can be truncated by truncating its operands.
+return Ty->getBitWidth() < OrigTy->getBitWidth() && 
+   CanEvaluateInDifferentType(I->getOperand(0), Ty, CastOpc,
+  NumCastsRemoved) &&
+   CanEvaluateInDifferentType(I->getOperand(1), Ty, CastOpc,
+  NumCastsRemoved);
+
   case Instruction::Shl:
 // If we are truncating the result of this SHL, and if it's a shift of a
 // constant amount, we can always perform a SHL in a smaller type.
@@ -6571,6 +6580,7 @@
   switch (I->getOpcode()) {
   case Instruction::Add:
   case Instruction::Sub:
+  case Instruction::Mul:
   case Instruction::And:
   case Instruction::Or:
   case Instruction::Xor:

Added: llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll?rev=46244&view=auto

==
--- llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll Mon Jan 21 
23:08:48 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i16 @test1(i16 %a) {
+%tmp = zext i16 %a to i32   ;  [#uses=2]
+%tmp21 = lshr i32 %tmp, 8   ;  [#uses=1]
+%tmp5 = mul i32 %tmp, 5 ;  [#uses=1]
+%tmp.upgrd.32 = or i32 %tmp21, %tmp5;  [#uses=1]
+%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16   ;  
[#uses=1]
+ret i16 %tmp.upgrd.3
+}
+


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


[llvm-commits] [llvm] r46245 - /llvm/trunk/Makefile.rules

2008-01-21 Thread Chris Lattner
Author: lattner
Date: Mon Jan 21 23:19:26 2008
New Revision: 46245

URL: http://llvm.org/viewvc/llvm-project?rev=46245&view=rev
Log:
One too many )'s breaks 'make clean' with certain versions of make.
This fixes PR1927

This should be pulled into llvm 2.2.

Modified:
llvm/trunk/Makefile.rules

Modified: llvm/trunk/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=46245&r1=46244&r2=46245&view=diff

==
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Mon Jan 21 23:19:26 2008
@@ -1457,7 +1457,7 @@
 ifndef DISABLE_AUTO_DEPENDENCIES
 
 # If its not one of the cleaning targets
-ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS,)
+ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
 
 # Get the list of dependency files
 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))


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


[llvm-commits] [llvm] r46246 - /llvm/trunk/test/Verifier/byval-2.ll

2008-01-21 Thread Chris Lattner
Author: lattner
Date: Mon Jan 21 23:31:58 2008
New Revision: 46246

URL: http://llvm.org/viewvc/llvm-project?rev=46246&view=rev
Log:
update this test to pass with duncan's change.

Modified:
llvm/trunk/test/Verifier/byval-2.ll

Modified: llvm/trunk/test/Verifier/byval-2.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/byval-2.ll?rev=46246&r1=46245&r2=46246&view=diff

==
--- llvm/trunk/test/Verifier/byval-2.ll (original)
+++ llvm/trunk/test/Verifier/byval-2.ll Mon Jan 21 23:31:58 2008
@@ -1,3 +1,3 @@
-; RUN: not llvm-as < %s -o /dev/null -f
+; RUN: llvm-as < %s -o /dev/null -f
%s = type opaque
 declare void @h(%s* byval %num)


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


Re: [llvm-commits] [llvm] r46244 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-01-21-MulTrunc.ll

2008-01-21 Thread Nate Begeman
I don't get different output for the attached patch before and after  
the patch, and the test fails.

On Jan 21, 2008, at 9:08 PM, Nick Lewycky wrote:

> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ==
> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp  
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon  
> Jan 21 23:08:48 2008
> @@ -6512,6 +6512,15 @@
>CanEvaluateInDifferentType(I->getOperand(1), Ty, CastOpc,
>   NumCastsRemoved);
>
> +  case Instruction::Mul:
> +break;

Probably due to this break.

>
> +// A multiply can be truncated by truncating its operands.
> +return Ty->getBitWidth() < OrigTy->getBitWidth() &&
> +   CanEvaluateInDifferentType(I->getOperand(0), Ty, CastOpc,
> +  NumCastsRemoved) &&
> +   CanEvaluateInDifferentType(I->getOperand(1), Ty, CastOpc,
> +  NumCastsRemoved);
> +
>   case Instruction::Shl:
> // If we are truncating the result of this SHL, and if it's a  
> shift of a
> // constant amount, we can always perform a SHL in a smaller type.
> @@ -6571,6 +6580,7 @@
>   switch (I->getOpcode()) {
>   case Instruction::Add:
>   case Instruction::Sub:
> +  case Instruction::Mul:
>   case Instruction::And:
>   case Instruction::Or:
>   case Instruction::Xor:
>
> Added: llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll?rev=46244&view=auto
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ==
> --- llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll  
> (added)
> +++ llvm/trunk/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll  
> Mon Jan 21 23:08:48 2008
> @@ -0,0 +1,11 @@
> +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
> +
> +define i16 @test1(i16 %a) {
> +%tmp = zext i16 %a to i32   ;  [#uses=2]
> +%tmp21 = lshr i32 %tmp, 8   ;  [#uses=1]
> +%tmp5 = mul i32 %tmp, 5 ;  [#uses=1]
> +%tmp.upgrd.32 = or i32 %tmp21, %tmp5;   
> [#uses=1]
> +%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16   ;  
>  [#uses=1]
> +ret i16 %tmp.upgrd.3
> +}
> +
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


Re: [llvm-commits] [llvm] r46244 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-01-21-MulTrunc.ll

2008-01-21 Thread Nick Lewycky
Duh. Thanks Nate!

Nate Begeman wrote:
> I don't get different output for the attached patch before and after  
> the patch, and the test fails.
> 
> On Jan 21, 2008, at 9:08 PM, Nick Lewycky wrote:
> 
>> ==
>> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp  
>> (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon  
>> Jan 21 23:08:48 2008
>> @@ -6512,6 +6512,15 @@
>>CanEvaluateInDifferentType(I->getOperand(1), Ty, CastOpc,
>>   NumCastsRemoved);
>>
>> +  case Instruction::Mul:
>> +break;
> 
> Probably due to this break.

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


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

2008-01-21 Thread Nick Lewycky
Author: nicholas
Date: Mon Jan 21 23:42:02 2008
New Revision: 46247

URL: http://llvm.org/viewvc/llvm-project?rev=46247&view=rev
Log:
Enable the fix I just checked in, silly me.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 21 
23:42:02 2008
@@ -6513,7 +6513,6 @@
   NumCastsRemoved);
 
   case Instruction::Mul:
-break;
 // A multiply can be truncated by truncating its operands.
 return Ty->getBitWidth() < OrigTy->getBitWidth() && 
CanEvaluateInDifferentType(I->getOperand(0), Ty, CastOpc,


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


[llvm-commits] [llvm] r46248 - /llvm/branches/release_22/Makefile.rules

2008-01-21 Thread Tanya Lattner
Author: tbrethou
Date: Tue Jan 22 01:16:09 2008
New Revision: 46248

URL: http://llvm.org/viewvc/llvm-project?rev=46248&view=rev
Log:
Merge from mainline.
One too many )'s breaks 'make clean' with certain versions of make.
This fixes PR1927


Modified:
llvm/branches/release_22/Makefile.rules

Modified: llvm/branches/release_22/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_22/Makefile.rules?rev=46248&r1=46247&r2=46248&view=diff

==
--- llvm/branches/release_22/Makefile.rules (original)
+++ llvm/branches/release_22/Makefile.rules Tue Jan 22 01:16:09 2008
@@ -1457,7 +1457,7 @@
 ifndef DISABLE_AUTO_DEPENDENCIES
 
 # If its not one of the cleaning targets
-ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS,)
+ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
 
 # Get the list of dependency files
 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))


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


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

2008-01-21 Thread Duncan Sands
Author: baldrick
Date: Tue Jan 22 01:17:34 2008
New Revision: 46249

URL: http://llvm.org/viewvc/llvm-project?rev=46249&view=rev
Log:
The final piece needed for storing arbitrary precision
integers.  Handle truncstore of a legal type to an unusual
number of bits.  Most of this code is not reachable unless
the new legalize infrastructure is turned on.

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=46249&r1=46248&r2=46249&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jan 22 01:17:34 2008
@@ -2254,38 +2254,99 @@
 return DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(),
  SVOffset, MVT::i8, isVolatile, Alignment);
   }
-
-  // Unconditionally promote TRUNCSTORE:i1 X -> TRUNCSTORE:i8 (and X, 1)
-  if (ST->getStoredVT() == MVT::i1) {
-// Promote the bool to a mask then store.
-Tmp3 = DAG.getNode(ISD::AND, Tmp3.getValueType(), Tmp3,
-   DAG.getConstant(1, Tmp3.getValueType()));
+
+  MVT::ValueType StVT = ST->getStoredVT();
+  unsigned StWidth = MVT::getSizeInBits(StVT);
+
+  if (StWidth != MVT::getStoreSizeInBits(StVT)) {
+// Promote to a byte-sized store with upper bits zero if not
+// storing an integral number of bytes.  For example, promote
+// TRUNCSTORE:i1 X -> TRUNCSTORE:i8 (and X, 1)
+MVT::ValueType NVT = 
MVT::getIntegerType(MVT::getStoreSizeInBits(StVT));
+Tmp3 = DAG.getZeroExtendInReg(Tmp3, StVT);
 Result = DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(),
-   SVOffset, MVT::i8,
-   isVolatile, Alignment);
-  } else if (Tmp1 != ST->getChain() || Tmp3 != ST->getValue() ||
- Tmp2 != ST->getBasePtr()) {
-Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp3, Tmp2,
-ST->getOffset());
-  }
+   SVOffset, NVT, isVolatile, Alignment);
+  } else if (StWidth & (StWidth - 1)) {
+// If not storing a power-of-2 number of bits, expand as two stores.
+assert(MVT::isExtendedVT(StVT) && !MVT::isVector(StVT) &&
+   "Unsupported truncstore!");
+unsigned RoundWidth = 1 << Log2_32(StWidth);
+assert(RoundWidth < StWidth);
+unsigned ExtraWidth = StWidth - RoundWidth;
+assert(ExtraWidth < RoundWidth);
+assert(!(RoundWidth % 8) && !(ExtraWidth % 8) &&
+   "Store size not an integral number of bytes!");
+MVT::ValueType RoundVT = MVT::getIntegerType(RoundWidth);
+MVT::ValueType ExtraVT = MVT::getIntegerType(ExtraWidth);
+SDOperand Lo, Hi;
+unsigned IncrementSize;
+
+if (TLI.isLittleEndian()) {
+  // TRUNCSTORE:i24 X -> TRUNCSTORE:i16 X, [EMAIL PROTECTED]:i8 (srl 
X, 16)
+  // Store the bottom RoundWidth bits.
+  Lo = DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(),
+ SVOffset, RoundVT,
+ isVolatile, Alignment);
+
+  // Store the remaining ExtraWidth bits.
+  IncrementSize = RoundWidth / 8;
+  Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2,
+ DAG.getIntPtrConstant(IncrementSize));
+  Hi = DAG.getNode(ISD::SRL, Tmp3.getValueType(), Tmp3,
+   DAG.getConstant(RoundWidth, 
TLI.getShiftAmountTy()));
+  Hi = DAG.getTruncStore(Tmp1, Hi, Tmp2, ST->getSrcValue(),
+ SVOffset + IncrementSize, ExtraVT, isVolatile,
+ MinAlign(Alignment, IncrementSize));
+} else {
+  // Big endian - avoid unaligned stores.
+  // TRUNCSTORE:i24 X -> TRUNCSTORE:i16 (srl X, 8), [EMAIL 
PROTECTED]:i8 X
+  // Store the top RoundWidth bits.
+  Hi = DAG.getNode(ISD::SRL, Tmp3.getValueType(), Tmp3,
+   DAG.getConstant(ExtraWidth, 
TLI.getShiftAmountTy()));
+  Hi = DAG.getTruncStore(Tmp1, Hi, Tmp2, ST->getSrcValue(), SVOffset,
+ RoundVT, isVolatile, Alignment);
+
+  // Store the remaining ExtraWidth bits.
+  IncrementSize = RoundWidth / 8;
+  Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2,
+ DAG.getIntPtrConstant(IncrementSize));
+  Lo = DAG.getTruncStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(),
+ SVOffset + IncrementSize, ExtraVT, isVolatile,
+ MinAlign(Alignment, IncrementSize));
+}
 
-