Re: [llvm-commits] [llvm] r40723 - in /llvm/trunk/lib/Target/X86: X86ISelDAGToDAG.cpp X86InstrInfo.td

2007-08-02 Thread Evan Cheng

On Aug 1, 2007, at 11:16 PM, Chris Lattner wrote:

>
> On Aug 1, 2007, at 10:48 PM, Evan Cheng wrote:
>
>> Author: evancheng
>> Date: Thu Aug  2 00:48:35 2007
>> New Revision: 40723
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=40723&view=rev
>> Log:
>> Switch some multiplication instructions over to the new scheme for
>> testing.
>
> Do you plan to eventually allow writing the pattern for these
> instructions?

Once I make the necessary tblgen changes the existing patterns should  
just work. I am changing a couple of instructions manually to make  
sure the scheme is feasible.

Evan


>
> -Chris
>
>
>
> ___
> 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] r40736 - in /llvm/trunk: lib/Target/X86/X86InstrMMX.td lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/constant-pool-remat-0.ll

2007-08-02 Thread Dan Gohman
Author: djg
Date: Thu Aug  2 09:27:55 2007
New Revision: 40736

URL: http://llvm.org/viewvc/llvm-project?rev=40736&view=rev
Log:
Mark the SSE and MMX load instructions that
X86InstrInfo::isReallyTriviallyReMaterializable knows how to handle
with the isReMaterializable flag so that it is given a chance to handle
them. Without hoisting constant-pool loads from loops this isn't very
visible, though it does keep CodeGen/X86/constant-pool-remat-0.ll from
making a copy of the constant pool on the stack.

Added:
llvm/trunk/test/CodeGen/X86/constant-pool-remat-0.ll
Modified:
llvm/trunk/lib/Target/X86/X86InstrMMX.td
llvm/trunk/lib/Target/X86/X86InstrSSE.td

Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=40736&r1=40735&r2=40736&view=diff

==
--- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Thu Aug  2 09:27:55 2007
@@ -157,6 +157,7 @@
 // Data Transfer Instructions
 def MMX_MOVD64rr : MMXI<0x6E, MRMSrcReg, (outs VR64:$dst), (ins GR32:$src),
 "movd\t{$src, $dst|$dst, $src}", []>;
+let isReMaterializable = 1 in
 def MMX_MOVD64rm : MMXI<0x6E, MRMSrcMem, (outs VR64:$dst), (ins i32mem:$src),
 "movd\t{$src, $dst|$dst, $src}", []>;
 def MMX_MOVD64mr : MMXI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, VR64:$src),
@@ -167,6 +168,7 @@
 
 def MMX_MOVQ64rr : MMXI<0x6F, MRMSrcReg, (outs VR64:$dst), (ins VR64:$src),
 "movq\t{$src, $dst|$dst, $src}", []>;
+let isReMaterializable = 1 in
 def MMX_MOVQ64rm : MMXI<0x6F, MRMSrcMem, (outs VR64:$dst), (ins i64mem:$src),
 "movq\t{$src, $dst|$dst, $src}",
 [(set VR64:$dst, (load_mmx addr:$src))]>;

Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=40736&r1=40735&r2=40736&view=diff

==
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Aug  2 09:27:55 2007
@@ -280,6 +280,7 @@
 // Move Instructions
 def MOVSSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src),
   "movss\t{$src, $dst|$dst, $src}", []>;
+let isReMaterializable = 1 in
 def MOVSSrm : SSI<0x10, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src),
   "movss\t{$src, $dst|$dst, $src}",
   [(set FR32:$dst, (loadf32 addr:$src))]>;
@@ -569,6 +570,7 @@
 // Move Instructions
 def MOVAPSrr : PSI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
"movaps\t{$src, $dst|$dst, $src}", []>;
+let isReMaterializable = 1 in
 def MOVAPSrm : PSI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src),
"movaps\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (alignedloadv4f32 addr:$src))]>;
@@ -936,6 +938,7 @@
 // Move Instructions
 def MOVSDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src),
   "movsd\t{$src, $dst|$dst, $src}", []>;
+let isReMaterializable = 1 in
 def MOVSDrm : SDI<0x10, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src),
   "movsd\t{$src, $dst|$dst, $src}",
   [(set FR64:$dst, (loadf64 addr:$src))]>;
@@ -1228,6 +1231,7 @@
 // Move Instructions
 def MOVAPDrr : PDI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
"movapd\t{$src, $dst|$dst, $src}", []>;
+let isReMaterializable = 1 in
 def MOVAPDrm : PDI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src),
"movapd\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (alignedloadv2f64 addr:$src))]>;

Added: llvm/trunk/test/CodeGen/X86/constant-pool-remat-0.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/constant-pool-remat-0.ll?rev=40736&view=auto

==
--- llvm/trunk/test/CodeGen/X86/constant-pool-remat-0.ll (added)
+++ llvm/trunk/test/CodeGen/X86/constant-pool-remat-0.ll Thu Aug  2 09:27:55 
2007
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep LCPI | wc -l | grep 3
+
+declare float @qux(float %y)
+
+define float @array(float %a) {
+  %n = mul float %a, 9.0
+  %m = call float @qux(float %n)
+  %o = mul float %m, 9.0
+  ret float %o
+}


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


[llvm-commits] [llvm] r40737 - in /llvm/trunk: lib/Transforms/Scalar/LoopUnswitch.cpp lib/VMCore/Dominators.cpp test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll

2007-08-02 Thread Devang Patel
Author: dpatel
Date: Thu Aug  2 10:25:57 2007
New Revision: 40737

URL: http://llvm.org/viewvc/llvm-project?rev=40737&view=rev
Log:
Update dominator info for the middle blocks created while spliting
exit edge to preserve LCSSA.

Fix dominance frontier update during loop unswitch. This fixes PR 1589, again


Added:
llvm/trunk/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/trunk/lib/VMCore/Dominators.cpp

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Aug  2 10:25:57 2007
@@ -543,17 +543,8 @@
 std::swap(TrueDest, FalseDest);
 
   // Insert the new branch.
-  BranchInst *BRI = new BranchInst(TrueDest, FalseDest, BranchVal, InsertPt);
+  new BranchInst(TrueDest, FalseDest, BranchVal, InsertPt);
 
-  // Update dominator info.
-  // BranchVal is a new preheader so it dominates true and false destination
-  // loop headers.
-  if (DominatorTree *DT = getAnalysisToUpdate()) {
-DT->changeImmediateDominator(TrueDest, BRI->getParent());
-DT->changeImmediateDominator(FalseDest, BRI->getParent());
-  }
-  // No need to update DominanceFrontier. BRI->getParent() dominated TrueDest
-  // and FalseDest anyway. Now it immediately dominates them.
 }
 
 
@@ -635,12 +626,14 @@
 
   // Split all of the edges from inside the loop to their exit blocks.  Update
   // the appropriate Phi nodes as we do so.
+  SmallVector MiddleBlocks;
   for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
 BasicBlock *ExitBlock = ExitBlocks[i];
 std::vector Preds(pred_begin(ExitBlock), pred_end(ExitBlock));
 
 for (unsigned j = 0, e = Preds.size(); j != e; ++j) {
   BasicBlock* MiddleBlock = SplitEdge(Preds[j], ExitBlock, this);
+  MiddleBlocks.push_back(MiddleBlock);
   BasicBlock* StartBlock = Preds[j];
   BasicBlock* EndBlock;
   if (MiddleBlock->getSinglePredecessor() == ExitBlock) {
@@ -685,6 +678,9 @@
   // Add exit blocks to the loop blocks.
   LoopBlocks.insert(LoopBlocks.end(), ExitBlocks.begin(), ExitBlocks.end());
 
+  DominanceFrontier *DF = getAnalysisToUpdate();
+  DominatorTree *DT = getAnalysisToUpdate();
+
   // Next step, clone all of the basic blocks that make up the loop (including
   // the loop preheader and exit blocks), keeping track of the mapping between
   // the instructions and blocks.
@@ -698,16 +694,21 @@
 LPM->cloneBasicBlockSimpleAnalysis(LoopBlocks[i], New, L);
   }
 
-  // Update dominator info
-  DominanceFrontier *DF = getAnalysisToUpdate();
-  if (DominatorTree *DT = getAnalysisToUpdate())
-for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) {
-  BasicBlock *LBB = LoopBlocks[i];
-  BasicBlock *NBB = NewBlocks[i];
-  CloneDomInfo(NBB, LBB, NewPreheader, OrigPreheader, 
-   OrigHeader, DT, DF, ValueMap);
+  // OutSiders are basic block that are dominated by original header and
+  // at the same time they are not part of loop.
+  SmallPtrSet OutSiders;
+  if (DT) {
+DomTreeNode *OrigHeaderNode = DT->getNode(OrigHeader);
+for(std::vector::iterator DI = OrigHeaderNode->begin(), 
+  DE = OrigHeaderNode->end();  DI != DE; ++DI) {
+  BasicBlock *B = (*DI)->getBlock();
+
+  DenseMap::iterator VI = ValueMap.find(B);
+  if (VI == ValueMap.end()) 
+OutSiders.insert(B);
 }
-  
+  }
+
   // Splice the newly inserted blocks into the function right before the
   // original preheader.
   F->getBasicBlockList().splice(LoopBlocks[0], F->getBasicBlockList(),
@@ -759,7 +760,62 @@
   EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR);
   OldBR->eraseFromParent();
   LPM->deleteSimpleAnalysisValue(OldBR, L);
-  
+
+  // Update dominator info
+  if (DF && DT) {
+
+// Clone dominator info for all cloned basic block.
+for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) {
+  BasicBlock *LBB = LoopBlocks[i];
+  BasicBlock *NBB = NewBlocks[i];
+  CloneDomInfo(NBB, LBB, NewPreheader, OrigPreheader, 
+   OrigHeader, DT, DF, ValueMap);
+
+  // Remove any OutSiders from LBB and NBB's dominance frontier.
+  DominanceFrontier::iterator LBBI = DF->find(LBB);
+  if (LBBI != DF->end()) {
+DominanceFrontier::DomSetType &LBSet = LBBI->second;
+for (DominanceFrontier::DomSetType::iterator LI = LBSet.begin(),
+   LE = LBSet.end(); LI != LE; ++LI) {
+  BasicBlock *B = *LI;
+  if (OutSiders.count(B))
+DF->removeFromFrontier(LBBI, B);
+}
+  }
+
+  // Remove any OutSiders from LBB and NBB's dominance frontier.
+  DominanceFrontier::iterator NBBI = DF->find

Re: [llvm-commits] [llvm] r40723 - in /llvm/trunk/lib/Target/X86: X86ISelDAGToDAG.cpp X86InstrInfo.td

2007-08-02 Thread Chris Lattner
On Aug 2, 2007, at 12:03 AM, Evan Cheng wrote:
> On Aug 1, 2007, at 11:16 PM, Chris Lattner wrote:
>> On Aug 1, 2007, at 10:48 PM, Evan Cheng wrote:
>>> Author: evancheng
>>> Date: Thu Aug  2 00:48:35 2007
>>> New Revision: 40723
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=40723&view=rev
>>> Log:
>>> Switch some multiplication instructions over to the new scheme for
>>> testing.
>>
>> Do you plan to eventually allow writing the pattern for these
>> instructions?
>
> Once I make the necessary tblgen changes the existing patterns should
> just work. I am changing a couple of instructions manually to make
> sure the scheme is feasible.

Sounds great Evan, thanks!

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


Re: [llvm-commits] [llvm] r40736 - in /llvm/trunk: lib/Target/X86/X86InstrMMX.td lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/constant-pool-remat-0.ll

2007-08-02 Thread Chris Lattner
> Mark the SSE and MMX load instructions that
> X86InstrInfo::isReallyTriviallyReMaterializable knows how to handle
> with the isReMaterializable flag so that it is given a chance to  
> handle
> them. Without hoisting constant-pool loads from loops this isn't very
> visible, though it does keep CodeGen/X86/constant-pool-remat-0.ll from
> making a copy of the constant pool on the stack.
>
> @@ -0,0 +1,10 @@
> +; RUN: llvm-as < %s | llc -march=x86-64 | grep LCPI | wc -l | grep 3
> +
> +declare float @qux(float %y)
> +
> +define float @array(float %a) {
> +  %n = mul float %a, 9.0
> +  %m = call float @qux(float %n)
> +  %o = mul float %m, 9.0
> +  ret float %o
> +}

Interesting testcase.  I'm now getting:

_array:
 subq$8, %rsp
 movss   LCPI1_0(%rip), %xmm1
 mulss   %xmm1, %xmm0
 call_qux
 movss   LCPI1_0(%rip), %xmm1
 mulss   %xmm1, %xmm0
 addq$8, %rsp
 ret

for this.  Both loads should be folded into the mulss's.  Because the  
load is shared at isel time, this can't be done there, but it can be  
done after the remat.  Maybe the register allocator needs to call  
MRegisterInfo::foldMemoryOperand if the remat is a load that has a  
single use?

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


Re: [llvm-commits] [llvm] r40578 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86CodeEmitter.cpp X86ISelDAGToDAG.cpp X86InstrInfo.td X86InstrX86-64.td X86IntelAsmPrinter.cpp

2007-08-02 Thread Chris Lattner
On Jul 28, 2007, at 6:24 PM, Christopher Lamb wrote:
> Author: clamb
> Date: Sat Jul 28 20:24:57 2007
> New Revision: 40578
>
> URL: http://llvm.org/viewvc/llvm-project?rev=40578&view=rev
> Log:
> Change the x86 backend to use extract_subreg for truncation  
> operations. Passes DejaGnu, SingleSource and MultiSource.

Very nice Christopher!  You removed some seriously ugly hacks :)

-Chris

> Modified:
> llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
> llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
> llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
> llvm/trunk/lib/Target/X86/X86InstrInfo.td
> llvm/trunk/lib/Target/X86/X86InstrX86-64.td
> llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ 
> X86ATTAsmPrinter.cpp?rev=40578&r1=40577&r2=40578&view=diff
>
> == 
> 
> --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jul 28  
> 20:24:57 2007
> @@ -580,29 +580,6 @@
>// See if a truncate instruction can be turned into a nop.
>switch (MI->getOpcode()) {
>default: break;
> -  case X86::TRUNC_64to32:
> -  case X86::TRUNC_64to16:
> -  case X86::TRUNC_32to16:
> -  case X86::TRUNC_32to8:
> -  case X86::TRUNC_16to8:
> -  case X86::TRUNC_32_to8:
> -  case X86::TRUNC_16_to8: {
> -const MachineOperand &MO0 = MI->getOperand(0);
> -const MachineOperand &MO1 = MI->getOperand(1);
> -unsigned Reg0 = MO0.getReg();
> -unsigned Reg1 = MO1.getReg();
> -unsigned Opc = MI->getOpcode();
> -if (Opc == X86::TRUNC_64to32)
> -  Reg1 = getX86SubSuperRegister(Reg1, MVT::i32);
> -else if (Opc == X86::TRUNC_32to16 || Opc == X86::TRUNC_64to16)
> -  Reg1 = getX86SubSuperRegister(Reg1, MVT::i16);
> -else
> -  Reg1 = getX86SubSuperRegister(Reg1, MVT::i8);
> -O << TAI->getCommentString() << " TRUNCATE ";
> -if (Reg0 != Reg1)
> -  O << "\n\t";
> -break;
> -  }
>case X86::PsMOVZX64rr32:
>  O << TAI->getCommentString() << " ZERO-EXTEND " << "\n\t";
>  break;
>
> Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ 
> X86CodeEmitter.cpp?rev=40578&r1=40577&r2=40578&view=diff
>
> == 
> 
> --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Sat Jul 28  
> 20:24:57 2007
> @@ -448,12 +448,6 @@
>return false;
>  }
>
> -inline static bool isX86_64TruncToByte(unsigned oc) {
> -  return (oc == X86::TRUNC_64to8 || oc == X86::TRUNC_32to8 ||
> -  oc == X86::TRUNC_16to8);
> -}
> -
> -
>  inline static bool isX86_64NonExtLowByteReg(unsigned reg) {
>return (reg == X86::SPL || reg == X86::BPL ||
>reg == X86::SIL || reg == X86::DIL);
> @@ -465,7 +459,6 @@
>  unsigned Emitter::determineREX(const MachineInstr &MI) {
>unsigned REX = 0;
>const TargetInstrDescriptor *Desc = MI.getInstrDescriptor();
> -  unsigned Opcode = Desc->Opcode;
>
>// Pseudo instructions do not need REX prefix byte.
>if ((Desc->TSFlags & X86II::FormMask) == X86II::Pseudo)
> @@ -479,16 +472,11 @@
>Desc->getOperandConstraint(1, TOI::TIED_TO) != -1;
>
>  // If it accesses SPL, BPL, SIL, or DIL, then it requires a  
> 0x40 REX prefix.
> -bool isTrunc8 = isX86_64TruncToByte(Opcode);
>  unsigned i = isTwoAddr ? 1 : 0;
>  for (unsigned e = NumOps; i != e; ++i) {
>const MachineOperand& MO = MI.getOperand(i);
>if (MO.isRegister()) {
>  unsigned Reg = MO.getReg();
> -// Trunc to byte are actually movb. The real source  
> operand is the low
> -// byte of the register.
> -if (isTrunc8 && i == 1)
> -  Reg = getX86SubSuperRegister(Reg, MVT::i8);
>  if (isX86_64NonExtLowByteReg(Reg))
>REX |= 0x40;
>}
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ 
> X86ISelDAGToDAG.cpp?rev=40578&r1=40577&r2=40578&view=diff
>
> == 
> 
> --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Sat Jul 28  
> 20:24:57 2007
> @@ -1258,39 +1258,51 @@
>
>return NULL;
>  }
> -
> +
>  case ISD::TRUNCATE: {
> -  if (!Subtarget->is64Bit() && NVT == MVT::i8) {
> -unsigned Opc2;
> -MVT::ValueType VT;
> -switch (Node->getOperand(0).getValueType()) {
> -default: assert(0 && "Unknown truncate!");
> -case MVT::i16:
> -  Opc = X86::MOV16to16_;
> -  VT = MVT::i16;
> -  Opc2 = X86::TRUNC_16_to8;
> -  break;
> -case MVT:

Re: [llvm-commits] [llvm] r40711 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/2007-08-01-NoAliasAndCalls.ll test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll

2007-08-02 Thread Chris Lattner
On Aug 1, 2007, at 6:18 PM, Christopher Lamb wrote:
> Author: clamb
> Teach BasicAA about noalias parameter attributes, but do it  
> correctly this time.

Nice!  One minor style nit-pick:

>if (isa(O1)) {
>  // Incoming argument cannot alias locally allocated object!
>  if (isa(O2)) return NoAlias;
> +
> +// If they are two different objects, and one is a noalias  
> argument
> +// then they do not alias.
> +if (O1 != O2 && isNoAliasArgument(cast(O1)))
> +  return NoAlias;

Instead of using isa + cast, please use dyncast:

if (const Argument *O1Arg = dyn_cast(O1)) {
  // Incoming argument cannot alias locally allocated object!
  if (isa(O2)) return NoAlias;
+
+// If they are two different objects, and one is a noalias  
argument
+// then they do not alias.
+if (O1 != O2 && isNoAliasArgument(O1Arg))
+  return NoAlias;

Thanks Christopher,

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


Re: [llvm-commits] Proposed patch for intrinsic parameter type matching

2007-08-02 Thread Chris Lattner
On Jul 31, 2007, at 11:18 AM, Chandler Carruth wrote:
> This is a patch that I have reworked based on Dan Gohman's original
> patch to be more incremental and address several issues that were  
> raised
> on the -commits list. This does change the Intrinsics.td format and  
> the
> mechanisms for defining new intrinsic functions, and so I would  
> like to
> get some feedback on it before committing it.

> Index: include/llvm/AutoUpgrade.h
> ===
> --- include/llvm/AutoUpgrade.h(revision 0)
> +++ include/llvm/AutoUpgrade.h(revision 0)
> @@ -0,0 +1,43 @@
> +//===-- llvm/Assembly/AutoUpgrade.h - AutoUpgrade Helpers  
> *- C++ -*-===//

The header is not quite correct (llvm/Assembly -> llvm), and is one  
char too long :)

> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file was developed by Reid Spencer is distributed under  
> the University

s/Reid/Chandler/

> +// of Illinois Open Source License. See LICENSE.TXT for details.
> +//
> +// 
> ===--- 
> ---===//
> +//
> +//  These functions are implemented by the lib/VMCore/ 
> AutoUpgrade.cpp.

s/the//

> +//
> +// 
> ===--- 
> ---===//
> +
> +#ifndef LLVM_ASSEMBLY_AUTOUPGRADE_H
> +#define LLVM_ASSEMBLY_AUTOUPGRADE_H

s/ASSEMBLY_//

> +
> +#include 
> +#include 

These two #includes can be removed.

> +namespace llvm {
> +  class Function;
> +  class CallInst;
> +  class Instruction;
> +  class Value;
> +  class BasicBlock;

It doesn't look like Value or Instruction are needed.


> Index: lib/VMCore/AutoUpgrade.cpp
> ===
> --- lib/VMCore/AutoUpgrade.cpp(revision 0)
> +++ lib/VMCore/AutoUpgrade.cpp(revision 0)
> @@ -0,0 +1,243 @@
> +//===-- AutoUpgrade.cpp - Implement auto-upgrade helper functions  
> -===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file was developed by Reid Spencer and is distributed  
> under the

s/Reid/Chandler/

> +// University of Illinois Open Source License. See LICENSE.TXT for  
> details.
> +//
> +// 
> ===--- 
> ---===//
> +//
> +// This file implements the auto-upgrade helper functions
> +//
> +// 
> ===--- 
> ---===//
> +
> +#include "llvm/AutoUpgrade.h"
> +#include "llvm/Constants.h"
> +#include "llvm/DerivedTypes.h"
> +#include "llvm/Function.h"
> +#include "llvm/Module.h"
> +#include "llvm/ValueSymbolTable.h"
> +#include "llvm/Instructions.h"
> +#include "llvm/ParameterAttributes.h"
> +#include "llvm/Intrinsics.h"

Please see if you can prune down this list at all.

> +using namespace llvm;
> +
> +
> +Function* llvm::UpgradeIntrinsicFunction(Function *F) {
> +  assert(F && "Illegal to upgrade a non-existent Function.");
> +
> +  // Get the Function's name.
> +  const std::string& Name = F->getName();
> +
> +  // Convenience
> +  const FunctionType *FTy = F->getFunctionType();
> +
> +  // Quickly eliminate it, if it's not a candidate.
> +  if (Name.length() <= 8 || Name[0] != 'l' || Name[1] != 'l' ||
> +  Name[2] != 'v' || Name[3] != 'm' || Name[4] != '.')
> +return 0;
> +
> +  Module *M = F->getParent();
> +  switch (Name[5]) {
> +  default: break;
> +  case 'b':
> +//  We only care about 'llvm.bswap.i*.i*', so check for  
> 'bswap.' and then
> +//  for there being a '.' after 'bswap.'

Please describe what this does.  For example, something like this  
would be sufficient:

// Upgrade llvm.bswap.i32.i32 -> llvm.bswap.i32.

Likewise for the others.

> +if (Name.compare(5,6,"bswap.",6) == 0) {
> +  std::string::size_type delim = Name.find('.',11);
> +
> +  if (delim != std::string::npos) {
> +//  Construct a new name as 'llvm.bswap' + '.i*'
> +std::string NewName = Name.substr(0,10)+Name.substr(delim);
> +return cast(M->getOrInsertFunction(NewName,
> + F- 
> >getReturnType(),
> + F- 
> >getReturnType(),
> + (Type *)0));

Instead of returning a new function, why not just change the name of  
the existing one?  You're not changing the type of the arguments or  
result here.  This would be more efficient.

Likewise for part.select and part.set.

> +  case 'c':
> +//  We only want to fix intrinsics which do not have the  
> correct return
> +//  type, so we check for the name 'llvm.ct*', and then check  
> if the return
> +//  type does not match the parameter type.
> +if ( (Name.compare(5,5,"ctpop",5) == 0 ||
> +  Name.compare(5,4,"ctlz",4) == 0 ||
> +  Name.compare(5,4,"cttz",4) == 0) &&
> +   

[llvm-commits] [llvm] r40738 - in /llvm/trunk/lib/Transforms/Scalar: CodeGenPrepare.cpp InstructionCombining.cpp LoopStrengthReduce.cpp LoopUnroll.cpp LoopUnswitch.cpp RedundantLoadElimination.cpp Sca

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 11:53:43 2007
New Revision: 40738

URL: http://llvm.org/viewvc/llvm-project?rev=40738&view=rev
Log:
wrap some long lines.  Major offenders that are left include
gvn, gvnpre, dse, and predsimplify.  To see these, use:

  make check-line-length


Modified:
llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp
llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp

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

==
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Thu Aug  2 11:53:43 2007
@@ -396,8 +396,8 @@
 
 /// OptimizeCmpExpression - sink the given CmpInst into user blocks to reduce 
 /// the number of virtual registers that must be created and coalesced.  This 
is
-/// a clear win except on targets with multiple condition code registers 
(powerPC),
-/// where it might lose; some adjustment may be wanted there.
+/// a clear win except on targets with multiple condition code registers
+///  (PowerPC), where it might lose; some adjustment may be wanted there.
 ///
 /// Return true if any changes are made.
 static bool OptimizeCmpExpression(CmpInst *CI){

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

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Aug  2 
11:53:43 2007
@@ -7988,7 +7988,8 @@
 &Args[0], Args.size(), Caller->getName(), Caller);
 cast(NC)->setCallingConv(II->getCallingConv());
   } else {
-NC = new CallInst(Callee, Args.begin(), Args.end(), Caller->getName(), 
Caller);
+NC = new CallInst(Callee, Args.begin(), Args.end(),
+  Caller->getName(), Caller);
 if (cast(Caller)->isTailCall())
   cast(NC)->setTailCall();

cast(NC)->setCallingConv(cast(Caller)->getCallingConv());

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Aug  2 11:53:43 
2007
@@ -651,9 +651,10 @@
 Instruction *InsertPt = PN->getIncomingBlock(i)->getTerminator();
 Code = InsertCodeForBaseAtPosition(NewBase, Rewriter, InsertPt, L);
 
-// Adjust the type back to match the PHI. Note that we can't use 
InsertPt
-// here because the SCEVExpander may have inserted its instructions 
after
-// that point, in its efforts to avoid inserting redundant expressions.
+// Adjust the type back to match the PHI. Note that we can't use
+// InsertPt here because the SCEVExpander may have inserted its
+// instructions after that point, in its efforts to avoid inserting
+// redundant expressions.
 if (isa(PN->getType())) {
   Code = SCEVExpander::InsertCastOfTo(Instruction::IntToPtr,
   Code,

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Thu Aug  2 11:53:43 2007
@@ -41,7 +41,7 @@
 using namespace llvm;
 
 STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
-STATISTIC(NumUnrolled,   "Number of loops unrolled (completely or 
otherwise)");
+STATISTIC(NumUnrolled,"Number of loops unrolled (completely or 
otherwise)");
 
 namespace {
   cl::opt

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

==
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/T

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

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 11:56:32 2007
New Revision: 40739

URL: http://llvm.org/viewvc/llvm-project?rev=40739&view=rev
Log:
Disable an xform that causes an infinite loop.  This fixes PR1594


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=40739&r1=40738&r2=40739&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Aug  2 
11:56:32 2007
@@ -6385,6 +6385,7 @@
   case Instruction::Trunc:
 // If this is the same kind of case as our original (e.g. zext+zext), we
 // can safely eliminate it.
+break;  // FIXME: This causes PR1594
 if (I->getOpcode() == CastOpc) {
   ++NumCastsRemoved;
   return true;


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


[llvm-commits] [llvm] r40740 - /llvm/trunk/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 12:11:24 2007
New Revision: 40740

URL: http://llvm.org/viewvc/llvm-project?rev=40740&view=rev
Log:
Reduced testcase for PR1594

Added:
llvm/trunk/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll

Added: llvm/trunk/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll?rev=40740&view=auto

==
--- llvm/trunk/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll Thu Aug  
2 12:11:24 2007
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR1594
+
+define i64 @test(i16 %tmp510, i16 %tmp512) {
+   %W = sext i16 %tmp510 to i32   ;  [#uses=1]
+%X = sext i16 %tmp512 to i32   ;  [#uses=1]
+%Y = add i32 %W, %X   ;  [#uses=1]
+%Z = sext i32 %Y to i64  ;  [#uses=1]
+   ret i64 %Z
+}


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


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

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 12:23:38 2007
New Revision: 40741

URL: http://llvm.org/viewvc/llvm-project?rev=40741&view=rev
Log:
Replacing a cast with another one does not reduce the number of 
casts in the input.

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=40741&r1=40740&r2=40741&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Aug  2 
12:23:38 2007
@@ -6384,12 +6384,10 @@
   case Instruction::SExt:
   case Instruction::Trunc:
 // If this is the same kind of case as our original (e.g. zext+zext), we
-// can safely eliminate it.
-break;  // FIXME: This causes PR1594
-if (I->getOpcode() == CastOpc) {
-  ++NumCastsRemoved;
+// can safely replace it.  Note that replacing it does not reduce the 
number
+// of casts in the input.
+if (I->getOpcode() == CastOpc)
   return true;
-}
 break;
   default:
 // TODO: Can handle more cases here.


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


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

2007-08-02 Thread Devang Patel
Author: dpatel
Date: Thu Aug  2 12:28:53 2007
New Revision: 40742

URL: http://llvm.org/viewvc/llvm-project?rev=40742&view=rev
Log:
Expand builtin_parity.

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=40742&r1=40741&r2=40742&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Aug  2 12:28:53 2007
@@ -4303,6 +4303,14 @@
 EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
 return true;
   }
+  case BUILT_IN_PARITY: {
+Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctpop); 
+Result = Builder.CreateBinOp(Instruction::And, Result, 
+  TreeConstantToLLVM::ConvertINTEGER_CST(integer_one_node),
+ "tmp");
+return true;
+  }
   case BUILT_IN_POPCOUNT:  // These GCC builtins always return int.
   case BUILT_IN_POPCOUNTL:
   case BUILT_IN_POPCOUNTLL: {


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


[llvm-commits] [llvm] r40743 - /llvm/trunk/test/Transforms/InstCombine/zext-fold.ll

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 12:43:39 2007
New Revision: 40743

URL: http://llvm.org/viewvc/llvm-project?rev=40743&view=rev
Log:
I don't have time to restore this functionality right now.

Modified:
llvm/trunk/test/Transforms/InstCombine/zext-fold.ll

Modified: llvm/trunk/test/Transforms/InstCombine/zext-fold.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/zext-fold.ll?rev=40743&r1=40742&r2=40743&view=diff

==
--- llvm/trunk/test/Transforms/InstCombine/zext-fold.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/zext-fold.ll Thu Aug  2 12:43:39 2007
@@ -1,5 +1,6 @@
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {zext } | wc -l | 
grep 1
 ; PR1570
+; XFAIL: *
 
 define i32 @test2(float %X, float %Y) {
 entry:


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


[llvm-commits] [llvm] r40745 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

2007-08-02 Thread Christopher Lamb
Author: clamb
Date: Thu Aug  2 12:52:00 2007
New Revision: 40745

URL: http://llvm.org/viewvc/llvm-project?rev=40745&view=rev
Log:
Implement review feedback.

Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=40745&r1=40744&r2=40745&view=diff

==
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Thu Aug  2 12:52:00 2007
@@ -311,25 +311,25 @@
   // Pointing at a discernible object?
   if (O1) {
 if (O2) {
-  if (isa(O1)) {
+  if (const Argument *O1Arg = dyn_cast(O1)) {
 // Incoming argument cannot alias locally allocated object!
 if (isa(O2)) return NoAlias;
 
 // If they are two different objects, and one is a noalias argument
 // then they do not alias.
-if (O1 != O2 && isNoAliasArgument(cast(O1)))
+if (O1 != O2 && isNoAliasArgument(O1Arg))
   return NoAlias;
   
 // Otherwise, nothing is known...
   } 
   
-  if (isa(O2)) {
+  if (const Argument *O2Arg = dyn_cast(O2)) {
 // Incoming argument cannot alias locally allocated object!
 if (isa(O1)) return NoAlias;
 
 // If they are two different objects, and one is a noalias argument
 // then they do not alias.
-if (O1 != O2 && isNoAliasArgument(cast(O2)))
+if (O1 != O2 && isNoAliasArgument(O2Arg))
   return NoAlias;
   
 // Otherwise, nothing is known...


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

2007-08-02 Thread Devang Patel

On Aug 2, 2007, at 10:34 AM, Chris Lattner wrote:

>> URL: http://llvm.org/viewvc/llvm-project?rev=40742&view=rev
>> Log:
>> Expand builtin_parity.
>
> Cool:
>
>> +  case BUILT_IN_PARITY: {
>> +Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
>> +EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctpop);
>> +Result = Builder.CreateBinOp(Instruction::And, Result,
>> +  TreeConstantToLLVM::ConvertINTEGER_CST
>> (integer_one_node),
>> + "tmp");
>
> I don't think that ConvertINTEGER_CST will work here: the type of the
> "Result" var and the "1" constant have to match.  I assume that this
> will work for parity of int, but fail on parity of long long etc.

That'd be BUILTIN_IN_PARITYL :)

> Please use:
>
>   ConstantInt::get(Result->getType(), 1)
>
> instead,

I'll fix it.
Thanks,
-
Devang
>
>
> -Chris
>
>
>
> ___
> 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-gcc-4.2] r40742 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

2007-08-02 Thread Chris Lattner
> URL: http://llvm.org/viewvc/llvm-project?rev=40742&view=rev
> Log:
> Expand builtin_parity.

Cool:

> +  case BUILT_IN_PARITY: {
> +Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
> +EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctpop);
> +Result = Builder.CreateBinOp(Instruction::And, Result,
> +  TreeConstantToLLVM::ConvertINTEGER_CST 
> (integer_one_node),
> + "tmp");

I don't think that ConvertINTEGER_CST will work here: the type of the  
"Result" var and the "1" constant have to match.  I assume that this  
will work for parity of int, but fail on parity of long long etc.

Please use:

   ConstantInt::get(Result->getType(), 1)

instead,

-Chris



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


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

2007-08-02 Thread Lauro Ramos Venancio
Author: laurov
Date: Thu Aug  2 12:51:38 2007
New Revision: 40744

URL: http://llvm.org/viewvc/llvm-project?rev=40744&view=rev
Log:
Set the alignment of loads and stores. (PR1548)


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

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=40744&r1=40743&r2=40744&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Aug  2 12:51:38 2007
@@ -1183,13 +1183,19 @@
 /// ptrs, copying all of the elements.
 static void CopyAggregate(Value *DestPtr, Value *SrcPtr, 
   bool isDstVolatile, bool isSrcVolatile,
-  LLVMBuilder &Builder) {
+  unsigned Alignment, LLVMBuilder &Builder) {
   assert(DestPtr->getType() == SrcPtr->getType() &&
  "Cannot copy between two pointers of different type!");
   const Type *ElTy = cast(DestPtr->getType())->getElementType();
+
+  unsigned TypeAlign = getTargetData().getABITypeAlignment(ElTy);
+  Alignment = MIN(Alignment, TypeAlign);
+
   if (ElTy->isFirstClassType()) {
 LoadInst *V = Builder.CreateLoad(SrcPtr, isSrcVolatile, "tmp");
-Builder.CreateStore(V, DestPtr, isDstVolatile);
+StoreInst *S = Builder.CreateStore(V, DestPtr, isDstVolatile);
+V->setAlignment(Alignment);
+S->setAlignment(Alignment);
   } else if (const StructType *STy = dyn_cast(ElTy)) {
 Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
 for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
@@ -1198,7 +1204,8 @@
   Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
   Value *DElPtr = Builder.CreateGEP(DestPtr, Zero, Idx, "tmp");
   Value *SElPtr = Builder.CreateGEP(SrcPtr, Zero, Idx, "tmp");
-  CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile, Builder);
+  CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile, Alignment,
+Builder);
 }
   } else {
 const ArrayType *ATy = cast(ElTy);
@@ -1207,7 +1214,8 @@
   Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
   Value *DElPtr = Builder.CreateGEP(DestPtr, Zero, Idx, "tmp");
   Value *SElPtr = Builder.CreateGEP(SrcPtr, Zero, Idx, "tmp");
-  CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile, Builder);
+  CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile, Alignment,
+Builder);
 }
   }
 }
@@ -1235,7 +1243,8 @@
 /// EmitAggregateCopy - Copy the elements from SrcPtr to DestPtr, using the
 /// GCC type specified by GCCType to know which elements to copy.
 void TreeToLLVM::EmitAggregateCopy(Value *DestPtr, Value *SrcPtr, tree type,
-   bool isDstVolatile, bool isSrcVolatile) {
+   bool isDstVolatile, bool isSrcVolatile,
+   unsigned Alignment) {
   if (DestPtr == SrcPtr && !isDstVolatile && !isSrcVolatile)
 return;  // noop copy.
 
@@ -1254,12 +1263,12 @@
PointerType::get(LLVMTy));
   SrcPtr = CastToType(Instruction::BitCast, SrcPtr, 
   PointerType::get(LLVMTy));
-  CopyAggregate(DestPtr, SrcPtr, isDstVolatile, isSrcVolatile, Builder);
+  CopyAggregate(DestPtr, SrcPtr, isDstVolatile, isSrcVolatile, Alignment,
+Builder);
   return;
 }
   }
   
-  unsigned Alignment = TYPE_ALIGN_OK(type) ? (TYPE_ALIGN_UNIT(type) & ~0U) : 0;
   Value *TypeSize = Emit(TYPE_SIZE_UNIT(type), 0);
   EmitMemCpy(DestPtr, SrcPtr, TypeSize, Alignment);
 }
@@ -2511,14 +2520,17 @@
   const Type *Ty = ConvertType(TREE_TYPE(exp));
   
   if (!LV.isBitfield()) {
-  
+unsigned Alignment = expr_align(exp) / 8;
 if (!DestLoc) {
   // Scalar value: emit a load.
   Value *Ptr = CastToType(Instruction::BitCast, LV.Ptr, 
   PointerType::get(Ty));
-  return Builder.CreateLoad(Ptr, isVolatile, "tmp");
+  LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile, "tmp");
+  LI->setAlignment(Alignment);
+  return LI;
 } else {
-  EmitAggregateCopy(DestLoc, LV.Ptr, TREE_TYPE(exp), false, isVolatile);
+  EmitAggregateCopy(DestLoc, LV.Ptr, TREE_TYPE(exp), false, isVolatile,
+Alignment);
   return 0;
 }
   } else {
@@ -2949,6 +2961,7 @@
   
   LValue LV = EmitLV(TREE_OPERAND(exp, 0));
   bool isVolatile = TREE_THIS_VOLATILE(TREE_OPERAND(exp, 0));
+  unsigned Alignment = expr_align(TREE_OPERAND(exp, 0)) / 8;
 
   if (!LV.isBitfield()) {
 const Type *ValTy = ConvertType(TREE_TYPE(TREE_OPERAND(exp, 1)));
@@ -2961,14 +2974,16 @@
 RHS = CastToAnyType(RHS, Op1Signed, PT->getElementType(), Op0Signed);
   else
 LV.Ptr = BitCastToType(LV.Ptr,

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

2007-08-02 Thread Owen Anderson
Author: resistor
Date: Thu Aug  2 13:11:11 2007
New Revision: 40749

URL: http://llvm.org/viewvc/llvm-project?rev=40749&view=rev
Log:
Fix 80 col. violations.

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=40749&r1=40748&r2=40749&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Thu Aug  2 
13:11:11 2007
@@ -1,4 +1,4 @@
-//===- DeadStoreElimination.cpp - Fast Dead Store Elimination 
--===//
+//===- DeadStoreElimination.cpp - Fast Dead Store Elimination 
-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -47,8 +47,9 @@
 }
 
 bool runOnBasicBlock(BasicBlock &BB);
-bool handleFreeWithNonTrivialDependency(FreeInst* F, Instruction* 
dependency,
-SetVector& 
possiblyDead);
+bool handleFreeWithNonTrivialDependency(FreeInst* F,
+Instruction* dependency,
+SetVector& possiblyDead);
 bool handleEndBlock(BasicBlock& BB, SetVector& possiblyDead);
 bool RemoveUndeadPointers(Value* pointer, unsigned pointerSize,
   BasicBlock::iterator& BBI,
@@ -57,7 +58,8 @@
 void DeleteDeadInstructionChains(Instruction *I,
  SetVector &DeadInsts);
 void TranslatePointerBitCasts(Value*& v) {
-  assert(isa(v->getType()) && "Translating a non-pointer 
type?");
+  assert(isa(v->getType()) &&
+ "Translating a non-pointer type?");
   
   // See through pointer-to-pointer bitcasts
   while (isa(v) || isa(v))
@@ -95,7 +97,8 @@
   bool MadeChange = false;
   
   // Do a top-down walk on the BB
-  for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); BBI != BBE; 
++BBI) {
+  for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end();
+   BBI != BBE; ++BBI) {
 // If we find a store or a free...
 if (isa(BBI) || isa(BBI)) {
   Value* pointer = 0;
@@ -144,7 +147,8 @@
   // Handle frees whose dependencies are non-trivial
   if (FreeInst* F = dyn_cast(BBI))
 if (!deletedStore)
-  MadeChange |= handleFreeWithNonTrivialDependency(F, 
MD.getDependency(F),
+  MadeChange |= handleFreeWithNonTrivialDependency(F,
+   MD.getDependency(F),
possiblyDead);
   
   // Update our most-recent-store map
@@ -173,7 +177,7 @@
 /// handleFreeWithNonTrivialDependency - Handle frees of entire structures 
whose
 /// dependency is a store to a field of that structure
 bool DSE::handleFreeWithNonTrivialDependency(FreeInst* F, Instruction* dep,
-  SetVector& 
possiblyDead) {
+   SetVector& possiblyDead) {
   TargetData &TD = getAnalysis();
   AliasAnalysis &AA = getAnalysis();
   MemoryDependenceAnalysis& MD = getAnalysis();
@@ -187,7 +191,8 @@
 return false;
   
   Value* depPointer = dependency->getPointerOperand();
-  unsigned depPointerSize = 
TD.getTypeSize(dependency->getOperand(0)->getType());
+  const Type* depType = dependency->getOperand(0)->getType();
+  unsigned depPointerSize = TD.getTypeSize(depType);
   
   // Check for aliasing
   AliasAnalysis::AliasResult A = AA.alias(F->getPointerOperand(), ~0UL,
@@ -211,9 +216,10 @@
   return false;
 }
 
-/// handleEndBlock - Remove dead stores to stack-allocated locations in the 
function
-/// end block
-bool DSE::handleEndBlock(BasicBlock& BB, SetVector& 
possiblyDead) {
+/// handleEndBlock - Remove dead stores to stack-allocated locations in the
+/// function end block
+bool DSE::handleEndBlock(BasicBlock& BB,
+ SetVector& possiblyDead) {
   TargetData &TD = getAnalysis();
   AliasAnalysis &AA = getAnalysis();
   MemoryDependenceAnalysis& MD = getAnalysis();
@@ -282,7 +288,8 @@
 // Get size information for the alloca
 unsigned pointerSize = ~0UL;
 if (ConstantInt* C = dyn_cast((*I)->getArraySize()))
-  pointerSize = C->getZExtValue() * 
TD.getTypeSize((*I)->getAllocatedType()); 
+  pointerSize = C->getZExtValue() * \
+TD.getTypeSize((*I)->getAllocatedType()); 
 
 // See if the call site touches it
 AliasAnalysis::ModRefResult A = AA.getModRefInfo(CallSite::get(BBI),
@@ -326,10 +333,12 @@
 // Get size information for the alloca
 unsigned pointerSize = ~0UL;
 if (ConstantInt* C = dyn_cast((*I)->getArraySize()))
-  pointerSize = C->getZExtValue() * 
TD.getTypeSize((*I)

[llvm-commits] [llvm] r40750 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp

2007-08-02 Thread Owen Anderson
Author: resistor
Date: Thu Aug  2 13:16:06 2007
New Revision: 40750

URL: http://llvm.org/viewvc/llvm-project?rev=40750&view=rev
Log:
Fix 80 col. violations.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Thu Aug  2 13:16:06 2007
@@ -146,8 +146,13 @@
 
 namespace llvm {
 template <> struct DenseMapKeyInfo {
-  static inline Expression getEmptyKey() { return 
Expression(Expression::EMPTY); }
-  static inline Expression getTombstoneKey() { return 
Expression(Expression::TOMBSTONE); }
+  static inline Expression getEmptyKey() {
+return Expression(Expression::EMPTY);
+  }
+  
+  static inline Expression getTombstoneKey() {
+return Expression(Expression::TOMBSTONE);
+  }
   
   static unsigned getHashValue(const Expression e) {
 unsigned hash = e.opcode;
@@ -160,8 +165,8 @@
 (unsigned)((uintptr_t)e.type >> 9) +
 hash * 37;
 
-for (SmallVector::const_iterator I = e.varargs.begin(), E = 
e.varargs.end();
- I != E; ++I)
+for (SmallVector::const_iterator I = e.varargs.begin(),
+ E = e.varargs.end(); I != E; ++I)
   hash = *I + hash * 37;
 
 return hash;
@@ -656,7 +661,8 @@
 ValueNumberedSet& currAvail,
 DenseMap& lastSeenLoad,
 SmallVector& toErase);
-bool processNonLocalLoad(LoadInst* L, SmallVector& 
toErase);
+bool processNonLocalLoad(LoadInst* L,
+ SmallVector& toErase);
 Value *GetValueForBlock(BasicBlock *BB, LoadInst* orig,
 DenseMap &Phis,
 bool top_level = false);
@@ -773,7 +779,8 @@
   return PN;
 }
 
-bool GVN::processNonLocalLoad(LoadInst* L, SmallVector& 
toErase) {
+bool GVN::processNonLocalLoad(LoadInst* L,
+  SmallVector& toErase) {
   MemoryDependenceAnalysis& MD = getAnalysis();
   
   DenseMap deps;
@@ -929,7 +936,8 @@
 
 for (BasicBlock::iterator BI = BB->begin(), BE = BB->end();
  BI != BE; ) {
-  changed_function |= processInstruction(BI, currAvail, lastSeenLoad, 
toErase);
+  changed_function |= processInstruction(BI, currAvail,
+ lastSeenLoad, toErase);
   
   NumGVNInstr += toErase.size();
   


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


[llvm-commits] [llvm] r40751 - /llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp

2007-08-02 Thread Owen Anderson
Author: resistor
Date: Thu Aug  2 13:20:52 2007
New Revision: 40751

URL: http://llvm.org/viewvc/llvm-project?rev=40751&view=rev
Log:
Fix 80 col. violations.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp Thu Aug  2 13:20:52 2007
@@ -156,8 +156,13 @@
 
 namespace llvm {
 template <> struct DenseMapKeyInfo {
-  static inline Expression getEmptyKey() { return 
Expression(Expression::EMPTY); }
-  static inline Expression getTombstoneKey() { return 
Expression(Expression::TOMBSTONE); }
+  static inline Expression getEmptyKey() {
+return Expression(Expression::EMPTY);
+  }
+  
+  static inline Expression getTombstoneKey() {
+return Expression(Expression::TOMBSTONE);
+  }
   
   static unsigned getHashValue(const Expression e) {
 unsigned hash = e.opcode;
@@ -170,8 +175,8 @@
 (unsigned)((uintptr_t)e.type >> 9) +
 hash * 37;
 
-for (SmallVector::const_iterator I = e.varargs.begin(), E = 
e.varargs.end();
- I != E; ++I)
+for (SmallVector::const_iterator I = e.varargs.begin(),
+ E = e.varargs.end(); I != E; ++I)
   hash = *I + hash * 37;
 
 return hash;
@@ -723,7 +728,7 @@
 FunctionPass *llvm::createGVNPREPass() { return new GVNPRE(); }
 
 static RegisterPass X("gvnpre",
-  "Global Value Numbering/Partial Redundancy 
Elimination");
+  "Global Value Numbering/Partial Redundancy Elimination");
 
 
 STATISTIC(NumInsertedVals, "Number of values inserted");
@@ -1223,7 +1228,8 @@
   isa(BI) || isa(BI) ||
   isa(BI) || isa(BI)) {
 
-if (availableOut[BB].test(VN.lookup(BI)) && 
!availableOut[BB].count(BI)) {
+if (availableOut[BB].test(VN.lookup(BI)) &&
+!availableOut[BB].count(BI)) {
   Value *leader = find_leader(availableOut[BB], VN.lookup(BI));
   if (Instruction* Instr = dyn_cast(leader))
 if (Instr->getParent() != 0 && Instr != BI) {
@@ -1243,8 +1249,8 @@
 changed_function = true;
   }
 
-  for (SmallVector::iterator I = erase.begin(), E = 
erase.end();
-   I != E; ++I)
+  for (SmallVector::iterator I = erase.begin(),
+   E = erase.end(); I != E; ++I)
  (*I)->eraseFromParent();
   
   return changed_function;


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


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

2007-08-02 Thread Devang Patel
Author: dpatel
Date: Thu Aug  2 13:02:46 2007
New Revision: 40747

URL: http://llvm.org/viewvc/llvm-project?rev=40747&view=rev
Log:
Expand builtin_parityl().


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=40747&r1=40746&r2=40747&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Aug  2 13:02:46 2007
@@ -4320,12 +4320,12 @@
 EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
 return true;
   }
+  case BUILT_IN_PARITYL:
   case BUILT_IN_PARITY: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
 EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctpop); 
 Result = Builder.CreateBinOp(Instruction::And, Result, 
-  TreeConstantToLLVM::ConvertINTEGER_CST(integer_one_node),
- "tmp");
+ ConstantInt::get(Result->getType(), 1), 
"tmp");
 return true;
   }
   case BUILT_IN_POPCOUNT:  // These GCC builtins always return int.


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


[llvm-commits] [llvm-gcc-4.2] r40752 - /llvm-gcc-4.2/trunk/gcc/config/i386/darwin-libgcc.10.5.ver

2007-08-02 Thread Devang Patel
Author: dpatel
Date: Thu Aug  2 13:35:29 2007
New Revision: 40752

URL: http://llvm.org/viewvc/llvm-project?rev=40752&view=rev
Log:
Propagate LLVM fixmes from 10.4.ver to 10.5.ver


Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/darwin-libgcc.10.5.ver

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin-libgcc.10.5.ver
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin-libgcc.10.5.ver?rev=40752&r1=40751&r2=40752&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/i386/darwin-libgcc.10.5.ver (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin-libgcc.10.5.ver Thu Aug  2 
13:35:29 2007
@@ -44,15 +44,19 @@
 ___fixunsdfsi
 ___fixunssfdi
 ___fixunssfsi
-___fixunsxfdi
-___fixunsxfsi
-___fixxfdi
+# LLVM LOCAL begin FIXME!
+#___fixunsxfdi
+#___fixunsxfsi
+#___fixxfdi
+# LLVM LOCAL end FIXME!
 ___floatdidf
 ___floatdisf
-___floatdixf
+# LLVM LOCAL FIXME!
+#___floatdixf
 ___floatundidf
 ___floatundisf
-___floatundixf
+# LLVM LOCAL FIXME!
+#___floatundixf
 ___gcc_personality_v0
 ___lshrdi3
 ___moddi3


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


[llvm-commits] [llvm] r40748 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 13:08:16 2007
New Revision: 40748

URL: http://llvm.org/viewvc/llvm-project?rev=40748&view=rev
Log:
don't redefine a parameter

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

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

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Aug  2 
13:08:16 2007
@@ -4031,7 +4031,7 @@
   SDOperand Res = DAG.getNode(ISD::CALL,
   DAG.getVTList(&RetTys[0], NumRegs + 1),
   &Ops[0], Ops.size());
-  SDOperand Chain = Res.getValue(NumRegs);
+  Chain = Res.getValue(NumRegs);
 
   // Gather up the call result into a single value.
   if (RetTy != Type::VoidTy) {


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


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

2007-08-02 Thread Devang Patel
Author: dpatel
Date: Thu Aug  2 13:38:54 2007
New Revision: 40753

URL: http://llvm.org/viewvc/llvm-project?rev=40753&view=rev
Log:
Don't forget BUILT_IN_PARITYLL.

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=40753&r1=40752&r2=40753&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Aug  2 13:38:54 2007
@@ -4320,6 +4320,7 @@
 EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
 return true;
   }
+  case BUILT_IN_PARITYLL:
   case BUILT_IN_PARITYL:
   case BUILT_IN_PARITY: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);


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


[llvm-commits] [llvm] r40746 - in /llvm/trunk/lib: Analysis/MemoryDependenceAnalysis.cpp Transforms/Scalar/GVN.cpp

2007-08-02 Thread Owen Anderson
Author: resistor
Date: Thu Aug  2 12:56:05 2007
New Revision: 40746

URL: http://llvm.org/viewvc/llvm-project?rev=40746&view=rev
Log:
Fix a bug that was causing several miscompilations on SPEC.

Modified:
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=40746&r1=40745&r2=40746&view=diff

==
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Thu Aug  2 12:56:05 
2007
@@ -111,19 +111,31 @@
   while (!stack.empty()) {
 BasicBlock* BB = stack.back();
 
-visited.insert(BB);
-
-if (resp.count(BB)) {
+if (visited.count(BB)) {
   stack.pop_back();
   continue;
 }
 
 if (BB != block) {
+  visited.insert(BB);
+  
   Instruction* localDep = getDependency(query, 0, BB);
   if (localDep != NonLocal) {
 resp.insert(std::make_pair(BB, localDep));
+stack.pop_back();
+
 continue;
   }
+} else if (BB == block && stack.size() > 1) {
+  visited.insert(BB);
+  
+  Instruction* localDep = getDependency(query, 0, BB);
+  if (localDep != query)
+resp.insert(std::make_pair(BB, localDep));
+  
+  stack.pop_back();
+  
+  continue;
 }
 
 bool predOnStack = false;

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

==
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Thu Aug  2 12:56:05 2007
@@ -658,7 +658,8 @@
 SmallVector& toErase);
 bool processNonLocalLoad(LoadInst* L, SmallVector& 
toErase);
 Value *GetValueForBlock(BasicBlock *BB, LoadInst* orig,
-  DenseMap &Phis);
+DenseMap &Phis,
+bool top_level = false);
 void dump(DenseMap& d);
   };
   
@@ -715,11 +716,12 @@
 /// GetValueForBlock - Get the value to use within the specified basic block.
 /// available values are in Phis.
 Value *GVN::GetValueForBlock(BasicBlock *BB, LoadInst* orig,
-   DenseMap &Phis) { 
+   DenseMap &Phis,
+   bool top_level) { 
  
   // If we have already computed this value, return the previously computed 
val.
   Value *&V = Phis[BB];
-  if (V) return V;
+  if (V && ! top_level) return V;
   
   BasicBlock* singlePred = BB->getSinglePredecessor();
   if (singlePred)
@@ -799,7 +801,7 @@
 }
   
   SmallPtrSet visited;
-  Value* v = GetValueForBlock(L->getParent(), L, repl);
+  Value* v = GetValueForBlock(L->getParent(), L, repl, true);
   
   MD.removeInstruction(L);
   L->replaceAllUsesWith(v);


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


Re: [llvm-commits] [llvm] r40736 - in /llvm/trunk: lib/Target/X86/X86InstrMMX.td lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/constant-pool-remat-0.ll

2007-08-02 Thread Evan Cheng
Yes, I'll look into that.

Evan

On Aug 2, 2007, at 8:50 AM, Chris Lattner wrote:

>> Mark the SSE and MMX load instructions that
>> X86InstrInfo::isReallyTriviallyReMaterializable knows how to handle
>> with the isReMaterializable flag so that it is given a chance to
>> handle
>> them. Without hoisting constant-pool loads from loops this isn't very
>> visible, though it does keep CodeGen/X86/constant-pool-remat-0.ll  
>> from
>> making a copy of the constant pool on the stack.
>>
>> @@ -0,0 +1,10 @@
>> +; RUN: llvm-as < %s | llc -march=x86-64 | grep LCPI | wc -l | grep 3
>> +
>> +declare float @qux(float %y)
>> +
>> +define float @array(float %a) {
>> +  %n = mul float %a, 9.0
>> +  %m = call float @qux(float %n)
>> +  %o = mul float %m, 9.0
>> +  ret float %o
>> +}
>
> Interesting testcase.  I'm now getting:
>
> _array:
> subq$8, %rsp
> movss   LCPI1_0(%rip), %xmm1
> mulss   %xmm1, %xmm0
> call_qux
> movss   LCPI1_0(%rip), %xmm1
> mulss   %xmm1, %xmm0
> addq$8, %rsp
> ret
>
> for this.  Both loads should be folded into the mulss's.  Because the
> load is shared at isel time, this can't be done there, but it can be
> done after the remat.  Maybe the register allocator needs to call
> MRegisterInfo::foldMemoryOperand if the remat is a load that has a
> single use?
>
> -Chris
> ___
> 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] r40754 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td

2007-08-02 Thread Dan Gohman
Author: djg
Date: Thu Aug  2 16:06:40 2007
New Revision: 40754

URL: http://llvm.org/viewvc/llvm-project?rev=40754&view=rev
Log:
Fix pastos in vector arithmetic intrinsics.

Modified:
llvm/trunk/lib/Target/X86/X86InstrSSE.td

Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=40754&r1=40753&r2=40754&view=diff

==
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Aug  2 16:06:40 2007
@@ -553,7 +553,7 @@
   }
 
   // Vector intrinsic operation, reg+mem.
-  def PSrm_Int : PSI;
 }
@@ -711,7 +711,7 @@
   }
 
   // Vector intrinsic operation, mem
-  def PSm_Int : PSI;
 }
@@ -1214,7 +1214,7 @@
   }
 
   // Vector intrinsic operation, reg+mem.
-  def PDrm_Int : PDI;
 }
@@ -1468,7 +1468,7 @@
   }
 
   // Vector intrinsic operation, mem
-  def PDm_Int : PDI;
 }


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


[llvm-commits] [llvm-gcc-4.0] r40755 - in /llvm-gcc-4.0/trunk: build_gcc gcc/Makefile.in

2007-08-02 Thread Bill Wendling
Author: void
Date: Thu Aug  2 16:13:45 2007
New Revision: 40755

URL: http://llvm.org/viewvc/llvm-project?rev=40755&view=rev
Log:
Hack to force MacOS X to use the system libgcc_s instead of
the one built by LLVM during bootstrapping.

Modified:
llvm-gcc-4.0/trunk/build_gcc
llvm-gcc-4.0/trunk/gcc/Makefile.in

Modified: llvm-gcc-4.0/trunk/build_gcc
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/build_gcc?rev=40755&r1=40754&r2=40755&view=diff

==
--- llvm-gcc-4.0/trunk/build_gcc (original)
+++ llvm-gcc-4.0/trunk/build_gcc Thu Aug  2 16:13:45 2007
@@ -424,35 +424,6 @@
 .$DEST_ROOT/lib/gcc || exit 1
 done
 
-SHARED_LIBS="libgcc_s.1.dylib libgcc_s.10.4.dylib libgcc_s.10.5.dylib"
-if echo $HOSTS | grep -q powerpc ; then
-  SHARED_LIBS="${SHARED_LIBS} libgcc_s_ppc64.1.dylib"
-fi
-# APPLE LOCAL begin x86_64 support */
-if echo $HOSTS | grep -q i686 ; then
-  SHARED_LIBS="${SHARED_LIBS} libgcc_s_x86_64.1.dylib"
-fi
-# APPLE LOCAL end x86_64 support */
-for l in $SHARED_LIBS ; do
-  CANDIDATES=()
-  for t in $TARGETS ; do
-# APPLE LOCAL LLVM build_gcc bug with non-/usr $DEST_ROOT
-if [ -e $DIR/dst-$t-$t/$DEST_ROOT/lib/$l ] ; then
-# APPLE LOCAL LLVM build_gcc bug with non-/usr $DEST_ROOT
-  CANDIDATES[${#CANDIDATES[*]}]=$DIR/dst-$t-$t/$DEST_ROOT/lib/$l
-fi
-  done
-# APPLE LOCAL LLVM CANDIDATES can be empty!
-  if [ "[EMAIL PROTECTED]" != x ]; then
-  if [ -L ${CANDIDATES[0]} ] ; then
-ln -s `readlink ${CANDIDATES[0]}` .$DEST_ROOT/lib/$l || exit 1
-  else
-lipo -output .$DEST_ROOT/lib/$l -create "[EMAIL PROTECTED]" || exit 1
-  fi
-# APPLE LOCAL LLVM CANDIDATES can be empty!
-  fi
-done
-
 for t in $TARGETS ; do
   cp -p /usr/lib/libstdc++.6.dylib \
 .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib \

Modified: llvm-gcc-4.0/trunk/gcc/Makefile.in
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/Makefile.in?rev=40755&r1=40754&r2=40755&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/Makefile.in (original)
+++ llvm-gcc-4.0/trunk/gcc/Makefile.in Thu Aug  2 16:13:45 2007
@@ -4079,7 +4079,7 @@
 # The stage1 compiler is always built with checking enabled.
 stage1_build:
if test "${SET_DYLIB_PATH}" = "1"; then \
- DYLD_LIBRARY_PATH="`${PWD_COMMAND}`"; \
+ DYLD_LIBRARY_PATH="/usr/lib:`${PWD_COMMAND}`"; \
fi; \
$(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" \
CFLAGS="$(STAGE1_CFLAGS) $(STAGE1_CHECKING)" \
@@ -4095,11 +4095,15 @@
echo stage2_build > stage_last
 
 stage2_build: stage1_copy
-   $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ 
-B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) 
-Bstage1/ -B$(build_tooldir)/bin/" \
-STAGE_PREFIX=stage1/ \
-$(POSTSTAGE1_FLAGS_TO_PASS) \
-$(STAGE2_FLAGS_TO_PASS) \
-LLVM_STAGE="-stage2"
+   if test "${SET_DYLIB_PATH}" = "1"; then \
+ DYLD_LIBRARY_PATH="/usr/lib:`${PWD_COMMAND}`"; \
+   fi; \
+   $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ 
-B$(build_tooldir)/bin/" \
+   CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) 
-Bstage1/ -B$(build_tooldir)/bin/" \
+   STAGE_PREFIX=stage1/ \
+   $(POSTSTAGE1_FLAGS_TO_PASS) \
+   $(STAGE2_FLAGS_TO_PASS) \
+   LLVM_STAGE="-stage2"
$(STAMP) stage2_build
echo stage2_build > stage_last
 
@@ -4109,11 +4113,15 @@
echo stage3_build > stage_last
 
 stageprofile_build: stage1_copy
-   $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ 
-B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) 
-Bstage1/ -B$(build_tooldir)/bin/" \
-STAGE_PREFIX=stage1/ \
-$(POSTSTAGE1_FLAGS_TO_PASS) \
-$(STAGEPROFILE_FLAGS_TO_PASS) \
-LLVM_STAGE="-stage_profile"
+   if test "${SET_DYLIB_PATH}" = "1"; then \
+ DYLD_LIBRARY_PATH="/usr/lib:`${PWD_COMMAND}`"; \
+   fi; \
+   $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ 
-B$(build_tooldir)/bin/" \
+   CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) 
-Bstage1/ -B$(build_tooldir)/bin/" \
+   STAGE_PREFIX=stage1/ \
+   $(POSTSTAGE1_FLAGS_TO_PASS) \
+   $(STAGEPROFILE_FLAGS_TO_PASS) \
+   LLVM_STAGE="-stage_profile"
$(STAMP) stageprofile_build
echo stageprofile_build > stage_last
 
@@ -4123,20 +4131,28 @@
echo stagefeedback_build > stage_last
 
 stage3_build: stage2_copy
-   $(MAKE) CC="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) -Bstage2/ 
-B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) 
-Bstage2/ -B$(build_tooldir)/bin/" \
- 

[llvm-commits] [llvm] r40756 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse-align-12.ll

2007-08-02 Thread Dan Gohman
Author: djg
Date: Thu Aug  2 16:17:01 2007
New Revision: 40756

URL: http://llvm.org/viewvc/llvm-project?rev=40756&view=rev
Log:
Fix the alignment requirements of several unpck and shuf instructions.
Generalize isPSHUFDMask and add a unary SHUFPD pattern so that SHUFPD's
memory operand alignment can be tested as well, with a fix to avoid
breaking MMX's use of isPSHUFDMask.

Added:
llvm/trunk/test/CodeGen/X86/sse-align-12.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86InstrSSE.td

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=40756&r1=40755&r2=40756&view=diff

==
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Aug  2 16:17:01 2007
@@ -1578,7 +1578,7 @@
 bool X86::isPSHUFDMask(SDNode *N) {
   assert(N->getOpcode() == ISD::BUILD_VECTOR);
 
-  if (N->getNumOperands() != 4)
+  if (N->getNumOperands() != 2 && N->getNumOperands() != 4)
 return false;
 
   // Check if the value doesn't reference the second vector.
@@ -1586,7 +1586,7 @@
 SDOperand Arg = N->getOperand(i);
 if (Arg.getOpcode() == ISD::UNDEF) continue;
 assert(isa(Arg) && "Invalid VECTOR_SHUFFLE mask!");
-if (cast(Arg)->getValue() >= 4)
+if (cast(Arg)->getValue() >= e)
   return false;
   }
 
@@ -2767,7 +2767,10 @@
 
   // If VT is integer, try PSHUF* first, then SHUFP*.
   if (MVT::isInteger(VT)) {
-if (X86::isPSHUFDMask(PermMask.Val) ||
+// MMX doesn't have PSHUFD; it does have PSHUFW. While it's theoretically
+// possible to shuffle a v2i32 using PSHUFW, that's not yet implemented.
+if (((MVT::getSizeInBits(VT) != 64 || NumElems == 4) &&
+ X86::isPSHUFDMask(PermMask.Val)) ||
 X86::isPSHUFHWMask(PermMask.Val) ||
 X86::isPSHUFLWMask(PermMask.Val)) {
   if (V2.getOpcode() != ISD::UNDEF)

Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=40756&r1=40755&r2=40756&view=diff

==
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Aug  2 16:17:01 2007
@@ -808,7 +808,7 @@
 "shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}",
 [(set VR128:$dst,
   (v4f32 (vector_shuffle
-  VR128:$src1, (load addr:$src2),
+  VR128:$src1, (memopv4f32 addr:$src2),
   SHUFP_shuffle_mask:$src3)))]>;
 
   let AddedComplexity = 10 in {
@@ -824,7 +824,7 @@
  "unpckhps\t{$src2, $dst|$dst, $src2}",
  [(set VR128:$dst,
(v4f32 (vector_shuffle
-   VR128:$src1, (load addr:$src2),
+   VR128:$src1, (memopv4f32 addr:$src2),
UNPCKH_shuffle_mask)))]>;
 
 def UNPCKLPSrr : PSI<0x14, MRMSrcReg, 
@@ -839,7 +839,7 @@
  "unpcklps\t{$src2, $dst|$dst, $src2}",
  [(set VR128:$dst,
(v4f32 (vector_shuffle
-   VR128:$src1, (load addr:$src2),
+   VR128:$src1, (memopv4f32 addr:$src2),
UNPCKL_shuffle_mask)))]>;
   } // AddedComplexity
 } // isTwoAddress
@@ -1561,7 +1561,7 @@
 "shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}",
 [(set VR128:$dst,
   (v2f64 (vector_shuffle
-  VR128:$src1, (load addr:$src2),
+  VR128:$src1, (memopv2f64 addr:$src2),
   SHUFP_shuffle_mask:$src3)))]>;
 
   let AddedComplexity = 10 in {
@@ -1577,7 +1577,7 @@
  "unpckhpd\t{$src2, $dst|$dst, $src2}",
  [(set VR128:$dst,
(v2f64 (vector_shuffle
-   VR128:$src1, (load addr:$src2),
+   VR128:$src1, (memopv2f64 addr:$src2),
UNPCKH_shuffle_mask)))]>;
 
 def UNPCKLPDrr : PDI<0x14, MRMSrcReg, 
@@ -1592,7 +1592,7 @@
  "unpcklpd\t{$src2, $dst|$dst, $src2}",
  [(set VR128:$dst,
(v2f64 (vector_shuffle
-   VR128:$src1, (load addr:$src2),
+   VR128:$src1, (memopv2f64 addr:$src2),
UNPCKL_shuffle_mask)))]>;
   } // AddedComplexity
 } // isTwoAddress

Re: [llvm-commits] [llvm-gcc-4.0] r40755 - in /llvm-gcc-4.0/trunk: build_gcc gcc/Makefile.in

2007-08-02 Thread Bill Wendling
On 8/2/07, Bill Wendling <[EMAIL PROTECTED]> wrote:
> Author: void
> Date: Thu Aug  2 16:13:45 2007
> New Revision: 40755
>
> URL: http://llvm.org/viewvc/llvm-project?rev=40755&view=rev
> Log:
> Hack to force MacOS X to use the system libgcc_s instead of
> the one built by LLVM during bootstrapping.
>
I'm intentionally *not* putting this in the llvm-gcc 4.2 branch as it
shouldn't be needed.

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


[llvm-commits] [llvm] r40757 - in /llvm/trunk/lib: CodeGen/BranchFolding.cpp CodeGen/VirtRegMap.h Target/ARM/ARMISelLowering.h Target/Alpha/AlphaISelLowering.h Target/IA64/IA64ISelLowering.h Target/Mi

2007-08-02 Thread Dan Gohman
Author: djg
Date: Thu Aug  2 16:21:54 2007
New Revision: 40757

URL: http://llvm.org/viewvc/llvm-project?rev=40757&view=rev
Log:
More explicit keywords.

Modified:
llvm/trunk/lib/CodeGen/BranchFolding.cpp
llvm/trunk/lib/CodeGen/VirtRegMap.h
llvm/trunk/lib/Target/ARM/ARMISelLowering.h
llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h
llvm/trunk/lib/Target/IA64/IA64ISelLowering.h
llvm/trunk/lib/Target/Mips/MipsISelLowering.h
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
llvm/trunk/lib/Target/X86/X86ISelLowering.h

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=40757&r1=40756&r2=40757&view=diff

==
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Thu Aug  2 16:21:54 2007
@@ -46,7 +46,7 @@
 
   struct BranchFolder : public MachineFunctionPass {
 static char ID;
-BranchFolder(bool defaultEnableTailMerge) : 
+explicit BranchFolder(bool defaultEnableTailMerge) : 
 MachineFunctionPass((intptr_t)&ID) {
   switch (FlagEnableTailMerge) {
   case cl::BOU_UNSET: EnableTailMerge = defaultEnableTailMerge; break;

Modified: llvm/trunk/lib/CodeGen/VirtRegMap.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.h?rev=40757&r1=40756&r2=40757&view=diff

==
--- llvm/trunk/lib/CodeGen/VirtRegMap.h (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.h Thu Aug  2 16:21:54 2007
@@ -75,7 +75,7 @@
 void operator=(const VirtRegMap&); // DO NOT IMPLEMENT
 
   public:
-VirtRegMap(MachineFunction &mf);
+explicit VirtRegMap(MachineFunction &mf);
 
 void grow();
 

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=40757&r1=40756&r2=40757&view=diff

==
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Thu Aug  2 16:21:54 2007
@@ -76,7 +76,7 @@
   class ARMTargetLowering : public TargetLowering {
 int VarArgsFrameIndex;// FrameIndex for start of varargs area.
   public:
-ARMTargetLowering(TargetMachine &TM);
+explicit ARMTargetLowering(TargetMachine &TM);
 
 virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
 virtual const char *getTargetNodeName(unsigned Opcode) const;

Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=40757&r1=40756&r2=40757&view=diff

==
--- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Thu Aug  2 16:21:54 2007
@@ -64,7 +64,7 @@
 int VarArgsBase;// What is the base FrameIndex
 bool useITOF;
   public:
-AlphaTargetLowering(TargetMachine &TM);
+explicit AlphaTargetLowering(TargetMachine &TM);
 
 /// LowerOperation - Provide custom lowering hooks for some operations.
 ///

Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.h?rev=40757&r1=40756&r2=40757&view=diff

==
--- llvm/trunk/lib/Target/IA64/IA64ISelLowering.h (original)
+++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.h Thu Aug  2 16:21:54 2007
@@ -43,7 +43,7 @@
 unsigned GP, SP, RP; // FIXME - clean this mess up
  
   public:
-IA64TargetLowering(TargetMachine &TM);
+explicit IA64TargetLowering(TargetMachine &TM);
 
 unsigned VirtGPR; // this is public so it can be accessed in the selector
   // for ISD::RET. add an accessor instead? FIXME

Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=40757&r1=40756&r2=40757&view=diff

==
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Thu Aug  2 16:21:54 2007
@@ -53,7 +53,7 @@
 // const MipsSubtarget &MipsSubTarget;
   public:
 
-MipsTargetLowering(MipsTargetMachine &TM);
+explicit MipsTargetLowering(MipsTargetMachine &TM);
 
 /// LowerOperation - Provide custom lowering hooks for some operations.
 virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=40757&r1=40756&r2=40757&

Re: [llvm-commits] [llvm] r40641 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-08-02 Thread Dan Gohman
>> Use SCEVExpander::InsertCastOfTo instead of calling new IntToPtrInst
>> directly, because the insert point used by the SCEVExpander may vary
>> from what LSR originally computes.
> 
> Did this cause a bug?  If so, can you please commit a regtest?  Thanks,

So far I've only seen the problem in the tree where I'm working on
the attached patch, which moves the getelementptr logic out of LSR into
SCEV, and generalizes it to handle more pointer expressions. 

Dan

-- 
Dan Gohman, Cray Inc.
Index: include/llvm/Analysis/ScalarEvolutionExpander.h
===
--- include/llvm/Analysis/ScalarEvolutionExpander.h (revision 40735)
+++ include/llvm/Analysis/ScalarEvolutionExpander.h (working copy)
@@ -144,6 +144,9 @@
 Value *visitAddRecExpr(SCEVAddRecExpr *S);
 
 Value *visitUnknown(SCEVUnknown *S) {
+  if (isa(S->getValue()->getType()))
+return InsertCastOfTo(Instruction::PtrToInt,
+  S->getValue(), S->getType());
   return S->getValue();
 }
   };
Index: include/llvm/Analysis/ScalarEvolutionExpressions.h
===
--- include/llvm/Analysis/ScalarEvolutionExpressions.h  (revision 40735)
+++ include/llvm/Analysis/ScalarEvolutionExpressions.h  (working copy)
@@ -498,14 +498,17 @@
   ///
   class SCEVUnknown : public SCEV {
 Value *V;
-SCEVUnknown(Value *v) : SCEV(scUnknown), V(v) {}
+const Type *Ty;
+SCEVUnknown(Value *v, const Type *ty) : SCEV(scUnknown), V(v), Ty(ty) {}
 
   protected:
 ~SCEVUnknown();
   public:
 /// get method - For SCEVUnknown, this just gets and returns a new
-/// SCEVUnknown.
-static SCEVHandle get(Value *V);
+/// SCEVUnknown. Ty is usually the type of V, unless V does not have an
+/// integer type, in which case it is the type that V will be implicitly
+/// casted to for the purposes of SCEV analysis.
+static SCEVHandle get(Value *V, const Type *Ty);
 
 /// getIntegerSCEV - Given an integer or FP type, create a constant for the
 /// specified signed integer value and return a SCEV for the constant.
@@ -524,7 +527,7 @@
   return this;
 }
 
-virtual const Type *getType() const;
+virtual const Type *getType() const { return Ty; }
 
 virtual void print(std::ostream &OS) const;
 void print(std::ostream *OS) const { if (OS) print(*OS); }
Index: lib/Analysis/ScalarEvolutionExpander.cpp
===
--- lib/Analysis/ScalarEvolutionExpander.cpp(revision 40735)
+++ lib/Analysis/ScalarEvolutionExpander.cpp(working copy)
@@ -200,7 +200,7 @@
   // folders, then expandCodeFor the closed form.  This allows the folders to
   // simplify the expression without having to build a bunch of special code
   // into this folder.
-  SCEVHandle IH = SCEVUnknown::get(I);   // Get I as a "symbolic" SCEV.
+  SCEVHandle IH = SCEVUnknown::get(I, Ty);   // Get I as a "symbolic" SCEV.
 
   SCEVHandle V = S->evaluateAtIteration(IH);
   //cerr << "Evaluated: " << *this << "\n to: " << *V << "\n";
Index: lib/Analysis/ScalarEvolution.cpp
===
--- lib/Analysis/ScalarEvolution.cpp(revision 40735)
+++ lib/Analysis/ScalarEvolution.cpp(working copy)
@@ -68,6 +68,7 @@
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Assembly/Writer.h"
+#include "llvm/Target/TargetData.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/CommandLine.h"
@@ -405,10 +406,6 @@
   return true;
 }
 
-const Type *SCEVUnknown::getType() const {
-  return V->getType();
-}
-
 void SCEVUnknown::print(std::ostream &OS) const {
   WriteAsOperand(OS, V, false);
 }
@@ -488,7 +485,7 @@
 C = ConstantFP::get(Ty, Val);
   else 
 C = ConstantInt::get(Ty, Val);
-  return SCEVUnknown::get(C);
+  return SCEVUnknown::get(C, Ty);
 }
 
 /// getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion of 
the
@@ -505,11 +502,26 @@
   return SCEVZeroExtendExpr::get(V, Ty);
 }
 
+/// getTruncateOrSignExtend - Return a SCEV corresponding to a conversion of 
the
+/// input value to the specified type.  If the type must be extended, it is 
sign
+/// extended.
+static SCEVHandle getTruncateOrSignExtend(const SCEVHandle &V, const Type *Ty) 
{
+  const Type *SrcTy = V->getType();
+  assert(SrcTy->isInteger() && Ty->isInteger() &&
+ "Cannot truncate or sign extend with non-integer arguments!");
+  if (SrcTy->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
+return V;  // No conversion
+  if (SrcTy->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits())
+return SCEVTruncateExpr::get(V, Ty);
+  return SCEVSignExtendExpr::get(V, Ty);
+}
+
 /// getNegativeSCEV - Return a SCEV corresponding to -V = -1*V
 ///
 SCEVHandle SCEV::getNegativeSCEV(const SCEVHandle &V) {
   if (SC

Re: [llvm-commits] [llvm] r40641 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-08-02 Thread Chris Lattner

On Aug 2, 2007, at 2:28 PM, Dan Gohman wrote:

>>> Use SCEVExpander::InsertCastOfTo instead of calling new IntToPtrInst
>>> directly, because the insert point used by the SCEVExpander may vary
>>> from what LSR originally computes.
>>
>> Did this cause a bug?  If so, can you please commit a regtest?   
>> Thanks,
>
> So far I've only seen the problem in the tree where I'm working on
> the attached patch

Ok, then don't worry about it.  Unless you just want to commit the  
test to make sure it never regresses in the future.

> , which moves the getelementptr logic out of LSR into
> SCEV, and generalizes it to handle more pointer expressions.

Interesting approach.  Does this impact the -indvars pass at all?

-Chris

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


Re: [llvm-commits] [llvm] r40738 - in /llvm/trunk/lib/Transforms/Scalar: CodeGenPrepare.cpp InstructionCombining.cpp LoopStrengthReduce.cpp LoopUnroll.cpp LoopUnswitch.cpp RedundantLoadElimination.cpp

2007-08-02 Thread Dan Gohman
> Log:
> wrap some long lines.  Major offenders that are left include
> gvn, gvnpre, dse, and predsimplify.  To see these, use:
> 
>   make check-line-length

[...]

> --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Thu Aug  2 
> 11:53:43 2007
> @@ -50,7 +50,7 @@
>  static char ID; // Pass identification, replacement for typeid
>  explicit SROA(signed T = -1) : FunctionPass((intptr_t)&ID) {
>if (T == -1)
> -SRThreshold = 128;
> +SRThreshold = 512;
>else
>  SRThreshold = T;
>  }

The original line there was within 80 cols ;-).

Dan

-- 
Dan Gohman, Cray Inc.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40758 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 16:33:36 2007
New Revision: 40758

URL: http://llvm.org/viewvc/llvm-project?rev=40758&view=rev
Log:
Fix an accidental commit.


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

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

==
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Thu Aug  2 
16:33:36 2007
@@ -50,7 +50,7 @@
 static char ID; // Pass identification, replacement for typeid
 explicit SROA(signed T = -1) : FunctionPass((intptr_t)&ID) {
   if (T == -1)
-SRThreshold = 512;
+SRThreshold = 128;
   else
 SRThreshold = T;
 }


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


Re: [llvm-commits] [llvm] r40738 - in /llvm/trunk/lib/Transforms/Scalar: CodeGenPrepare.cpp InstructionCombining.cpp LoopStrengthReduce.cpp LoopUnroll.cpp LoopUnswitch.cpp RedundantLoadElimination.cpp

2007-08-02 Thread Chris Lattner

On Aug 2, 2007, at 2:32 PM, Dan Gohman wrote:

>> --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp  
>> (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Thu  
>> Aug  2 11:53:43 2007
>> @@ -50,7 +50,7 @@
>>  static char ID; // Pass identification, replacement for typeid
>>  explicit SROA(signed T = -1) : FunctionPass((intptr_t)&ID) {
>>if (T == -1)
>> -SRThreshold = 128;
>> +SRThreshold = 512;
>>else
>>  SRThreshold = T;
>>  }
>
> The original line there was within 80 cols ;-).

Whoa.  Thank you so much for catching that!

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


Re: [llvm-commits] [llvm] r40660 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/ExecutionEngine/JIT/ lib/Transforms/IPO/ lib/Transforms/Instr

2007-08-02 Thread David A. Greene
On Wednesday 01 August 2007 08:49, Gordon Henriksen wrote:

> Can't you just use
>
>   Value* Args[] = { CI->GetOperand(1),
> CI->GetOperand(2) };
>   CallInst *NC = new CallInst(GCRead, Args, Args + 2,
>   CI->getName(), CI);
>
> here and in UpgradeParser.y?

Yep.  Do people prefer that?  I'll change it if so.

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


Re: [llvm-commits] [llvm] r40660 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/ExecutionEngine/JIT/ lib/Transforms/IPO/ lib/Transforms/Instr

2007-08-02 Thread David A. Greene
On Wednesday 01 August 2007 18:43, Chandler Carruth wrote:
> )
>
> You missed one client, the indirect usage by llvm2cpp, which _generates_
> calls to CallInst, but doesn't make them directly. It is currently
> generating calls to the old API, and causes test/Feature/llvm2cpp to fail.

Whoops!  Thanks for the heads-up.

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


Re: [llvm-commits] [llvm] r40660 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/ExecutionEngine/JIT/ lib/Transforms/IPO/ lib/Transforms/Instr

2007-08-02 Thread Chris Lattner

On Aug 2, 2007, at 2:34 PM, David A. Greene wrote:

> On Wednesday 01 August 2007 08:49, Gordon Henriksen wrote:
>
>> Can't you just use
>>
>>   Value* Args[] = { CI->GetOperand(1),
>> CI->GetOperand(2) };
>>   CallInst *NC = new CallInst(GCRead, Args, Args + 2,
>>   CI->getName(), CI);
>>
>> here and in UpgradeParser.y?
>
> Yep.  Do people prefer that?  I'll change it if so.

Yes please.  SmallVector's are still variable sized (like  
std::vector) so they have a slight amount of overhead compared to  
arrays.  If you can use a fixed-size array, they are better.

Thanks David,

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


Re: [llvm-commits] [llvm] r40714 - /llvm/trunk/tools/llvm2cpp/CppWriter.cpp

2007-08-02 Thread David A. Greene
On Wednesday 01 August 2007 22:30, Reid Spencer wrote:
> Author: reid
> Date: Wed Aug  1 22:30:26 2007
> New Revision: 40714
>
> URL: http://llvm.org/viewvc/llvm-project?rev=40714&view=rev
> Log:
> Adjust for new CallInst constructor interface.
> This fixes test/Feature/llvm2cpp.ll

Thanks, Reid.

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


Re: [llvm-commits] [llvm] r40660 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/ExecutionEngine/JIT/ lib/Transforms/IPO/ lib/Transforms/Instr

2007-08-02 Thread Chandler Carruth
This still contains a subtle bug (i think):

David Greene wrote:
> +  template
> +  void init(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
> +const std::string &Name,
> +// This argument ensures that we have an iterator we can
> +// do arithmetic on in constant time
> +std::random_access_iterator_tag) {
> +typename std::iterator_traits::difference_type NumArgs = 
> +  std::distance(ArgBegin, ArgEnd);
> +
> +if (NumArgs > 0) {
> +  // This requires that the iterator points to contiguous memory.
> +  init(Func, &*ArgBegin, NumArgs);
> +}
> +else {
> +  init(Func, 0, NumArgs);
> +}
> +
> +setName(Name);
> +  }

The CallInst::init method you are calling within this templated init
method expects an "unsigned" type as the final parameter. You are
passing a difference_type, which is clearly a signed type (given that
you check whether it is positive). I am getting compile errors using
these when I provide pointers as the input iterators, and I suspect
there are other cases where this causes errors as well (although
std::vector seems to not cause such errors...)

Am I just misunderstanding something? The error I receive is as follows:

.../include/llvm/Instructions.h: In member function 'void
llvm::CallInst::init(llvm::Value*, InputIterator, InputIterator, const
std::string&, std::random_access_iterator_tag) [with InputIterator =
llvm::Use*]':
.../include/llvm/Instructions.h:788:   instantiated from
'llvm::CallInst::CallInst(llvm::Value*, InputIterator, InputIterator,
const std::string&, llvm::Instruction*) [with InputIterator = llvm::Use*]'
.../lib/VMCore/AutoUpgrade.cpp:144:   instantiated from here
.../include/llvm/Instructions.h:766: error: no matching function for
call to 'llvm::CallInst::init(llvm::Value*&, llvm::Use*, ptrdiff_t&)'
.../include/llvm/Instructions.h:750: note: candidates are: void
llvm::CallInst::init(llvm::Value*, llvm::Value* const*, unsigned int)


-Chandler Carruth

> +
>  public:
> +  /// Construct a CallInst given a range of arguments.  InputIterator
> +  /// must be a random-access iterator pointing to contiguous storage
> +  /// (e.g. a std::vector<>::iterator).  Checks are made for
> +  /// random-accessness but not for contiguous storage as that would
> +  /// incur runtime overhead.
> +  /// @brief Construct a CallInst from a range of arguments
> +  template
> +  CallInst(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
> +   const std::string &Name = "", Instruction *InsertBefore = 0)
> +  : Instruction(cast(cast(Func->getType())
> +   ->getElementType())->getReturnType(),
> +Instruction::Call, 0, 0, InsertBefore) {
> +init(Func, ArgBegin, ArgEnd, Name, 
> + typename std::iterator_traits::iterator_category());
> +  }
> +
> +  /// Construct a CallInst given a range of arguments.  InputIterator
> +  /// must be a random-access iterator pointing to contiguous storage
> +  /// (e.g. a std::vector<>::iterator).  Checks are made for
> +  /// random-accessness but not for contiguous storage as that would
> +  /// incur runtime overhead.
> +  /// @brief Construct a CallInst from a range of arguments
> +  template
> +  CallInst(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
> +   const std::string &Name, BasicBlock *InsertAtEnd)
> +  : Instruction(cast(cast(Func->getType())
> +   ->getElementType())->getReturnType(),
> +Instruction::Call, 0, 0, InsertAtEnd) {
> +init(Func, ArgBegin, ArgEnd, Name,
> + typename std::iterator_traits::iterator_category());
> +  }
> +
> +#if 0
> +  // Leave these here for llvm-gcc
>CallInst(Value *F, Value* const *Args, unsigned NumArgs,
> const std::string &Name = "", Instruction *InsertBefore = 0);
>CallInst(Value *F, Value *const *Args, unsigned NumArgs,
> const std::string &Name, BasicBlock *InsertAtEnd);
> -  
> +
>// Alternate CallInst ctors w/ two actuals, w/ one actual and no
>// actuals, respectively.
>CallInst(Value *F, Value *Actual1, Value *Actual2,
> const std::string& Name = "", Instruction *InsertBefore = 0);
>CallInst(Value *F, Value *Actual1, Value *Actual2,
> const std::string& Name, BasicBlock *InsertAtEnd);
> +#endif
>CallInst(Value *F, Value *Actual, const std::string& Name = "",
> Instruction *InsertBefore = 0);
>CallInst(Value *F, Value *Actual, const std::string& Name,
> 
> Modified: llvm/trunk/include/llvm/Support/LLVMBuilder.h
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/LLVMBuilder.h?rev=40660&r1=40659&r2=40660&view=diff
> 
> ==
> --- llvm/trunk/include/llvm/Support/LLVMBuilder.h (original)
> +++ llvm/trunk/include/llvm/Support/LLVMBuilder.h Tue Jul 

[llvm-commits] [llvm-gcc-4.2] r40767 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm.c arm.h lib1funcs.asm t-bpabi t-symbian

2007-08-02 Thread Lauro Ramos Venancio
Author: laurov
Date: Thu Aug  2 17:54:50 2007
New Revision: 40767

URL: http://llvm.org/viewvc/llvm-project?rev=40767&view=rev
Log:
Fix the build for ARM.


Modified:
llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm
llvm-gcc-4.2/trunk/gcc/config/arm/t-bpabi
llvm-gcc-4.2/trunk/gcc/config/arm/t-symbian

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=40767&r1=40766&r2=40767&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Thu Aug  2 17:54:50 2007
@@ -4903,19 +4903,6 @@
 }
 }
 
-/* LLVM LOCAL begin */
-/* Values which must be returned in the most-significant end of the return
-   register.  */
-
-static bool
-arm_return_in_msb (tree valtype)
-{
-  return (TARGET_AAPCS_BASED
-  && BYTES_BIG_ENDIAN
-  && (AGGREGATE_TYPE_P (valtype)
-  || TREE_CODE (valtype) == COMPLEX_TYPE));
-}
-/* LLVM LOCAL end */
 
 /* RTX cost for cores with a fast multiply unit (M variants).  */
 
@@ -6234,60 +6221,6 @@
   output_asm_insn (buf, operands);
   return "";
 }
-
-/* LLVM LOCAL begin */
-/* Return true if a type must be passed in memory. For AAPCS, small aggregates
-   (padded to the size of a word) should be passed in a register.  */
-
-static bool
-arm_must_pass_in_stack (enum machine_mode mode, tree type)
-{
-  if (TARGET_AAPCS_BASED)
-return must_pass_in_stack_var_size (mode, type);
-  else
-return must_pass_in_stack_var_size_or_pad (mode, type);
-}
-
-
-/* For use by FUNCTION_ARG_PADDING (MODE, TYPE).
-   Return true if an argument passed on the stack should be padded upwards,
-   i.e. if the least-significant byte has useful data.  */
-
-bool
-arm_pad_arg_upward (enum machine_mode mode, tree type)
-{
-  if (!TARGET_AAPCS_BASED)
-return DEFAULT_FUNCTION_ARG_PADDING(mode, type);
-
-  if (type && BYTES_BIG_ENDIAN && INTEGRAL_TYPE_P (type))
-return false;
-
-  return true;
-}
-
-
-/* Similarly, for use by BLOCK_REG_PADDING (MODE, TYPE, FIRST).
-   For non-AAPCS, return !BYTES_BIG_ENDIAN if the least significant
-   byte of the register has useful data, and return the opposite if the
-   most significant byte does.
-   For AAPCS, small aggregates and small complex types are always padded
-   upwards.  */
-
-bool
-arm_pad_reg_upward (enum machine_mode mode ATTRIBUTE_UNUSED,
-tree type, int first ATTRIBUTE_UNUSED)
-{
-  if (TARGET_AAPCS_BASED
-  && BYTES_BIG_ENDIAN
-  && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE)
-  && int_size_in_bytes (type) <= 4)
-return true;
-
-  /* Otherwise, use default padding.  */
-  return !BYTES_BIG_ENDIAN;
-}
-/* LLVM LOCAL end */
-
 
 /* Routines for use in generating RTL.  */
 
@@ -13042,23 +12975,6 @@
   fprintf (f, "}\n");
 }
 
-  /* LLVM LOCAL begin */
-  if (ARM_EABI_UNWIND_TABLES && push)
-{
-  fprintf (f, "\t.save\t{");
-  for (regno = 0; regno < 15; regno++)
-   {
- if (real_regs & (1 << regno))
-   {
- if (real_regs & ((1 << regno) -1))
-   fprintf (f, ", ");
- asm_fprintf (f, "%r", regno);
-   }
-   }
-  fprintf (f, "}\n");
-}
-  /* LLVM LOCAL end */
-
   fprintf (f, "\t%s\t{", push ? "push" : "pop");
 
   /* Look at the low registers first.  */
@@ -14111,11 +14027,6 @@
   if (ARM_EABI_UNWIND_TABLES)
asm_fprintf (f, "\t.pad #16\n");
 
-  /* LLVM LOCAL begin */
-  if (ARM_EABI_UNWIND_TABLES)
-   asm_fprintf (f, "\t.pad #16\n");
-  /* LLVM LOCAL end */
-
   asm_fprintf
(f, "\tsub\t%r, %r, #16\t%@ Create stack backtrace structure\n",
 SP_REGNUM, SP_REGNUM);
@@ -15145,9 +15056,7 @@
 static bool
 arm_align_anon_bitfield (void)
 {
-  /* LLVM LOCAL begin */
-  return TARGET_AAPCS_BASED && arm_abi != ARM_ABI_AAPCS_LINUX;
-  /* LLVM LOCAL end */
+  return TARGET_AAPCS_BASED;
 }
 
 
@@ -15246,14 +15155,6 @@
 }
 
 
-/* LLVM LOCAL begin */
-static bool
-arm_cxx_use_aeabi_atexit (void)
-{
-  return TARGET_AAPCS_BASED;
-}
-/* LLVM LOCAL end */
-
 void
 arm_set_return_address (rtx source, rtx scratch)
 {

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

==
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Thu Aug  2 17:54:50 2007
@@ -519,12 +519,6 @@
 #define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int")
 #endif
 
-/* LLVM LOCAL begin */
-#ifndef PTRDIFF_TYPE
-#define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int")
-#endif
-/* LLVM LOCAL end */
-
 /* AAPCS requires that structure al

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

2007-08-02 Thread Chris Lattner
Author: lattner
Date: Thu Aug  2 19:17:42 2007
New Revision: 40772

URL: http://llvm.org/viewvc/llvm-project?rev=40772&view=rev
Log:
add an observation

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

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

==
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Thu Aug  2 19:17:42 2007
@@ -1103,3 +1103,30 @@
 movaps %xmm1, 192(%esp) 
 movaps %xmm1, 224(%esp) 
 movaps %xmm1, 176(%esp)
+
+//===-===//
+
+This is a "commutable two-address" register coallescing deficiency:
+
+define <4 x float> @test1(<4 x float> %V) {
+entry:
+%tmp8 = shufflevector <4 x float> %V, <4 x float> undef, <4 x i32> < 
i32 3, i32 2, i32 1, i32 0 >   ; <<4 x float>> [#uses=1]
+%add = add <4 x float> %tmp8, %V; <<4 x float>> 
[#uses=1]
+ret <4 x float> %add
+}
+
+this codegens to:
+
+_test1:
+pshufd  $27, %xmm0, %xmm1
+addps   %xmm0, %xmm1
+movaps  %xmm1, %xmm0
+ret
+
+instead of:
+
+_test1:
+pshufd  $27, %xmm0, %xmm1
+addps   %xmm1, %xmm0
+ret
+


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


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

2007-08-02 Thread Anton Korobeynikov
Author: asl
Date: Thu Aug  2 19:05:05 2007
New Revision: 40770

URL: http://llvm.org/viewvc/llvm-project?rev=40770&view=rev
Log:
Another CONSTRUCTOR-related fix

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=40770&r1=40769&r2=40770&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Aug  2 19:05:05 2007
@@ -5777,7 +5777,11 @@
 }
 
 Constant *TreeConstantToLLVM::ConvertCONSTRUCTOR(tree exp) {
-  if (CONSTRUCTOR_ELTS(exp) == 0)  // All zeros?
+  // Please note, that we can have empty ctor, even if array is non-trivial 
(has
+  // nonzero number of entries). This situation is typical for static ctors,
+  // when array is filled during program initialization.
+  if (CONSTRUCTOR_ELTS(exp) == 0 ||
+  VEC_length(constructor_elt, CONSTRUCTOR_ELTS(exp)) == 0)  // All zeros?
 return Constant::getNullValue(ConvertType(TREE_TYPE(exp)));
 
   switch (TREE_CODE(TREE_TYPE(exp))) {


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


Re: [llvm-commits] [llvm] r40660 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/ExecutionEngine/JIT/ lib/Transforms/IPO/ lib/Transforms/Instr

2007-08-02 Thread David A. Greene
On Thursday 02 August 2007 18:15, Chandler Carruth wrote:

> .../include/llvm/Instructions.h: In member function 'void
> llvm::CallInst::init(llvm::Value*, InputIterator, InputIterator, const
> std::string&, std::random_access_iterator_tag) [with InputIterator =
> llvm::Use*]':
> .../include/llvm/Instructions.h:788:   instantiated from
> 'llvm::CallInst::CallInst(llvm::Value*, InputIterator, InputIterator,
> const std::string&, llvm::Instruction*) [with InputIterator = llvm::Use*]'
> .../lib/VMCore/AutoUpgrade.cpp:144:   instantiated from here
> .../include/llvm/Instructions.h:766: error: no matching function for
> call to 'llvm::CallInst::init(llvm::Value*&, llvm::Use*, ptrdiff_t&)'
> .../include/llvm/Instructions.h:750: note: candidates are: void
> llvm::CallInst::init(llvm::Value*, llvm::Value* const*, unsigned int)
> 

You're trying to construct with pointers to Use, which are not compatible
with this interface as explained here:

> >  namespace {
> > @@ -197,8 +198,18 @@
> >  CI->setOperand(0, GCRead);
> >} else {
> >  // Create a whole new call to replace the old one.
> > -CallInst *NC = new CallInst(GCRead, CI->getOperand(1),
> > -CI->getOperand(2),
> > +
> > +// It sure would be nice to pass op_begin()+1,
> > +// op_begin()+2 but it runs into trouble with
> > +// CallInst::init's &*ierator, which requires a
> > +// conversion from Use* to Value*.  The conversion
> > +// from Use to Value * is not useful because the
> > +// memory for Value * won't be contiguous.
> > +SmallVector Args;
> > +Args.push_back(CI->getOperand(1));
> > +Args.push_back(CI->getOperand(2));
> > +CallInst *NC = new CallInst(GCRead, Args.begin(),
> > +Args.end(),
> >  CI->getName(), CI);

You simply cannot construct with Use*.  As far as I know, you could not do
so before either because the CallInst(...,Value *, NumArgs,...) constructor
assumed a contiguous array of Value * which Use * most definitely does not
provide.

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


[llvm-commits] [llvm] r40775 - in /llvm/trunk/website: ./ index.html

2007-08-02 Thread Reid Spencer
Author: reid
Date: Fri Aug  3 00:43:35 2007
New Revision: 40775

URL: http://llvm.org/viewvc/llvm-project?rev=40775&view=rev
Log:
Prepare for "core" website.

Added:
llvm/trunk/website/
llvm/trunk/website/index.html

Added: llvm/trunk/website/index.html
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/website/index.html?rev=40775&view=auto

==
--- llvm/trunk/website/index.html (added)
+++ llvm/trunk/website/index.html Fri Aug  3 00:43:35 2007
@@ -0,0 +1,26 @@
+http://www.w3.org/TR/html4/strict.dtd";>
+
+
+  LLVM Core Website
+  
+
+
+
+LLVM Core Web Site
+  This is just a place holder for now.
+
+
+
+
+
+
+  http://jigsaw.w3.org/css-validator/check/referer";>http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!">
+  http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
+
+  http://llvm.org";>LLVM Compiler Infrastructure
+  Last modified: $Date: 2007-07-09 01:04:31 -0700 (Mon, 09 Jul 2007) $
+
+


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