[llvm-commits] [llvm] r46449 - /llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp

2008-01-28 Thread Bill Wendling
Author: void
Date: Mon Jan 28 03:15:03 2008
New Revision: 46449

URL: http://llvm.org/viewvc/llvm-project?rev=46449&view=rev
Log:
If the function has no machine instructions, then emit a "nop" so that
the function label isn't associated with something it shouldn't be.

Modified:
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=46449&r1=46448&r2=46449&view=diff

==
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Mon Jan 28 03:15:03 2008
@@ -233,6 +233,16 @@
   // Emit pre-function debug information.
   DW.BeginFunction(&MF);
 
+  if (Subtarget->isTargetDarwin()) {
+// If the function is empty, then we need to emit *something*. Otherwise,
+// the function's label might be associated with something that it wasn't
+// meant to be associated with. We emit a noop in this situation.
+MachineFunction::iterator I = MF.begin();
+
+if (++I == MF.end() && MF.front().empty())
+  O << "\tnop\n";
+  }
+
   // Print out code for the function.
   for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {


___
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] r46381 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

2008-01-28 Thread Duncan Sands
Hi Evan,

> I did check in two test cases in a subsequent commit. Those used to  
> choke llvm-gcc. I'll look at this today. It's obvious not all zero  
> sized aggregates are not created equal.

I guess you mean this:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080121/057572.html

I can understand that in function calls you don't want to pass zero-sized 
structs
by copy.  What I don't understand is why this requires modifying the way gcc 
structs
are converted to llvm structs.  Surely when generating function parameters, you 
can
just skip the zero-sized structs at that point.

Best wishes,

Duncan.
___
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] r46381 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

2008-01-28 Thread Evan Cheng
Hopefully this patch fixed it:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057665.html

Please verify. Thanks.

Evan

On Jan 28, 2008, at 1:02 AM, Duncan Sands wrote:

> Hi Evan,
>
>> I did check in two test cases in a subsequent commit. Those used to
>> choke llvm-gcc. I'll look at this today. It's obvious not all zero
>> sized aggregates are not created equal.
>
> I guess you mean this:
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080121/057572.html
>
> I can understand that in function calls you don't want to pass zero- 
> sized structs
> by copy.  What I don't understand is why this requires modifying the  
> way gcc structs
> are converted to llvm structs.  Surely when generating function  
> parameters, you can
> just skip the zero-sized structs at that point.
>
> Best wishes,
>
> Duncan.

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


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

2008-01-28 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 28 03:49:51 2008
New Revision: 46450

URL: http://llvm.org/viewvc/llvm-project?rev=46450&view=rev
Log:
1. Only skip over zero sized bit fields which just affects layout, not all 
zero-sized aggregates.
2. Do not pass zero sized struct and union parameters.

Modified:
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
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-abi.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=46450&r1=46449&r2=46450&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Mon Jan 28 03:49:51 2008
@@ -120,6 +120,14 @@
   }
 }
 
+/// isZeroSizedStructOrUnion - Returns true if this is a struct or union 
+/// which is zero bits wide.
+static bool isZeroSizedStructOrUnion(tree type) {
+  if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
+return false;
+  return int_size_in_bytes(type) == 0;
+}
+
 // 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.
@@ -212,6 +220,8 @@
   /// their fields.
   void HandleArgument(tree type, uint16_t *Attributes = NULL) {
 const Type *Ty = ConvertType(type);
+// Figure out if this field is zero bits wide, e.g. {} or [0 x int].  Do
+// not include variable sized fields here.
 std::vector Elts;
 if (isPassedByInvisibleReference(type)) { // variable size -> by-ref.
   C.HandleScalarArgument(PointerType::getUnqual(Ty), type);
@@ -225,8 +235,8 @@
 *Attributes |= ParamAttr::ByVal;
 } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
   PassInIntegerRegisters(type, Ty);
-} else if (isAggregateOfSizeZero(type)) {
-  // Zero sized aggregate, just drop it!
+} else if (isZeroSizedStructOrUnion(type)) {
+  // Zero sized struct or union, just drop it!
   ;
 } else if (TREE_CODE(type) == RECORD_TYPE) {
   for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))

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=46450&r1=46449&r2=46450&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Jan 28 03:49:51 2008
@@ -118,10 +118,6 @@
 /// element added to match llvm struct type size and gcc struct type size.
 bool isPaddingElement(const Type *T, unsigned N);
 
-/// isAggregateOfSizeZero - Returns true if this is an aggregate with size 
zero.
-///
-bool isAggregateOfSizeZero(union tree_node*);
-
 /// TypeConverter - Implement the converter from GCC types to LLVM types.
 ///
 class TypeConverter {

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=46450&r1=46449&r2=46450&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jan 28 03:49:51 2008
@@ -1612,14 +1612,6 @@
 
 }
 
-/// isAggregateOfSizeZero - Returns true if this is an aggregate with size 
zero.
-///
-bool isAggregateOfSizeZero(tree type) {
-  if (!isAggregateTreeType(type)) return false;
-  return int_size_in_bytes(type) == 0;
-}
-
-
 /// Mapping from type to type-used-as-base-class and back.
 static DenseMap BaseTypesMap;
 
@@ -2054,9 +2046,6 @@
   unsigned FieldOffsetInBits = getFieldOffsetInBits(Field);
   tree FieldType = getDeclaredType(Field);
 
-  if (isAggregateOfSizeZero(FieldType))
-continue;
-
   // If this is a bitfield, we may want to adjust the FieldOffsetInBits to
   // produce safe code.  In particular, bitfields will be loaded/stored as
   // their *declared* type, not the smallest integer type that contains
@@ -2071,6 +2060,11 @@
 // because the FieldOffsetInBits can be lower than it was in the
 // previous iteration.
 CurFieldNo = 0;
+
+// Skip 'int:0', which just affects layout.
+unsigned FieldSizeInBits = TREE_INT_CST_LOW(DECL_SIZE(Field));
+if (FieldSizeInBits == 0)
+  continue;
   }
 
   // Figure out if this field is zero bits wide, e.g. {} or [0 x int].  Do


___
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] r46450 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

2008-01-28 Thread Duncan Sands
Hi Evan, thanks for doing this.

> +static bool isZeroSizedStructOrUnion(tree type) {
> +  if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)

You should let QUAL_UNION through here as well.  And what about size-zero
arrays?  Or for that matter, zero size anything?

> +// Skip 'int:0', which just affects layout.
> +unsigned FieldSizeInBits = TREE_INT_CST_LOW(DECL_SIZE(Field));
> +if (FieldSizeInBits == 0)
> +  continue;

This is probably safe (not completely clear), but why do you need to do it at 
all?

Ciao,

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


[llvm-commits] [llvm] r46451 - /llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 28 04:35:11 2008
New Revision: 46451

URL: http://llvm.org/viewvc/llvm-project?rev=46451&view=rev
Log:
Make this more likely to be passed byval.

Modified:
llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c

Modified: llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c?rev=46451&r1=46450&r2=46451&view=diff

==
--- llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c (original)
+++ llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c Mon Jan 28 04:35:11 
2008
@@ -1,6 +1,6 @@
 // RUN: %llvmgcc %s -S -O1 -o - | llvm-as | opt -std-compile-opts | llvm-dis | 
not grep add
 
-struct S { int A; int B; int C; int D; };
+struct S { int A; int B; char C[1000]; };
 
 int f(struct S x) __attribute__ ((const));
 


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


Re: [llvm-commits] [llvm] r46432 - /llvm/trunk/Makefile.rules

2008-01-28 Thread Duncan Sands
> Author: lattner
> Date: Sun Jan 27 22:18:41 2008
> New Revision: 46432
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46432&view=rev
> Log:
> reduce duplicate -I flags passed to the compiler, cleaning up the VERBOSE
> output.  Patch contributed by Sam Bishop!

This breaks the build when the objects directory is different to the
source directory.

Ciao,

Duncan.

In file included from llvm/lib/Target/X86/X86AsmPrinter.h:19,
 from llvm/lib/Target/X86/X86ATTAsmPrinter.h:17,
 from llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:17:
llvm/lib/Target/X86/X86.h:60:35: error: X86GenRegisterNames.inc: No such file 
or directory
llvm/lib/Target/X86/X86.h:64:32: error: X86GenInstrNames.inc: No such file or 
directory
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46432 - /llvm/trunk/Makefile.rules

2008-01-28 Thread Sam Bishop
Hi, Duncan.

On Mon, January 28, 2008 6:48 am, Duncan Sands wrote:
> This breaks the build when the objects directory is different to the
> source directory.

I'm very sorry about this.  The attached patch will fix it.

Thanks,
Sam Bishop

Makefile.rules.patch
Description: Binary data
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46455 - /llvm/trunk/lib/Support/FileUtilities.cpp

2008-01-28 Thread Evan Cheng

On Jan 28, 2008, at 10:23 AM, Lauro Ramos Venancio wrote:

> Author: laurov
> Date: Mon Jan 28 12:23:23 2008
> New Revision: 46455
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46455&view=rev
> Log:
> Fix fpcmp infinite loop when comparing "29-266" with "29-268".
>
>
> Modified:
>llvm/trunk/lib/Support/FileUtilities.cpp
>
> Modified: llvm/trunk/lib/Support/FileUtilities.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FileUtilities.cpp?rev=46455&r1=46454&r2=46455&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ==
> --- llvm/trunk/lib/Support/FileUtilities.cpp (original)
> +++ llvm/trunk/lib/Support/FileUtilities.cpp Mon Jan 28 12:23:23 2008
> @@ -20,11 +20,15 @@
> #include 
> using namespace llvm;
>
> -static bool isNumberChar(char C) {
> +static bool isSignedChar(char C) {
> +  if (C == '+' || C == '-')
> +return true;
> +  else
> +return false;
> +}

How about just
   return (C == '+' || C == '-');

Thanks.

Evan

>
> +
> +static bool isExpoentChar(char C) {
>   switch (C) {
> -  case '0': case '1': case '2': case '3': case '4':
> -  case '5': case '6': case '7': case '8': case '9':
> -  case '.': case '+': case '-':
>   case 'D':  // Strange exponential notation.
>   case 'd':  // Strange exponential notation.
>   case 'e':
> @@ -33,13 +37,25 @@
>   }
> }
>
> +static bool isNumberChar(char C) {
> +  switch (C) {
> +  case '0': case '1': case '2': case '3': case '4':
> +  case '5': case '6': case '7': case '8': case '9':
> +  case '.': return true;
> +  default: return isSignedChar(C) || isExpoentChar(C);
> +  }
> +}
> +
> static char *BackupNumber(char *Pos, char *FirstChar) {
>   // If we didn't stop in the middle of a number, don't backup.
>   if (!isNumberChar(*Pos)) return Pos;
>
>   // Otherwise, return to the start of the number.
> -  while (Pos > FirstChar && isNumberChar(Pos[-1]))
> +  while (Pos > FirstChar && isNumberChar(Pos[-1])) {
> --Pos;
> +if (Pos > FirstChar && isSignedChar(Pos[0]) && ! 
> isExpoentChar(Pos[-1]))
> +  break;
> +  }
>   return Pos;
> }
>
>
>
> ___
> 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] r46419 - /llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h

2008-01-28 Thread Evan Cheng

On Jan 27, 2008, at 11:51 AM, Owen Anderson wrote:

> Author: resistor
> Date: Sun Jan 27 13:51:03 2008
> New Revision: 46419
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46419&view=rev
> Log:
> Fixes for BreakCriticalMachineCodeEdge by Fernando.
>
> Modified:
>llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h
>
> Modified: llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h?rev=46419&r1=46418&r2=46419&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ==
> --- llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h  
> (original)
> +++ llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h Sun  
> Jan 27 13:51:03 2008
> @@ -33,13 +33,14 @@
>
>   // insert the new block into the machine function.
>   src->getParent()->getBasicBlockList().insert(src->getParent()- 
> >end(),
> -   crit_mbb);
> + crit_mbb);
>
>   // insert a unconditional branch linking the new block to dst
>   const TargetMachine& TM = src->getParent()->getTarget();
>   const TargetInstrInfo* TII = TM.getInstrInfo();
>   std::vector emptyConditions;
> -  TII->InsertBranch(*crit_mbb, dst, (MachineBasicBlock*)0,  
> emptyConditions);
> +  TII->InsertBranch(*crit_mbb, dst, (MachineBasicBlock*)0,
> +emptyConditions);
>
>   // modify every branch in src that points to dst to point to the new
>   // machine basic block instead:
> @@ -48,18 +49,18 @@
>   while (mii != src->begin()) {
> mii--;
> // if there are no more branches, finish the loop
> -if (!TII->isTerminatorInstr(mii->getOpcode())) {
> +if (!mii->getDesc().isTerminator()) {
>   break;
> }

Perhaps it's safer to use TII->isUnpredicatedTerminator()?

Evan

>
> -
> +
> // Scan the operands of this branch, replacing any uses of dst  
> with
> // crit_mbb.
> for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {
>   MachineOperand & mo = mii->getOperand(i);
>   if (mo.isMachineBasicBlock() &&
> -  mo.getMachineBasicBlock() == dst) {
> +  mo.getMBB() == dst) {
> found_branch = true;
> -mo.setMachineBasicBlock(crit_mbb);
> +mo.setMBB(crit_mbb);
>   }
> }
>   }
> @@ -68,7 +69,8 @@
>   // I am inserting too many gotos, but I am trusting that the asm  
> printer
>   // will optimize the unnecessary gotos.
>   if(!found_branch) {
> -TII->InsertBranch(*src, crit_mbb, (MachineBasicBlock*)0,  
> emptyConditions);
> +TII->InsertBranch(*src, crit_mbb, (MachineBasicBlock*)0,
> +  emptyConditions);
>   }
>
>   /// Change all the phi functions in dst, so that the incoming  
> block be
> @@ -77,29 +79,28 @@
> /// the first instructions are always phi functions.
> if(mii->getOpcode() != TargetInstrInfo::PHI)
>   break;
> -
> +
> // Find the operands corresponding to the source block
> std::vector toRemove;
> unsigned reg = 0;
> for (unsigned u = 0; u != mii->getNumOperands(); ++u)
>   if (mii->getOperand(u).isMachineBasicBlock() &&
> -  mii->getOperand(u).getMachineBasicBlock() == src) {
> +  mii->getOperand(u).getMBB() == src) {
> reg = mii->getOperand(u-1).getReg();
> toRemove.push_back(u-1);
>   }
> -
> // Remove all uses of this MBB
> for (std::vector::reverse_iterator I =  
> toRemove.rbegin(),
>  E = toRemove.rend(); I != E; ++I) {
>   mii->RemoveOperand(*I+1);
>   mii->RemoveOperand(*I);
> }
> -
> +
> // Add a single use corresponding to the new MBB
> -mii->addRegOperand(reg, false);
> -mii->addMachineBasicBlockOperand(crit_mbb);
> +mii->addOperand(MachineOperand::CreateReg(reg, false));
> +mii->addOperand(MachineOperand::CreateMBB(crit_mbb));
>   }
> -
> +
>   return crit_mbb;
> }
>
>
>
> ___
> 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] r46382 - /llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c

2008-01-28 Thread Tanya Lattner
This test is failing for me. llvm-gcc-4.0 on x86/darwin8.

../../src/gcc/llvm-types.cpp:1426: failed assertion `0 && "Could not  
find field!"'

-Tanya

On Jan 25, 2008, at 4:35 PM, Evan Cheng wrote:

> Author: evancheng
> Date: Fri Jan 25 18:35:43 2008
> New Revision: 46382
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46382&view=rev
> Log:
> New test case.
>
> Added:
> llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c
>
> Added: llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/ 
> 2008-01-25-ZeroSizedAggregate.c?rev=46382&view=auto
>
> == 
> 
> --- llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c (added)
> +++ llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c Fri  
> Jan 25 18:35:43 2008
> @@ -0,0 +1,23 @@
> +// RUN: %llvmgcc %s -S -o -
> +
> +// Aggregates of size zero should be dropped from argument list.
> +typedef long int Tlong;
> +struct S2411 {
> +  __attribute__((aligned)) Tlong:0;
> +};
> +
> +extern struct S2411 a2411[5];
> +extern void checkx2411(struct S2411);
> +void test2411(void) {
> +  checkx2411(a2411[0]);
> +}
> +
> +// A field that is an aggregates of size zero should be dropped  
> during
> +// type conversion.
> +typedef unsigned long long int Tal2ullong __attribute__((aligned 
> (2)));
> +struct S2525 {
> + Tal2ullong: 0;
> + struct {
> + } e;
> +};
> +struct S2525 s2525;
>
>
> ___
> 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] r46372 - /llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c

2008-01-28 Thread Duncan Sands
Hi Tanya,

> This test is failing for me. llvm-gcc-4.0, x86 darwin8.

it should be better now.  It needed tweaking for a policy
change on byval+const/pure.  Also, a patch had not been
backported from 4.2 to 4.0.

Ciao,

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


[llvm-commits] [llvm] r46455 - /llvm/trunk/lib/Support/FileUtilities.cpp

2008-01-28 Thread Lauro Ramos Venancio
Author: laurov
Date: Mon Jan 28 12:23:23 2008
New Revision: 46455

URL: http://llvm.org/viewvc/llvm-project?rev=46455&view=rev
Log:
Fix fpcmp infinite loop when comparing "29-266" with "29-268".


Modified:
llvm/trunk/lib/Support/FileUtilities.cpp

Modified: llvm/trunk/lib/Support/FileUtilities.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FileUtilities.cpp?rev=46455&r1=46454&r2=46455&view=diff

==
--- llvm/trunk/lib/Support/FileUtilities.cpp (original)
+++ llvm/trunk/lib/Support/FileUtilities.cpp Mon Jan 28 12:23:23 2008
@@ -20,11 +20,15 @@
 #include 
 using namespace llvm;
 
-static bool isNumberChar(char C) {
+static bool isSignedChar(char C) {
+  if (C == '+' || C == '-')
+return true;
+  else
+return false;
+}
+
+static bool isExpoentChar(char C) {
   switch (C) {
-  case '0': case '1': case '2': case '3': case '4':
-  case '5': case '6': case '7': case '8': case '9':
-  case '.': case '+': case '-':
   case 'D':  // Strange exponential notation.
   case 'd':  // Strange exponential notation.
   case 'e':
@@ -33,13 +37,25 @@
   }
 }
 
+static bool isNumberChar(char C) {
+  switch (C) {
+  case '0': case '1': case '2': case '3': case '4':
+  case '5': case '6': case '7': case '8': case '9':
+  case '.': return true;
+  default: return isSignedChar(C) || isExpoentChar(C);
+  }
+}
+
 static char *BackupNumber(char *Pos, char *FirstChar) {
   // If we didn't stop in the middle of a number, don't backup.
   if (!isNumberChar(*Pos)) return Pos;
 
   // Otherwise, return to the start of the number.
-  while (Pos > FirstChar && isNumberChar(Pos[-1]))
+  while (Pos > FirstChar && isNumberChar(Pos[-1])) {
 --Pos;
+if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExpoentChar(Pos[-1]))
+  break;
+  }
   return Pos;
 }
 


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


Re: [llvm-commits] [llvm] r46382 - /llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c

2008-01-28 Thread Evan Cheng
I'll merge in all the ABI related changes from 4.2.

Evan

On Jan 28, 2008, at 11:15 AM, Tanya Lattner wrote:

> This test is failing for me. llvm-gcc-4.0 on x86/darwin8.
>
> ../../src/gcc/llvm-types.cpp:1426: failed assertion `0 && "Could not
> find field!"'
>
> -Tanya
>
> On Jan 25, 2008, at 4:35 PM, Evan Cheng wrote:
>
>> Author: evancheng
>> Date: Fri Jan 25 18:35:43 2008
>> New Revision: 46382
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=46382&view=rev
>> Log:
>> New test case.
>>
>> Added:
>>llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c
>>
>> Added: llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/
>> 2008-01-25-ZeroSizedAggregate.c?rev=46382&view=auto
>>
>> =
>> =
>> 
>> --- llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c (added)
>> +++ llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c Fri
>> Jan 25 18:35:43 2008
>> @@ -0,0 +1,23 @@
>> +// RUN: %llvmgcc %s -S -o -
>> +
>> +// Aggregates of size zero should be dropped from argument list.
>> +typedef long int Tlong;
>> +struct S2411 {
>> +  __attribute__((aligned)) Tlong:0;
>> +};
>> +
>> +extern struct S2411 a2411[5];
>> +extern void checkx2411(struct S2411);
>> +void test2411(void) {
>> +  checkx2411(a2411[0]);
>> +}
>> +
>> +// A field that is an aggregates of size zero should be dropped
>> during
>> +// type conversion.
>> +typedef unsigned long long int Tal2ullong __attribute__((aligned
>> (2)));
>> +struct S2525 {
>> + Tal2ullong: 0;
>> + struct {
>> + } e;
>> +};
>> +struct S2525 s2525;
>>
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


Re: [llvm-commits] [llvm] r46455 - /llvm/trunk/lib/Support/FileUtilities.cpp

2008-01-28 Thread Chris Lattner
On Jan 28, 2008, at 10:56 AM, Evan Cheng wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=46455&view=rev
>> Log:
>> Fix fpcmp infinite loop when comparing "29-266" with "29-268".
>> +static bool isExpoentChar(char C) {

Also, typo: Expoent -> Exponent.

Thanks Lauro,

-Chris

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


[llvm-commits] [llvm-gcc-4.0] r46457 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 28 13:57:01 2008
New Revision: 46457

URL: http://llvm.org/viewvc/llvm-project?rev=46457&view=rev
Log:
Backport the patch turning off readnone/readonly
when there is a byval parameter from 4.2.

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

Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=46457&r1=46456&r2=46457&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Mon Jan 28 13:57:01 2008
@@ -1043,17 +1043,16 @@
 
   // Check for 'readnone' function attribute.
   if (flags & ECF_CONST)
-// Since they write the return value through a pointer,
-// 'sret' functions cannot be 'readnone'.
-if (!ABIConverter.isStructReturn())
-  RAttributes |= ParamAttr::ReadNone;
+RAttributes |= ParamAttr::ReadNone;
 
   // Check for 'readonly' function attribute.
-  if (flags & ECF_PURE)
-// Since they write the return value through a pointer,
-// 'sret' functions cannot be 'readonly'.
-if (!ABIConverter.isStructReturn())
-  RAttributes |= ParamAttr::ReadOnly;
+  if (flags & ECF_PURE && !(flags & ECF_CONST))
+ RAttributes |= ParamAttr::ReadOnly;
+
+  // Since they write the return value through a pointer,
+  // 'sret' functions cannot be 'readnone' or 'readonly'.
+  if (ABIConverter.isStructReturn())
+RAttributes &= ~(ParamAttr::ReadNone|ParamAttr::ReadOnly);
 
   // Compute whether the result needs to be zext or sext'd.
   RAttributes |= HandleArgumentExtension(TREE_TYPE(type));
@@ -1082,6 +1081,9 @@
   LLVM_TARGET_INIT_REGPARM(local_regparam, type);
 #endif // LLVM_TARGET_ENABLE_REGPARM
   
+  // Keep track of whether we see a byval argument.
+  bool HasByVal = false;
+  
   // Check if we have a corresponding decl to inspect.
   tree DeclArgs = (decl) ? DECL_ARGUMENTS(decl) : NULL;
   // Loop over all of the arguments, adding them as we go.
@@ -1128,13 +1130,27 @@
 local_regparam);
 #endif // LLVM_TARGET_ENABLE_REGPARM
 
-if (Attributes != ParamAttr::None)
+if (Attributes != ParamAttr::None) {
+  HasByVal |= Attributes & ParamAttr::ByVal;
   Attrs.push_back(ParamAttrsWithIndex::get(ArgTypes.size(), Attributes));
+}
   
 if (DeclArgs)
   DeclArgs = TREE_CHAIN(DeclArgs);
   }
   
+  // If there is a byval argument then it is not safe to mark the function
+  // 'readnone' or 'readonly': gcc permits a 'const' or 'pure' function to
+  // write to struct arguments passed by value, but in LLVM this becomes a
+  // write through the byval pointer argument, which LLVM does not allow for
+  // readonly/readnone functions.
+  if (HasByVal && Attrs[0].index == 0) {
+uint16_t &RAttrs = Attrs[0].attrs;
+RAttrs &= ~(ParamAttr::ReadNone | ParamAttr::ReadOnly);
+if (RAttrs == ParamAttr::None)
+  Attrs.erase(Attrs.begin());
+  }
+
   // If the argument list ends with a void type node, it isn't vararg.
   isVarArg = (Args == 0);
   assert(RetTy && "Return type not specified!");


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


Re: [llvm-commits] [llvm] r46382 - /llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c

2008-01-28 Thread Duncan Sands
> How long should we continue to support 4.0?  I thought 2.2 was the  
> last release for it?

Does 4.0 do anything better than 4.2?  I'm all for dropping it like
a hot potato if not.

Ciao,

Duncan.
___
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] r46450 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

2008-01-28 Thread Duncan Sands
Hi Evan,

> > This is probably safe (not completely clear), but why do you need to  
> > do it at all?
> 
> Because they are skipped earlier when we did the type translation.

I see - this was orthogonal to the rest of your patch.  I have a different
fix for this issue which I like better, but that's my problem :)

Ciao,

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


Re: [llvm-commits] [llvm] r46432 - /llvm/trunk/Makefile.rules

2008-01-28 Thread Duncan Sands
> > This breaks the build when the objects directory is different to the
> > source directory.
> 
> I'm very sorry about this.  The attached patch will fix it.

Indeed it does, so I've applied it.  Thanks for the quick fix!

Best wishes,

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


[llvm-commits] [llvm] r46456 - /llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 28 13:25:47 2008
New Revision: 46456

URL: http://llvm.org/viewvc/llvm-project?rev=46456&view=rev
Log:
Pure/const functions with ByVal parameters cannot
be marked readonly either.

Modified:
llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c

Modified: llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c?rev=46456&r1=46455&r2=46456&view=diff

==
--- llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c (original)
+++ llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c Mon Jan 28 13:25:47 
2008
@@ -1,10 +1,15 @@
-// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep readonly
+// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | not grep readonly
 // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | not grep readnone
 
 
-// The struct being passed byval means that we need to mark the 
-// function readonly instead of readnone.  Readnone would allow
-// stores to the arg to be deleted in the caller.
+// The struct being passed byval means that we cannot mark the
+// function readnone.  Readnone would allow stores to the arg to
+// be deleted in the caller.  We also don't allow readonly since
+// the callee might write to the byval parameter.  The inliner
+// would have to assume the worse and introduce an explicit
+// temporary when inlining such a function, which is costly for
+// the common case in which the byval argument is not written.
 struct S { int A[1000]; };
 int __attribute__ ((const)) f(struct S x) { return x.A[0]; }
-
+int g(struct S x) __attribute__ ((pure));
+int h(struct S x) { return g(x); }


___
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] r46450 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal. h llvm-types.cpp

2008-01-28 Thread Duncan Sands
Hi Devang,

> >> +// Skip 'int:0', which just affects layout.
> >> +unsigned FieldSizeInBits =  
> >> TREE_INT_CST_LOW(DECL_SIZE(Field));
> >> +if (FieldSizeInBits == 0)
> >> +  continue;
> >
> > This is probably safe (not completely clear), but why do you need to  
> > do it at all?
> 
>getLLVMFieldFor() does not handle zero-sized bit-fields.

so this is fixing a getLLVMFieldFor crash noticed while working on
struct passing?  I have a patch somewhere that causes zero-sized
bit-fields to be indexed properly (I thought it had been applied
at some point, but I guess it fell through a crack...).  I will
dig it out and apply it, since I think it is better if you can
always rely on every gcc field having an LLVM field index (except
for variable offset fields, for which that is impossible).

Ciao,

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


Re: [llvm-commits] [llvm] r46372 - /llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c

2008-01-28 Thread Tanya Lattner
This test is failing for me. llvm-gcc-4.0, x86 darwin8.

-Tanya

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

> Author: lattner
> Date: Fri Jan 25 16:36:24 2008
> New Revision: 46372
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46372&view=rev
> Log:
> add a testcase for a bug Duncan pointed out.
>
> Added:
> llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c
>
> Added: llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/ 
> 2008-01-25-ByValReadNone.c?rev=46372&view=auto
>
> == 
> 
> --- llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c (added)
> +++ llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c Fri Jan 25  
> 16:36:24 2008
> @@ -0,0 +1,10 @@
> +// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep readonly
> +// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | not grep readnone
> +
> +
> +// The struct being passed byval means that we need to mark the
> +// function readonly instead of readnone.  Readnone would allow
> +// stores to the arg to be deleted in the caller.
> +struct S { int A[1000]; };
> +int __attribute__ ((const)) f(struct S x) { return x.A[0]; }
> +
>
>
> ___
> 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] r46451 - /llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c

2008-01-28 Thread Tanya Lattner
This fails with 4.0 on darwin x86.

-Tanya

On Jan 28, 2008, at 2:35 AM, Duncan Sands wrote:

> Author: baldrick
> Date: Mon Jan 28 04:35:11 2008
> New Revision: 46451
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46451&view=rev
> Log:
> Make this more likely to be passed byval.
>
> Modified:
> llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c
>
> Modified: llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/ 
> 2008-01-26-ReadOnlyByVal.c?rev=46451&r1=46450&r2=46451&view=diff
>
> == 
> 
> --- llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c (original)
> +++ llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c Mon Jan 28  
> 04:35:11 2008
> @@ -1,6 +1,6 @@
>  // RUN: %llvmgcc %s -S -O1 -o - | llvm-as | opt -std-compile-opts  
> | llvm-dis | not grep add
>
> -struct S { int A; int B; int C; int D; };
> +struct S { int A; int B; char C[1000]; };
>
>  int f(struct S x) __attribute__ ((const));
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] [llvm-gcc-4.2] r46463 - in /llvm-gcc-4.2/trunk: gcc/config/darwin.h libcpp/directives.c libcpp/internal.h libcpp/lex.c

2008-01-28 Thread Bill Wendling
Author: void
Date: Mon Jan 28 15:47:12 2008
New Revision: 46463

URL: http://llvm.org/viewvc/llvm-project?rev=46463&view=rev
Log:
This program:

$ cat testcase.c
#pragma mark Mike's world
#ifdef DO_ERROR
#error Mike's world
#endif
int i;

Gives us these warnings:

pragma-2.c:1:18: warning: missing terminating ' character
pragma-2.c:3:12: warning: missing terminating ' character

We should ignore unbalanced quotes in these pragmas. Porting fixes from Apple
GCC.

Modified:
llvm-gcc-4.2/trunk/gcc/config/darwin.h
llvm-gcc-4.2/trunk/libcpp/directives.c
llvm-gcc-4.2/trunk/libcpp/internal.h
llvm-gcc-4.2/trunk/libcpp/lex.c

Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=46463&r1=46462&r2=46463&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Mon Jan 28 15:47:12 2008
@@ -1162,10 +1162,9 @@
 
 #define DARWIN_REGISTER_TARGET_PRAGMAS()   \
   do { \
-/* APPLE LOCAL begin mainline 2007-10-10 5497482 */\
-cpp_register_pragma (parse_in, NULL, "mark",   \
-darwin_pragma_ignore, false);  \
-/* APPLE LOCAL end mainline 2007-10-10 5497482 */  \
+/* APPLE LOCAL begin pragma mark 5614511 */\
+/* Removed mark.  */   \
+/* APPLE LOCAL end pragma mark 5614511 */  \
 c_register_pragma (0, "options", darwin_pragma_options);   \
 c_register_pragma (0, "segment", darwin_pragma_ignore);\
 /* APPLE LOCAL pragma fenv */   \

Modified: llvm-gcc-4.2/trunk/libcpp/directives.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libcpp/directives.c?rev=46463&r1=46462&r2=46463&view=diff

==
--- llvm-gcc-4.2/trunk/libcpp/directives.c (original)
+++ llvm-gcc-4.2/trunk/libcpp/directives.c Mon Jan 28 15:47:12 2008
@@ -1073,7 +1073,11 @@
   if (print_dir)
fprintf (stderr, "#%s ", pfile->directive->name);
   pfile->state.prevent_expansion++;
+  /* APPLE LOCAL #error with unmatched quotes 5607574 */
+  pfile->state.in_diagnostic++;
   cpp_output_line (pfile, stderr);
+  /* APPLE LOCAL #error with unmatched quotes 5607574 */
+  pfile->state.in_diagnostic--;
   pfile->state.prevent_expansion--;
 }
 }
@@ -1262,12 +1266,25 @@
 }
 }  
 
+/* APPLE LOCAL begin pragma mark 5614511 */
+/* Handle #pragma mark.  */
+static void
+do_pragma_mark (cpp_reader *pfile)
+{
+  ++pfile->state.skipping;
+  skip_rest_of_line (pfile);
+  --pfile->state.skipping;
+}
+/* APPLE LOCAL end pragma mark 5614511 */
+
 /* Register the pragmas the preprocessor itself handles.  */
 void
 _cpp_init_internal_pragmas (cpp_reader *pfile)
 {
   /* Pragmas in the global namespace.  */
   register_pragma_internal (pfile, 0, "once", do_pragma_once);
+  /* APPLE LOCAL pragma mark 5614511 */
+  register_pragma_internal (pfile, 0, "mark", do_pragma_mark);
 
   /* New GCC-specific pragmas should be put in the GCC namespace.  */
   register_pragma_internal (pfile, "GCC", "poison", do_pragma_poison);

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

==
--- llvm-gcc-4.2/trunk/libcpp/internal.h (original)
+++ llvm-gcc-4.2/trunk/libcpp/internal.h Mon Jan 28 15:47:12 2008
@@ -226,6 +226,11 @@
 
   /* Nonzero if the deferred pragma being handled allows macro expansion.  */
   unsigned char pragma_allow_expansion;
+
+  /* APPLE LOCAL begin #error with unmatched quotes 5607574 */
+  /* Nonzero when handling #error and #warning to allow unmatched quotes.  */
+  unsigned char in_diagnostic;
+  /* APPLE LOCAL end #error with unmatched quotes 5607574 */
 };
 
 /* Special nodes - identifiers with predefined significance.  */

Modified: llvm-gcc-4.2/trunk/libcpp/lex.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libcpp/lex.c?rev=46463&r1=46462&r2=46463&view=diff

==
--- llvm-gcc-4.2/trunk/libcpp/lex.c (original)
+++ llvm-gcc-4.2/trunk/libcpp/lex.c Mon Jan 28 15:47:12 2008
@@ -665,7 +665,12 @@
 cpp_error (pfile, CPP_DL_WARNING,
   "null character(s) preserved in literal");
 
-  if (type == CPP_OTHER && CPP_OPTION (pfile, lang) != CLK_ASM)
+  /* APPLE LOCAL begin #error with unmatched quotes 5607574 */
+  if (type == CPP_OTHER
+  && CPP_OPTION (pfile, lang) != CLK_ASM
+  && !pfile->state.in_diagnostic
+  && !pfile->state.skipping)
+  /* APPLE LOCAL end #er

[llvm-commits] [llvm-gcc-4.2] r46460 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 28 14:57:24 2008
New Revision: 46460

URL: http://llvm.org/viewvc/llvm-project?rev=46460&view=rev
Log:
Fix PR1942 differently, by having the caller
take care of making a copy of the aggregate
return value rather than the callee (the previous
fix).  This is better adapted for optimization
(though the optimizations needed don't exist
yet...) and is also the way gcc does it, so is
needed for interoperability with gcc compiled
code.

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

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=46460&r1=46459&r2=46460&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jan 28 14:57:24 2008
@@ -367,8 +367,6 @@
 
   AllocaInsertionPoint = 0;
 
-  UsedSRetBuffer = false;
-
   ExceptionValue = 0;
   ExceptionSelectorValue = 0;
   FuncEHException = 0;
@@ -413,12 +411,10 @@
 LLVMBuilder Builder;
 std::vector LocStack;
 std::vector NameStack;
-bool &UsedSRetBuffer;
 FunctionPrologArgumentConversion(tree FnDecl,
  Function::arg_iterator &ai,
- const LLVMBuilder &B,
- bool &SRetBuffer)
-  : FunctionDecl(FnDecl), AI(ai), Builder(B), UsedSRetBuffer(SRetBuffer) {}
+ const LLVMBuilder &B)
+  : FunctionDecl(FnDecl), AI(ai), Builder(B) {}
 
 void setName(const std::string &Name) {
   NameStack.push_back(Name);
@@ -446,11 +442,7 @@
   tree ResultDecl = DECL_RESULT(FunctionDecl);
   tree RetTy = TREE_TYPE(TREE_TYPE(FunctionDecl));
   if (TREE_CODE(RetTy) == TREE_CODE(TREE_TYPE(ResultDecl))) {
-// Use a buffer for the return result.  This ensures that writes to the
-// return value do not interfere with reads from parameters: the same
-// aggregate might be used for the return value and as a parameter.
-TheTreeToLLVM->EmitAutomaticVariableDecl(DECL_RESULT(FunctionDecl));
-UsedSRetBuffer = true;
+SET_DECL_LLVM(ResultDecl, AI);
 ++AI;
 return;
   }
@@ -666,7 +658,7 @@
   Function::arg_iterator AI = Fn->arg_begin();
 
   // Rename and alloca'ify real arguments.
-  FunctionPrologArgumentConversion Client(FnDecl, AI, Builder, UsedSRetBuffer);
+  FunctionPrologArgumentConversion Client(FnDecl, AI, Builder);
   TheLLVMABI ABIConverter(Client);
 
   // Handle the DECL_RESULT.
@@ -766,14 +758,6 @@
  PointerType::getUnqual(Fn->getReturnType()));
   RetVal = Builder.CreateLoad(RetVal, "retval");
 }
-  } else if (UsedSRetBuffer) {
-// A buffer was used for the aggregate return result.  Copy it out now.
-assert(Fn->arg_begin() != Fn->arg_end() && "No struct return value?");
-unsigned Alignment = expr_align(DECL_RESULT(FnDecl))/8;
-bool Volatile = TREE_THIS_VOLATILE(DECL_RESULT(FnDecl));
-MemRef BufLoc(DECL_LLVM(DECL_RESULT(FnDecl)), Alignment, false);
-MemRef RetLoc(Fn->arg_begin(), Alignment, Volatile);
-EmitAggregateCopy(RetLoc, BufLoc, TREE_TYPE(DECL_RESULT(FnDecl)));
   }
   if (TheDebugInfo) TheDebugInfo->EmitRegionEnd(Fn, Builder.GetInsertBlock());
   Builder.CreateRet(RetVal);
@@ -2321,6 +2305,7 @@
 CallingConv::ID &CallingConvention;
 LLVMBuilder &Builder;
 const MemRef *DestLoc;
+MemRef BufLoc;
 std::vector LocStack;
 
 FunctionCallArgumentConversion(tree exp, SmallVector &ops,
@@ -2352,7 +2337,19 @@
   assert(LocStack.size() == 1 && "Imbalance!");
   LocStack.clear();
 }
-
+
+// CopyOutResult - If the (aggregate) return result was redirected to a
+// buffer, copy it to the final destination.
+void CopyOutResult(tree result_type) {
+  if (BufLoc.Ptr && DestLoc) {
+// A buffer was used for the aggregate return result.  Copy it out now.
+assert(ConvertType(result_type) ==
+   cast(BufLoc.Ptr->getType())->getElementType() &&
+   "Inconsistent result types!");
+TheTreeToLLVM->EmitAggregateCopy(*DestLoc, BufLoc, result_type);
+  }
+}
+
 /// HandleScalarResult - This callback is invoked if the function returns a
 /// simple scalar result value.
 void HandleScalarResult(const Type *RetTy) {
@@ -2367,7 +2364,7 @@
 void HandleAggregateResultAsScalar(const Type *ScalarTy) {
   // There is nothing to do here.
 }
-
+
 /// HandleAggregateShadowArgument - This callback is invoked if the 
function
 /// returns an aggregate value by using a "shadow" first parameter.  If
 /// RetPtr is set to true, the pointer argument itself is returned from the
@@ -2375,19 +2372,15 @@
 void HandleAggregateShadowArgument(const PointerType *PtrArgTy,
  

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

2008-01-28 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 28 14:55:32 2008
New Revision: 46459

URL: http://llvm.org/viewvc/llvm-project?rev=46459&view=rev
Log:
QUAL_UNION_TYPE is just like UNION_TYPE.

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=46459&r1=46458&r2=46459&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Mon Jan 28 14:55:32 2008
@@ -123,7 +123,9 @@
 /// isZeroSizedStructOrUnion - Returns true if this is a struct or union 
 /// which is zero bits wide.
 static bool isZeroSizedStructOrUnion(tree type) {
-  if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
+  if (TREE_CODE(type) != RECORD_TYPE &&
+  TREE_CODE(type) != UNION_TYPE &&
+  TREE_CODE(type) != QUAL_UNION_TYPE)
 return false;
   return int_size_in_bytes(type) == 0;
 }


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


[llvm-commits] [llvm] r46461 - /llvm/tags/Apple/llvmCore-2012/Makefile.rules

2008-01-28 Thread Devang Patel
Author: dpatel
Date: Mon Jan 28 15:01:04 2008
New Revision: 46461

URL: http://llvm.org/viewvc/llvm-project?rev=46461&view=rev
Log:
Fix build failure.
Backport patch from trunk.

Modified:
llvm/tags/Apple/llvmCore-2012/Makefile.rules

Modified: llvm/tags/Apple/llvmCore-2012/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2012/Makefile.rules?rev=46461&r1=46460&r2=46461&view=diff

==
--- llvm/tags/Apple/llvmCore-2012/Makefile.rules (original)
+++ llvm/tags/Apple/llvmCore-2012/Makefile.rules Mon Jan 28 15:01:04 2008
@@ -454,8 +454,8 @@
 LD.Flags  += -L$(LibDir) -L$(LLVMLibDir) 
 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
 # All -I flags should go here, so that they don't confuse llvm-config.
-CPP.Flags += $(patsubst %,-I%/include,$(sort \
-$(PROJ_OBJ_DIR) $(PROJ_SRC_DIR) \
+CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
+$(patsubst %,-I%/include,\
 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
 $(CPP.BaseFlags)


___
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] r46450 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

2008-01-28 Thread Duncan Sands
Hi Evan,

> > You should let QUAL_UNION through here as well.  And what about size- 
> > zero
> > arrays?  Or for that matter, zero size anything?
> 
> What exactly is QUAL_UNION? I am pretty sure other cases (especially  
> zero sized arrays) are handled differently.

QUAL_UNION is a union with an associated variable saying which of the
union fields you can use (so this is only known at runtime in general).
It is not used by the C-like languages.  It is used by Ada to implement
variant records, which I think Ada inherited from Pascal.  You can mostly
treat a QUAL_UNION the same as a union.

Ciao,

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


[llvm-commits] [llvm] r46454 - /llvm/trunk/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll

2008-01-28 Thread Chris Lattner
Author: lattner
Date: Mon Jan 28 11:38:46 2008
New Revision: 46454

URL: http://llvm.org/viewvc/llvm-project?rev=46454&view=rev
Log:
this test is now compiled into the right thing.

Modified:
llvm/trunk/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll

Modified: 
llvm/trunk/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll?rev=46454&r1=46453&r2=46454&view=diff

==
--- llvm/trunk/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll 
(original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll 
Mon Jan 28 11:38:46 2008
@@ -1,5 +1,6 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zext
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp ugt}
 ; PR1107
+; PR1940
 
 define i1 @test(i8 %A, i8 %B) {
%a = zext i8 %A to i32


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


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

2008-01-28 Thread Ted Kremenek
Author: kremenek
Date: Mon Jan 28 16:05:23 2008
New Revision: 46465

URL: http://llvm.org/viewvc/llvm-project?rev=46465&view=rev
Log:
Added destructor for template class FoldingSetNodeWrapper.
Added getValue() to FoldingSetNodeWrapper.

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=46465&r1=46464&r2=46465&view=diff

==
--- llvm/trunk/include/llvm/ADT/FoldingSet.h (original)
+++ llvm/trunk/include/llvm/ADT/FoldingSet.h Mon Jan 28 16:05:23 2008
@@ -329,7 +329,7 @@
   T data;
 public:
   FoldingSetNodeWrapper(const T& x) : data(x) {}
-  virtual ~FoldingSetNodeWrapper();
+  virtual ~FoldingSetNodeWrapper() {}
   
   template
   explicit FoldingSetNodeWrapper(const A1& a1)
@@ -356,6 +356,9 @@
   
   void Profile(FoldingSetNodeID& ID) { FoldingSetTrait::Profile(data, ID); }
 
+  T& getValue() { return data; }
+  const T& getValue() const { return data; }
+
   operator T&() { return data; }
   operator const T&() const { return data; }
 };


___
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] r46450 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

2008-01-28 Thread Evan Cheng

On Jan 28, 2008, at 2:14 AM, Duncan Sands wrote:

> Hi Evan, thanks for doing this.
>
>> +static bool isZeroSizedStructOrUnion(tree type) {
>> +  if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) !=  
>> UNION_TYPE)
>
> You should let QUAL_UNION through here as well.  And what about size- 
> zero
> arrays?  Or for that matter, zero size anything?

What exactly is QUAL_UNION? I am pretty sure other cases (especially  
zero sized arrays) are handled differently.

>
>
>> +// Skip 'int:0', which just affects layout.
>> +unsigned FieldSizeInBits =  
>> TREE_INT_CST_LOW(DECL_SIZE(Field));
>> +if (FieldSizeInBits == 0)
>> +  continue;
>
> This is probably safe (not completely clear), but why do you need to  
> do it at all?

Because they are skipped earlier when we did the type translation.

Evan

>
>
> Ciao,
>
> Duncan.

___
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] r46450 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

2008-01-28 Thread Devang Patel

Hi Duncan,

On Jan 28, 2008, at 2:14 AM, Duncan Sands wrote:


+// Skip 'int:0', which just affects layout.
+unsigned FieldSizeInBits =  
TREE_INT_CST_LOW(DECL_SIZE(Field));

+if (FieldSizeInBits == 0)
+  continue;


This is probably safe (not completely clear), but why do you need to  
do it at all?


  getLLVMFieldFor() does not handle zero-sized bit-fields.

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


[llvm-commits] [llvm] r46452 - /llvm/tags/Apple/llvmCore-2012/

2008-01-28 Thread Devang Patel
Author: dpatel
Date: Mon Jan 28 10:59:48 2008
New Revision: 46452

URL: http://llvm.org/viewvc/llvm-project?rev=46452&view=rev
Log:
Tag llvmCore-2012

Added:
llvm/tags/Apple/llvmCore-2012/
  - copied from r46439, llvm/trunk/

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


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

2008-01-28 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 28 16:28:50 2008
New Revision: 46469

URL: http://llvm.org/viewvc/llvm-project?rev=46469&view=rev
Log:
Debug info for byval parameter. First attempt, unclear if it is right. But at 
least it tells gdb there is a parameter.

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=46469&r1=46468&r2=46469&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jan 28 16:28:50 2008
@@ -672,13 +672,22 @@
 if (DECL_NAME(Args)) Name = IDENTIFIER_POINTER(DECL_NAME(Args));
 
 const Type *ArgTy = ConvertType(TREE_TYPE(Args));
-if (isPassedByInvisibleReference(TREE_TYPE(Args)) ||
+bool isInvRef = isPassedByInvisibleReference(TREE_TYPE(Args));
+if (isInvRef ||
 (!ArgTy->isFirstClassType() &&
  LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(TREE_TYPE(Args), ArgTy))) 
{
   // If the value is passed by 'invisible reference' or 'byval reference',
   // the l-value for the argument IS the argument itself.
-  SET_DECL_LLVM(Args, AI);
   AI->setName(Name);
+  SET_DECL_LLVM(Args, AI);
+  if (!isInvRef && TheDebugInfo) {
+Value *Tmp = CreateTemporary(PointerType::getUnqual(ArgTy));
+Tmp->setName(std::string(Name)+"_addr");
+TheDebugInfo->EmitDeclare(Args, llvm::dwarf::DW_TAG_arg_variable,
+  Name, TREE_TYPE(Args), Tmp, 
+  Builder.GetInsertBlock());
+Builder.CreateStore(AI, Tmp);
+  }
   ++AI;
 } else {
   // Otherwise, we create an alloca to hold the argument value and provide


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


Re: [llvm-commits] [llvm] r46382 - /llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c

2008-01-28 Thread Tanya Lattner

On Jan 28, 2008, at 11:35 AM, Chris Lattner wrote:

> On Jan 28, 2008, at 11:15 AM, Tanya Lattner wrote:
>> This test is failing for me. llvm-gcc-4.0 on x86/darwin8.
>>
>> ../../src/gcc/llvm-types.cpp:1426: failed assertion `0 && "Could not
>> find field!"'
>
> How long should we continue to support 4.0?  I thought 2.2 was the
> last release for it?
>

There are 2 things that we should be doing to drop 4.0.

1) Are there less tests in llvm-test that are failing for 4.0 versus  
4.2?
2) We have to communicate to people who are using svn for LLVM and  
llvm-gcc that we are moving to supporting only llvm-gcc-4.2 and when  
that cutoff date is.

We can't just start dropping 4.0 and letting make check fail, without  
the 2 above steps.

-Tanya

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


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

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 28 11:38:30 2008
New Revision: 46453

URL: http://llvm.org/viewvc/llvm-project?rev=46453&view=rev
Log:
Unbreak builds with differing object and source
directories.  Patch by Sam Bishop.

Modified:
llvm/trunk/Makefile.rules

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

==
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Mon Jan 28 11:38:30 2008
@@ -454,8 +454,8 @@
 LD.Flags  += -L$(LibDir) -L$(LLVMLibDir) 
 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
 # All -I flags should go here, so that they don't confuse llvm-config.
-CPP.Flags += $(patsubst %,-I%/include,$(sort \
-$(PROJ_OBJ_DIR) $(PROJ_SRC_DIR) \
+CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
+$(patsubst %,-I%/include,\
 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
 $(CPP.BaseFlags)


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


Re: [llvm-commits] [llvm] r46382 - /llvm/trunk/test/CFrontend/2008-01-25-ZeroSizedAggregate.c

2008-01-28 Thread Chris Lattner
On Jan 28, 2008, at 11:15 AM, Tanya Lattner wrote:
> This test is failing for me. llvm-gcc-4.0 on x86/darwin8.
>
> ../../src/gcc/llvm-types.cpp:1426: failed assertion `0 && "Could not
> find field!"'

How long should we continue to support 4.0?  I thought 2.2 was the  
last release for it?

-Chris

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


[llvm-commits] [llvm] r46458 - /llvm/trunk/lib/Support/FileUtilities.cpp

2008-01-28 Thread Lauro Ramos Venancio
Author: laurov
Date: Mon Jan 28 14:02:51 2008
New Revision: 46458

URL: http://llvm.org/viewvc/llvm-project?rev=46458&view=rev
Log:
Simplify the code and fix a typo.


Modified:
llvm/trunk/lib/Support/FileUtilities.cpp

Modified: llvm/trunk/lib/Support/FileUtilities.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FileUtilities.cpp?rev=46458&r1=46457&r2=46458&view=diff

==
--- llvm/trunk/lib/Support/FileUtilities.cpp (original)
+++ llvm/trunk/lib/Support/FileUtilities.cpp Mon Jan 28 14:02:51 2008
@@ -21,13 +21,10 @@
 using namespace llvm;
 
 static bool isSignedChar(char C) {
-  if (C == '+' || C == '-')
-return true;
-  else
-return false;
+  return (C == '+' || C == '-');
 }
 
-static bool isExpoentChar(char C) {
+static bool isExponentChar(char C) {
   switch (C) {
   case 'D':  // Strange exponential notation.
   case 'd':  // Strange exponential notation.
@@ -42,7 +39,7 @@
   case '0': case '1': case '2': case '3': case '4':
   case '5': case '6': case '7': case '8': case '9':
   case '.': return true;
-  default: return isSignedChar(C) || isExpoentChar(C);
+  default: return isSignedChar(C) || isExponentChar(C);
   }
 }
 
@@ -53,7 +50,7 @@
   // Otherwise, return to the start of the number.
   while (Pos > FirstChar && isNumberChar(Pos[-1])) {
 --Pos;
-if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExpoentChar(Pos[-1]))
+if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExponentChar(Pos[-1]))
   break;
   }
   return Pos;


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


[llvm-commits] [llvm] r46473 - /llvm/tags/Apple/llvmCore-2013/

2008-01-28 Thread Bill Wendling
Author: void
Date: Mon Jan 28 18:18:43 2008
New Revision: 46473

URL: http://llvm.org/viewvc/llvm-project?rev=46473&view=rev
Log:
Creating llvmCore-2013 branch

Added:
llvm/tags/Apple/llvmCore-2013/
  - copied from r46472, llvm/trunk/

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


[llvm-commits] [llvm-gcc-4.2] r46474 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2013/

2008-01-28 Thread Bill Wendling
Author: void
Date: Mon Jan 28 18:18:49 2008
New Revision: 46474

URL: http://llvm.org/viewvc/llvm-project?rev=46474&view=rev
Log:
Creating llvmgcc42-2013 branch

Added:
llvm-gcc-4.2/tags/Apple/llvmgcc42-2013/
  - copied from r46473, llvm-gcc-4.2/trunk/

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


[llvm-commits] [llvm] r46476 - /llvm/trunk/test/CFrontend/2008-01-28-PragmaMark.c

2008-01-28 Thread Bill Wendling
Author: void
Date: Mon Jan 28 18:41:29 2008
New Revision: 46476

URL: http://llvm.org/viewvc/llvm-project?rev=46476&view=rev
Log:
Add test to make sure that #pragma mark/error doesn't error if there are
unbalanced quotes.

Added:
llvm/trunk/test/CFrontend/2008-01-28-PragmaMark.c

Added: llvm/trunk/test/CFrontend/2008-01-28-PragmaMark.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-28-PragmaMark.c?rev=46476&view=auto

==
--- llvm/trunk/test/CFrontend/2008-01-28-PragmaMark.c (added)
+++ llvm/trunk/test/CFrontend/2008-01-28-PragmaMark.c Mon Jan 28 18:41:29 2008
@@ -0,0 +1,6 @@
+// RUN: %llvmgcc -Werror -c %s -o /dev/null
+#pragma mark LLVM's world
+#ifdef DO_ERROR
+#error LLVM's world
+#endif
+int i;


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


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

2008-01-28 Thread Devang Patel
Author: dpatel
Date: Mon Jan 28 19:09:18 2008
New Revision: 46478

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

While selecting union size, select larger field size irrespective of whether 
field is packed or not.

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=46478&r1=46477&r2=46478&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jan 28 19:09:18 2008
@@ -2160,12 +2160,8 @@
   continue;
 
 const Type *TheTy = ConvertType(TREE_TYPE(Field));
-bool isPacked = false;
 unsigned Size  = TD.getABITypeSize(TheTy);
 unsigned Align = TD.getABITypeAlignment(TheTy);
-if (const StructType *STy = dyn_cast(TheTy)) 
-  if (STy->isPacked())
-isPacked = true;
 
 adjustPaddingElement(UnionTy, TheTy);
 
@@ -2181,7 +2177,7 @@
   useTheTy = true;
 else if (MaxAlign == Align && Size > MaxSize)
   useTheTy = true;
-else if (isPacked && Size > MaxSize)
+else if (Size > MaxSize)
   useTheTy = true;
 
 if (useTheTy) {


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


[llvm-commits] [llvm] r46479 - /llvm/trunk/test/CFrontend/2008-01-28-UnionSize.c

2008-01-28 Thread Devang Patel
Author: dpatel
Date: Mon Jan 28 19:10:04 2008
New Revision: 46479

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

Added:
llvm/trunk/test/CFrontend/2008-01-28-UnionSize.c

Added: llvm/trunk/test/CFrontend/2008-01-28-UnionSize.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-28-UnionSize.c?rev=46479&view=auto

==
--- llvm/trunk/test/CFrontend/2008-01-28-UnionSize.c (added)
+++ llvm/trunk/test/CFrontend/2008-01-28-UnionSize.c Mon Jan 28 19:10:04 2008
@@ -0,0 +1,24 @@
+// RUN: %llvmgcc %s -S -o -
+// PR 1861
+
+typedef unsigned char __u8;
+typedef unsigned int __u32;
+typedef unsigned short u16;
+typedef __u32 __le32;
+struct bcm43xx_plcp_hdr6 {
+  union {
+__le32 data;
+__u8 raw[6];
+  }
+__attribute__((__packed__));
+}
+  __attribute__((__packed__));
+struct bcm43xx_txhdr {
+  union {
+struct {
+  struct bcm43xx_plcp_hdr6 plcp;
+};
+  };
+}
+  __attribute__((__packed__));
+static void bcm43xx_generate_rts(struct bcm43xx_txhdr *txhdr ) { }


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


[llvm-commits] [llvm] r46484 - in /llvm/trunk: lib/Transforms/Scalar/LoopIndexSplit.cpp test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll

2008-01-28 Thread Devang Patel
Author: dpatel
Date: Mon Jan 28 20:20:41 2008
New Revision: 46484

URL: http://llvm.org/viewvc/llvm-project?rev=46484&view=rev
Log:
Filter loops that subtract induction variables.
These loops are not yet handled.

Fix PR 1912.

Added:
llvm/trunk/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Jan 28 20:20:41 2008
@@ -301,23 +301,23 @@
   Value *Op0 = I->getOperand(0);
   Value *Op1 = I->getOperand(1);
   
-  if (PHINode *PN = dyn_cast(Op0)) {
-if (PN->getParent() == L->getHeader()
-&& isa(Op1)) {
-  IndVar = PN;
-  IndVarIncrement = I;
-  return;
-}
-  }
-  
-  if (PHINode *PN = dyn_cast(Op1)) {
-if (PN->getParent() == L->getHeader()
-&& isa(Op0)) {
-  IndVar = PN;
-  IndVarIncrement = I;
-  return;
-}
-  }
+  if (PHINode *PN = dyn_cast(Op0)) 
+if (PN->getParent() == L->getHeader()) 
+  if (ConstantInt *CI = dyn_cast(Op1)) 
+if (CI->isOne()) {
+  IndVar = PN;
+  IndVarIncrement = I;
+  return;
+}
+
+  if (PHINode *PN = dyn_cast(Op1)) 
+if (PN->getParent() == L->getHeader()) 
+  if (ConstantInt *CI = dyn_cast(Op0)) 
+if (CI->isOne()) {
+  IndVar = PN;
+  IndVarIncrement = I;
+  return;
+}
   
   return;
 }

Added: llvm/trunk/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll?rev=46484&view=auto

==
--- llvm/trunk/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll (added)
+++ llvm/trunk/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll Mon 
Jan 28 20:20:41 2008
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
+; RUN: not grep "loop-index-split" 
+
+; Induction variable decrement is not yet handled.
+; pr1912.bc
+target datalayout = 
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin9"
+   %struct.cset = type { i8*, i8, i8, i32, i8* }
+   %struct.parse = type { i8*, i8*, i32, i32*, i32, i32, i32, 
%struct.re_guts*, [10 x i32], [10 x i32] }
+   %struct.re_guts = type { i32, i32*, i32, i32, %struct.cset*, i8*, i32, 
i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, i32, i32, [1 x i8] }
+
+define fastcc void @p_bracket(%struct.parse* %p) {
+entry:
+   br i1 false, label %bb160, label %bb195
+
+bb160: ; preds = %entry
+   br i1 false, label %bb.i169, label %bb9.i
+
+bb195: ; preds = %entry
+   ret void
+
+bb.i169:   ; preds = %bb160
+   br i1 false, label %bb372, label %bb565
+
+bb9.i: ; preds = %bb160
+   ret void
+
+bb372: ; preds = %bb418, %bb.i169
+   %i1.0.reg2mem.0 = phi i32 [ %i1.0, %bb418 ], [ 0, %bb.i169 ]
;  [#uses=2]
+   %tmp3.i.i.i170 = icmp ult i32 %i1.0.reg2mem.0, 128  ;  
[#uses=1]
+   br i1 %tmp3.i.i.i170, label %bb.i.i173, label %bb13.i.i
+
+bb.i.i173: ; preds = %bb372
+   br label %bb418
+
+bb13.i.i:  ; preds = %bb372
+   br label %bb418
+
+bb418: ; preds = %bb13.i.i, %bb.i.i173
+   %i1.0 = add i32 %i1.0.reg2mem.0, -1 ;  [#uses=2]
+   %tmp420 = icmp sgt i32 %i1.0, -1;  [#uses=1]
+   br i1 %tmp420, label %bb372, label %bb565
+
+bb565: ; preds = %bb418, %bb.i169
+   ret void
+}


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


[llvm-commits] [llvm] r46485 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp

2008-01-28 Thread Dale Johannesen
Author: johannes
Date: Mon Jan 28 20:21:21 2008
New Revision: 46485

URL: http://llvm.org/viewvc/llvm-project?rev=46485&view=rev
Log:
Handle 'X' constraint in asm's better.


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

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

==
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jan 28 20:21:21 2008
@@ -1006,6 +1006,11 @@
 getRegForInlineAsmConstraint(const std::string &Constraint,
  MVT::ValueType VT) const;
   
+  /// LowerXConstraint - try to replace an X constraint, which matches 
anything,
+  /// with another that has more specific requirements based on the type of the
+  /// corresponding operand.
+  virtual void lowerXConstraint(MVT::ValueType ConstraintVT, 
+std::string&) const;
   
   /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
   /// vector.  If it is invalid, don't add anything to Ops.

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

==
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Jan 28 20:21:21 2008
@@ -1108,9 +1108,10 @@
   // Disassemble the AsmStr, printing out the literal pieces, the operands, 
etc.
   const char *AsmStr = MI->getOperand(NumDefs).getSymbolName();
 
-  // If this asmstr is empty, don't bother printing the #APP/#NOAPP markers.
+  // If this asmstr is empty, just print the #APP/#NOAPP markers.
+  // These are useful to see where empty asm's wound up.
   if (AsmStr[0] == 0) {
-O << "\n";  // Tab already printed, avoid double indenting next instr.
+O << TAI->getInlineAsmStart() << "\n\t" << TAI->getInlineAsmEnd() << "\n";
 return;
   }
   

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jan 28 
20:21:21 2008
@@ -3250,27 +3250,41 @@
   if (Codes.size() == 1) {   // Single-letter constraints ('r') are very 
common.
 ConstraintCode = *Current;
 ConstraintType = CurType;
-return;
+  } else {
+unsigned CurGenerality = getConstraintGenerality(CurType);
+
+// If we have multiple constraints, try to pick the most general one ahead
+// of time.  This isn't a wonderful solution, but handles common cases.
+for (unsigned j = 1, e = Codes.size(); j != e; ++j) {
+  TargetLowering::ConstraintType ThisType = 
TLI.getConstraintType(Codes[j]);
+  unsigned ThisGenerality = getConstraintGenerality(ThisType);
+  if (ThisGenerality > CurGenerality) {
+// This constraint letter is more general than the previous one,
+// use it.
+CurType = ThisType;
+Current = &Codes[j];
+CurGenerality = ThisGenerality;
+  }
+}
+
+ConstraintCode = *Current;
+ConstraintType = CurType;
   }
-  
-  unsigned CurGenerality = getConstraintGenerality(CurType);
-  
-  // If we have multiple constraints, try to pick the most general one ahead
-  // of time.  This isn't a wonderful solution, but handles common cases.
-  for (unsigned j = 1, e = Codes.size(); j != e; ++j) {
-TargetLowering::ConstraintType ThisType = TLI.getConstraintType(Codes[j]);
-unsigned ThisGenerality = getConstraintGenerality(ThisType);
-if (ThisGenerality > CurGenerality) {
-  // This constraint letter is more general than the previous one,
-  // use it.
-  CurType = ThisType;
-  Current = &Codes[j];
-  CurGenerality = ThisGenerality;
+
+  if (ConstraintCode == "X") {
+if (isa(CallOperandVal) || isa(CallOperandVal))
+  return;
+// This matches anything.  Labels and constants we handle elsewhere 
+// ('X' is the only thing that matches labels).  Otherwise, try to 
+// resolve it to something we know about by looking at the actual 
+// operand type.
+std::string s = "";
+TLI.lowerXConstraint(ConstraintVT, s);
+if (s!="") {
+  ConstraintCode = s;
+  ConstraintType = TLI.getCons

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

2008-01-28 Thread Nate Begeman
Author: sampo
Date: Mon Jan 28 20:24:00 2008
New Revision: 46486

URL: http://llvm.org/viewvc/llvm-project?rev=46486&view=rev
Log:
Properly expand extract-element for non-power-of-2 codegen

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=46486&r1=46485&r2=46486&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jan 28 20:24:00 2008
@@ -4405,14 +4405,15 @@
 // This must be an access of the only element.  Return it.
 Op = ScalarizeVectorOp(Vec);
   } else if (!TLI.isTypeLegal(TVT) && isa(Idx)) {
+unsigned NumLoElts =  1 << Log2_32(NumElems-1);
 ConstantSDNode *CIdx = cast(Idx);
 SDOperand Lo, Hi;
 SplitVectorOp(Vec, Lo, Hi);
-if (CIdx->getValue() < NumElems/2) {
+if (CIdx->getValue() < NumLoElts) {
   Vec = Lo;
 } else {
   Vec = Hi;
-  Idx = DAG.getConstant(CIdx->getValue() - NumElems/2,
+  Idx = DAG.getConstant(CIdx->getValue() - NumLoElts,
 Idx.getValueType());
 }
   


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


[llvm-commits] [llvm] r46487 - /llvm/trunk/utils/TableGen/DAGISelEmitter.cpp

2008-01-28 Thread Scott Michel
Author: pingbak
Date: Mon Jan 28 20:29:31 2008
New Revision: 46487

URL: http://llvm.org/viewvc/llvm-project?rev=46487&view=rev
Log:
Fix to bug 1951: tblgen gratuitously renames variables when no temporary was
generated. This feature would only show up in fairly complex patterns, such
as this one in CellSPU:

  def : Pat<(add (SPUhi tconstpool:$in, 0), (SPUlo tconstpool:$in, 0)),
(IOHLlo (ILHUhi tconstpool:$in), tconstpool:$in)>;

which generated the following emit code:

SDNode *Emit_0(const SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType 
VT0, MVT::ValueType VT1) DISABLE_INLINE {
  SDOperand N0 = N.getOperand(0);
  SDOperand N00 = N0.getOperand(0);
  SDOperand N01 = N0.getOperand(1);
  SDOperand N1 = N.getOperand(1);
  SDOperand N10 = N1.getOperand(0);
  SDOperand N11 = N1.getOperand(1);
  SDOperand Tmp3(CurDAG->getTargetNode(Opc0, VT0, N00), 0);
  return CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp3, Tmp2); /* Tmp2 s/b N00 */
}

Tested against the test suites without incident.

Modified:
llvm/trunk/utils/TableGen/DAGISelEmitter.cpp

Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=46487&r1=46486&r2=46487&view=diff

==
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Jan 28 20:29:31 2008
@@ -694,7 +694,9 @@
 std::vector NodeOps;
 // This is something selected from the pattern we matched.
 if (!N->getName().empty()) {
-  std::string &Val = VariableMap[N->getName()];
+  const std::string &VarName = N->getName();
+  std::string Val = VariableMap[VarName];
+  bool ModifiedVal = false;
   assert(!Val.empty() &&
  "Variable referenced but not defined and not caught earlier!");
   if (Val[0] == 'T' && Val[1] == 'm' && Val[2] == 'p') {
@@ -708,6 +710,7 @@
   if (!N->isLeaf() && N->getOperator()->getName() == "imm") {
 assert(N->getExtTypes().size() == 1 && "Multiple types not handled!");
 std::string CastType;
+std::string TmpVar =  "Tmp" + utostr(ResNo);
 switch (N->getTypeNum(0)) {
 default:
   cerr << "Cannot handle " << getEnumName(N->getTypeNum(0))
@@ -719,56 +722,53 @@
 case MVT::i32: CastType = "unsigned"; break;
 case MVT::i64: CastType = "uint64_t"; break;
 }
-emitCode("SDOperand Tmp" + utostr(ResNo) + 
+emitCode("SDOperand " + TmpVar + 
  " = CurDAG->getTargetConstant(((" + CastType +
  ") cast(" + Val + ")->getValue()), " +
  getEnumName(N->getTypeNum(0)) + ");");
-NodeOps.push_back("Tmp" + utostr(ResNo));
 // Add Tmp to VariableMap, so that we don't multiply select this
 // value if used multiple times by this pattern result.
-Val = "Tmp"+utostr(ResNo);
+Val = TmpVar;
+ModifiedVal = true;
+NodeOps.push_back(Val);
   } else if (!N->isLeaf() && N->getOperator()->getName() == 
"texternalsym"){
 Record *Op = OperatorMap[N->getName()];
 // Transform ExternalSymbol to TargetExternalSymbol
 if (Op && Op->getName() == "externalsym") {
-  emitCode("SDOperand Tmp" + utostr(ResNo) + " = CurDAG->getTarget"
+  std::string TmpVar = "Tmp"+utostr(ResNo);
+  emitCode("SDOperand " + TmpVar + " = CurDAG->getTarget"
"ExternalSymbol(cast(" +
Val + ")->getSymbol(), " +
getEnumName(N->getTypeNum(0)) + ");");
-  NodeOps.push_back("Tmp" + utostr(ResNo));
   // Add Tmp to VariableMap, so that we don't multiply select
   // this value if used multiple times by this pattern result.
-  Val = "Tmp"+utostr(ResNo);
-} else {
-  NodeOps.push_back(Val);
+  Val = TmpVar;
+  ModifiedVal = true;
 }
+NodeOps.push_back(Val);
   } else if (!N->isLeaf() && (N->getOperator()->getName() == "tglobaladdr"
  || N->getOperator()->getName() == "tglobaltlsaddr")) {
 Record *Op = OperatorMap[N->getName()];
 // Transform GlobalAddress to TargetGlobalAddress
 if (Op && (Op->getName() == "globaladdr" ||
Op->getName() == "globaltlsaddr")) {
-  emitCode("SDOperand Tmp" + utostr(ResNo) + " = CurDAG->getTarget"
+  std::string TmpVar = "Tmp" + utostr(ResNo);
+  emitCode("SDOperand " + TmpVar + " = CurDAG->getTarget"
"GlobalAddress(cast(" + Val +
")->getGlobal(), " + getEnumName(N->getTypeNum(0)) +
");");
-  NodeOps.push_back("Tmp" + utostr(ResNo));
   // Add Tmp to VariableMap, so that we don't multiply select
   // this value if used multiple times by this pattern result.
-  Val = "Tmp"+utostr(R

[llvm-commits] [llvm] r46488 - /llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp

2008-01-28 Thread Owen Anderson
Author: resistor
Date: Mon Jan 28 20:32:13 2008
New Revision: 46488

URL: http://llvm.org/viewvc/llvm-project?rev=46488&view=rev
Log:
RegAllocBigBlock doesn't need LiveVariables either.

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

Modified: llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp?rev=46488&r1=46487&r2=46488&view=diff

==
--- llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp Mon Jan 28 20:32:13 2008
@@ -97,10 +97,6 @@
 /// etc)
 const MRegisterInfo *RegInfo;
 
-/// LV - Our generic LiveVariables pointer
-///
-LiveVariables *LV;
-
 typedef SmallVector VRegTimes;
 
 /// VRegReadTable - maps VRegs in a BB to the set of times they are read
@@ -182,7 +178,6 @@
 /// getAnalaysisUsage - declares the required analyses
 ///
 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-  AU.addRequired();
   AU.addRequiredID(PHIEliminationID);
   AU.addRequiredID(TwoAddressInstructionPassID);
   MachineFunctionPass::getAnalysisUsage(AU);
@@ -528,9 +523,7 @@
 Ops.push_back(OpNum);
 if(MachineInstr* FMI = TII->foldMemoryOperand(MI, Ops, FrameIndex)) {
   ++NumFolded;
-  // Since we changed the address of MI, make sure to update live variables
-  // to know that the new instruction has the properties of the old one.
-  LV->instructionChanged(MI, FMI);
+  FMI->copyKillDeadInfo(MI);
   return MBB.insert(MBB.erase(MI), FMI);
 }
 
@@ -832,11 +825,8 @@
 
 // Finally, if this is a noop copy instruction, zap it.
 unsigned SrcReg, DstReg;
-if (TII.isMoveInstr(*MI, SrcReg, DstReg) && SrcReg == DstReg) {
-  LV->removeVirtualRegistersKilled(MI);
-  LV->removeVirtualRegistersDead(MI);
+if (TII.isMoveInstr(*MI, SrcReg, DstReg) && SrcReg == DstReg)
   MBB.erase(MI);
-}
   }
 
   MachineBasicBlock::iterator MI = MBB.getFirstTerminator();
@@ -857,7 +847,6 @@
   MF = &Fn;
   TM = &Fn.getTarget();
   RegInfo = TM->getRegisterInfo();
-  LV = &getAnalysis();
 
   PhysRegsUsed.assign(RegInfo->getNumRegs(), -1);
   


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


Re: [llvm-commits] [llvm] r46485 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/SelectionDAG/TargetLowering

2008-01-28 Thread Chris Lattner

On Jan 28, 2008, at 6:21 PM, Dale Johannesen wrote:

> Author: johannes
> Date: Mon Jan 28 20:21:21 2008
> New Revision: 46485
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46485&view=rev
> Log:
> Handle 'X' constraint in asm's better.

Hey Dale,

Can this be done in llvm-gcc?  It seems better to only expose  
'simplified' constraints to the llvm code generator.  This means the  
target hooks would become wonderful macros in i386.h for example, but  
that seems tolerable.

It also might be possible to iterate over the constraint letters  
somehow in GCC, which would make it possible to implement this in a  
target independent way.

What do you think?

-Chris

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


Re: [llvm-commits] [llvm] r46483 - in /llvm/trunk: lib/Target/CellSPU/ test/CodeGen/CellSPU/

2008-01-28 Thread Chris Lattner
On Jan 28, 2008, at 6:31 PM, Owen Anderson wrote:
> I'm getting a build failure after this commit:
>
> llvm[3]: Compiling SPUISelDAGToDAG.cpp for Release build
> SPUGenDAGISel.inc: In member function ‘llvm::SDNode*  
> SPUDAGToDAGISel::Emit_5(const llvm::SDOperand&, unsigned int,  
> unsigned int, llvm::MVT::ValueType, llvm::MVT::ValueType)’:
> SPUGenDAGISel.inc:948: error: ‘Tmp2’ was not declared in this scope

Works for me, is your tree fully up to date?

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


Re: [llvm-commits] [llvm] r46485 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/SelectionDAG/TargetLowering

2008-01-28 Thread Dale Johannesen

On Jan 28, 2008, at 8:29 PM, Chris Lattner wrote:

>
> On Jan 28, 2008, at 6:21 PM, Dale Johannesen wrote:
>
>> Author: johannes
>> Date: Mon Jan 28 20:21:21 2008
>> New Revision: 46485
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=46485&view=rev
>> Log:
>> Handle 'X' constraint in asm's better.
>
> Hey Dale,
>
> Can this be done in llvm-gcc?  It seems better to only expose
> 'simplified' constraints to the llvm code generator.  This means the
> target hooks would become wonderful macros in i386.h for example, but
> that seems tolerable.

Sure, but you'd have to reimplement it in clang (etc).  I think it's  
better to have it in one place.  (If you're thinking we  don't need to  
support this in clang eventually, I don't believe it, alas.)

> It also might be possible to iterate over the constraint letters
> somehow in GCC, which would make it possible to implement this in a
> target independent way.

In llvm you mean maybe?  Could be, I didn't look at that closely.  I  
know there are some collisions between targets of machine-dependent  
constraint letters, but the semantics can't be too different or reload  
would screw up; it might be doable.

That said, I'm not particularly happy with the implementation I wound  
up with, not neat-looking at all and there's probably cases that  
aren't handled the same as gcc.  I don't think there's a silver bullet  
though.

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


Re: [llvm-commits] [llvm] r46485 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/SelectionDAG/TargetLowering

2008-01-28 Thread Chris Lattner

On Jan 28, 2008, at 9:24 PM, Dale Johannesen wrote:
>> Can this be done in llvm-gcc?  It seems better to only expose
>> 'simplified' constraints to the llvm code generator.  This means the
>> target hooks would become wonderful macros in i386.h for example, but
>> that seems tolerable.
>
> Sure, but you'd have to reimplement it in clang (etc).  I think it's
> better to have it in one place.  (If you're thinking we  don't need to
> support this in clang eventually, I don't believe it, alas.)

Right, clang eventually needs full inline asm support, but it also  
needs a lot of other stuff (such as better target parameterization of  
constraints etc) that baking this stuff into the LLVM codegen's don't  
help with.

When we go for full clang inline asm handling, I'm hoping that we'll  
have much better abstractions that GCC does, so this functionality  
won't be hard to support.

>> It also might be possible to iterate over the constraint letters
>> somehow in GCC, which would make it possible to implement this in a
>> target independent way.
>
> In llvm you mean maybe?  Could be, I didn't look at that closely.  I
> know there are some collisions between targets of machine-dependent
> constraint letters, but the semantics can't be too different or reload
> would screw up; it might be doable.

Nope, I meant in GCC.  GCC "knows" the current target (because all the  
#defines are baked in), I don't know if it provides a good way to  
iterate over the target-specific letters though.

> That said, I'm not particularly happy with the implementation I wound
> up with, not neat-looking at all and there's probably cases that
> aren't handled the same as gcc.  I don't think there's a silver bullet
> though.

I agree that there is unlikely to be a silver bullet,

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


[llvm-commits] [llvm] r46492 - /llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 28 23:57:23 2008
New Revision: 46492

URL: http://llvm.org/viewvc/llvm-project?rev=46492&view=rev
Log:
After recent changes we fail to optimize this test
sufficiently to have it pass.  I'm removing it from
the testsuite and adding it to PR452 instead.

Removed:
llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c

Removed: llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c?rev=46491&view=auto

==
--- llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c (original)
+++ llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c (removed)
@@ -1,19 +0,0 @@
-// RUN: %llvmgcc %s -S -O1 -o - | llvm-as | opt -std-compile-opts | llvm-dis | 
not grep add
-
-struct S { int A; int B; char C[1000]; };
-
-int f(struct S x) __attribute__ ((const));
-
-static int __attribute__ ((const)) g(struct S x) {
-   x.A = x.B;
-   return f(x);
-}
-
-int h(void) {
-   struct S x;
-   int r;
-   x.A = 0;
-   x.B = 9;
-   r = g(x);
-   return r + x.A;
-}


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


[llvm-commits] [llvm] r46494 - /llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp

2008-01-28 Thread Owen Anderson
Author: resistor
Date: Tue Jan 29 00:18:36 2008
New Revision: 46494

URL: http://llvm.org/viewvc/llvm-project?rev=46494&view=rev
Log:
Add support for eliminating memcpy's at the end of functions.  Also fix some 
errors I noticed in
the handling of eliminating stores to byval arguments.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Tue Jan 29 
00:18:36 2008
@@ -20,6 +20,7 @@
 #include "llvm/Constants.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
+#include "llvm/IntrinsicInst.h"
 #include "llvm/Pass.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -53,7 +54,7 @@
 bool handleEndBlock(BasicBlock& BB, SetVector& possiblyDead);
 bool RemoveUndeadPointers(Value* pointer,
   BasicBlock::iterator& BBI,
-  SmallPtrSet& deadPointers, 
+  SmallPtrSet& deadPointers, 
   SetVector& possiblyDead);
 void DeleteDeadInstructionChains(Instruction *I,
  SetVector &DeadInsts);
@@ -249,13 +250,17 @@
   bool MadeChange = false;
   
   // Pointers alloca'd in this function are dead in the end block
-  SmallPtrSet deadPointers;
+  SmallPtrSet deadPointers;
   
   // Find all of the alloca'd pointers in the entry block
   BasicBlock *Entry = BB.getParent()->begin();
   for (BasicBlock::iterator I = Entry->begin(), E = Entry->end(); I != E; ++I)
 if (AllocaInst *AI = dyn_cast(I))
   deadPointers.insert(AI);
+  for (Function::arg_iterator AI = BB.getParent()->arg_begin(),
+   AE = BB.getParent()->arg_end(); AI != AE; ++AI)
+if (AI->hasByValAttr())
+  deadPointers.insert(AI);
   
   // Scan the basic block backwards
   for (BasicBlock::iterator BBI = BB.end(); BBI != BB.begin(); ){
@@ -270,10 +275,7 @@
   
 // Alloca'd pointers or byval arguments (which are functionally like
 // alloca's) are valid candidates for removal.
-if ( (isa(pointerOperand) && 
-  deadPointers.count(cast(pointerOperand))) ||
- (isa(pointerOperand) &&
-  cast(pointerOperand)->hasByValAttr())) {
+if (deadPointers.count(pointerOperand)) {
   // Remove it!
   MD.removeInstruction(S);
 
@@ -291,6 +293,32 @@
   }
   
   continue;
+
+// We can also remove memcpy's to local variables at the end of a function
+} else if (MemCpyInst* M = dyn_cast(BBI)) {
+  Value* dest = M->getDest();
+  TranslatePointerBitCasts(dest);
+  
+  if (deadPointers.count(dest)) {
+MD.removeInstruction(M);
+
+// DCE instructions only used to calculate that memcpy
+if (Instruction* D = dyn_cast(M->getSource()))
+  possiblyDead.insert(D);
+if (Instruction* D = dyn_cast(M->getLength()))
+  possiblyDead.insert(D);
+if (Instruction* D = dyn_cast(M->getRawDest()))
+  possiblyDead.insert(D);
+
+BBI++;
+M->eraseFromParent();
+NumFastOther++;
+MadeChange = true;
+
+continue;
+  }
+  
+  // Because a memcpy is also a load, we can't skip it if we didn't remove 
it
 }
 
 Value* killPointer = 0;
@@ -314,8 +342,8 @@
   unsigned other = 0;
   
   // Remove any pointers made undead by the call from the dead set
-  std::vector dead;
-  for (SmallPtrSet::iterator I = deadPointers.begin(),
+  std::vector dead;
+  for (SmallPtrSet::iterator I = deadPointers.begin(),
E = deadPointers.end(); I != E; ++I) {
 // HACK: if we detect that our AA is imprecise, it's not
 // worth it to scan the rest of the deadPointers set.  Just
@@ -328,9 +356,15 @@
 
 // Get size information for the alloca
 unsigned pointerSize = ~0U;
-if (ConstantInt* C = dyn_cast((*I)->getArraySize()))
-  pointerSize = C->getZExtValue() * \
-TD.getABITypeSize((*I)->getAllocatedType());
+if (AllocaInst* A = dyn_cast(*I)) {
+  if (ConstantInt* C = dyn_cast(A->getArraySize()))
+pointerSize = C->getZExtValue() * \
+  TD.getABITypeSize(A->getAllocatedType());
+} else {
+  const PointerType* PT = cast(
+ 
cast(*I)->getType());
+  pointerSize = TD.getABITypeSize(PT->getElementType());
+}
 
 // See if the call site touches it
 AliasAnalysis::ModRefResult A = AA.ge

[llvm-commits] [llvm] r46495 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/CodeGen/ELFWriter.cpp lib/CodeGen/MachOWriter.cpp lib/ExecutionEngine/JIT/JIT.cpp lib/Target/IA64/IA64AsmPrinter.cpp

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Tue Jan 29 00:23:44 2008
New Revision: 46495

URL: http://llvm.org/viewvc/llvm-project?rev=46495&view=rev
Log:
Use getPreferredAlignmentLog or getPreferredAlignment
to get the alignment of global variables, rather than
using hand-made versions.

Modified:
llvm/trunk/include/llvm/Target/TargetData.h
llvm/trunk/lib/CodeGen/ELFWriter.cpp
llvm/trunk/lib/CodeGen/MachOWriter.cpp
llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp
llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp
llvm/trunk/lib/Target/TargetData.cpp

Modified: llvm/trunk/include/llvm/Target/TargetData.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=46495&r1=46494&r2=46495&view=diff

==
--- llvm/trunk/include/llvm/Target/TargetData.h (original)
+++ llvm/trunk/include/llvm/Target/TargetData.h Tue Jan 29 00:23:44 2008
@@ -200,7 +200,7 @@
 
 
   /// getPrefTypeAlignment - Return the preferred stack/global alignment for
-  /// the specified type.
+  /// the specified type.  This is always at least as good as the ABI 
alignment.
   unsigned char getPrefTypeAlignment(const Type *Ty) const;
 
   /// getPreferredTypeAlignmentShift - Return the preferred alignment for the
@@ -230,6 +230,11 @@
   /// avoid a dangling pointer in this cache.
   void InvalidateStructLayoutInfo(const StructType *Ty) const;
 
+  /// getPreferredAlignment - Return the preferred alignment of the specified
+  /// global.  This includes an explicitly requested alignment (if the global
+  /// has one).
+  unsigned getPreferredAlignment(const GlobalVariable *GV) const;
+
   /// getPreferredAlignmentLog - Return the preferred alignment of the
   /// specified global, returned in log form.  This includes an explicitly
   /// requested alignment (if the global has one).

Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=46495&r1=46494&r2=46495&view=diff

==
--- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Tue Jan 29 00:23:44 2008
@@ -257,7 +257,7 @@
   }
 
   const Type *GVType = (const Type*)GV->getType();
-  unsigned Align = TM.getTargetData()->getPrefTypeAlignment(GVType);
+  unsigned Align = TM.getTargetData()->getPreferredAlignment(GV);
   unsigned Size  = TM.getTargetData()->getABITypeSize(GVType);
 
   // If this global has a zero initializer, it is part of the .bss or common

Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=46495&r1=46494&r2=46495&view=diff

==
--- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Tue Jan 29 00:23:44 2008
@@ -334,10 +334,8 @@
 void MachOWriter::AddSymbolToSection(MachOSection *Sec, GlobalVariable *GV) {
   const Type *Ty = GV->getType()->getElementType();
   unsigned Size = TM.getTargetData()->getABITypeSize(Ty);
-  unsigned Align = GV->getAlignment();
-  if (Align == 0)
-Align = TM.getTargetData()->getPrefTypeAlignment(Ty);
-  
+  unsigned Align = TM.getTargetData()->getPreferredAlignment(GV);
+
   // Reserve space in the .bss section for this symbol while maintaining the
   // desired section alignment, which must be at least as much as required by
   // this symbol.

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=46495&r1=46494&r2=46495&view=diff

==
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Tue Jan 29 00:23:44 2008
@@ -355,7 +355,7 @@
 // compilation.
 const Type *GlobalType = GV->getType()->getElementType();
 size_t S = getTargetData()->getABITypeSize(GlobalType);
-size_t A = getTargetData()->getPrefTypeAlignment(GlobalType);
+size_t A = getTargetData()->getPreferredAlignment(GV);
 if (A <= 8) {
   Ptr = malloc(S);
 } else {

Modified: llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp?rev=46495&r1=46494&r2=46495&view=diff

==
--- llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp Tue Jan 29 00:23:44 2008
@@ -271,8 +271,8 @@
   std::string name = Mang->getValueName(I);
   Constant *C = I->getInitializer();
   unsigned Size = TD->getABITypeSize(C->getType());
-  unsigned Align = TD->getPreferredTypeAlignmentShift(C->getType());
-  
+  unsigned A

[llvm-commits] [llvm] r46496 - in /llvm/trunk/test/CodeGen: PowerPC/2008-01-25-EmptyFunction.ll X86/2008-01-25-EmptyFunction.ll

2008-01-28 Thread Chris Lattner
Author: lattner
Date: Tue Jan 29 00:26:07 2008
New Revision: 46496

URL: http://llvm.org/viewvc/llvm-project?rev=46496&view=rev
Log:
Add target triples to these so they don't fail on linux.

Modified:
llvm/trunk/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll
llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll

Modified: llvm/trunk/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll?rev=46496&r1=46495&r2=46496&view=diff

==
--- llvm/trunk/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll Tue Jan 29 
00:26:07 2008
@@ -1,4 +1,6 @@
 ; RUN: llvm-as < %s | llc -march=ppc32 | grep nop
+target triple = "powerpc-apple-darwin8"
+
 
 define void @bork() noreturn nounwind  {
 entry:

Modified: llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll?rev=46496&r1=46495&r2=46496&view=diff

==
--- llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll Tue Jan 29 00:26:07 
2008
@@ -1,4 +1,6 @@
 ; RUN: llvm-as < %s | llc -march=x86 | grep nop
+target triple = "i686-apple-darwin8"
+
 
 define void @bork() noreturn nounwind  {
 entry:


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


[llvm-commits] [llvm] r46493 - /llvm/trunk/test/C++Frontend/2008-01-25-ResultIsParam.cpp

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Tue Jan 29 00:04:54 2008
New Revision: 46493

URL: http://llvm.org/viewvc/llvm-project?rev=46493&view=rev
Log:
This would be better done as an executable test.

Removed:
llvm/trunk/test/C++Frontend/2008-01-25-ResultIsParam.cpp

Removed: llvm/trunk/test/C++Frontend/2008-01-25-ResultIsParam.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/C%2B%2BFrontend/2008-01-25-ResultIsParam.cpp?rev=46492&view=auto

==
--- llvm/trunk/test/C++Frontend/2008-01-25-ResultIsParam.cpp (original)
+++ llvm/trunk/test/C++Frontend/2008-01-25-ResultIsParam.cpp (removed)
@@ -1,23 +0,0 @@
-// RUN: %llvmgcc %s -S -o - | not grep [EMAIL PROTECTED]
-// PR1942
-
-class foo
-{
-public:
-  int a;
-  int b;
-
-  foo(void) : a(0), b(0) {}
-
-  foo(int aa, int bb) : a(aa), b(bb) {}
-
-  const foo operator+(const foo& in) const;
-
-};
-
-const foo foo::operator+(const foo& in) const {
-  foo Out;
-  Out.a = a + in.a;
-  Out.b = b + in.b;
-  return Out;
-}


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


Re: [llvm-commits] [llvm] r46451 - /llvm/trunk/test/CFrontend/2008-01-26-ReadOnlyByVal.c

2008-01-28 Thread Duncan Sands
> This fails with 4.0 on darwin x86.

I've removed it.  With recent changes needed for
byval correctness, it became too hard for the optimizers.
I've added it to PR452 instead.

Ciao,

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


[llvm-commits] [test-suite] r46498 - /test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp

2008-01-28 Thread Duncan Sands
Author: baldrick
Date: Tue Jan 29 00:46:44 2008
New Revision: 46498

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

Added:

test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp

Added: 
test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/2008-01-29-ParamAliasesReturn.cpp?rev=46498&view=auto

==
--- 
test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp 
(added)
+++ 
test-suite/trunk/SingleSource/Regression/C++/2008-01-29-ParamAliasesReturn.cpp 
Tue Jan 29 00:46:44 2008
@@ -0,0 +1,38 @@
+#include 
+
+class foo
+{
+public:
+  int a;
+  int b;
+  int c;
+  int d;
+
+  foo(void) : a(0), b(0) {}
+
+  foo(int aa, int bb) : a(aa), b(bb) {}
+
+  const foo operator+(const foo& in) const;
+
+  foo operator+=(const foo& in);
+};
+
+const foo foo::operator+(const foo& in) const {
+  foo Out;
+  Out.a = a + in.a;
+  Out.b = b + in.b;
+  return Out;
+}
+
+foo foo::operator+=(const foo& in) {
+  *this = *this + in;
+  return *this;
+}
+
+int main() {
+  foo x(1, 2);
+  foo y(3, 4);
+  x += y;
+  printf("%d %d\n", x.a, x.b);
+  return 0;
+}


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


[llvm-commits] [llvm] r46499 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/zero-point-zero-add.ll

2008-01-28 Thread Chris Lattner
Author: lattner
Date: Tue Jan 29 00:52:45 2008
New Revision: 46499

URL: http://llvm.org/viewvc/llvm-project?rev=46499&view=rev
Log:
eliminate additions of 0.0 when they are obviously dead.  This has to be 
careful to
avoid turning -0.0 + 0.0 -> -0.0 which is incorrect.

Added:
llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.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=46499&r1=46498&r2=46499&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Jan 29 
00:52:45 2008
@@ -1943,6 +1943,48 @@
   return ReplaceInstUsesWith(I, NewPN);
 }
 
+
+/// CannotBeNegativeZero - Return true if we can prove that the specified FP 
+/// value is never equal to -0.0.
+///
+/// Note that this function will need to be revisited when we support 
nondefault
+/// rounding modes!
+///
+static bool CannotBeNegativeZero(const Value *V) {
+  if (const ConstantFP *CFP = dyn_cast(V))
+return !CFP->getValueAPF().isNegZero();
+
+  // (add x, 0.0) is guaranteed to return +0.0, not -0.0.
+  if (const Instruction *I = dyn_cast(V)) {
+if (I->getOpcode() == Instruction::Add &&
+isa(I->getOperand(1)) && 
+cast(I->getOperand(1))->isNullValue())
+  return true;
+
+if (const IntrinsicInst *II = dyn_cast(I))
+  if (II->getIntrinsicID() == Intrinsic::sqrt)
+return CannotBeNegativeZero(II->getOperand(1));
+
+if (const CallInst *CI = dyn_cast(I))
+  if (const Function *F = CI->getCalledFunction()) {
+if (F->isDeclaration()) {
+  switch (F->getNameLen()) {
+  case 3:  // abs(x) != -0.0
+if (!strcmp(F->getNameStart(), "abs")) return true;
+break;
+  case 4:  // abs[lf](x) != -0.0
+if (!strcmp(F->getNameStart(), "absf")) return true;
+if (!strcmp(F->getNameStart(), "absl")) return true;
+break;
+  }
+}
+  }
+  }
+  
+  return false;
+}
+
+
 Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
   bool Changed = SimplifyCommutative(I);
   Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
@@ -2160,6 +2202,11 @@
 return new SelectInst(SI->getCondition(), A, N);
 }
   }
+  
+  // Check for X+0.0.  Simplify it to X if we know X is not -0.0.
+  if (ConstantFP *CFP = dyn_cast(RHS))
+if (CFP->getValueAPF().isPosZero() && CannotBeNegativeZero(LHS))
+  return ReplaceInstUsesWith(I, LHS);
 
   return Changed ? &I : 0;
 }

Added: llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll?rev=46499&view=auto

==
--- llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll Tue Jan 29 
00:52:45 2008
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 0.0 | count 1
+
+declare double @abs(double)
+
+define double @test(double %X) {
+  %Y = add double %X, 0.0  ;; Should be a single add x, 0.0
+  %Z = add double %Y, 0.0
+  ret double %Z
+}
+
+define double @test1(double %X) {
+  %Y = call double @abs(double %X)
+  %Z = add double %Y, 0.0
+  ret double %Z
+}


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


Re: [llvm-commits] [llvm] r46497 - /llvm/trunk/test/Transforms/DeadStoreElimination/memcpy.ll

2008-01-28 Thread Chris Lattner

On Jan 28, 2008, at 10:40 PM, Owen Anderson wrote:

> Author: resistor
> Date: Tue Jan 29 00:40:32 2008
> New Revision: 46497
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46497&view=rev
> Log:
> Add a testcase for eliminating memcpy's at the end of functions.   
> Forgot to commit this with my last commit.

Nice, this is definitely progress.  However, 'opt -dse' reduces this  
testcase down to:

define void @_ada_placeholder() nounwind  {
entry:
%an_interval = alloca %struct.placeholder__an_interval___PAD
; < 
%struct.placeholder__an_interval___PAD*> [#uses=3]
%tmp34 = bitcast %struct.placeholder__an_interval___PAD* %an_interval  
to %struct.placeholder__T5b*; <%struct.placeholder__T5b*> [#uses=1]
%tmp5 = getelementptr %struct.placeholder__an_interval___PAD*  
%an_interval, i32 0, i32 0, i32 0   ;  [#uses=1]
store i32 1, i32* %tmp5, align 8
%tmp10 = getelementptr %struct.placeholder__T5b* %tmp34, i32 0, i32  
1, i32 0;  [#uses=1]
store i32 1, i32* %tmp10, align 4
%tmp183185 = bitcast %struct.placeholder__an_interval___PAD*  
%an_interval to i8* ;  [#uses=0]
ret void
}

Why is DSE leaving around dead stores to the stack? :)  Also, it seems  
that DSE would eliminate the trivially dead bitcast at the end as well.

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


Re: [llvm-commits] [llvm] r46499 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/zero-point-zero-add.ll

2008-01-28 Thread Nick Lewycky
Chris Lattner wrote:
> +if (const IntrinsicInst *II = dyn_cast(I))
> +  if (II->getIntrinsicID() == Intrinsic::sqrt)
> +return CannotBeNegativeZero(II->getOperand(1));

"Unlike sqrt in libm, however, llvm.sqrt has undefined behavior for 
negative numbers (which allows for better optimization)."

I think you can safely return true here.

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


[llvm-commits] [llvm] r46497 - /llvm/trunk/test/Transforms/DeadStoreElimination/memcpy.ll

2008-01-28 Thread Owen Anderson
Author: resistor
Date: Tue Jan 29 00:40:32 2008
New Revision: 46497

URL: http://llvm.org/viewvc/llvm-project?rev=46497&view=rev
Log:
Add a testcase for eliminating memcpy's at the end of functions.  Forgot to 
commit this with my last commit.

Added:
llvm/trunk/test/Transforms/DeadStoreElimination/memcpy.ll

Added: llvm/trunk/test/Transforms/DeadStoreElimination/memcpy.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/memcpy.ll?rev=46497&view=auto

==
--- llvm/trunk/test/Transforms/DeadStoreElimination/memcpy.ll (added)
+++ llvm/trunk/test/Transforms/DeadStoreElimination/memcpy.ll Tue Jan 29 
00:40:32 2008
@@ -0,0 +1,52 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep tmp180
+; ModuleID = 'placeholder.adb'
+target datalayout = 
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+   %struct.placeholder__T5b = type { i32, [1 x i32] }
+   %struct.placeholder__an_interval___PAD = type { 
%struct.placeholder__interval, [4 x i32] }
+   %struct.placeholder__interval = type { i32, i32 }
+   %struct.placeholder__s__s__the_interval___PAD = type { 
%struct.placeholder__interval }
+
+define void @_ada_placeholder() nounwind  {
+entry:
+   %an_interval = alloca %struct.placeholder__an_interval___PAD
; <%struct.placeholder__an_interval___PAD*> [#uses=3]
+   %tmp34 = bitcast %struct.placeholder__an_interval___PAD* %an_interval 
to %struct.placeholder__T5b*  ; <%struct.placeholder__T5b*> 
[#uses=1]
+   %tmp5 = getelementptr %struct.placeholder__an_interval___PAD* 
%an_interval, i32 0, i32 0, i32 0 ;  [#uses=2]
+   store i32 1, i32* %tmp5, align 8
+   %tmp10 = getelementptr %struct.placeholder__T5b* %tmp34, i32 0, i32 1, 
i32 0;  [#uses=1]
+   store i32 1, i32* %tmp10, align 4
+   %tmp82 = load i32* %tmp5, align 8   ;  [#uses=5]
+   %tmp83 = icmp slt i32 %tmp82, 6 ;  [#uses=1]
+   %min84 = select i1 %tmp83, i32 %tmp82, i32 5;  
[#uses=3]
+   %tmp85 = icmp sgt i32 %min84, -1;  [#uses=2]
+   %min84.cast193 = zext i32 %min84 to i64 ;  [#uses=1]
+   %min84.cast193.op = shl i64 %min84.cast193, 33  ;  
[#uses=1]
+   %tmp104 = icmp sgt i32 %tmp82, -1   ;  [#uses=2]
+   %tmp103.cast192 = zext i32 %tmp82 to i64;  
[#uses=1]
+   %tmp103.cast192.op = shl i64 %tmp103.cast192, 33;  
[#uses=1]
+   %min84.cast193.op.op = ashr i64 %min84.cast193.op, 28   ;  
[#uses=1]
+   %sextr121 = select i1 %tmp85, i64 %min84.cast193.op.op, i64 0   
;  [#uses=2]
+   %tmp103.cast192.op.op = ashr i64 %tmp103.cast192.op, 28 ;  
[#uses=1]
+   %sextr123 = select i1 %tmp104, i64 %tmp103.cast192.op.op, i64 0 
;  [#uses=2]
+   %tmp124 = icmp sle i64 %sextr121, %sextr123 ;  [#uses=1]
+   %min125 = select i1 %tmp124, i64 %sextr121, i64 %sextr123   
;  [#uses=1]
+   %sextr131194 = and i64 %min125, 34359738336 ;  
[#uses=1]
+   %tmp134 = add i64 %sextr131194, 63  ;  [#uses=1]
+   lshr i64 %tmp134, 3 ; :0 [#uses=1]
+   %tmp150188.shrunk = trunc i64 %0 to i32 ;  [#uses=1]
+   %tmp159 = and i32 %tmp150188.shrunk, -4 ;  [#uses=1]
+   %tmp161 = alloca i8, i32 %tmp159;  [#uses=1]
+   %min167.op = shl i32 %min84, 2  ;  [#uses=1]
+   %tmp170 = select i1 %tmp85, i32 %min167.op, i32 0   ;  
[#uses=2]
+   %tmp173.op = shl i32 %tmp82, 2  ;  [#uses=1]
+   %tmp176 = select i1 %tmp104, i32 %tmp173.op, i32 0  ;  
[#uses=2]
+   %tmp177 = icmp sle i32 %tmp170, %tmp176 ;  [#uses=1]
+   %min178 = select i1 %tmp177, i32 %tmp170, i32 %tmp176   ;  
[#uses=1]
+   %tmp179 = add i32 %min178, 7;  [#uses=1]
+   %tmp180 = and i32 %tmp179, -4   ;  [#uses=1]
+   %tmp183185 = bitcast %struct.placeholder__an_interval___PAD* 
%an_interval to i8*;  [#uses=1]
+   call void @llvm.memcpy.i32( i8* %tmp161, i8* %tmp183185, i32 %tmp180, 
i32 4 )
+   ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind 


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


Re: [llvm-commits] [llvm] r46494 - /llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp

2008-01-28 Thread Chris Lattner
On Jan 28, 2008, at 10:18 PM, Owen Anderson wrote:
> Author: resistor
> Date: Tue Jan 29 00:18:36 2008
> New Revision: 46494
> URL: http://llvm.org/viewvc/llvm-project?rev=46494&view=rev
> Log:
> Add support for eliminating memcpy's at the end of functions.  Also  
> fix some errors I noticed in
> the handling of eliminating stores to byval arguments.

Ooh, coolness.  Testcase please :)

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


Re: [llvm-commits] [llvm] r46499 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/zero-point-zero-add.ll

2008-01-28 Thread Chris Lattner

On Jan 28, 2008, at 10:56 PM, Nick Lewycky wrote:

> Chris Lattner wrote:
>> +if (const IntrinsicInst *II = dyn_cast(I))
>> +  if (II->getIntrinsicID() == Intrinsic::sqrt)
>> +return CannotBeNegativeZero(II->getOperand(1));
>
> "Unlike sqrt in libm, however, llvm.sqrt has undefined behavior for
> negative numbers (which allows for better optimization)."
>
> I think you can safely return true here.

I will clarify LangRef: llvm.sqrt is defined for -0.0.  Thanks!

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


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

2008-01-28 Thread Chris Lattner
Author: lattner
Date: Tue Jan 29 01:00:44 2008
New Revision: 46500

URL: http://llvm.org/viewvc/llvm-project?rev=46500&view=rev
Log:
llvm.sqrt(-0.0) is defined.

Modified:
llvm/trunk/docs/LangRef.html

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

==
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Tue Jan 29 01:00:44 2008
@@ -4677,7 +4677,9 @@
 The 'llvm.sqrt' intrinsics return the sqrt of the specified operand,
 returning the same value as the libm 'sqrt' functions would.  Unlike
 sqrt in libm, however, llvm.sqrt has undefined behavior for
-negative numbers (which allows for better optimization).
+negative numbers other than -0.0 (which allows for better optimization, because
+there is no need to worry about errno being set).  llvm.sqrt(-0.0) is
+defined to return -0.0 like IEEE sqrt.
 
 
 Arguments:


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