Re: [llvm-commits] CVS: llvm/lib/VMCore/Function.cpp

2007-06-05 Thread Chris Lattner
 Commit first round work of PR1373: http://llvm.org/PR1373 .  
 noalias is now fully supported in
 VMCore, BitCode, and Assembly. Documentation and test case  
 paramattrs.ll
 updated also.

Cool.  Please also make the verifier assert that this attribute is  
only applied to pointers as well.

Thanks!

-Chris


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

  Function.cpp |2 ++
  1 files changed, 2 insertions(+)


 Index: llvm/lib/VMCore/Function.cpp
 diff -u llvm/lib/VMCore/Function.cpp:1.127 llvm/lib/VMCore/ 
 Function.cpp:1.128
 --- llvm/lib/VMCore/Function.cpp:1.127Wed Apr 25 00:49:09 2007
 +++ llvm/lib/VMCore/Function.cpp  Tue Jun  5 00:28:26 2007
 @@ -99,6 +99,8 @@
  Result += nounwind ;
if (Attrs  ParamAttr::InReg)
  Result += inreg ;
 +  if (Attrs  ParamAttr::NoAlias)
 +Result += noalias ;
if (Attrs  ParamAttr::StructRet)
  Result += sret ;
return Result;



 ___
 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] noinline attributes patch

2007-06-05 Thread Anton Korobeynikov
Tanya,

 The attached patch creates a global to track functions that should  
 not be inlined (noinline attribute). The llvm inliner will need to be  
 modified to make use of it.
Why don't use the function attribute for noinline? This seems to be
natural way to handle such things.

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics  Mechanics, Saint Petersburg State University.


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


[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.25 - 1.26
---
Log message:

I had a senior moment.

---
Diffs of the changes:  (+4 -3)

 IfConversion.cpp |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.25 
llvm/lib/CodeGen/IfConversion.cpp:1.26
--- llvm/lib/CodeGen/IfConversion.cpp:1.25  Mon Jun  4 20:31:40 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Tue Jun  5 02:05:25 2007
@@ -444,10 +444,11 @@
 /// isNextBlock - Returns true either if ToBB the next block after BB or
 /// that all the intervening blocks are empty.
 static bool isNextBlock(MachineBasicBlock *BB, MachineBasicBlock *ToBB) {
-  MachineFunction *MF = BB-getParent();
   MachineFunction::iterator I = BB;
-  while (++I != MF-end()  I != MachineFunction::iterator(ToBB))
-if (!I-empty())
+  MachineFunction::iterator TI = ToBB;
+  MachineFunction::iterator E = BB-getParent()-end();
+  while (++I != TI)
+if (I == E || !I-empty())
   return false;
   return true;
 }



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


[llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMAsmPrinter.cpp updated: 1.75 - 1.76
---
Log message:

PIC label asm printing cosmetic changes.

---
Diffs of the changes:  (+9 -0)

 ARMAsmPrinter.cpp |9 +
 1 files changed, 9 insertions(+)


Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp
diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.75 
llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.76
--- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.75  Thu May 31 13:57:45 2007
+++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp   Tue Jun  5 02:36:38 2007
@@ -753,6 +753,15 @@
 switch (Opc) {
 case ARM::PICADD:
 case ARM::PICLD:
+case ARM::PICLDZH:
+case ARM::PICLDZB:
+case ARM::PICLDH:
+case ARM::PICLDB:
+case ARM::PICLDSH:
+case ARM::PICLDSB:
+case ARM::PICSTR:
+case ARM::PICSTRH:
+case ARM::PICSTRB:
 case ARM::tPICADD:
   break;
 default:



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


Re: [llvm-commits] noinline attributes patch

2007-06-05 Thread Devang Patel

On Jun 4, 2007, at 11:59 PM, Anton Korobeynikov wrote:

 Tanya,

 The attached patch creates a global to track functions that should
 not be inlined (noinline attribute). The llvm inliner will need to be
 modified to make use of it.
 Why don't use the function attribute for noinline? This seems to be
 natural way to handle such things.

Attribute is natural way, if significant percentage of total  
functions is
annotated with noinline, which is not the case here.

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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp

2007-06-05 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

LICM.cpp updated: 1.104 - 1.105
---
Log message:

Allow insertelement, extractelement, and shufflevector to be hoisted/sunk
by LICM.


---
Diffs of the changes:  (+3 -1)

 LICM.cpp |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.104 
llvm/lib/Transforms/Scalar/LICM.cpp:1.105
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.104   Sun Jun  3 19:32:21 2007
+++ llvm/lib/Transforms/Scalar/LICM.cpp Tue Jun  5 11:05:55 2007
@@ -389,7 +389,9 @@
 
   // Otherwise these instructions are hoistable/sinkable
   return isaBinaryOperator(I) || isaCastInst(I) ||
- isaSelectInst(I) || isaGetElementPtrInst(I) || isaCmpInst(I);
+ isaSelectInst(I) || isaGetElementPtrInst(I) || isaCmpInst(I) ||
+ isaInsertElementInst(I) || isaExtractElementInst(I) ||
+ isaShuffleVectorInst(I);
 }
 
 /// isNotUsedInLoop - Return true if the only users of this instruction are



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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp

2007-06-05 Thread Owen Anderson


Changes in directory llvm/lib/Transforms/Scalar:

GVNPRE.cpp updated: 1.18 - 1.19
---
Log message:

Fix a small bug, some 80 cols violations, and add some more debugging output.


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

 GVNPRE.cpp |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.18 
llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.19
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.18  Mon Jun  4 18:34:56 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp   Tue Jun  5 12:31:23 2007
@@ -354,6 +354,10 @@
   currTemps, currAvail, availableOut);
   }
   
+  DOUT  Maximal Set: ;
+  dump_unique(VN, maximalSet);
+  DOUT  \n;
+  
   PostDominatorTree PDT = getAnalysisPostDominatorTree();
   
   // Second Phase of BuildSets - calculate ANTIC_IN
@@ -384,10 +388,12 @@
   std::setValue*, ExprLT old (anticIn.begin(), anticIn.end());
   
   if (BB-getTerminator()-getNumSuccessors() == 1) {
- if (visited.find(BB) == visited.end())
+ if (visited.find(BB-getTerminator()-getSuccessor(0)) == 
+ visited.end())
phi_translate_set(VN, maximalSet, maximalSet, BB, anticOut);
  else
-   phi_translate_set(VN, maximalSet, 
anticipatedIn[BB-getTerminator()-getSuccessor(0)], BB, anticOut);
+   phi_translate_set(VN, maximalSet, 
+ anticipatedIn[BB-getTerminator()-getSuccessor(0)], BB, 
anticOut);
   } else if (BB-getTerminator()-getNumSuccessors()  1) {
 BasicBlock* first = BB-getTerminator()-getSuccessor(0);
 anticOut.insert(anticipatedIn[first].begin(),



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


[llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMAsmPrinter.cpp updated: 1.76 - 1.77
---
Log message:

Print predicate of the second instruction of the two-piece constant MI.

---
Diffs of the changes:  (+3 -1)

 ARMAsmPrinter.cpp |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp
diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.76 
llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.77
--- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.76  Tue Jun  5 02:36:38 2007
+++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp   Tue Jun  5 13:55:18 2007
@@ -361,7 +361,9 @@
   unsigned V1 = ARM_AM::getSOImmTwoPartFirst(MO.getImmedValue());
   unsigned V2 = ARM_AM::getSOImmTwoPartSecond(MO.getImmedValue());
   printSOImm(O, ARM_AM::getSOImmVal(V1), TAI);
-  O  \n\torr ;
+  O  \n\torr;
+  printPredicateOperand(MI, 2);
+  O   ;
   printOperand(MI, 0); 
   O  , ;
   printOperand(MI, 0); 



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


[llvm-commits] CVS: llvm/lib/Analysis/CFGPrinter.cpp

2007-06-05 Thread Devang Patel


Changes in directory llvm/lib/Analysis:

CFGPrinter.cpp updated: 1.27 - 1.28
---
Log message:

Fix PR 1497: http://llvm.org/PR1497 
Use separate pass id for CFGOnlyPrinter.



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

 CFGPrinter.cpp |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Analysis/CFGPrinter.cpp
diff -u llvm/lib/Analysis/CFGPrinter.cpp:1.27 
llvm/lib/Analysis/CFGPrinter.cpp:1.28
--- llvm/lib/Analysis/CFGPrinter.cpp:1.27   Mon May 14 09:25:08 2007
+++ llvm/lib/Analysis/CFGPrinter.cppTue Jun  5 15:24:36 2007
@@ -135,6 +135,7 @@
   struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
 static char ID; // Pass identification, replacement for typeid
 CFGPrinter() : FunctionPass((intptr_t)ID) {}
+CFGPrinter(intptr_t pid) : FunctionPass(pid) {}
 
 virtual bool runOnFunction(Function F) {
   std::string Filename = cfg. + F.getName() + .dot;
@@ -162,6 +163,7 @@
 
   struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
 static char ID; // Pass identification, replacement for typeid
+CFGOnlyPrinter() : CFGPrinter((intptr_t)ID) {}
 virtual bool runOnFunction(Function F) {
   bool OldCFGOnly = CFGOnly;
   CFGOnly = true;



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


[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.26 - 1.27
---
Log message:

Do not ifcvt if either true / false path is a backedge. Not profitable in 
almost all cases.

---
Diffs of the changes:  (+3 -0)

 IfConversion.cpp |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.26 
llvm/lib/CodeGen/IfConversion.cpp:1.27
--- llvm/lib/CodeGen/IfConversion.cpp:1.26  Tue Jun  5 02:05:25 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Tue Jun  5 15:38:42 2007
@@ -237,6 +237,9 @@
 !TII-AnalyzeBranch(*BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond);
   if (!BBI.IsAnalyzable || BBI.BrCond.size() == 0)
 return;
+  // Do not ifcvt if either path is a back edge to the entry block.
+  if (BBI.TrueBB == BB || BBI.FalseBB == BB)
+return;
 
   StructuralAnalysis(BBI.TrueBB);
   BBInfo TrueBBI = BBAnalysis[BBI.TrueBB-getNumber()];



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


[llvm-commits] CVS: llvm/test/Other/2007-06-05-PassID.ll

2007-06-05 Thread Devang Patel


Changes in directory llvm/test/Other:

2007-06-05-PassID.ll added (r1.1)
---
Log message:

New test.


---
Diffs of the changes:  (+11 -0)

 2007-06-05-PassID.ll |   11 +++
 1 files changed, 11 insertions(+)


Index: llvm/test/Other/2007-06-05-PassID.ll
diff -c /dev/null llvm/test/Other/2007-06-05-PassID.ll:1.1
*** /dev/null   Tue Jun  5 15:23:30 2007
--- llvm/test/Other/2007-06-05-PassID.llTue Jun  5 15:23:20 2007
***
*** 0 
--- 1,11 
+ ;RUN: llvm-as  %s | opt -analyze -print-cfg-only -disable-output
+ ;PR 1497
+ 
+ define void @foo() {
+ entry:
+   br label %return
+ 
+ return:   ; preds = %entry
+   ret void
+ }
+ 



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


Re: [llvm-commits] noinline attributes patch

2007-06-05 Thread Tanya Lattner

On Jun 4, 2007, at 11:59 PM, Anton Korobeynikov wrote:

 Tanya,

 The attached patch creates a global to track functions that should
 not be inlined (noinline attribute). The llvm inliner will need to be
 modified to make use of it.
 Why don't use the function attribute for noinline? This seems to be
 natural way to handle such things.

That is another way to do it. I thought this was simpler. What are  
the pros/cons of using function attribute?

-Tanya

 -- 
 With best regards, Anton Korobeynikov.

 Faculty of Mathematics  Mechanics, Saint Petersburg State University.


 ___
 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] CVS: llvm/lib/CodeGen/IfConversion.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.27 - 1.28
---
Log message:

ReplaceUsesOfBlockWith() can modify the predecessors list.

---
Diffs of the changes:  (+4 -3)

 IfConversion.cpp |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.27 
llvm/lib/CodeGen/IfConversion.cpp:1.28
--- llvm/lib/CodeGen/IfConversion.cpp:1.27  Tue Jun  5 15:38:42 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Tue Jun  5 17:03:53 2007
@@ -756,9 +756,10 @@
 ToBBI.BB-removeSuccessor(FromBBI.BB);
 
   // Redirect all branches to FromBB to ToBB.
-  for (MachineBasicBlock::pred_iterator I = FromBBI.BB-pred_begin(),
- E = FromBBI.BB-pred_end(); I != E; ++I)
-(*I)-ReplaceUsesOfBlockWith(FromBBI.BB, ToBBI.BB);
+  std::vectorMachineBasicBlock * Preds(FromBBI.BB-pred_begin(),
+ FromBBI.BB-pred_end());
+  for (unsigned i = 0, e = Preds.size(); i != e; ++i)
+Preds[i]-ReplaceUsesOfBlockWith(FromBBI.BB, ToBBI.BB);
 
   // Transfer preds / succs and update size.
   TransferPreds(ToBBI.BB, FromBBI.BB);



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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp

2007-06-05 Thread Owen Anderson


Changes in directory llvm/lib/Transforms/Scalar:

GVNPRE.cpp updated: 1.19 - 1.20
---
Log message:

Don't leak memory.


---
Diffs of the changes:  (+6 -3)

 GVNPRE.cpp |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.19 
llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.20
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.19  Tue Jun  5 12:31:23 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp   Tue Jun  5 17:11:49 2007
@@ -158,11 +158,14 @@
   Value* newVal = BinaryOperator::create(BO-getOpcode(),
  newOp1, newOp2,
  BO-getName()+.gvnpre);
-  add(VN, MS, newVal);
-  if (!find_leader(VN, set, VN[newVal]))
+  
+  if (!find_leader(VN, set, VN[newVal])) {
+add(VN, MS, newVal);
 return newVal;
-  else
+  } else {
+delete newVal;
 return 0;
+  }
 }
   } else if (PHINode* P = dyn_castPHINode(V)) {
 if (P-getParent() == pred-getTerminator()-getSuccessor(0))



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


[llvm-commits] [128026] Do bitcase before pushing onto vector and remove GlobalInit.

2007-06-05 Thread lattner
Revision: 128026
Author:   lattner
Date: 2007-06-05 16:45:35 -0700 (Tue, 05 Jun 2007)

Log Message:
---
Do bitcase before pushing onto vector and remove GlobalInit. Clear vectors for 
used and noinline attributes when finished.

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-backend.cpp
apple-local/branches/llvm/gcc/llvm-convert.cpp
apple-local/branches/llvm/gcc/llvm-internal.h

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-06-05 17:39:31 UTC 
(rev 128025)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-06-05 23:45:35 UTC 
(rev 128026)
@@ -79,8 +79,8 @@
 llvm::OStream *AsmOutFile = 0;
 
 std::vectorstd::pairFunction*, int  StaticCtors, StaticDtors;
-std::vectorGlobalValue* AttributeUsedGlobals;
-std::vectorFunction* AttributeNoinlineFunctions;
+std::vectorConstant* AttributeUsedGlobals;
+std::vectorConstant* AttributeNoinlineFunctions;
 
 /// PerFunctionPasses - This is the list of cleanup passes run per-function
 /// as each is compiled.  In cases where we are not doing IPO, it includes the 
@@ -467,31 +467,26 @@
 CreateStructorsList(StaticDtors, llvm.global_dtors);
   
   if (!AttributeUsedGlobals.empty()) {
-std::vectorConstant* GlobalInit;
 const Type *SBP = PointerType::get(Type::Int8Ty);
-for (unsigned i = 0, e = AttributeUsedGlobals.size(); i != e; ++i)
-  GlobalInit.push_back(ConstantExpr::getBitCast(AttributeUsedGlobals[i], 
-SBP));
 ArrayType *AT = ArrayType::get(SBP, AttributeUsedGlobals.size());
-Constant *Init = ConstantArray::get(AT, GlobalInit);
+Constant *Init = ConstantArray::get(AT, AttributeUsedGlobals);
 new GlobalVariable(AT, false, GlobalValue::AppendingLinkage, Init,
llvm.used, TheModule);
+AttributeUsedGlobals.clear();
   }
   
   // Add llvm.noinline
   if (!AttributeNoinlineFunctions.empty()) {
-std::vectorConstant* GlobalInit;
 const Type *SBP= PointerType::get(Type::Int8Ty);
-for (unsigned i = 0, e = AttributeNoinlineFunctions.size(); i != e; ++i)
-  GlobalInit.push_back(ConstantExpr::getBitCast(
-AttributeNoinlineFunctions[i], 
-SBP));
 ArrayType *AT = ArrayType::get(SBP, AttributeNoinlineFunctions.size());
-Constant *Init = ConstantArray::get(AT, GlobalInit);
+Constant *Init = ConstantArray::get(AT, AttributeUsedGlobals);
 GlobalValue *gv = new GlobalVariable(AT, false, 
 GlobalValue::AppendingLinkage, Init,
 llvm.noinline, TheModule);
 gv-setSection(llvm.metadata);
+
+// Clear vector
+AttributeNoinlineFunctions.clear();
   }
   
   // Finish off the per-function pass.
@@ -763,8 +758,10 @@
 }
 
 // Handle used decls
-if (DECL_PRESERVE_P (decl))
-  AttributeUsedGlobals.push_back(GV);
+if (DECL_PRESERVE_P (decl)) {
+  const Type *SBP= PointerType::get(Type::Int8Ty);
+  AttributeUsedGlobals.push_back(ConstantExpr::getBitCast(GV, SBP));
+}
   }
   
   if (TheDebugInfo) TheDebugInfo-EmitGlobalVariable(GV, decl); 

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===
--- apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-06-05 17:39:31 UTC 
(rev 128025)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-06-05 23:45:35 UTC 
(rev 128026)
@@ -589,12 +589,16 @@
 Fn-setSection(TREE_STRING_POINTER(DECL_SECTION_NAME(FnDecl)));
 
   // Handle used Functions
-  if (DECL_PRESERVE_P (FnDecl))
-AttributeUsedGlobals.push_back(Fn);
+  if (DECL_PRESERVE_P (FnDecl)) {
+const Type *SBP= PointerType::get(Type::Int8Ty);
+AttributeUsedGlobals.push_back(ConstantExpr::getBitCast(Fn,SBP));
+  }
   
   // Handle noinline Functions
-  if (DECL_UNINLINABLE (FnDecl))
-AttributeNoinlineFunctions.push_back(Fn); 
+  if (DECL_UNINLINABLE (FnDecl)) {
+const Type *SBP= PointerType::get(Type::Int8Ty);
+AttributeNoinlineFunctions.push_back(ConstantExpr::getBitCast(Fn,SBP));
+  }
   
   // Create a new basic block for the function.
   Builder.SetInsertPoint(new BasicBlock(entry, Fn));

Modified: apple-local/branches/llvm/gcc/llvm-internal.h
===
--- apple-local/branches/llvm/gcc/llvm-internal.h   2007-06-05 17:39:31 UTC 
(rev 128025)
+++ apple-local/branches/llvm/gcc/llvm-internal.h   2007-06-05 23:45:35 UTC 
(rev 128026)
@@ -86,11 +86,11 @@
 extern std::vectorstd::pairFunction*, int  StaticCtors, StaticDtors;
 
 /// AttributeUsedGlobals - The list of globals that are marked attribute(used).
-extern std::vectorGlobalValue* AttributeUsedGlobals;
+extern std::vectorConstant* 

[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp

2007-06-05 Thread Owen Anderson


Changes in directory llvm/lib/Transforms/Scalar:

GVNPRE.cpp updated: 1.20 - 1.21
---
Log message:

Fix a misunderstanding of the algorithm.  Really, we should be tracking values
and expression separately.  We can get around this, however, by only keeping
opaque values in TMP_GEN.


---
Diffs of the changes:  (+17 -14)

 GVNPRE.cpp |   31 +--
 1 files changed, 17 insertions(+), 14 deletions(-)


Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.20 
llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.21
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.20  Tue Jun  5 17:11:49 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp   Tue Jun  5 18:46:12 2007
@@ -77,7 +77,7 @@
 void dump_unique(ValueTable VN, std::setValue*, ExprLT s);
 void clean(ValueTable VN, std::setValue*, ExprLT set);
 bool add(ValueTable VN, std::setValue*, ExprLT MS, Value* V);
-Value* find_leader(ValueTable VN, std::setValue*, ExprLT vals, uint32_t 
v);
+Value* find_leader(ValueTable VN, std::setValue*, ExprLT vals, Value* 
v);
 Value* phi_translate(ValueTable VN, std::setValue*, ExprLT MS,
  std::setValue*, ExprLT set,
  Value* V, BasicBlock* pred);
@@ -122,10 +122,11 @@
 
 Value* GVNPRE::find_leader(GVNPRE::ValueTable VN,
std::setValue*, ExprLT vals,
-   uint32_t v) {
+   Value* v) {
+  ExprLT cmp;
   for (std::setValue*, ExprLT::iterator I = vals.begin(), E = vals.end();
I != E; ++I)
-if (VN[*I] == v)
+if (!cmp(v, *I)  !cmp(*I, v))
   return *I;
   
   return 0;
@@ -140,7 +141,7 @@
   if (BinaryOperator* BO = dyn_castBinaryOperator(V)) {
 Value* newOp1 = isaInstruction(BO-getOperand(0))
 ? phi_translate(VN, MS, set,
-  find_leader(VN, set, VN[BO-getOperand(0)]),
+  find_leader(VN, set, BO-getOperand(0)),
   pred)
 : BO-getOperand(0);
 if (newOp1 == 0)
@@ -148,7 +149,7 @@
 
 Value* newOp2 = isaInstruction(BO-getOperand(1))
 ? phi_translate(VN, MS, set,
-  find_leader(VN, set, VN[BO-getOperand(0)]),
+  find_leader(VN, set, BO-getOperand(1)),
   pred)
 : BO-getOperand(1);
 if (newOp2 == 0)
@@ -159,7 +160,7 @@
  newOp1, newOp2,
  BO-getName()+.gvnpre);
   
-  if (!find_leader(VN, set, VN[newVal])) {
+  if (!find_leader(VN, set, newVal)) {
 add(VN, MS, newVal);
 return newVal;
   } else {
@@ -233,19 +234,21 @@
   std::insert_iteratorstd::vectorValue*  q_ins(Q, Q.begin());
   std::set_difference(set.begin(), set.end(),
  toErase.begin(), toErase.end(),
- q_ins, ExprLT());
+ q_ins);
   
-  std::setValue*, ExprLT visited;
+  std::setValue* visited;
   while (!Q.empty()) {
 Value* e = Q.back();
   
 if (BinaryOperator* BO = dyn_castBinaryOperator(e)) {
-  Value* l = find_leader(VN, set, VN[BO-getOperand(0)]);
-  Value* r = find_leader(VN, set, VN[BO-getOperand(1)]);
+  Value* l = find_leader(VN, set, BO-getOperand(0));
+  Value* r = find_leader(VN, set, BO-getOperand(1));
   
-  if (l != 0  visited.find(l) == visited.end())
+  if (l != 0  isaInstruction(l) 
+  visited.find(l) == visited.end())
 Q.push_back(l);
-  else if (r != 0  visited.find(r) == visited.end())
+  else if (r != 0  isaInstruction(r) 
+   visited.find(r) == visited.end())
 Q.push_back(r);
   else {
 vec.push_back(e);
@@ -316,7 +319,7 @@
 currExps.insert(rightValue);
   currExps.insert(BO);
   
-  currTemps.insert(BO);
+  //currTemps.insert(BO);
   
 // Handle unsupported ops
 } else if (!BI-isTerminator()){
@@ -442,7 +445,7 @@
   dump_unique(VN, anticIn);
   DOUT  \n;
   
-  if (old != anticIn)
+  if (old.size() != anticIn.size())
 changed = true;
   
   anticOut.clear();



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


[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.28 - 1.29
---
Log message:

Fix diamond shape ifcvt bugs.

---
Diffs of the changes:  (+41 -61)

 IfConversion.cpp |  102 ++-
 1 files changed, 41 insertions(+), 61 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.28 
llvm/lib/CodeGen/IfConversion.cpp:1.29
--- llvm/lib/CodeGen/IfConversion.cpp:1.28  Tue Jun  5 17:03:53 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Tue Jun  5 18:46:14 2007
@@ -284,7 +284,7 @@
 }
   } else if (TrueBBI.TrueBB == FalseBBI.TrueBB  CanRevCond 
  TrueBBI.BB-pred_size() == 1 
- TrueBBI.BB-pred_size() == 1 
+ FalseBBI.BB-pred_size() == 1 
  // Check the 'true' and 'false' blocks if either isn't ended with
  // a branch. If the block does not fallthrough to another block
  // then we need to add a branch to its successor.
@@ -301,7 +301,7 @@
 // TBB FBB
 //   \ /
 //  TailBB
-// Note MBB can be empty in case both TBB and FBB are return blocks.
+// Note TailBB can be empty.
 BBI.Kind = ICDiamond;
 TrueBBI.Kind = FalseBBI.Kind = ICChild;
 BBI.TailBB = TrueBBI.TrueBB;
@@ -611,74 +611,58 @@
 --TrueBBI.NonPredSize;
   }
 
-  // Check the 'true' and 'false' blocks if either isn't ended with a branch.
-  // Either the block fallthrough to another block or it ends with a
-  // return. If it's the former, add a branch to its successor.
-  bool TrueNeedBr  = !TrueBBI.TrueBB  BBI.TrueBB-succ_size();
-  bool FalseNeedBr = !FalseBBI.TrueBB  BBI.FalseBB-succ_size(); 
-
   // Merge the 'true' and 'false' blocks by copying the instructions
   // from the 'false' block to the 'true' block. That is, unless the true
   // block would clobber the predicate, in that case, do the opposite.
+  BBInfo *BBI1 = TrueBBI;
+  BBInfo *BBI2 = FalseBBI;
   std::vectorMachineOperand RevCond(BBI.BrCond);
   TII-ReverseBranchCondition(RevCond);
-  BBInfo *CvtBBI;
-  if (!TrueBBI.ModifyPredicate) {
-// Predicate the 'true' block after removing its branch.
-TrueBBI.NonPredSize -= TII-RemoveBranch(*BBI.TrueBB);
-PredicateBlock(TrueBBI, BBI.BrCond);
-
-// Predicate the 'false' block.
-PredicateBlock(FalseBBI, RevCond, true);
-
-if (TrueNeedBr)
-  TII-InsertBranch(*BBI.TrueBB, *BBI.TrueBB-succ_begin(), NULL,
-BBI.BrCond);
-// Add an unconditional branch from 'false' to to 'false' successor if it
-// will not be the fallthrough block.
-if (FalseNeedBr 
-!isNextBlock(BBI.BB, *BBI.FalseBB-succ_begin()))
-  InsertUncondBranch(BBI.FalseBB, *BBI.FalseBB-succ_begin(), TII);
-MergeBlocks(TrueBBI, FalseBBI);
-CvtBBI = TrueBBI;
-  } else {
-// Predicate the 'false' block after removing its branch.
-FalseBBI.NonPredSize -= TII-RemoveBranch(*BBI.FalseBB);
-PredicateBlock(FalseBBI, RevCond);
-
-// Predicate the 'false' block.
-PredicateBlock(TrueBBI, BBI.BrCond, true);
-
-// Add a conditional branch from 'false' to 'false' successor if needed.
-if (FalseNeedBr)
-  TII-InsertBranch(*BBI.FalseBB, *BBI.FalseBB-succ_begin(), NULL,
-RevCond);
-// Add an unconditional branch from 'true' to to 'true' successor if it
-// will not be the fallthrough block.
-if (TrueNeedBr 
-!isNextBlock(BBI.BB, *BBI.TrueBB-succ_begin()))
-  InsertUncondBranch(BBI.TrueBB, *BBI.TrueBB-succ_begin(), TII);
-MergeBlocks(FalseBBI, TrueBBI);
-CvtBBI = FalseBBI;
+  std::vectorMachineOperand *Cond1 = BBI.BrCond;
+  std::vectorMachineOperand *Cond2 = RevCond;
+  if (TrueBBI.ModifyPredicate) {
+std::swap(BBI1, BBI2);
+std::swap(Cond1, Cond2);
   }
 
+  // Check the 'true' and 'false' blocks if either isn't ended with a branch.
+  // Either the block fallthrough to another block or it ends with a
+  // return. If it's the former, add a branch to its successor.
+  bool NeedBr1 = !BBI1-TrueBB  BBI1-BB-succ_size();
+  bool NeedBr2 = !BBI2-TrueBB  BBI1-BB-succ_size(); 
+
+  // Predicate the 'true' block after removing its branch.
+  BBI1-NonPredSize -= TII-RemoveBranch(*BBI1-BB);
+  PredicateBlock(*BBI1, *Cond1);
+
+  // Add an early exit branch if needed.
+  if (NeedBr1)
+TII-InsertBranch(*BBI1-BB, *BBI1-BB-succ_begin(), NULL, *Cond1);
+
+  // Predicate the 'false' block.
+  PredicateBlock(*BBI2, *Cond2, true);
+
+  // Add an unconditional branch from 'false' to to 'false' successor if it
+  // will not be the fallthrough block.
+  if (NeedBr2  !isNextBlock(BBI2-BB, *BBI2-BB-succ_begin()))
+InsertUncondBranch(BBI2-BB, *BBI2-BB-succ_begin(), TII);
+
+  // Keep them as two separate blocks if there is an early exit.
+  if (!NeedBr1)
+MergeBlocks(*BBI1, *BBI2);
+  else if (!isNextBlock(BBI1-BB, BBI2-BB))
+InsertUncondBranch(BBI1-BB, BBI2-BB, TII);
+
   // Remove the conditional branch from entry to 

[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp

2007-06-05 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Function.cpp updated: 1.128 - 1.129
---
Log message:

Fix a user-reported error building with GCC 3.4.4 on Cygwin.


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

 Function.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.128 llvm/lib/VMCore/Function.cpp:1.129
--- llvm/lib/VMCore/Function.cpp:1.128  Tue Jun  5 00:28:26 2007
+++ llvm/lib/VMCore/Function.cppTue Jun  5 18:49:06 2007
@@ -271,7 +271,7 @@
 }
 
 const FunctionType *Intrinsic::getType(ID id, const Type **Tys, 
-   uint32_t numTys) {
+   unsigned numTys) {
   const Type *ResultTy = NULL;
   std::vectorconst Type* ArgTys;
   bool IsVarArg = false;



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


[llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h

2007-06-05 Thread Devang Patel


Changes in directory llvm/include/llvm/Transforms:

Scalar.h updated: 1.80 - 1.81
---
Log message:

Avoid non-trivial loop unswitching while optimizing for size.


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

 Scalar.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/Transforms/Scalar.h
diff -u llvm/include/llvm/Transforms/Scalar.h:1.80 
llvm/include/llvm/Transforms/Scalar.h:1.81
--- llvm/include/llvm/Transforms/Scalar.h:1.80  Tue May 29 18:36:32 2007
+++ llvm/include/llvm/Transforms/Scalar.h   Tue Jun  5 19:21:03 2007
@@ -127,7 +127,7 @@
 //
 // LoopUnswitch - This pass is a simple loop unswitching pass.
 //
-LoopPass *createLoopUnswitchPass();
+LoopPass *createLoopUnswitchPass(bool Os = false);
 
 
//===--===//
 //



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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp

2007-06-05 Thread Devang Patel


Changes in directory llvm/lib/Transforms/Scalar:

LoopUnswitch.cpp updated: 1.69 - 1.70
---
Log message:

Avoid non-trivial loop unswitching while optimizing for size.


---
Diffs of the changes:  (+12 -3)

 LoopUnswitch.cpp |   15 ---
 1 files changed, 12 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.69 
llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.70
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.69Wed May  9 03:24:12 2007
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Jun  5 19:21:03 2007
@@ -67,10 +67,12 @@
 // after RewriteLoopBodyWithConditionConstant rewrites first loop.
 std::vectorLoop* LoopProcessWorklist;
 SmallPtrSetValue *,8 UnswitchedVals;
-
+
+bool OptimizeForSize;
   public:
 static char ID; // Pass ID, replacement for typeid
-LoopUnswitch() : LoopPass((intptr_t)ID) {}
+LoopUnswitch(bool Os = false) : 
+  LoopPass((intptr_t)ID), OptimizeForSize(Os) {}
 
 bool runOnLoop(Loop *L, LPPassManager LPM);
 
@@ -116,7 +118,9 @@
   RegisterPassLoopUnswitch X(loop-unswitch, Unswitch loops);
 }
 
-LoopPass *llvm::createLoopUnswitchPass() { return new LoopUnswitch(); }
+LoopPass *llvm::createLoopUnswitchPass(bool Os) { 
+  return new LoopUnswitch(Os); 
+}
 
 /// FindLIVLoopCondition - Cond is a condition that occurs in L.  If it is
 /// invariant in the loop, or has an invariant piece, return the invariant.
@@ -359,6 +363,11 @@
 bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val,Loop 
*L){
   // Check to see if it would be profitable to unswitch this loop.
   unsigned Cost = getLoopUnswitchCost(L, LoopCond);
+
+  // Do not do non-trivial unswitch while optimizing for size.
+  if (Cost  OptimizeForSize)
+return false;
+
   if (Cost  Threshold) {
 // FIXME: this should estimate growth by the amount of code shared by the
 // resultant unswitched loops.



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


[llvm-commits] [128027] Let loop unswitch pass know whether we are optimizing for size or not.

2007-06-05 Thread dpatel
Revision: 128027
Author:   dpatel
Date: 2007-06-05 17:23:16 -0700 (Tue, 05 Jun 2007)

Log Message:
---
Let loop unswitch pass know whether we are optimizing for size or not.

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-backend.cpp

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-06-05 23:45:35 UTC 
(rev 128026)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-06-06 00:23:16 UTC 
(rev 128027)
@@ -327,7 +327,7 @@
 PM-add(createReassociatePass());   // Reassociate expressions
 PM-add(createLoopRotatePass());// Rotate Loop
 PM-add(createLICMPass());  // Hoist loop invariants
-PM-add(createLoopUnswitchPass());  // Unswitch loops.
+PM-add(createLoopUnswitchPass(optimize_size ? true : false));
 PM-add(createInstructionCombiningPass());  // Clean up after LICM/reassoc
 PM-add(createIndVarSimplifyPass());// Canonicalize indvars
 if (flag_unroll_loops)


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


Re: [llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h

2007-06-05 Thread Chris Lattner
  //
  // LoopUnswitch - This pass is a simple loop unswitching pass.
  //
 -LoopPass *createLoopUnswitchPass();
 +LoopPass *createLoopUnswitchPass(bool Os = false);

Hey Devang, please name this something like OptimizeForSize or  
something, instead of Os :)

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


[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h

2007-06-05 Thread Devang Patel


Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.90 - 1.91
---
Log message:

Simplify class hierarchy.


---
Diffs of the changes:  (+1 -3)

 Dominators.h |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.90 
llvm/include/llvm/Analysis/Dominators.h:1.91
--- llvm/include/llvm/Analysis/Dominators.h:1.90Mon Jun  4 18:45:02 2007
+++ llvm/include/llvm/Analysis/Dominators.h Tue Jun  5 19:46:36 2007
@@ -63,7 +63,7 @@
 class DomTreeNode {
   friend class DominatorTree;
   friend struct PostDominatorTree;
-  friend class DominatorTreeBase;
+
   BasicBlock *TheBB;
   DomTreeNode *IDom;
   std::vectorDomTreeNode* Children;
@@ -99,10 +99,8 @@
 return properlyDominates(N);
   }
   
-private:
   inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), 
IDom(iDom) {}
   inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return 
C; }
-
   void setIDom(DomTreeNode *NewIDom);
 };
 



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


[llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h

2007-06-05 Thread Devang Patel


Changes in directory llvm/include/llvm/Transforms:

Scalar.h updated: 1.81 - 1.82
---
Log message:

Rename.


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

 Scalar.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/Transforms/Scalar.h
diff -u llvm/include/llvm/Transforms/Scalar.h:1.81 
llvm/include/llvm/Transforms/Scalar.h:1.82
--- llvm/include/llvm/Transforms/Scalar.h:1.81  Tue Jun  5 19:21:03 2007
+++ llvm/include/llvm/Transforms/Scalar.h   Tue Jun  5 19:49:02 2007
@@ -127,7 +127,7 @@
 //
 // LoopUnswitch - This pass is a simple loop unswitching pass.
 //
-LoopPass *createLoopUnswitchPass(bool Os = false);
+LoopPass *createLoopUnswitchPass(bool OptimizeForSize = false);
 
 
//===--===//
 //



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


[llvm-commits] [128028] Fix a bug in debug info emission that causes an ICE on a really horrible C++

2007-06-05 Thread clattner
Revision: 128028
Author:   clattner
Date: 2007-06-05 17:56:14 -0700 (Tue, 05 Jun 2007)

Log Message:
---
Fix a bug in debug info emission that causes an ICE on a really horrible C++
testcase (54KLOC) that Wolfgang Bangerth provided.

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-debug.cpp

Modified: apple-local/branches/llvm/gcc/llvm-debug.cpp
===
--- apple-local/branches/llvm/gcc/llvm-debug.cpp2007-06-06 00:23:16 UTC 
(rev 128027)
+++ apple-local/branches/llvm/gcc/llvm-debug.cpp2007-06-06 00:56:14 UTC 
(rev 128028)
@@ -674,7 +674,8 @@
NULL;
 
 if (TREE_CODE(Member) == FIELD_DECL) {
-  if (TREE_CODE(DECL_FIELD_OFFSET(Member)) != INTEGER_CST)
+  if (DECL_FIELD_OFFSET(Member) == 0 ||
+  TREE_CODE(DECL_FIELD_OFFSET(Member)) != INTEGER_CST)
 // FIXME: field with variable position, skip it for now.
 continue;
 


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


[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.29 - 1.30
---
Log message:

Fix a couple of typos and be smarter about order of blocks when ifcvt a diamond.

---
Diffs of the changes:  (+30 -17)

 IfConversion.cpp |   47 ++-
 1 files changed, 30 insertions(+), 17 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.29 
llvm/lib/CodeGen/IfConversion.cpp:1.30
--- llvm/lib/CodeGen/IfConversion.cpp:1.29  Tue Jun  5 18:46:14 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Tue Jun  5 19:57:55 2007
@@ -308,8 +308,8 @@
   } else {
 // FIXME: Consider duplicating if BB is small.
 bool TryTriangle = TrueBBI.TrueBB  TrueBBI.TrueBB == BBI.FalseBB 
-   BBI.TrueBB-pred_size() == 1;
-bool TrySimple = TrueBBI.BrCond.size() == 0  BBI.TrueBB-pred_size() == 
1;
+   TrueBBI.BB-pred_size() == 1;
+bool TrySimple = TrueBBI.BrCond.size() == 0  TrueBBI.BB-pred_size() == 
1;
 if ((TryTriangle || TrySimple) 
 FeasibilityAnalysis(TrueBBI, BBI.BrCond)) {
   if (TryTriangle) {
@@ -333,14 +333,21 @@
 BBI.Kind = ICSimple;
 TrueBBI.Kind = ICChild;
   }
-} else if (FalseBBI.BrCond.size() == 0  BBI.FalseBB-pred_size() == 1) {
-  // Try 'simple' on the other path...
+} else if (FalseBBI.BrCond.size() == 0  FalseBBI.BB-pred_size() == 1) {
+  // Try the other path...
   std::vectorMachineOperand RevCond(BBI.BrCond);
-  if (TII-ReverseBranchCondition(RevCond))
-assert(false  Unable to reverse branch condition!);
-  if (FeasibilityAnalysis(FalseBBI, RevCond)) {
-BBI.Kind = ICSimpleFalse;
-FalseBBI.Kind = ICChild;
+  if (!TII-ReverseBranchCondition(RevCond) 
+  FeasibilityAnalysis(FalseBBI, RevCond)) {
+if (FalseBBI.TrueBB  FalseBBI.TrueBB == BBI.TrueBB 
+FalseBBI.BB-pred_size() == 1) {
+  // Reverse 'true' and 'false' paths.
+  ReverseBranchCondition(BBI);
+  BBI.Kind = ICTriangle;
+  FalseBBI.Kind = ICChild;
+} else {
+  BBI.Kind = ICSimpleFalse;
+  FalseBBI.Kind = ICChild;
+}
   }
 }
   }
@@ -620,16 +627,19 @@
   TII-ReverseBranchCondition(RevCond);
   std::vectorMachineOperand *Cond1 = BBI.BrCond;
   std::vectorMachineOperand *Cond2 = RevCond;
-  if (TrueBBI.ModifyPredicate) {
-std::swap(BBI1, BBI2);
-std::swap(Cond1, Cond2);
-  }
-
   // Check the 'true' and 'false' blocks if either isn't ended with a branch.
   // Either the block fallthrough to another block or it ends with a
   // return. If it's the former, add a branch to its successor.
   bool NeedBr1 = !BBI1-TrueBB  BBI1-BB-succ_size();
-  bool NeedBr2 = !BBI2-TrueBB  BBI1-BB-succ_size(); 
+  bool NeedBr2 = !BBI2-TrueBB  BBI2-BB-succ_size(); 
+
+  if ((TrueBBI.ModifyPredicate  !FalseBBI.ModifyPredicate) ||
+  (!TrueBBI.ModifyPredicate  !FalseBBI.ModifyPredicate 
+   NeedBr1  !NeedBr2)) {
+std::swap(BBI1, BBI2);
+std::swap(Cond1, Cond2);
+std::swap(NeedBr1, NeedBr2);
+  }
 
   // Predicate the 'true' block after removing its branch.
   BBI1-NonPredSize -= TII-RemoveBranch(*BBI1-BB);
@@ -650,8 +660,6 @@
   // Keep them as two separate blocks if there is an early exit.
   if (!NeedBr1)
 MergeBlocks(*BBI1, *BBI2);
-  else if (!isNextBlock(BBI1-BB, BBI2-BB))
-InsertUncondBranch(BBI1-BB, BBI2-BB, TII);
 
   // Remove the conditional branch from entry to the blocks.
   BBI.NonPredSize -= TII-RemoveBranch(*BBI.BB);
@@ -659,6 +667,11 @@
   // Merge the combined block into the entry of the diamond.
   MergeBlocks(BBI, *BBI1);
 
+  // 'True' and 'false' aren't combined, see if we need to add a unconditional
+  // branch to the 'false' block.
+  if (NeedBr1  !isNextBlock(BBI.BB, BBI2-BB))
+InsertUncondBranch(BBI1-BB, BBI2-BB, TII);
+
   // If the if-converted block fallthrough or unconditionally branch into the
   // tail block, and the tail block does not have other predecessors, then
   // fold the tail block in as well.



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


[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.30 - 1.31
---
Log message:

Minor statistics counting bug.

---
Diffs of the changes:  (+5 -3)

 IfConversion.cpp |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.30 
llvm/lib/CodeGen/IfConversion.cpp:1.31
--- llvm/lib/CodeGen/IfConversion.cpp:1.30  Tue Jun  5 19:57:55 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Tue Jun  5 20:12:44 2007
@@ -158,15 +158,17 @@
 // Block has been already been if-converted, abort!
 break;
   case ICSimple:
-  case ICSimpleFalse:
+  case ICSimpleFalse: {
+bool isRev = BBI.Kind == ICSimpleFalse;
 DOUT  Ifcvt (Simple  (BBI.Kind == ICSimpleFalse ?  false : )
   ): BB#  BBI.BB-getNumber()   ;
 RetVal = IfConvertSimple(BBI);
 DOUT  (RetVal ? succeeded! : failed!)  \n;
 if (RetVal)
-  if (BBI.Kind == ICSimple) NumSimple++;
-  else  NumSimpleRev++;
+  if (isRev) NumSimple++;
+  else   NumSimpleRev++;
break;
+  }
   case ICTriangle:
 DOUT  Ifcvt (Triangle): BB#  BBI.BB-getNumber()   ;
 RetVal = IfConvertTriangle(BBI);



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


[llvm-commits] CVS: llvm/test/CodeGen/X86/2007-06-05-LSR-Dominator.ll

2007-06-05 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

2007-06-05-LSR-Dominator.ll added (r1.1)
---
Log message:

new testcase for PR1495: http://llvm.org/PR1495 


---
Diffs of the changes:  (+129 -0)

 2007-06-05-LSR-Dominator.ll |  129 
 1 files changed, 129 insertions(+)


Index: llvm/test/CodeGen/X86/2007-06-05-LSR-Dominator.ll
diff -c /dev/null llvm/test/CodeGen/X86/2007-06-05-LSR-Dominator.ll:1.1
*** /dev/null   Tue Jun  5 20:21:56 2007
--- llvm/test/CodeGen/X86/2007-06-05-LSR-Dominator.ll   Tue Jun  5 20:21:46 2007
***
*** 0 
--- 1,129 
+ ; PR1495
+ ; RUN: llvm-as  %s | llc -march=x86
+ 
+ target datalayout = 
e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64
+ target triple = i686-pc-linux-gnu
+   %struct.AVRational = type { i32, i32 }
+   %struct.FFTComplex = type { float, float }
+   %struct.FFTContext = type { i32, i32, i16*, %struct.FFTComplex*, 
%struct.FFTComplex*, void (%struct.FFTContext*, %struct.FFTComplex*)*, void 
(%struct.MDCTContext*, float*, float*, float*)* }
+   %struct.MDCTContext = type { i32, i32, float*, float*, 
%struct.FFTContext }
+   %struct.Minima = type { i32, i32, i32, i32 }
+   %struct.codebook_t = type { i32, i8*, i32*, i32, float, float, i32, 
i32, i32*, float*, float* }
+   %struct.floor_class_t = type { i32, i32, i32, i32* }
+   %struct.floor_t = type { i32, i32*, i32, %struct.floor_class_t*, i32, 
i32, i32, %struct.Minima* }
+   %struct.mapping_t = type { i32, i32*, i32*, i32*, i32, i32*, i32* }
+   %struct.residue_t = type { i32, i32, i32, i32, i32, i32, [8 x i8]*, [2 
x float]* }
+   %struct.venc_context_t = type { i32, i32, [2 x i32], [2 x 
%struct.MDCTContext], [2 x float*], i32, float*, float*, float*, float*, float, 
i32, %struct.codebook_t*, i32, %struct.floor_t*, i32, %struct.residue_t*, i32, 
%struct.mapping_t*, i32, %struct.AVRational* }
+ 
+ define fastcc i32 @put_main_header(%struct.venc_context_t* %venc, i8** %out) {
+ entry:
+   br i1 false, label %bb1820, label %bb288.bb148_crit_edge
+ 
+ bb288.bb148_crit_edge:; preds = %entry
+   ret i32 0
+ 
+ cond_next1712:; preds = %bb1820.bb1680_crit_edge
+   ret i32 0
+ 
+ bb1817:   ; preds = %bb1820.bb1680_crit_edge
+   br label %bb1820
+ 
+ bb1820:   ; preds = %bb1817, %entry
+   %pb.1.50 = phi i32 [ %tmp1693, %bb1817 ], [ 8, %entry ] ; i32 
[#uses=3]
+   br i1 false, label %bb2093, label %bb1820.bb1680_crit_edge
+ 
+ bb1820.bb1680_crit_edge:  ; preds = %bb1820
+   %tmp1693 = add i32 %pb.1.50, 8  ; i32 [#uses=2]
+   %tmp1702 = icmp slt i32 %tmp1693, 0 ; i1 [#uses=1]
+   br i1 %tmp1702, label %cond_next1712, label %bb1817
+ 
+ bb2093:   ; preds = %bb1820
+   %tmp2102 = add i32 %pb.1.50, 65 ; i32 [#uses=0]
+   %tmp2236 = add i32 %pb.1.50, 72 ; i32 [#uses=1]
+   %tmp2237 = sdiv i32 %tmp2236, 8 ; i32 [#uses=2]
+   br i1 false, label %bb2543, label %bb2536.bb2396_crit_edge
+ 
+ bb2536.bb2396_crit_edge:  ; preds = %bb2093
+   ret i32 0
+ 
+ bb2543:   ; preds = %bb2093
+   br i1 false, label %cond_next2576, label %bb2690
+ 
+ cond_next2576:; preds = %bb2543
+   ret i32 0
+ 
+ bb2682:   ; preds = %bb2690
+   ret i32 0
+ 
+ bb2690:   ; preds = %bb2543
+   br i1 false, label %bb2682, label %bb2698
+ 
+ bb2698:   ; preds = %bb2690
+   br i1 false, label %cond_next2726, label %bb2831
+ 
+ cond_next2726:; preds = %bb2698
+   ret i32 0
+ 
+ bb2831:   ; preds = %bb2698
+   br i1 false, label %cond_next2859, label %bb2964
+ 
+ cond_next2859:; preds = %bb2831
+   br i1 false, label %bb2943, label %cond_true2866
+ 
+ cond_true2866:; preds = %cond_next2859
+   br i1 false, label %cond_true2874, label %cond_false2897
+ 
+ cond_true2874:; preds = %cond_true2866
+   ret i32 0
+ 
+ cond_false2897:   ; preds = %cond_true2866
+   ret i32 0
+ 
+ bb2943:   ; preds = %cond_next2859
+   ret i32 0
+ 
+ bb2964:   ; preds = %bb2831
+   br i1 false, label %cond_next2997, label %bb4589
+ 
+ cond_next2997:; preds = %bb2964
+   ret i32 0
+ 
+ bb3103:   ; preds = %bb4589
+   ret i32 0
+ 
+ bb4589:   ; preds = %bb2964
+   br i1 false, label %bb3103, label %bb4597
+ 
+ bb4597:   ; preds = %bb4589
+   br i1 false, label %cond_next4630, label %bb4744
+ 
+ cond_next4630:; preds = %bb4597
+   br i1 false, label %bb4744, label %cond_true4724
+ 
+ cond_true4724:; preds = %cond_next4630
+   br i1 false, label %bb4736, label %bb7531
+ 
+ bb4736:   ; preds = 

[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h

2007-06-05 Thread Chris Lattner


Changes in directory llvm/include/llvm/Analysis:

ScalarEvolutionExpander.h updated: 1.15 - 1.16
---
Log message:

add accessor


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

 ScalarEvolutionExpander.h |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.15 
llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.16
--- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.15   Tue Apr 17 
19:43:05 2007
+++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.hTue Jun  5 
20:22:09 2007
@@ -73,6 +73,8 @@
   InsertedInstructions.insert(I);
 }
 
+Instruction *getInsertionPoint() const { return InsertPt; }
+
 /// expandCodeFor - Insert code to directly compute the specified SCEV
 /// expression into the program.  The inserted code is inserted into the
 /// specified block.



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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-06-05 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.138 - 1.139
---
Log message:

Fix PR1495: http://llvm.org/PR1495  and CodeGen/X86/2007-06-05-LSR-Dominator.ll


---
Diffs of the changes:  (+6 -0)

 LoopStrengthReduce.cpp |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.138 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.139
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.138 Fri May 18 
20:22:21 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Tue Jun  5 20:23:55 2007
@@ -560,11 +560,17 @@
 OperandValToReplace-getType());
 
   Value *Base = Rewriter.expandCodeFor(NewBase, BaseInsertPt);
+
+  // If we are inserting the base and imm values in the same block, make sure 
to
+  // adjust the IP position if insertion reused a result.
+  if (IP == BaseInsertPt)
+IP = Rewriter.getInsertionPoint();
   
   // Always emit the immediate (if non-zero) into the same block as the user.
   SCEVHandle NewValSCEV = SCEVAddExpr::get(SCEVUnknown::get(Base), Imm);
   return Rewriter.expandCodeFor(NewValSCEV, IP,
 OperandValToReplace-getType());
+  
 }
 
 



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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp

2007-06-05 Thread Owen Anderson


Changes in directory llvm/lib/Transforms/Scalar:

GVNPRE.cpp updated: 1.21 - 1.22
---
Log message:

Add simple full redundancy elimination.


---
Diffs of the changes:  (+38 -12)

 GVNPRE.cpp |   50 ++
 1 files changed, 38 insertions(+), 12 deletions(-)


Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.21 
llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.22
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.21  Tue Jun  5 18:46:12 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp   Tue Jun  5 20:27:49 2007
@@ -77,7 +77,7 @@
 void dump_unique(ValueTable VN, std::setValue*, ExprLT s);
 void clean(ValueTable VN, std::setValue*, ExprLT set);
 bool add(ValueTable VN, std::setValue*, ExprLT MS, Value* V);
-Value* find_leader(ValueTable VN, std::setValue*, ExprLT vals, Value* 
v);
+Value* find_leader(std::setValue*, ExprLT vals, Value* v);
 Value* phi_translate(ValueTable VN, std::setValue*, ExprLT MS,
  std::setValue*, ExprLT set,
  Value* V, BasicBlock* pred);
@@ -120,8 +120,7 @@
   return ret.second;
 }
 
-Value* GVNPRE::find_leader(GVNPRE::ValueTable VN,
-   std::setValue*, ExprLT vals,
+Value* GVNPRE::find_leader(std::setValue*, ExprLT vals,
Value* v) {
   ExprLT cmp;
   for (std::setValue*, ExprLT::iterator I = vals.begin(), E = vals.end();
@@ -141,7 +140,7 @@
   if (BinaryOperator* BO = dyn_castBinaryOperator(V)) {
 Value* newOp1 = isaInstruction(BO-getOperand(0))
 ? phi_translate(VN, MS, set,
-  find_leader(VN, set, BO-getOperand(0)),
+  find_leader(set, BO-getOperand(0)),
   pred)
 : BO-getOperand(0);
 if (newOp1 == 0)
@@ -149,7 +148,7 @@
 
 Value* newOp2 = isaInstruction(BO-getOperand(1))
 ? phi_translate(VN, MS, set,
-  find_leader(VN, set, BO-getOperand(1)),
+  find_leader(set, BO-getOperand(1)),
   pred)
 : BO-getOperand(1);
 if (newOp2 == 0)
@@ -160,7 +159,7 @@
  newOp1, newOp2,
  BO-getName()+.gvnpre);
   
-  if (!find_leader(VN, set, newVal)) {
+  if (!find_leader(set, newVal)) {
 add(VN, MS, newVal);
 return newVal;
   } else {
@@ -241,8 +240,8 @@
 Value* e = Q.back();
   
 if (BinaryOperator* BO = dyn_castBinaryOperator(e)) {
-  Value* l = find_leader(VN, set, BO-getOperand(0));
-  Value* r = find_leader(VN, set, BO-getOperand(1));
+  Value* l = find_leader(set, BO-getOperand(0));
+  Value* r = find_leader(set, BO-getOperand(1));
   
   if (l != 0  isaInstruction(l) 
   visited.find(l) == visited.end())
@@ -319,8 +318,6 @@
 currExps.insert(rightValue);
   currExps.insert(BO);
   
-  //currTemps.insert(BO);
-  
 // Handle unsupported ops
 } else if (!BI-isTerminator()){
   add(VN, MS, BI);
@@ -344,7 +341,9 @@
   
   DominatorTree DT = getAnalysisDominatorTree();   
   
-  // First Phase of BuildSets - calculate AVAIL_OUT
+  // Phase 1: BuildSets
+  
+  // Phase 1, Part 1: calculate AVAIL_OUT
   
   // Top-down walk of the dominator tree
   for (df_iteratorDomTreeNode* DI = df_begin(DT.getRootNode()),
@@ -366,7 +365,7 @@
   
   PostDominatorTree PDT = getAnalysisPostDominatorTree();
   
-  // Second Phase of BuildSets - calculate ANTIC_IN
+  // Phase 1, Part 2: calculate ANTIC_IN
   
   std::setBasicBlock* visited;
   
@@ -476,5 +475,32 @@
 DOUT  \n;
   }
   
+  
+  // Phase 2: Insert
+  // FIXME: Not implemented yet
+  
+  // Phase 3: Eliminate
+  for (df_iteratorDomTreeNode* DI = df_begin(DT.getRootNode()),
+ E = df_end(DT.getRootNode()); DI != E; ++DI) {
+BasicBlock* BB = DI-getBlock();
+
+std::vectorInstruction* erase;
+
+for (BasicBlock::iterator BI = BB-begin(), BE = BB-end();
+ BI != BE; ++BI) {
+  Value* leader = find_leader(availableOut[BB], BI);
+  if (leader != 0)
+if (Instruction* Instr = dyn_castInstruction(leader))
+  if (Instr-getParent() != 0  Instr != BI) {
+BI-replaceAllUsesWith(leader);
+erase.push_back(BI);
+  }
+}
+
+for (std::vectorInstruction*::iterator I = erase.begin(), E = 
erase.end();
+ I != E; ++I)
+  (*I)-eraseFromParent();
+  }
+  
   return false;
 }



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


[llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp

2007-06-05 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.31 - 1.32
---
Log message:

If a unconditional branch is added to branch to the false path during ifcvt, 
the predicated block cannot be iteratively ifcvted.

---
Diffs of the changes:  (+33 -6)

 IfConversion.cpp |   39 +--
 1 files changed, 33 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.31 
llvm/lib/CodeGen/IfConversion.cpp:1.32
--- llvm/lib/CodeGen/IfConversion.cpp:1.31  Tue Jun  5 20:12:44 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Tue Jun  5 21:08:52 2007
@@ -165,8 +165,8 @@
 RetVal = IfConvertSimple(BBI);
 DOUT  (RetVal ? succeeded! : failed!)  \n;
 if (RetVal)
-  if (isRev) NumSimple++;
-  else   NumSimpleRev++;
+  if (isRev) NumSimpleRev++;
+  else   NumSimple++;
break;
   }
   case ICTriangle:
@@ -515,12 +515,25 @@
   // to the 'false' branch.
   BBI.NonPredSize -= TII-RemoveBranch(*BBI.BB);
   MergeBlocks(BBI, *CvtBBI);
-  if (!isNextBlock(BBI.BB, NextBBI-BB))
+  bool IterIfcvt = true;
+  if (!isNextBlock(BBI.BB, NextBBI-BB)) {
+// Now ifcvt'd block will look like this:
+// BB:
+// ...
+// t, f = cmp
+// if t op
+// b BBf
+//
+// We cannot further ifcvt this block because the unconditional branch will
+// have to be predicated on the new condition, that will not be available
+// if cmp executes.
 InsertUncondBranch(BBI.BB, NextBBI-BB, TII);
+  }
   std::copy(Cond.begin(), Cond.end(), std::back_inserter(BBI.Predicate));
 
   // Update block info. BB can be iteratively if-converted.
-  BBI.Kind = ICReAnalyze;
+  if (IterIfcvt)
+BBI.Kind = ICReAnalyze;
   ReTryPreds(BBI.BB);
   CvtBBI-Kind = ICDead;
 
@@ -552,11 +565,24 @@
   // predecessors. Otherwise, add a unconditional branch from 'true' to 
'false'.
   BBInfo FalseBBI = BBAnalysis[BBI.FalseBB-getNumber()];
   bool FalseBBDead = false;
+  bool IterIfcvt = true;
   if (!HasEarlyExit  FalseBBI.BB-pred_size() == 2) {
 MergeBlocks(TrueBBI, FalseBBI);
 FalseBBDead = true;
-  } else if (!isNextBlock(TrueBBI.BB, FalseBBI.BB))
+  } else if (!isNextBlock(TrueBBI.BB, FalseBBI.BB)) {
 InsertUncondBranch(TrueBBI.BB, FalseBBI.BB, TII);
+// Now ifcvt'd block will look like this:
+// BB:
+// ...
+// t, f = cmp
+// if t op
+// b BBf
+//
+// We cannot further ifcvt this block because the unconditional branch will
+// have to be predicated on the new condition, that will not be available
+// if cmp executes.
+IterIfcvt = false;
+  }
 
   // Now merge the entry of the triangle with the true block.
   BBI.NonPredSize -= TII-RemoveBranch(*BBI.BB);
@@ -565,7 +591,8 @@
 std::back_inserter(BBI.Predicate));
 
   // Update block info. BB can be iteratively if-converted.
-  BBI.Kind = ICReAnalyze;
+  if (IterIfcvt) 
+BBI.Kind = ICReAnalyze;
   ReTryPreds(BBI.BB);
   TrueBBI.Kind = ICDead;
   if (FalseBBDead)



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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

2007-06-05 Thread Nick Lewycky


Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.119 - 1.120
---
Log message:

Inform ScalarEvolutions that we're deleting Values.
This is the obviously correct part of the fix for PR1487: 
http://llvm.org/PR1487 .


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

 IndVarSimplify.cpp |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.119 
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.120
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.119 Sun May  6 08:37:16 2007
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp   Tue Jun  5 22:51:56 2007
@@ -181,6 +181,7 @@
   GetElementPtrInst *NGEPI = new GetElementPtrInst(
   NCE, Constant::getNullValue(Type::Int32Ty), NewAdd, 
   GEPI-getName(), GEPI);
+  SE-deleteInstructionFromRecords(GEPI);
   GEPI-replaceAllUsesWith(NGEPI);
   GEPI-eraseFromParent();
   GEPI = NGEPI;
@@ -398,6 +399,7 @@
 // the PHI entirely.  This is safe, because the NewVal won't be variant
 // in the loop, so we don't need an LCSSA phi node anymore.
 if (NumPreds == 1) {
+  SE-deleteInstructionFromRecords(PN);
   PN-replaceAllUsesWith(ExitVal);
   PN-eraseFromParent();
   break;



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


[llvm-commits] CVS: llvm/test/Transforms/IndVarsSimplify/2007-06-06-DeleteDanglesPtr.ll

2007-06-05 Thread Nick Lewycky


Changes in directory llvm/test/Transforms/IndVarsSimplify:

2007-06-06-DeleteDanglesPtr.ll added (r1.1)
---
Log message:

new testcase for PR1487: http://llvm.org/PR1487 


---
Diffs of the changes:  (+117 -0)

 2007-06-06-DeleteDanglesPtr.ll |  117 +
 1 files changed, 117 insertions(+)


Index: llvm/test/Transforms/IndVarsSimplify/2007-06-06-DeleteDanglesPtr.ll
diff -c /dev/null 
llvm/test/Transforms/IndVarsSimplify/2007-06-06-DeleteDanglesPtr.ll:1.1
*** /dev/null   Tue Jun  5 23:11:31 2007
--- llvm/test/Transforms/IndVarsSimplify/2007-06-06-DeleteDanglesPtr.ll Tue Jun 
 5 23:11:21 2007
***
*** 0 
--- 1,117 
+ ; RUN: llvm-as  %s | opt -indvars -disable-output
+ ; PR1487
+ 
+   %struct.AVClass = type { i8*, i8* (i8*)*, %struct.AVOption* }
+   %struct.AVCodec = type { i8*, i32, i32, i32, i32 
(%struct.AVCodecContext*)*, i32 (%struct.AVCodecContext*, i8*, i32, i8*)*, i32 
(%struct.AVCodecContext*)*, i32 (%struct.AVCodecContext*, i8*, i32*, i8*, 
i32)*, i32, %struct.AVCodec*, void (%struct.AVCodecContext*)*, 
%struct.AVCodecTag*, i32* }
+   %struct.AVCodecContext = type { %struct.AVClass*, i32, i32, i32, i32, 
i32, i8*, i32, %struct.AVCodecTag, i32, i32, i32, i32, i32, void 
(%struct.AVCodecContext*, %struct.AVFrame*, i32*, i32, i32, i32)*, i32, i32, 
i32, i32, i32, i32, i32, float, float, i32, i32, i32, i32, float, i32, i32, 
i32, %struct.AVCodec*, i8*, i32, i32, void (%struct.AVCodecContext*, i8*, i32, 
i32)*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, [32 x i8], i32, i32, 
i32, i32, i32, i32, i32, float, i32, i32 (%struct.AVCodecContext*, 
%struct.AVFrame*)*, void (%struct.AVCodecContext*, %struct.AVFrame*)*, i32, 
i32, i32, i32, i8*, i8*, float, float, i32, %struct.RcOverride*, i32, i8*, i32, 
i32, i32, float, float, float, float, i32, float, float, float, float, float, 
i32, i32, i32, i32*, i32, i32, i32, i32, %struct.AVCodecTag, %struct.AVFrame*, 
i32, i32, [4 x i64], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 
i32, i32 (%struct.AVCodecContext*, i32*)*, i32, i32, i32, i32, i32, i32, i8*, 
i32, i3!
 2, i32, i32, i32, i32, i16*, i16*, i32, i32, i32, i32, 
%struct.AVPaletteControl*, i32, i32 (%struct.AVCodecContext*, 
%struct.AVFrame*)*, i32, i32, i32, i32, i32, i32, i32, i32 
(%struct.AVCodecContext*, i32 (%struct.AVCodecContext*, i8*)*, i8**, i32*, 
i32)*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 
i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, 
i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 
i32, i32, i32, i32, i32, i64 }
+   %struct.AVCodecTag = type { i32, i32 }
+   %struct.AVFrame = type { [4 x i8*], [4 x i32], [4 x i8*], i32, i32, 
i64, i32, i32, i32, i32, i32, i8*, i32, i8*, [2 x [2 x i16]*], i32*, i8, i8*, 
[4 x i64], i32, i32, i32, i32, i32, %struct.AVPanScan*, i32, i32, i16*, [2 x 
i8*] }
+   %struct.AVOption = type { i8*, i8*, i32, i32, double, double, double, 
i32, i8* }
+   %struct.AVPaletteControl = type { i32, [256 x i32] }
+   %struct.AVPanScan = type { i32, i32, i32, [3 x [2 x i16]] }
+   %struct.RcOverride = type { i32, i32, i32, float }
+ 
+ define i32 @smc_decode_frame(%struct.AVCodecContext* %avctx, i8* %data, i32* 
%data_size, i8* %buf, i32 %buf_size) {
+ entry:
+   br i1 false, label %cond_next, label %cond_true
+ 
+ cond_true:; preds = %entry
+   ret i32 -1
+ 
+ cond_next:; preds = %entry
+   br i1 false, label %bb.outer5.split.split.split.us, label 
%cond_true194.split
+ 
+ bb.outer5.split.split.split.us:   ; preds = %cond_next
+   br i1 false, label %cond_next188.us503.us, label %bb.us481
+ 
+ bb275.us493.us:   ; preds = %cond_next188.us503.us, 
%cond_next188.us503.us
+   ret i32 0
+ 
+ cond_next188.us503.us:; preds = 
%bb.outer5.split.split.split.us
+   switch i32 0, label %bb1401 [
+i32 0, label %cond_next202.bb215_crit_edge.split
+i32 16, label %bb215
+i32 32, label %bb275.us493.us
+i32 48, label %bb275.us493.us
+i32 64, label %cond_next202.bb417_crit_edge.split
+i32 80, label %bb417
+i32 96, label %cond_next202.bb615_crit_edge.split
+i32 112, label %bb615
+i32 128, label %cond_next202.bb716_crit_edge.split
+i32 144, label %bb716
+i32 160, label %cond_next202.bb882_crit_edge.split
+i32 176, label %bb882
+i32 192, label %cond_next202.bb1062_crit_edge.split
+i32 208, label %bb1062
+i32 224, label %bb1326.us.outer.outer
+   ]
+ 
+ bb.us481: ; preds = %bb.outer5.split.split.split.us
+   ret i32 0
+ 
+ cond_true194.split:   ; preds = %cond_next
+   ret i32 %buf_size
+ 
+ cond_next202.bb1062_crit_edge.split:  ; preds 

[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2007-06-05 Thread Nick Lewycky


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.116 - 1.117
---
Log message:

Fix PR1487: http://llvm.org/PR1487  and 
Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll



---
Diffs of the changes:  (+22 -3)

 ScalarEvolution.cpp |   25 ++---
 1 files changed, 22 insertions(+), 3 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.116 
llvm/lib/Analysis/ScalarEvolution.cpp:1.117
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.116 Wed May  2 20:11:53 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Tue Jun  5 23:12:20 2007
@@ -1196,9 +1196,28 @@
 /// client before it removes an instruction from the program, to make sure
 /// that no dangling references are left around.
 void ScalarEvolutionsImpl::deleteInstructionFromRecords(Instruction *I) {
-  Scalars.erase(I);
-  if (PHINode *PN = dyn_castPHINode(I))
-ConstantEvolutionLoopExitValue.erase(PN);
+  SmallVectorInstruction *, 16 Worklist;
+
+  if (Scalars.erase(I)) {
+if (PHINode *PN = dyn_castPHINode(I))
+  ConstantEvolutionLoopExitValue.erase(PN);
+Worklist.push_back(I);
+  }
+
+  while (!Worklist.empty()) {
+Instruction *II = Worklist.back();
+Worklist.pop_back();
+
+for (Instruction::use_iterator UI = II-use_begin(), UE = II-use_end();
+ UI != UE; ++UI) {
+  Instruction *Inst = dyn_castInstruction(*UI);
+  if (Inst  hasSCEV(Inst)  Scalars.erase(Inst)) {
+if (PHINode *PN = dyn_castPHINode(II))
+  ConstantEvolutionLoopExitValue.erase(PN);
+Worklist.push_back(Inst);
+  }
+}
+  }
 }
 
 



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


Re: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2007-06-05 Thread Chris Lattner
 Fix PR1487: http://llvm.org/PR1487  and Transforms/IndVar/ 
 2007-06-06-DeleteDanglesPtr.ll

Thanks Nicholas,

  /// client before it removes an instruction from the program, to  
 make sure
  /// that no dangling references are left around.
  void ScalarEvolutionsImpl::deleteInstructionFromRecords 
 (Instruction *I) {
 +  while (!Worklist.empty()) {
 +Instruction *II = Worklist.back();
 +Worklist.pop_back();
 +
 +for (Instruction::use_iterator UI = II-use_begin(), UE = II- 
 use_end();
 + UI != UE; ++UI) {
 +  Instruction *Inst = dyn_castInstruction(*UI);
 +  if (Inst  hasSCEV(Inst)  Scalars.erase(Inst)) {

One more thing, sorry I didn't notice this before:

The only thing that can use Instructions are other intstructions.  As  
such, you can change the dyn_castinstruction into castinstruction  
and there is no need to check for null in the next line.

-Chris

 +if (PHINode *PN = dyn_castPHINode(II))
 +  ConstantEvolutionLoopExitValue.erase(PN);
 +Worklist.push_back(Inst);
 +  }
 +}
 +  }
  }





 ___
 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] CVS: llvm/test/C++Frontend/2003-11-09-ConstructorTypeSafety.cpp.tr 2003-11-18-MemberInitializationCasting.cpp.tr 2005-07-21-VirtualBaseAccess.cpp

2007-06-05 Thread Tanya Lattner


Changes in directory llvm/test/C++Frontend:

2003-11-09-ConstructorTypeSafety.cpp.tr updated: 1.3 - 1.4
2003-11-18-MemberInitializationCasting.cpp.tr updated: 1.3 - 1.4
2005-07-21-VirtualBaseAccess.cpp updated: 1.2 - 1.3
---
Log message:

Ignore llvm.noinline


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

 2003-11-09-ConstructorTypeSafety.cpp.tr   |2 +-
 2003-11-18-MemberInitializationCasting.cpp.tr |2 +-
 2005-07-21-VirtualBaseAccess.cpp  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/test/C++Frontend/2003-11-09-ConstructorTypeSafety.cpp.tr
diff -u llvm/test/C++Frontend/2003-11-09-ConstructorTypeSafety.cpp.tr:1.3 
llvm/test/C++Frontend/2003-11-09-ConstructorTypeSafety.cpp.tr:1.4
--- llvm/test/C++Frontend/2003-11-09-ConstructorTypeSafety.cpp.tr:1.3   Sun Apr 
15 15:41:31 2007
+++ llvm/test/C++Frontend/2003-11-09-ConstructorTypeSafety.cpp.tr   Wed Jun 
 6 00:53:50 2007
@@ -1,6 +1,6 @@
 // The code generated for this testcase should be completely typesafe!
 // RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | \
-// RUN:   notcast
+// RUN:grep -v llvm.noinline | notcast
 
 struct contained {
   unsigned X;


Index: llvm/test/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr
diff -u llvm/test/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr:1.3 
llvm/test/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr:1.4
--- llvm/test/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr:1.3 
Sun Apr 15 15:41:31 2007
+++ llvm/test/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr Wed Jun 
 6 00:53:50 2007
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | notcast
+// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | grep -v 
llvm.noinline | notcast
 
 struct A {
 A() : i(0) {}


Index: llvm/test/C++Frontend/2005-07-21-VirtualBaseAccess.cpp
diff -u llvm/test/C++Frontend/2005-07-21-VirtualBaseAccess.cpp:1.2 
llvm/test/C++Frontend/2005-07-21-VirtualBaseAccess.cpp:1.3
--- llvm/test/C++Frontend/2005-07-21-VirtualBaseAccess.cpp:1.2  Thu Apr 13 
12:28:28 2006
+++ llvm/test/C++Frontend/2005-07-21-VirtualBaseAccess.cpp  Wed Jun  6 
00:53:50 2007
@@ -1,4 +1,4 @@
-// RUN: %llvmgxx -xc++ %s -c -o - | opt -die | llvm-dis | not grep cast
+// RUN: %llvmgxx -xc++ %s -c -o - | opt -die | llvm-dis | grep -v 
llvm.noinline | not grep cast
 
 void foo(int*);
 



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


[llvm-commits] CVS: llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr

2007-06-05 Thread Tanya Lattner


Changes in directory llvm/test/CFrontend:

2003-07-22-ArrayAccessTypeSafety.c.tr updated: 1.6 - 1.7
---
Log message:

Ignore llvm.noinline


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

 2003-07-22-ArrayAccessTypeSafety.c.tr |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr
diff -u llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr:1.6 
llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr:1.7
--- llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr:1.6   Mon Apr 
16 01:04:03 2007
+++ llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr   Wed Jun  6 
00:53:50 2007
@@ -1,4 +1,4 @@
-/* RUN: %llvmgcc -xc %s -S -o - | grep -v alloca | not grep bitcast
+/* RUN: %llvmgcc -xc %s -S -o - | grep -v alloca | grep -v llvm.noinline | not 
grep bitcast
  */
 
 void test(int* array, long long N) {



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


[llvm-commits] [128029] Fixing paste error so noinline uses the right vector.

2007-06-05 Thread lattner
Revision: 128029
Author:   lattner
Date: 2007-06-05 22:58:43 -0700 (Tue, 05 Jun 2007)

Log Message:
---
Fixing paste error so noinline uses the right vector.

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-backend.cpp

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-06-06 00:56:14 UTC 
(rev 128028)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-06-06 05:58:43 UTC 
(rev 128029)
@@ -479,7 +479,7 @@
   if (!AttributeNoinlineFunctions.empty()) {
 const Type *SBP= PointerType::get(Type::Int8Ty);
 ArrayType *AT = ArrayType::get(SBP, AttributeNoinlineFunctions.size());
-Constant *Init = ConstantArray::get(AT, AttributeUsedGlobals);
+Constant *Init = ConstantArray::get(AT, AttributeNoinlineFunctions);
 GlobalValue *gv = new GlobalVariable(AT, false, 
 GlobalValue::AppendingLinkage, Init,
 llvm.noinline, TheModule);


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