[llvm-commits] [release_20] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.105.2.1 - 1.105.2.2
---
Log message:

Merge from mainline.


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

 GlobalOpt.cpp |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.105.2.1 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.105.2.2
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.105.2.1 Fri May 18 01:02:03 2007
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Fri May 18 01:02:45 2007
@@ -623,9 +623,10 @@
   Loads.push_back(LI);
   Changed |= OptimizeAwayTrappingUsesOfValue(LI, LV);
 } else {
-  // If we get here we could have stores, loads, or phi nodes whose values
+  // If we get here we could have stores, selects, or phi nodes whose 
values
   // are loaded.
-  assert((isaStoreInst(*GUI) || isaPHINode(*GUI)) 
+  assert((isaStoreInst(*GUI) || isaPHINode(*GUI) ||
+  isaSelectInst(*GUI)) 
  Only expect load and stores!);
 }
 



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


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

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.762 - 1.762.2.1
---
Log message:

Merge from mainline.


---
Diffs of the changes:  (+16 -7)

 InstructionCombining.cpp |   23 ---
 1 files changed, 16 insertions(+), 7 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.762 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.762.2.1
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.762   Sun May  6 
08:37:16 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri May 18 01:03:55 2007
@@ -6449,16 +6449,25 @@
   while (Offset) {
 if (const StructType *STy = dyn_castStructType(GEPIdxTy)) {
   const StructLayout *SL = TD-getStructLayout(STy);
-  unsigned Elt = SL-getElementContainingOffset(Offset);
-  NewIndices.push_back(ConstantInt::get(Type::Int32Ty, Elt));
+  if (Offset  (int64_t)SL-getSizeInBytes()) {
+unsigned Elt = SL-getElementContainingOffset(Offset);
+NewIndices.push_back(ConstantInt::get(Type::Int32Ty, Elt));
   
-  Offset -= SL-getElementOffset(Elt);
-  GEPIdxTy = STy-getElementType(Elt);
+Offset -= SL-getElementOffset(Elt);
+GEPIdxTy = STy-getElementType(Elt);
+  } else {
+// Otherwise, we can't index into this, bail out.
+Offset = 0;
+OrigBase = 0;
+  }
 } else if (isaArrayType(GEPIdxTy) || isaVectorType(GEPIdxTy)) {
   const SequentialType *STy = castSequentialType(GEPIdxTy);
-  uint64_t EltSize = TD-getTypeSize(STy-getElementType());
-  NewIndices.push_back(ConstantInt::get(IntPtrTy, Offset/EltSize));
-  Offset %= EltSize;
+  if (uint64_t EltSize = TD-getTypeSize(STy-getElementType())) {
+
NewIndices.push_back(ConstantInt::get(IntPtrTy,Offset/EltSize));
+Offset %= EltSize;
+  } else {
+NewIndices.push_back(ConstantInt::get(IntPtrTy, 0));
+  }
   GEPIdxTy = STy-getElementType();
 } else {
   // Otherwise, we can't index into this, bail out.



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


[llvm-commits] [release_20] CVS: llvm/include/llvm/IntrinsicsX86.td

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/include/llvm:

IntrinsicsX86.td updated: 1.44 - 1.44.2.1
---
Log message:

Merge from mainline


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

 IntrinsicsX86.td |4 
 1 files changed, 4 insertions(+)


Index: llvm/include/llvm/IntrinsicsX86.td
diff -u llvm/include/llvm/IntrinsicsX86.td:1.44 
llvm/include/llvm/IntrinsicsX86.td:1.44.2.1
--- llvm/include/llvm/IntrinsicsX86.td:1.44 Tue Apr 24 16:18:37 2007
+++ llvm/include/llvm/IntrinsicsX86.td  Fri May 18 01:05:30 2007
@@ -702,6 +702,10 @@
 
 // Misc.
 let TargetPrefix = x86 in {  // All intrinsics start with llvm.x86..
+  def int_x86_mmx_maskmovq : GCCBuiltin__builtin_ia32_maskmovq,
+  Intrinsic[llvm_void_ty, llvm_v8i8_ty, llvm_v8i8_ty, 
llvm_ptr_ty],
+[IntrWriteMem];
+
   def int_x86_mmx_pmovmskb : GCCBuiltin__builtin_ia32_pmovmskb,
   Intrinsic[llvm_i32_ty, llvm_v8i8_ty], [IntrNoMem];
 



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


[llvm-commits] [release_20] CVS: llvm/lib/Target/X86/X86InstrMMX.td

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/lib/Target/X86:

X86InstrMMX.td updated: 1.31 - 1.31.2.1
---
Log message:

Merge from mainline


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

 X86InstrMMX.td |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86InstrMMX.td
diff -u llvm/lib/Target/X86/X86InstrMMX.td:1.31 
llvm/lib/Target/X86/X86InstrMMX.td:1.31.2.1
--- llvm/lib/Target/X86/X86InstrMMX.td:1.31 Tue Apr 24 16:18:37 2007
+++ llvm/lib/Target/X86/X86InstrMMX.td  Fri May 18 01:08:42 2007
@@ -493,7 +493,9 @@
 
 // Misc.
 def MMX_MASKMOVQ : MMXI0xF7, MRMDestMem, (ops VR64:$src, VR64:$mask),
-maskmovq {$mask, $src|$src, $mask}, [];
+maskmovq {$mask, $src|$src, $mask},
+[(int_x86_mmx_maskmovq VR64:$src, VR64:$mask, EDI)],
+Imp[EDI],[];
 
 
//===--===//
 // Alias Instructions



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


[llvm-commits] [release_20] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp BitcodeReader.h

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.47.2.1 - 1.47.2.2
BitcodeReader.h updated: 1.19 - 1.19.2.1
---
Log message:

Merge from mainline.


---
Diffs of the changes:  (+93 -44)

 BitcodeReader.cpp |  124 +++---
 BitcodeReader.h   |   13 -
 2 files changed, 93 insertions(+), 44 deletions(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.47.2.1 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.47.2.2
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.47.2.1  Tue May  8 01:37:35 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Fri May 18 01:20:09 2007
@@ -24,8 +24,15 @@
 #include llvm/Support/MemoryBuffer.h
 using namespace llvm;
 
-BitcodeReader::~BitcodeReader() {
+void BitcodeReader::FreeState() {
   delete Buffer;
+  Buffer = 0;
+  std::vectorPATypeHolder().swap(TypeList);
+  ValueList.clear();
+  std::vectorconst ParamAttrsList*().swap(ParamAttrs);
+  std::vectorBasicBlock*().swap(FunctionBBs);
+  std::vectorFunction*().swap(FunctionsWithBodies);
+  DeferredFunctionInfo.clear();
 }
 
 
//===--===//
@@ -1102,42 +1109,6 @@
 }
 
 
-bool BitcodeReader::materializeFunction(Function *F, std::string *ErrInfo) {
-  // If it already is material, ignore the request.
-  if (!F-hasNotBeenReadFromBytecode()) return false;
-
-  DenseMapFunction*, std::pairuint64_t, unsigned ::iterator DFII = 
-DeferredFunctionInfo.find(F);
-  assert(DFII != DeferredFunctionInfo.end()  Deferred function not found!);
-  
-  // Move the bit stream to the saved position of the deferred function body 
and
-  // restore the real linkage type for the function.
-  Stream.JumpToBit(DFII-second.first);
-  F-setLinkage((GlobalValue::LinkageTypes)DFII-second.second);
-  DeferredFunctionInfo.erase(DFII);
-  
-  if (ParseFunctionBody(F)) {
-if (ErrInfo) *ErrInfo = ErrorString;
-return true;
-  }
-  
-  return false;
-}
-
-Module *BitcodeReader::materializeModule(std::string *ErrInfo) {
-  DenseMapFunction*, std::pairuint64_t, unsigned ::iterator I = 
-DeferredFunctionInfo.begin();
-  while (!DeferredFunctionInfo.empty()) {
-Function *F = (*I++).first;
-assert(F-hasNotBeenReadFromBytecode() 
-   Deserialized function found in map!);
-if (materializeFunction(F, ErrInfo))
-  return 0;
-  }
-  return TheModule;
-}
-
-
 /// ParseFunctionBody - Lazily parse the specified function body block.
 bool BitcodeReader::ParseFunctionBody(Function *F) {
   if (Stream.EnterSubBlock(bitc::FUNCTION_BLOCK_ID))
@@ -1586,6 +1557,69 @@
   return false;
 }
 
+//===--===//
+// ModuleProvider implementation
+//===--===//
+
+
+bool BitcodeReader::materializeFunction(Function *F, std::string *ErrInfo) {
+  // If it already is material, ignore the request.
+  if (!F-hasNotBeenReadFromBytecode()) return false;
+  
+  DenseMapFunction*, std::pairuint64_t, unsigned ::iterator DFII = 
+DeferredFunctionInfo.find(F);
+  assert(DFII != DeferredFunctionInfo.end()  Deferred function not found!);
+  
+  // Move the bit stream to the saved position of the deferred function body 
and
+  // restore the real linkage type for the function.
+  Stream.JumpToBit(DFII-second.first);
+  F-setLinkage((GlobalValue::LinkageTypes)DFII-second.second);
+  
+  if (ParseFunctionBody(F)) {
+if (ErrInfo) *ErrInfo = ErrorString;
+return true;
+  }
+  
+  return false;
+}
+
+void BitcodeReader::dematerializeFunction(Function *F) {
+  // If this function isn't materialized, or if it is a proto, this is a noop.
+  if (F-hasNotBeenReadFromBytecode() || F-isDeclaration())
+return;
+  
+  assert(DeferredFunctionInfo.count(F)  No info to read function later?);
+  
+  // Just forget the function body, we can remat it later.
+  F-deleteBody();
+  F-setLinkage(GlobalValue::GhostLinkage);
+}
+
+
+Module *BitcodeReader::materializeModule(std::string *ErrInfo) {
+  for (DenseMapFunction*, std::pairuint64_t, unsigned ::iterator I = 
+   DeferredFunctionInfo.begin(), E = DeferredFunctionInfo.end(); I != E;
+   ++I) {
+Function *F = I-first;
+if (F-hasNotBeenReadFromBytecode() 
+materializeFunction(F, ErrInfo))
+  return 0;
+  }
+  return TheModule;
+}
+
+
+/// This method is provided by the parent ModuleProvde class and overriden
+/// here. It simply releases the module from its provided and frees up our
+/// state.
+/// @brief Release our hold on the generated module
+Module *BitcodeReader::releaseModule(std::string *ErrInfo) {
+  // Since we're losing control of this Module, we must hand it back complete
+  Module *M = ModuleProvider::releaseModule(ErrInfo);
+  FreeState();
+  return M;
+}
+
 
 
//===--===//
 // External 

[llvm-commits] [release_20] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.399.2.1 - 1.399.2.2
---
Log message:

Merge from mainline


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

 X86ISelLowering.cpp |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.399.2.1 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.399.2.2
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.399.2.1   Fri May 18 00:59:52 2007
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri May 18 01:21:50 2007
@@ -2675,7 +2675,8 @@
   return Op;
 }
 
-if (X86::isSHUFPMask(PermMask.Val))
+if (X86::isSHUFPMask(PermMask.Val) 
+MVT::getSizeInBits(VT) != 64)// Don't do this for MMX.
   return Op;
 
 // Handle v8i16 shuffle high / low shuffle node pair.
@@ -2712,7 +2713,9 @@
 }
   }
 
-  if (NumElems == 4) {
+  if (NumElems == 4  
+  // Don't do this for MMX.
+  MVT::getSizeInBits(VT) != 64) {
 MVT::ValueType MaskVT = PermMask.getValueType();
 MVT::ValueType MaskEVT = MVT::getVectorBaseType(MaskVT);
 SmallVectorstd::pairint, int, 8 Locs;



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


[llvm-commits] [release_20] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.105 - 1.105.2.1
---
Log message:

Merge from mainline.


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

 GlobalOpt.cpp |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.105 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.105.2.1
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.105 Sun May  6 08:37:16 2007
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Fri May 18 01:02:03 2007
@@ -623,7 +623,10 @@
   Loads.push_back(LI);
   Changed |= OptimizeAwayTrappingUsesOfValue(LI, LV);
 } else {
-  assert(isaStoreInst(*GUI)  Only expect load and stores!);
+  // If we get here we could have stores, loads, or phi nodes whose values
+  // are loaded.
+  assert((isaStoreInst(*GUI) || isaPHINode(*GUI)) 
+ Only expect load and stores!);
 }
 
   if (Changed) {



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


[llvm-commits] CVS: llvm/docs/ReleaseNotes.html

2007-05-18 Thread Chris Lattner


Changes in directory llvm/docs:

ReleaseNotes.html updated: 1.382 - 1.383
---
Log message:

crank out notes


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

 ReleaseNotes.html |  263 +++---
 1 files changed, 134 insertions(+), 129 deletions(-)


Index: llvm/docs/ReleaseNotes.html
diff -u llvm/docs/ReleaseNotes.html:1.382 llvm/docs/ReleaseNotes.html:1.383
--- llvm/docs/ReleaseNotes.html:1.382   Thu May 17 19:44:29 2007
+++ llvm/docs/ReleaseNotes.html Fri May 18 01:33:02 2007
@@ -72,16 +72,23 @@
 series./li
 liThere are several significant change to the LLVM IR and internal APIs, such
 as a major overhaul of the type system, the completely new bitcode file
-format, etc./li
+format, etc (described below)./li
 liWe designed the release around a 6 month release cycle instead of the usual
 3-month cycle.  This gave us extra time to develop and test some of the
 more invasive features in this release./li
-liLLVM 2.0 no longer supports the llvm-gcc3 front-end./li
+liLLVM 2.0 no longer supports the llvm-gcc3 front-end.  Users are required to
+upgrade to llvm-gcc4.  llvm-gcc4 includes many features over
+llvm-gcc3, is faster, and is a href=CFEBuildInstrs.htmlmuch easier to
+build from source/a./li
 /ol
 
 pNote that while this is a major version bump, this release has been
extensively tested on a wide range of software.  It is easy to say that this
-   is our best release yet, in terms of both features and correctness./p
+   is our best release yet, in terms of both features and correctness.  This is
+   the first LLVM release to correctly compile and optimize major software like
+   LLVM itself, Mozilla/Seamonkey, Qt 4.3rc1, kOffice, etc out of the box on
+   linux/x86.
+   /p
 
 /div
 
@@ -93,26 +100,27 @@
 
!--_--
 div class=doc_subsubsectiona name=majorchangesMajor Changes/a/div
 div class=doc_text
-pblah
-/p
 
-ul
+pChanges to the LLVM IR itself:/p
 
-lillvm-gcc3 is now officially unsupported.  Users are required to
-upgrade to llvm-gcc4.  llvm-gcc4 includes many features over
-llvm-gcc3, is faster, and is much easier to build./li
+ul
 
 liInteger types are now completely signless. This means that we
 have types like i8/i16/i32 instead of ubyte/sbyte/short/ushort/int
 etc. LLVM operations that depend on sign have been split up into 
-separate instructions (a href=http://llvm.org/PR950;PR950/a)./li
+separate instructions (a href=http://llvm.org/PR950;PR950/a).  This
+eliminates cast instructions that just change the sign of the operands 
(e.g.
+int - uint), which reduces the size of the IR and makes optimizers
+simpler to write./li
+
+liInteger types with arbitrary bitwidths (e.g. i13, i36, i42, i1057, etc) are
+now supported in the LLVM IR and optimizations (a 
+href=http://llvm.org/PR1043;PR1043/a).  However, neither llvm-gcc
+(a href=http://llvm.org/PR1284;PR1284/a) nor the native code 
generators
+(a href=http://llvm.org/PR1270;PR1270/a) support non-standard width
+integers yet./li
 
-liArbitrary bitwidth integers (e.g. i13, i36, i42, etc) are now
-supported in the LLVM IR and optimizations. However, neither llvm-gcc nor
-the native code generators support non-standard width integers 
-(a href=http://llvm.org/PR1043;PR1043/a)./li
-
-li'type planes' have been removed (a 
href=http://llvm.org/PR411;PR411/a).
+li'Type planes' have been removed (a 
href=http://llvm.org/PR411;PR411/a).
 It is no longer possible to have two values with the same name in the 
 same symbol table.  This simplifies LLVM internals, allowing significant 
 speedups./li
@@ -121,36 +129,36 @@
 @ instead of % (a href=http://llvm.org/PR645;PR645/a)./li
 
 liThe LLVM 1.x bytecode format has been replaced with a  
-completely new binary representation, named 'bitcode'.  Because we  
-plan to maintain binary compatibility between LLVM 2.x .bc files,  
-this is an important change to get right.  Bitcode brings a number of  
-advantages to the LLVM over the old bytecode format.  It is denser  
+completely new binary representation, named 'bitcode'. The a
+href=BitCodeFormat.htmlBitcode Format/a brings a
+number of advantages to the LLVM over the old bytecode format: it is 
denser  
 (files are smaller), more extensible, requires less memory to read,  
 is easier to keep backwards compatible (so LLVM 2.5 will read 2.0 .bc  
 files), and has many other nice features./li
 
-liSupport was added for alignment values on load and store
-instructions (a href=http://www.llvm.org/PR400;PR400/a).  This 
-allows the IR to express loads that are not
-sufficiently aligned (e.g. due to pragma packed) or to capture extra
-alignment information. /li
-
-liLLVM now has a new MSIL backend. llc - march=msil will now turn LLVM 
-into MSIL (.net) bytecode.  This is still fairly 

[llvm-commits] CVS: llvm/docs/ReleaseNotes.html

2007-05-18 Thread Chris Lattner


Changes in directory llvm/docs:

ReleaseNotes.html updated: 1.383 - 1.384
---
Log message:

finished the first draft


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

 ReleaseNotes.html |   17 +
 1 files changed, 5 insertions(+), 12 deletions(-)


Index: llvm/docs/ReleaseNotes.html
diff -u llvm/docs/ReleaseNotes.html:1.383 llvm/docs/ReleaseNotes.html:1.384
--- llvm/docs/ReleaseNotes.html:1.383   Fri May 18 01:33:02 2007
+++ llvm/docs/ReleaseNotes.html Fri May 18 01:38:51 2007
@@ -157,6 +157,8 @@
 into MSIL (.net) bytecode.  This is still fairly early development 
 with a number of limitations./li
 
+liA new a href=CommandGuide/html/llvm-upgrade.htmlllvm-upgrade/a tool 
+exists to migrates LLVM 1.9 .ll files to LLVM 2.0 syntax./li
 /ul
 
 /div
@@ -378,15 +380,11 @@
 div class=doc_subsubsectiona name=otherOther Improvements/a/div
 div class=doc_text
 
-pThis release includes many other improvements, including
-performance work, specifically designed to tune datastructure
-usage. This makes several critical components faster./p
-
 pMore specific changes include:/p
 
 ul
 liLLVM no longer relies on static destructors to shut itself down.  Instead,
-it lazily initializes itself and shuts down when llvm_shutdown() is 
+it lazily initializes itself and shuts down when ttllvm_shutdown()/tt 
is 
 explicitly called./li
 
 liLLVM now has significantly fewer static constructors, reducing startup 
time.
@@ -397,16 +395,11 @@
 
 liConstruction of intrinsic function declarations has been simplified./li
 
-liThe llvm-upgrade tool now exists. This migrates LLVM 1.9 .ll files to 
-LLVM 2.0 syntax./li
-
-liThe gccas/gccld tools have been removed./li
+liThe gccas/gccld tools have been replaced with small shell scripts./li
 
 liSupport has been added to llvm-test for running on low-memory  
 or slow machines (make SMALL_PROBLEM_SIZE=1)./li
 
-lillvm-test is now more portable and should build with MS Visual Studio./li
-
 /ul
 /div
 
@@ -856,7 +849,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01! //a
 
   a href=http://llvm.org/;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2007/05/18 06:33:02 $
+  Last modified: $Date: 2007/05/18 06:38:51 $
 /address
 
 /body



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


[llvm-commits] [release_20] CVS: llvm/docs/ReleaseNotes.html

2007-05-18 Thread Chris Lattner


Changes in directory llvm/docs:

ReleaseNotes.html updated: 1.368 - 1.368.2.1
---
Log message:

first cut of llvm 2.0 release notes


---
Diffs of the changes:  (+411 -242)

 ReleaseNotes.html |  653 +-
 1 files changed, 411 insertions(+), 242 deletions(-)


Index: llvm/docs/ReleaseNotes.html
diff -u llvm/docs/ReleaseNotes.html:1.368 llvm/docs/ReleaseNotes.html:1.368.2.1
--- llvm/docs/ReleaseNotes.html:1.368   Tue Apr  3 23:14:31 2007
+++ llvm/docs/ReleaseNotes.html Fri May 18 01:39:06 2007
@@ -4,11 +4,11 @@
 head
   meta http-equiv=Content-Type content=text/html; charset=utf-8
   link rel=stylesheet href=llvm.css type=text/css
-  titleLLVM 1.9 Release Notes/title
+  titleLLVM 2.0 Release Notes/title
 /head
 body
 
-div class=doc_titleLLVM 1.9 Release Notes/div
+div class=doc_titleLLVM 2.0 Release Notes/div
  
 ol
   lia href=#introIntroduction/a/li
@@ -32,13 +32,10 @@
 div class=doc_text
 
 pThis document contains the release notes for the LLVM compiler
-infrastructure, release 1.9.  Here we describe the status of LLVM, including 
any
-known problems and major improvements from the previous release.  The most
-up-to-date version of this document (corresponding to LLVM CVS) can be found
-on the a
-href=http://llvm.org/releases/;LLVM releases web site/a.  If you are
-not reading this on the LLVM web pages, you should probably go there because
-this document may be updated after the release./p
+infrastructure, release 2.0.  Here we describe the status of LLVM, including 
any
+known problems and major improvements from the previous release.  All LLVM
+releases may be downloaded from the a href=http://llvm.org/releases/;LLVM
+releases web site/a.
 
 pFor more information about LLVM, including information about the latest
 release, please check out the a href=http://llvm.org/;main LLVM
@@ -61,67 +58,175 @@
 
 div class=doc_text
 
-pThis is the tenth public release of the LLVM Compiler Infrastructure. This
-release incorporates a large number of enhancements, new features, and bug
-fixes.  We recommend that all users of previous LLVM versions upgrade.
-/p
+pThis is the eleventh public release of the LLVM Compiler Infrastructure. 
+Being the first major release since 1.0, this release is different in several
+ways from our previous releases:/p
+
+ol
+liWe took this as an opportunity to
+break backwards compatibility with the LLVM 1.x bytecode and .ll file format.
+If you have LLVM 1.9 .ll files that you would like to upgrade to LLVM 2.x, we 
+recommend the use of the stand alone a href=#llvm-upgradellvm-upgrade/a
+tool (which is included with 2.0).  We intend to keep compatibility with .ll 
+and .bc formats within the 2.x release series, like we did within the 1.x 
+series./li
+liThere are several significant change to the LLVM IR and internal APIs, such
+as a major overhaul of the type system, the completely new bitcode file
+format, etc (described below)./li
+liWe designed the release around a 6 month release cycle instead of the usual
+3-month cycle.  This gave us extra time to develop and test some of the
+more invasive features in this release./li
+liLLVM 2.0 no longer supports the llvm-gcc3 front-end.  Users are required to
+upgrade to llvm-gcc4.  llvm-gcc4 includes many features over
+llvm-gcc3, is faster, and is a href=CFEBuildInstrs.htmlmuch easier to
+build from source/a./li
+/ol
+
+pNote that while this is a major version bump, this release has been
+   extensively tested on a wide range of software.  It is easy to say that this
+   is our best release yet, in terms of both features and correctness.  This is
+   the first LLVM release to correctly compile and optimize major software like
+   LLVM itself, Mozilla/Seamonkey, Qt 4.3rc1, kOffice, etc out of the box on
+   linux/x86.
+   /p
 
 /div
 
 
!--=--
 div class=doc_subsection
-a name=newfeaturesNew Features in LLVM 1.9/a
+a name=newfeaturesNew Features in LLVM 2.0/a
 /div
 
 
!--_--
-div class=doc_subsubsectiona name=x86-64New X86-64 Backend/a/div
+div class=doc_subsubsectiona name=majorchangesMajor Changes/a/div
 div class=doc_text
-pLLVM 1.9 now fully supports the x86-64 instruction set on Mac OS/X, and
-supports it on Linux (and other operating systems) when compiling in -static
-mode. LLVM includes JIT support for X86-64, and supports both Intel EMT-64T
-and AMD-64 architectures.  The X86-64 instruction set permits addressing a
-64-bit addressing space and provides the compiler with twice the
-number of integer registers to use./p
-/div
 
-!--_--
-div class=doc_subsubsectiona name=ltoLink-Time Optimization integration
-with native linkers/a/div
-div class=doc_text
-pLLVM now includes a href=LinkTimeOptimization.htmlliblto/a which can
-be used to 

[llvm-commits] CVS: llvm/include/llvm/ValueSymbolTable.h BasicBlock.h

2007-05-18 Thread Chris Lattner


Changes in directory llvm/include/llvm:

ValueSymbolTable.h updated: 1.13 - 1.14
BasicBlock.h updated: 1.68 - 1.69
---
Log message:

better portability for intptr_t.


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

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


Index: llvm/include/llvm/ValueSymbolTable.h
diff -u llvm/include/llvm/ValueSymbolTable.h:1.13 
llvm/include/llvm/ValueSymbolTable.h:1.14
--- llvm/include/llvm/ValueSymbolTable.h:1.13   Wed Apr 25 09:27:10 2007
+++ llvm/include/llvm/ValueSymbolTable.hFri May 18 02:07:05 2007
@@ -16,6 +16,7 @@
 
 #include llvm/Value.h
 #include llvm/ADT/StringMap.h
+#include llvm/Support/DataTypes.h
 
 namespace llvm {
   templatetypename ValueSubClass, typename ItemParentClass


Index: llvm/include/llvm/BasicBlock.h
diff -u llvm/include/llvm/BasicBlock.h:1.68 llvm/include/llvm/BasicBlock.h:1.69
--- llvm/include/llvm/BasicBlock.h:1.68 Tue Apr 17 13:16:39 2007
+++ llvm/include/llvm/BasicBlock.h  Fri May 18 02:07:05 2007
@@ -17,6 +17,7 @@
 #include llvm/Instruction.h
 #include llvm/SymbolTableListTraits.h
 #include llvm/ADT/ilist
+#include llvm/Support/DataTypes.h
 
 namespace llvm {
 



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


[llvm-commits] [release_20] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

2007-05-18 Thread Tanya Lattner


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.399 - 1.399.2.1
---
Log message:

Merging from mainline.


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

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


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.399 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.399.2.1
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.399   Thu May  3 11:52:29 2007
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri May 18 00:59:52 2007
@@ -4725,18 +4725,19 @@
   case 'I':
 if (ConstantSDNode *C = dyn_castConstantSDNode(Op)) {
   if (C-getValue() = 31)
-return Op;
+return DAG.getTargetConstant(C-getValue(), Op.getValueType());
 }
 return SDOperand(0,0);
   case 'N':
 if (ConstantSDNode *C = dyn_castConstantSDNode(Op)) {
   if (C-getValue() = 255)
-return Op;
+return DAG.getTargetConstant(C-getValue(), Op.getValueType());
 }
 return SDOperand(0,0);
   case 'i': {
 // Literal immediates are always ok.
-if (isaConstantSDNode(Op)) return Op;
+if (ConstantSDNode *CST = dyn_castConstantSDNode(Op))
+  return DAG.getTargetConstant(CST-getValue(), Op.getValueType());
 
 // If we are in non-pic codegen mode, we allow the address of a global 
(with
 // an optional displacement) to be used with 'i'.



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


[llvm-commits] CVS: llvm/docs/ReleaseNotes.html

2007-05-18 Thread Duncan Sands


Changes in directory llvm/docs:

ReleaseNotes.html updated: 1.384 - 1.385
---
Log message:

Fix typo.


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

 ReleaseNotes.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/docs/ReleaseNotes.html
diff -u llvm/docs/ReleaseNotes.html:1.384 llvm/docs/ReleaseNotes.html:1.385
--- llvm/docs/ReleaseNotes.html:1.384   Fri May 18 01:38:51 2007
+++ llvm/docs/ReleaseNotes.html Fri May 18 04:04:20 2007
@@ -693,7 +693,7 @@
   See a 
href=http://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html#Constructing%20Calls;Constructing
 Calls/a: Dispatching a call to another function./p
 /li
 
-lipllvm-gcc bpartially/b supports tthese GCC extensions:/p
+lipllvm-gcc bpartially/b supports these GCC extensions:/p
   ol
   lia 
href=http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html#Nested%20Functions;Nested
 Functions/a: As in Algol and Pascal, lexical scoping of functions.br
   Nested functions are supported, but llvm-gcc does not support non-local
@@ -849,7 +849,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01! //a
 
   a href=http://llvm.org/;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2007/05/18 06:38:51 $
+  Last modified: $Date: 2007/05/18 09:04:20 $
 /address
 
 /body



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


[llvm-commits] CVS: llvm/test/lib/llvm.exp

2007-05-18 Thread Duncan Sands


Changes in directory llvm/test/lib:

llvm.exp updated: 1.23 - 1.24
---
Log message:

Fix typo.


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

 llvm.exp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/lib/llvm.exp
diff -u llvm/test/lib/llvm.exp:1.23 llvm/test/lib/llvm.exp:1.24
--- llvm/test/lib/llvm.exp:1.23 Mon Apr 23 16:21:53 2007
+++ llvm/test/lib/llvm.exp  Fri May 18 07:13:34 2007
@@ -39,7 +39,7 @@
   return $resultmsg
 }
 
-# This prcoedure performs variable substitutions on the RUN: lines of a test
+# This procedure performs variable substitutions on the RUN: lines of a test
 # cases.
 proc substitute { line test tmpFile } {
   global srcroot objroot srcdir objdir subdir target_triplet prcontext 



___
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-05-18 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.6 - 1.7
---
Log message:

Watch out for blocks that end with a return.

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

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


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.6 
llvm/lib/CodeGen/IfConversion.cpp:1.7
--- llvm/lib/CodeGen/IfConversion.cpp:1.6   Thu May 17 20:55:58 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Fri May 18 12:06:53 2007
@@ -316,7 +316,7 @@
 
 // Either the 'true' block fallthrough to another block or it ends with a
 // return. If it's the former, add a conditional branch to its successor.
-if (!TrueBBI.TrueBB)
+if (!TrueBBI.TrueBB  BBI.TrueBB-succ_size())
   TII-InsertBranch(*BBI.TrueBB, *BBI.TrueBB-succ_begin(), NULL, 
BBI.Cond);
 
 // Predicate the 'false' block.
@@ -326,7 +326,7 @@
 
 // Either the 'false' block fallthrough to another block or it ends with a
 // return. If it's the former, add a conditional branch to its successor.
-if (!FalseBBI.TrueBB)
+if (!FalseBBI.TrueBB  BBI.FalseBB-succ_size())
   TII-InsertBranch(*BBI.FalseBB, *BBI.FalseBB-succ_begin(), 
NULL,NewCond);
 
 // Merge the 'true' and 'false' blocks by copying the instructions



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


[llvm-commits] [release_20] CVS: llvm-test/SingleSource/Makefile

2007-05-18 Thread Tanya Lattner


Changes in directory llvm-test/SingleSource:

Makefile updated: 1.13 - 1.13.2.1
---
Log message:

Remove CustomChecked


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

 Makefile |4 
 1 files changed, 4 deletions(-)


Index: llvm-test/SingleSource/Makefile
diff -u llvm-test/SingleSource/Makefile:1.13 
llvm-test/SingleSource/Makefile:1.13.2.1
--- llvm-test/SingleSource/Makefile:1.13Fri May  4 16:50:39 2007
+++ llvm-test/SingleSource/Makefile Fri May 18 12:01:32 2007
@@ -2,10 +2,6 @@
 
 PARALLEL_DIRS  = UnitTests Regression Benchmarks
 
-ifndef REMOTE_HOST
-PARALLEL_DIRS += CustomChecked
-endif
-
 LDFLAGS += -lm
 
 include Makefile.singlesrc



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


[llvm-commits] CVS: llvm-test/RunSafely.sh

2007-05-18 Thread Chris Lattner


Changes in directory llvm-test:

RunSafely.sh updated: 1.31 - 1.32
---
Log message:

reid's patch from yesterday broke darwin


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

 RunSafely.sh |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm-test/RunSafely.sh
diff -u llvm-test/RunSafely.sh:1.31 llvm-test/RunSafely.sh:1.32
--- llvm-test/RunSafely.sh:1.31 Thu May 17 22:34:23 2007
+++ llvm-test/RunSafely.sh  Fri May 18 12:34:06 2007
@@ -35,7 +35,6 @@
 # program is the path to the program to run
 # args... are the arguments to pass to the program.
 #
-
 if [ $# -lt 4 ]; then
   echo ./RunSafely.sh timeout exitok infile outfile program 
args...
   exit 1
@@ -103,7 +102,7 @@
 fi
 
 if [ x$RHOST = x ] ; then
-  ( eval $ULIMITCMD time -p sh -c $COMMAND $OUTFILE 21  $INFILE ; echo 
exit $? ) 21 \
+  ( sh -c $ULIMITCMD; time -p sh -c $COMMAND $OUTFILE 21  $INFILE ; 
echo exit $? ) 21 \
 | awk -- '\
 BEGIN { cpu = 0.0; }
 /^user/   { cpu += $2; print; }



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


Re: [llvm-commits] CVS: llvm-test/RunSafely.sh

2007-05-18 Thread Reid Spencer
On Fri, 2007-05-18 at 12:34 -0500, Chris Lattner wrote:
 
 Changes in directory llvm-test:
 
 RunSafely.sh updated: 1.31 - 1.32
 ---
 Log message:
 
 reid's patch from yesterday broke darwin

You realize that reverting that patch means that all tests are not
guarded by any of the ulimit controls?

Reid.

 
 
 ---
 Diffs of the changes:  (+1 -2)
 
  RunSafely.sh |3 +--
  1 files changed, 1 insertion(+), 2 deletions(-)
 
 
 Index: llvm-test/RunSafely.sh
 diff -u llvm-test/RunSafely.sh:1.31 llvm-test/RunSafely.sh:1.32
 --- llvm-test/RunSafely.sh:1.31   Thu May 17 22:34:23 2007
 +++ llvm-test/RunSafely.shFri May 18 12:34:06 2007
 @@ -35,7 +35,6 @@
  # program is the path to the program to run
  # args... are the arguments to pass to the program.
  #
 -
  if [ $# -lt 4 ]; then
echo ./RunSafely.sh timeout exitok infile outfile program 
 args...
exit 1
 @@ -103,7 +102,7 @@
  fi
  
  if [ x$RHOST = x ] ; then
 -  ( eval $ULIMITCMD time -p sh -c $COMMAND $OUTFILE 21  $INFILE ; echo 
 exit $? ) 21 \
 +  ( sh -c $ULIMITCMD; time -p sh -c $COMMAND $OUTFILE 21  $INFILE ; 
 echo exit $? ) 21 \
  | awk -- '\
  BEGIN { cpu = 0.0; }
  /^user/   { cpu += $2; print; }
 
 
 
 ___
 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/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp SelectionDAGPrinter.cpp TargetLowering.cpp

2007-05-18 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.493 - 1.494
SelectionDAGISel.cpp updated: 1.451 - 1.452
SelectionDAGPrinter.cpp updated: 1.45 - 1.46
TargetLowering.cpp updated: 1.115 - 1.116
---
Log message:

Qualify several calls to functions in the MVT namespace, for consistency.


---
Diffs of the changes:  (+25 -23)

 LegalizeDAG.cpp |   28 +++-
 SelectionDAGISel.cpp|   14 +++---
 SelectionDAGPrinter.cpp |2 +-
 TargetLowering.cpp  |4 ++--
 4 files changed, 25 insertions(+), 23 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.493 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.494
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.493 Thu May 17 13:15:41 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Fri May 18 12:52:13 2007
@@ -2722,7 +2722,7 @@
 case TargetLowering::Promote: {
   MVT::ValueType OVT = Tmp1.getValueType();
   MVT::ValueType NVT = TLI.getTypeToPromoteTo(Node-getOpcode(), OVT);
-  unsigned DiffBits = getSizeInBits(NVT) - getSizeInBits(OVT);
+  unsigned DiffBits = MVT::getSizeInBits(NVT) - MVT::getSizeInBits(OVT);
 
   Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, NVT, Tmp1);
   Tmp1 = DAG.getNode(ISD::BSWAP, NVT, Tmp1);
@@ -2760,16 +2760,16 @@
   case ISD::CTTZ:
 //if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT)
 Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), Tmp1,
-DAG.getConstant(getSizeInBits(NVT), NVT),
+DAG.getConstant(MVT::getSizeInBits(NVT), NVT),
 ISD::SETEQ);
 Result = DAG.getNode(ISD::SELECT, NVT, Tmp2,
-   DAG.getConstant(getSizeInBits(OVT),NVT), Tmp1);
+   DAG.getConstant(MVT::getSizeInBits(OVT),NVT), Tmp1);
 break;
   case ISD::CTLZ:
 // Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT))
 Result = DAG.getNode(ISD::SUB, NVT, Tmp1,
- DAG.getConstant(getSizeInBits(NVT) -
- getSizeInBits(OVT), NVT));
+ DAG.getConstant(MVT::getSizeInBits(NVT) -
+ MVT::getSizeInBits(OVT), NVT));
 break;
   }
   break;
@@ -3527,7 +3527,8 @@
 Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, NVT, Tmp1);
 Tmp1 = DAG.getNode(ISD::BSWAP, NVT, Tmp1);
 Result = DAG.getNode(ISD::SRL, NVT, Tmp1,
- DAG.getConstant(getSizeInBits(NVT) - 
getSizeInBits(VT),
+ DAG.getConstant(MVT::getSizeInBits(NVT) -
+ MVT::getSizeInBits(VT),
  TLI.getShiftAmountTy()));
 break;
   case ISD::CTPOP:
@@ -3544,15 +3545,16 @@
 case ISD::CTTZ:
   // if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT)
   Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), Tmp1,
-  DAG.getConstant(getSizeInBits(NVT), NVT), 
ISD::SETEQ);
+  DAG.getConstant(MVT::getSizeInBits(NVT), NVT),
+  ISD::SETEQ);
   Result = DAG.getNode(ISD::SELECT, NVT, Tmp2,
-   DAG.getConstant(getSizeInBits(VT), NVT), Tmp1);
+   DAG.getConstant(MVT::getSizeInBits(VT), NVT), Tmp1);
   break;
 case ISD::CTLZ:
   //Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT))
   Result = DAG.getNode(ISD::SUB, NVT, Tmp1,
-   DAG.getConstant(getSizeInBits(NVT) -
-   getSizeInBits(VT), NVT));
+   DAG.getConstant(MVT::getSizeInBits(NVT) -
+   MVT::getSizeInBits(VT), NVT));
   break;
 }
 break;
@@ -4639,7 +4641,7 @@
 };
 MVT::ValueType VT = Op.getValueType();
 MVT::ValueType ShVT = TLI.getShiftAmountTy();
-unsigned len = getSizeInBits(VT);
+unsigned len = MVT::getSizeInBits(VT);
 for (unsigned i = 0; (1U  i) = (len / 2); ++i) {
   //x = (x  mask[i][len/8]) + (x  (1  i)  mask[i][len/8])
   SDOperand Tmp2 = DAG.getConstant(mask[i], VT);
@@ -4662,7 +4664,7 @@
 // but see also: http://www.hackersdelight.org/HDcode/nlz.cc
 MVT::ValueType VT = Op.getValueType();
 MVT::ValueType ShVT = TLI.getShiftAmountTy();
-unsigned len = getSizeInBits(VT);
+unsigned len = MVT::getSizeInBits(VT);
 for (unsigned i = 0; (1U  i) = (len / 2); ++i) {
   SDOperand Tmp3 = DAG.getConstant(1ULL  i, ShVT);
   Op = DAG.getNode(ISD::OR, VT, Op, DAG.getNode(ISD::SRL, VT, Op, Tmp3));
@@ -4684,7 +4686,7 @@
 if (!TLI.isOperationLegal(ISD::CTPOP, VT) 
 TLI.isOperationLegal(ISD::CTLZ, VT))
   return DAG.getNode(ISD::SUB, VT,
- DAG.getConstant(getSizeInBits(VT), VT),
+

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

2007-05-18 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.7 - 1.8
---
Log message:

Some restructuring in preparation for most aggressive if-conversion.

---
Diffs of the changes:  (+71 -40)

 IfConversion.cpp |  111 +++
 1 files changed, 71 insertions(+), 40 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.7 
llvm/lib/CodeGen/IfConversion.cpp:1.8
--- llvm/lib/CodeGen/IfConversion.cpp:1.7   Fri May 18 12:06:53 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Fri May 18 13:14:37 2007
@@ -39,16 +39,20 @@
 /// if-conversion feasibility analysis. This includes results from
 /// TargetInstrInfo::AnalyzeBranch() (i.e. TBB, FBB, and Cond), and its
 /// classification, and common tail block of its successors (if it's a
-/// diamond shape).
+/// diamond shape), its size, whether it's predicable, and whether any
+/// instruction can clobber the 'would-be' predicate.
 struct BBInfo {
   BBICKind Kind;
+  unsigned Size;
+  bool isPredicable;
+  bool ClobbersPred;
   MachineBasicBlock *BB;
   MachineBasicBlock *TrueBB;
   MachineBasicBlock *FalseBB;
   MachineBasicBlock *TailBB;
   std::vectorMachineOperand Cond;
-  unsigned Size;
-  BBInfo() : Kind(ICInvalid), BB(0), TrueBB(0), FalseBB(0), TailBB(0), 
Size(0) {}
+  BBInfo() : Kind(ICInvalid), Size(0), isPredicable(false),
+ ClobbersPred(false), BB(0), TrueBB(0), FalseBB(0), TailBB(0) 
{}
 };
 
 /// BBAnalysis - Results of if-conversion feasibility analysis indexed by
@@ -66,12 +70,12 @@
 virtual const char *getPassName() const { return If converter; }
 
   private:
-void AnalyzeBlock(MachineBasicBlock *BB);
+void StructuralAnalysis(MachineBasicBlock *BB);
+void FeasibilityAnalysis(BBInfo BBI);
 void InitialFunctionAnalysis(MachineFunction MF,
  std::vectorint Candidates);
-bool IfConvertDiamond(BBInfo BBI);
 bool IfConvertTriangle(BBInfo BBI);
-bool isBlockPredicable(MachineBasicBlock *BB) const;
+bool IfConvertDiamond(BBInfo BBI);
 void PredicateBlock(MachineBasicBlock *BB,
 std::vectorMachineOperand Cond,
 bool IgnoreTerm = false);
@@ -127,7 +131,10 @@
   return NULL;
 }
 
-void IfConverter::AnalyzeBlock(MachineBasicBlock *BB) {
+/// StructuralAnalysis - Analyze the structure of the sub-CFG starting from
+/// the specified block. Record its successors and whether it looks like an
+/// if-conversion candidate.
+void IfConverter::StructuralAnalysis(MachineBasicBlock *BB) {
   BBInfo BBI = BBAnalysis[BB-getNumber()];
 
   if (BBI.Kind != ICInvalid)
@@ -147,7 +154,7 @@
 return;
 
   // Not a candidate if 'true' block is going to be if-converted.
-  AnalyzeBlock(BBI.TrueBB);
+  StructuralAnalysis(BBI.TrueBB);
   BBInfo TrueBBI = BBAnalysis[BBI.TrueBB-getNumber()];
   if (TrueBBI.Kind != ICNotClassfied)
 return;
@@ -168,7 +175,7 @@
 return;
 
   // Not a candidate if 'false' block is going to be if-converted.
-  AnalyzeBlock(BBI.FalseBB);
+  StructuralAnalysis(BBI.FalseBB);
   BBInfo FalseBBI = BBAnalysis[BBI.FalseBB-getNumber()];
   if (FalseBBI.Kind != ICNotClassfied)
 return;
@@ -203,13 +210,36 @@
   return;
 }
 
+/// FeasibilityAnalysis - Determine if the block is predicable. In most
+/// cases, that means all the instructions in the block has M_PREDICABLE flag.
+/// Also checks if the block contains any instruction which can clobber a
+/// predicate (e.g. condition code register). If so, the block is not
+/// predicable unless it's the last instruction. Note, this function assumes
+/// all the terminator instructions can be converted or deleted so it ignore
+/// them.
+void IfConverter::FeasibilityAnalysis(BBInfo BBI) {
+  if (BBI.Size == 0 || BBI.Size  TLI-getIfCvtBlockSizeLimit())
+return;
+
+  for (MachineBasicBlock::iterator I = BBI.BB-begin(), E = BBI.BB-end();
+   I != E; ++I) {
+// TODO: check if instruction clobbers predicate.
+if (TII-isTerminatorInstr(I-getOpcode()))
+  break;
+if (!I-isPredicable())
+  return;
+  }
+
+  BBI.isPredicable = true;
+}
+
 /// InitialFunctionAnalysis - Analyze all blocks and find entries for all
 /// if-conversion candidates.
 void IfConverter::InitialFunctionAnalysis(MachineFunction MF,
   std::vectorint Candidates) {
   for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
 MachineBasicBlock *BB = I;
-AnalyzeBlock(BB);
+StructuralAnalysis(BB);
 BBInfo BBI = BBAnalysis[BB-getNumber()];
 if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry)
   Candidates.push_back(BB-getNumber());
@@ -245,8 +275,10 @@
 /// IfConvertTriangle - If convert a triangle sub-CFG.
 ///
 bool IfConverter::IfConvertTriangle(BBInfo BBI) {
-  if (isBlockPredicable(BBI.TrueBB)) {
-BBInfo 

Re: [llvm-commits] CVS: llvm-test/RunSafely.sh

2007-05-18 Thread Chris Lattner

On May 18, 2007, at 10:42 AM, Reid Spencer wrote:

 On Fri, 2007-05-18 at 12:34 -0500, Chris Lattner wrote:

 Changes in directory llvm-test:

 RunSafely.sh updated: 1.31 - 1.32
 ---
 Log message:

 reid's patch from yesterday broke darwin

 You realize that reverting that patch means that all tests are not
 guarded by any of the ulimit controls?

Yes.  You realize with the patch applied, all tests fail on darwin?

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


[llvm-commits] CVS: llvm/lib/CodeGen/README.txt

2007-05-18 Thread Dale Johannesen


Changes in directory llvm/lib/CodeGen:

README.txt updated: 1.5 - 1.6
---
Log message:

Document an inefficiency in tail merging.


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

 README.txt |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/lib/CodeGen/README.txt
diff -u llvm/lib/CodeGen/README.txt:1.5 llvm/lib/CodeGen/README.txt:1.6
--- llvm/lib/CodeGen/README.txt:1.5 Mon Apr 30 13:42:09 2007
+++ llvm/lib/CodeGen/README.txt Fri May 18 13:46:40 2007
@@ -142,3 +142,22 @@
 load [T + 7]
 ...
 load [T + 15]
+//===-===//
+Tail merging issue:
+When we're trying to merge the tails of predecessors of a block I, and there
+are more than 2 predecessors, we don't do it optimally.  Suppose predecessors
+are A,B,C where B and C have 5 instructions in common, and A has 2 in common
+with B or C.  We want to get:
+A:
+  jmp C3
+B:
+  jmp C2
+C:
+C2:  3 common to B and C but not A
+C3:  2 common to all 3
+You get this if B and C are merged first, but currently it might randomly 
decide
+to merge A and B first, which results in not sharing the C2 instructions.  We 
+could look at all N*(N-1) combinations of predecessors and merge the ones with
+the most instructions in common first.  Usually that will be fast, but it 
+could get slow on big graphs (e.g. large switches tend to have blocks with 
many 
+predecessors).



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


Re: [llvm-commits] CVS: llvm-test/RunSafely.sh

2007-05-18 Thread Reid Spencer
On Fri, 2007-05-18 at 11:24 -0700, Chris Lattner wrote:
 On May 18, 2007, at 10:42 AM, Reid Spencer wrote:
 
  On Fri, 2007-05-18 at 12:34 -0500, Chris Lattner wrote:
 
  Changes in directory llvm-test:
 
  RunSafely.sh updated: 1.31 - 1.32
  ---
  Log message:
 
  reid's patch from yesterday broke darwin
 
  You realize that reverting that patch means that all tests are not
  guarded by any of the ulimit controls?
 
 Yes.  You realize with the patch applied, all tests fail on darwin?

Yes. I'm not saying you did the wrong thing, just that we'll need to
find a solution that works for all platforms. BTW, what error do you get
or what happens when you try it with eval ?

Reid.

 
 -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] [see] CVS: llvm-poolalloc/lib/DSA/Local.cpp

2007-05-18 Thread Andrew Lenharth


Changes in directory llvm-poolalloc/lib/DSA:

Local.cpp updated: 1.158.2.4.2.10 - 1.158.2.4.2.11
---
Log message:

revert

---
Diffs of the changes:  (+15 -70)

 Local.cpp |   85 ++
 1 files changed, 15 insertions(+), 70 deletions(-)


Index: llvm-poolalloc/lib/DSA/Local.cpp
diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.10 
llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.11
--- llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.10 Fri May 18 12:38:28 2007
+++ llvm-poolalloc/lib/DSA/Local.cppFri May 18 13:26:25 2007
@@ -12,6 +12,7 @@
 // external interface to this file is the DSGraph constructor.
 //
 
//===--===//
+
 #include llvm/ADT/Statistic.h
 #include dsa/DataStructure.h
 #include dsa/DSGraph.h
@@ -649,21 +650,12 @@
   case Intrinsic::memcpy_i64:
   case Intrinsic::memmove_i32:
   case Intrinsic::memmove_i64: {
-DSNodeHandle destNH = getValueDest(**CS.arg_begin());
-DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1));
-if (!destNH.getNode()) {
-  setDestTo(**CS.arg_begin(), createNode());
-  destNH = getValueDest(**CS.arg_begin());
-}
-if (!srcNH.getNode()) {
-  setDestTo(**(CS.arg_begin() + 1), createNode());
-  srcNH = getValueDest(**(CS.arg_begin() + 1));
-}
-destNH.getNode()-foldNodeCompletely();
-srcNH.getNode()-foldNodeCompletely();
-getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode()));
-destNH.getNode()-setModifiedMarker();
-srcNH.getNode()-setReadMarker();
+// Merge the first  second arguments, and mark the memory read and
+// modified.
+DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
+RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1)));
+if (DSNode *N = RetNH.getNode())
+  N-setModifiedMarker()-setReadMarker();
 return true;
   }
   case Intrinsic::memset_i32:
@@ -796,7 +788,7 @@
   N-setModifiedMarker()-setUnknownNodeMarker();
   const Type *RetTy = F-getFunctionType()-getReturnType();
   if (const PointerType *PTy = dyn_castPointerType(RetTy))
-N-mergeTypeInfo(PTy-getElementType(), Result.getOffset());
+  N-mergeTypeInfo(PTy-getElementType(), Result.getOffset());
 }
 
 // If this is freopen, merge the file descriptor passed in with the
@@ -1109,21 +1101,12 @@
   } else if (F-getName() == llva_memcpy) {
 if (CS.getCaller()-getName() == kmem_cache_alloc)
 return false;
-DSNodeHandle destNH = getValueDest(**CS.arg_begin());
-DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1));
-if (!destNH.getNode()) {
-  setDestTo(**CS.arg_begin(), createNode());
-  destNH = getValueDest(**CS.arg_begin());
-}
-if (!srcNH.getNode()) {
-  setDestTo(**(CS.arg_begin() + 1), createNode());
-  srcNH = getValueDest(**(CS.arg_begin() + 1));
-}
-destNH.getNode()-foldNodeCompletely();
-srcNH.getNode()-foldNodeCompletely();
-getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode()));
-destNH.getNode()-setModifiedMarker();
-srcNH.getNode()-setReadMarker();
+// Merge the first  second arguments, and mark the memory read and
+// modified.
+DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
+RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1)));
+if (DSNode *N = RetNH.getNode())
+  N-setModifiedMarker()-setReadMarker();
 return true;
 #if 1
   } else if (F-getName() == llva_save_stackp) {
@@ -1154,7 +1137,7 @@
 #endif
   }
 #endif
-  
+
   return false;
 }
 
@@ -1162,16 +1145,6 @@
   Value *Callee = CS.getCalledValue();
 
   if (Function *F = dyn_castFunction(Callee)) {
-// if (F-getName() == printk) {
-//   CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end();
-//   for (; AI != E; ++AI) {
-// // printf reads all pointer arguments.
-// if (isPointerType((*AI)-getType()))
-//   if (DSNode *N = getValueDest(**AI).getNode())
-// N-setReadMarker();
-//   }
-//   return;
-// }
 if (F-isExternal())
   if (F-isIntrinsic()  visitIntrinsic(CS, F))
 return;
@@ -1198,34 +1171,6 @@
 if (visitExternal(CS,F))
   return;
 
-
-if (F-getName() == llva_invoke) {
-  Value* FF = *(CS.arg_begin() + 1);
-  if (isaCastInst(FF)) {
-FF = castCastInst(FF)-getOperand(0);
-  }
-  if (isaConstantExpr(FF)  castConstantExpr(FF)-getOpcode() == 
Instruction::Cast) {
-FF = castConstantExpr(FF)-getOperand(0);
-  }
-  //std::cerr  invoke special for: ; FF-dump(); std::cerr  \n;
-  std::vectorDSNodeHandle Args;
-// Calculate the arguments vector...
-  for (CallSite::arg_iterator I = CS.arg_begin() + 2, E = 
CS.arg_end(); I != E; ++I) {
-Value* AA = *I;
-if (isaCastInst(AA)) {
-  AA = castCastInst(AA)-getOperand(0);
-}
-   

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

2007-05-18 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.307 - 1.308
---
Log message:

Qualify calls to getTypeForValueType with MVT:: too.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.307 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.308
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.307 Wed May 16 17:45:30 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Fri May 18 13:41:29 2007
@@ -2689,7 +2689,7 @@
   TLI.isOperationLegal(ISD::LOAD, VT)) {
 LoadSDNode *LN0 = castLoadSDNode(N0);
 unsigned Align = TLI.getTargetMachine().getTargetData()-
-  getABITypeAlignment(getTypeForValueType(VT));
+  getABITypeAlignment(MVT::getTypeForValueType(VT));
 unsigned OrigAlign = LN0-getAlignment();
 if (Align = OrigAlign) {
   SDOperand Load = DAG.getLoad(VT, LN0-getChain(), LN0-getBasePtr(),
@@ -3569,7 +3569,7 @@
 unsigned Align = ST-getAlignment();
 MVT::ValueType SVT = Value.getOperand(0).getValueType();
 unsigned OrigAlign = TLI.getTargetMachine().getTargetData()-
-  getABITypeAlignment(getTypeForValueType(SVT));
+  getABITypeAlignment(MVT::getTypeForValueType(SVT));
 if (Align = OrigAlign  TLI.isOperationLegal(ISD::STORE, SVT))
   return DAG.getStore(Chain, Value.getOperand(0), Ptr, ST-getSrcValue(),
   ST-getSrcValueOffset());
@@ -3765,7 +3765,7 @@
 if (VecIn2.Val) {
   Ops[1] = VecIn2;
 } else {
-   // Use an undef vbuild_vector as input for the second operand.
+  // Use an undef vbuild_vector as input for the second operand.
   std::vectorSDOperand UnOps(NumInScalars,
DAG.getNode(ISD::UNDEF, 
castVTSDNode(EltType)-getVT()));



___
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-05-18 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.8 - 1.9
---
Log message:

Change to depth-first traversal.

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

 IfConversion.cpp |   33 ++---
 1 files changed, 22 insertions(+), 11 deletions(-)


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.8 
llvm/lib/CodeGen/IfConversion.cpp:1.9
--- llvm/lib/CodeGen/IfConversion.cpp:1.8   Fri May 18 13:14:37 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Fri May 18 14:26:33 2007
@@ -19,6 +19,7 @@
 #include llvm/Target/TargetLowering.h
 #include llvm/Target/TargetMachine.h
 #include llvm/Support/Debug.h
+#include llvm/ADT/DepthFirstIterator.h
 #include llvm/ADT/Statistic.h
 using namespace llvm;
 
@@ -237,8 +238,11 @@
 /// if-conversion candidates.
 void IfConverter::InitialFunctionAnalysis(MachineFunction MF,
   std::vectorint Candidates) {
-  for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
-MachineBasicBlock *BB = I;
+  std::setMachineBasicBlock* Visited;
+  MachineBasicBlock *Entry = MF.begin();
+  for (df_ext_iteratorMachineBasicBlock* DFI = df_ext_begin(Entry, Visited),
+ E = df_ext_end(Entry, Visited); DFI != E; ++DFI) {
+MachineBasicBlock *BB = *DFI;
 StructuralAnalysis(BB);
 BBInfo BBI = BBAnalysis[BB-getNumber()];
 if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry)
@@ -379,23 +383,30 @@
   TII-InsertBranch(*BBI.FalseBB, *BBI.FalseBB-succ_begin(), 
NULL,NewCond);
 
 // Merge the 'true' and 'false' blocks by copying the instructions
-// from the 'false' block to the 'true' block.
-MergeBlocks(TrueBBI, FalseBBI);
+// 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 *CvtBBI;
+if (!TrueBBI.ClobbersPred) {
+  MergeBlocks(TrueBBI, FalseBBI);
+  CvtBBI = TrueBBI;
+} else {
+  MergeBlocks(FalseBBI, TrueBBI);
+  CvtBBI = FalseBBI;
+}
 
 // Remove the conditional branch from entry to the blocks.
 BBI.Size -= TII-RemoveBranch(*BBI.BB);
 
 // Merge the combined block into the entry of the diamond if the entry
-// block is the only predecessor. Otherwise, insert an unconditional
-// branch.
-BBInfo *CvtBBI = TrueBBI;
-if (BBI.TrueBB-pred_size() == 1) {
-  BBI.BB-removeSuccessor(BBI.TrueBB);
-  MergeBlocks(BBI, TrueBBI);
+// block is its only predecessor. Otherwise, insert an unconditional
+// branch from entry to the if-converted block.
+if (CvtBBI-BB-pred_size() == 1) {
+  BBI.BB-removeSuccessor(CvtBBI-BB);
+  MergeBlocks(BBI, *CvtBBI);
   CvtBBI = BBI;
 } else {
   std::vectorMachineOperand NoCond;
-  TII-InsertBranch(*BBI.BB, BBI.TrueBB, NULL, NoCond);
+  TII-InsertBranch(*BBI.BB, CvtBBI-BB, NULL, NoCond);
 }
 
 // If the if-converted block fallthrough into the tail block, then



___
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-05-18 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

IfConversion.cpp updated: 1.9 - 1.10
---
Log message:

Clean up.

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

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


Index: llvm/lib/CodeGen/IfConversion.cpp
diff -u llvm/lib/CodeGen/IfConversion.cpp:1.9 
llvm/lib/CodeGen/IfConversion.cpp:1.10
--- llvm/lib/CodeGen/IfConversion.cpp:1.9   Fri May 18 14:26:33 2007
+++ llvm/lib/CodeGen/IfConversion.cpp   Fri May 18 14:32:08 2007
@@ -74,7 +74,7 @@
 void StructuralAnalysis(MachineBasicBlock *BB);
 void FeasibilityAnalysis(BBInfo BBI);
 void InitialFunctionAnalysis(MachineFunction MF,
- std::vectorint Candidates);
+ std::vectorBBInfo* Candidates);
 bool IfConvertTriangle(BBInfo BBI);
 bool IfConvertDiamond(BBInfo BBI);
 void PredicateBlock(MachineBasicBlock *BB,
@@ -96,14 +96,14 @@
   unsigned NumBBs = MF.getNumBlockIDs();
   BBAnalysis.resize(NumBBs);
 
-  std::vectorint Candidates;
+  std::vectorBBInfo* Candidates;
   // Do an intial analysis for each basic block and finding all the potential
   // candidates to perform if-convesion.
   InitialFunctionAnalysis(MF, Candidates);
 
   MadeChange = false;
   for (unsigned i = 0, e = Candidates.size(); i != e; ++i) {
-BBInfo BBI = BBAnalysis[Candidates[i]];
+BBInfo BBI = *Candidates[i];
 switch (BBI.Kind) {
 default: assert(false  Unexpected!);
   break;
@@ -237,7 +237,7 @@
 /// InitialFunctionAnalysis - Analyze all blocks and find entries for all
 /// if-conversion candidates.
 void IfConverter::InitialFunctionAnalysis(MachineFunction MF,
-  std::vectorint Candidates) {
+  std::vectorBBInfo* Candidates) {
   std::setMachineBasicBlock* Visited;
   MachineBasicBlock *Entry = MF.begin();
   for (df_ext_iteratorMachineBasicBlock* DFI = df_ext_begin(Entry, Visited),
@@ -246,7 +246,7 @@
 StructuralAnalysis(BB);
 BBInfo BBI = BBAnalysis[BB-getNumber()];
 if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry)
-  Candidates.push_back(BB-getNumber());
+  Candidates.push_back(BBI);
   }
 }
 



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


[llvm-commits] CVS: llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll

2007-05-18 Thread Dan Gohman


Changes in directory llvm/test/Transforms/LoopUnroll:

2007-05-09-UnknownTripCount.ll added (r1.1)
---
Log message:

Add a testcase for unrolling loops with unknown tripcounts.


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

 2007-05-09-UnknownTripCount.ll |   18 ++
 1 files changed, 18 insertions(+)


Index: llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
diff -c /dev/null 
llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll:1.1
*** /dev/null   Fri May 18 14:59:34 2007
--- llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll  Fri May 
18 14:59:23 2007
***
*** 0 
--- 1,18 
+ ; RUN: llvm-as  %s | opt -loop-unroll -unroll-count=3 | llvm-dis | grep 
bb72.2
+ 
+ define void @foo(i32 %trips) {
+ entry:
+   br label %cond_true.outer
+ 
+ cond_true.outer:
+   %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ]
+   br label %bb72
+ 
+ bb72:
+   %indvar.next2 = add i32 %indvar1.ph, 1
+   %exitcond3 = icmp eq i32 %indvar.next2, %trips
+   br i1 %exitcond3, label %cond_true138, label %cond_true.outer
+ 
+ cond_true138:
+   ret void
+ }



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


Re: [llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target

2007-05-18 Thread Chris Lattner

On May 18, 2007, at 11:59 AM, Dan Gohman wrote:

 Hello all,

 While doing some experiments with vector ValueTypes, I noticed that
 the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently with
 the way it is declared. I don't have the resources to test PowerPC
 changes, so I'm just sending this patch to the list in case anyone
 who does is interested in it.

The patch looks safe to me, but how is it semantically different?

-Chris

 Dan

 Index: lib/Target/PowerPC/PPCISelLowering.cpp
 ===
 RCS file: /var/cvs/llvm/llvm/lib/Target/PowerPC/PPCISelLowering.cpp,v
 retrieving revision 1.270
 diff -u -r1.270 PPCISelLowering.cpp
 --- lib/Target/PowerPC/PPCISelLowering.cpp
 +++ lib/Target/PowerPC/PPCISelLowering.cpp
 @@ -222,7 +222,7 @@
  // First set operation action for all vector types to expand.  
 Then we
  // will selectively turn on ones that can be effectively  
 codegen'd.
  for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
 - VT != (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
 + VT = (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
// add/sub are legal for all supported vector VT's.
setOperationAction(ISD::ADD , (MVT::ValueType)VT, Legal);
setOperationAction(ISD::SUB , (MVT::ValueType)VT, Legal);
 ___
 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/Target/X86/README.txt

2007-05-18 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.168 - 1.169
---
Log message:

add a note


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

 README.txt |9 +
 1 files changed, 9 insertions(+)


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.168 
llvm/lib/Target/X86/README.txt:1.169
--- llvm/lib/Target/X86/README.txt:1.168Wed May  9 19:08:04 2007
+++ llvm/lib/Target/X86/README.txt  Fri May 18 15:18:14 2007
@@ -26,6 +26,15 @@
 
 ... which should only be one imul instruction.
 
+or:
+
+unsigned long long int t2(unsigned int a, unsigned int b) {
+   return (unsigned long long)a * b;
+}
+
+... which should be one mul instruction.
+
+
 This can be done with a custom expander, but it would be nice to move this to
 generic code.
 



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


Re: [llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target

2007-05-18 Thread Dan Gohman
On May 18, 2007, at 3:08 PM, Chris Lattner wrote:
 
  Hello all,
 
  While doing some experiments with vector ValueTypes, I noticed that
  the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently with
  the way it is declared. I don't have the resources to test PowerPC
  changes, so I'm just sending this patch to the list in case anyone
  who does is interested in it.
 
 The patch looks safe to me, but how is it semantically different?

It would make the for loop cover v2f64, where it didn't before.

Dan

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


Re: [llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target

2007-05-18 Thread Chris Lattner

On May 18, 2007, at 2:51 PM, Dan Gohman wrote:

 On May 18, 2007, at 3:08 PM, Chris Lattner wrote:

 Hello all,

 While doing some experiments with vector ValueTypes, I noticed that
 the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently  
 with
 the way it is declared. I don't have the resources to test PowerPC
 changes, so I'm just sending this patch to the list in case anyone
 who does is interested in it.

 The patch looks safe to me, but how is it semantically different?

 It would make the for loop cover v2f64, where it didn't before.

Ah, I get it.  LAST_VECTOR_VT is inclusive, not exclusive.  The patch  
looks great, plz apply,

Thanks,

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


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp

2007-05-18 Thread Dan Gohman


Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.270 - 1.271
---
Log message:

Apply this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070514/049845.html


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

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


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.270 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.271
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.270   Mon May 14 20:31:05 2007
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Fri May 18 18:21:46 2007
@@ -222,7 +222,7 @@
 // First set operation action for all vector types to expand. Then we
 // will selectively turn on ones that can be effectively codegen'd.
 for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
- VT != (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
+ VT = (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
   // add/sub are legal for all supported vector VT's.
   setOperationAction(ISD::ADD , (MVT::ValueType)VT, Legal);
   setOperationAction(ISD::SUB , (MVT::ValueType)VT, Legal);



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


[llvm-commits] CVS: llvm/lib/Support/APInt.cpp

2007-05-18 Thread Reid Spencer


Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.85 - 1.86
---
Log message:

Fix an assertion introduced by my last change to the toString method. We
can't use getZExtValue() to extract the low order bits for each digit. 
Instead, we need to access the low order word directly.


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

 APInt.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.85 llvm/lib/Support/APInt.cpp:1.86
--- llvm/lib/Support/APInt.cpp:1.85 Thu May 17 14:23:02 2007
+++ llvm/lib/Support/APInt.cpp  Fri May 18 19:29:55 2007
@@ -1962,9 +1962,9 @@
   uint64_t mask = radix - 1;
   APInt zero(tmp.getBitWidth(), 0);
   while (tmp.ne(zero)) {
-unsigned digit = tmp.getZExtValue()  mask;
-tmp = tmp.lshr(shift);
+unsigned digit = (tmp.isSingleWord() ? tmp.VAL : tmp.pVal[0])  mask;
 result.insert(insert_at, digits[digit]);
+tmp = tmp.lshr(shift);
   }
 }
 return result;



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output

2007-05-18 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

bigint.reference_output updated: 1.3 - 1.4
---
Log message:

The reference output was previously in error as it wasn't showing 500
bits when an APInt of 500 bits was printed. This corrects the output.


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

 bigint.reference_output |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output
diff -u llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.3 
llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.4
--- llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.3
Mon May 14 13:43:28 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bigint.reference_outputFri May 
18 19:33:35 2007
@@ -1,9 +1,9 @@
 Initially:
-int500 x = 

+int500 x = 

 int169 y = 
101010111001100100010
 
 After modification:
-int500 x = 
0001
+int500 x = 
0001
 int169 y = 
101010111000100110011
 
 result = x * y = 
01010100110110110001011101101



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bits.h

2007-05-18 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

bits.h updated: 1.10 - 1.11
---
Log message:

Add uint169 type.


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

 bits.h |1 +
 1 files changed, 1 insertion(+)


Index: llvm-test/SingleSource/UnitTests/Integer/bits.h
diff -u llvm-test/SingleSource/UnitTests/Integer/bits.h:1.10 
llvm-test/SingleSource/UnitTests/Integer/bits.h:1.11
--- llvm-test/SingleSource/UnitTests/Integer/bits.h:1.10Thu May 17 
13:02:42 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bits.h Fri May 18 19:39:45 2007
@@ -41,6 +41,7 @@
 typedef unsigned int __attribute__((bitwidth(68))) uint68;
 typedef unsigned int __attribute__((bitwidth(69))) uint69;
 typedef unsigned int __attribute__((bitwidth(128))) uint128;
+typedef unsigned int __attribute__((bitwidth(169))) uint169;
 typedef unsigned int __attribute__((bitwidth(250))) uint250;
 typedef unsigned int __attribute__((bitwidth(256))) uint256;
 typedef unsigned int __attribute__((bitwidth(500))) uint500;



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


[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/compare-duplicate.ll

2007-05-18 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/PowerPC:

compare-duplicate.ll added (r1.1)
---
Log message:

new testcase


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

 compare-duplicate.ll |   11 +++
 1 files changed, 11 insertions(+)


Index: llvm/test/CodeGen/PowerPC/compare-duplicate.ll
diff -c /dev/null llvm/test/CodeGen/PowerPC/compare-duplicate.ll:1.1
*** /dev/null   Fri May 18 19:41:50 2007
--- llvm/test/CodeGen/PowerPC/compare-duplicate.ll  Fri May 18 19:41:40 2007
***
*** 0 
--- 1,11 
+ ; RUN: llvm-as  %s | llc | not grep slwi
+ 
+ define i32 @test(i32 %A, i32 %B) {
+   %C = sub i32 %B, %A
+   %D = icmp eq i32 %C, %A
+   br i1 %D, label %T, label %F
+ T:
+   ret i32 19123
+ F:
+   ret i32 %C
+ }



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


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

2007-05-18 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

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

Disable the (A == (B-A)) - 2*A == B xform when the sub has multiple uses (in
this case, the xform introduces an extra operation).  This compiles
PowerPC/compare-duplicate.ll into:

_test:
subf r2, r3, r4
cmplw cr0, r2, r3
bne cr0, LBB1_2 ;F

instead of:

_test:
slwi r2, r3, 1
subf r3, r3, r4
cmplw cr0, r4, r2
bne cr0, LBB1_2 ;F

This is target independent of course.



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

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


Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.116 
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.117
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.116  Fri May 18 
12:52:13 2007
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppFri May 18 19:43:44 2007
@@ -1785,7 +1785,7 @@
 if (DAG.isCommutativeBinOp(N0.getOpcode()))
   return DAG.getSetCC(VT, N0.getOperand(0),
   DAG.getConstant(0, N0.getValueType()), Cond);
-else {
+else if (N0.Val-hasOneUse()) {
   assert(N0.getOpcode() == ISD::SUB  Unexpected operation!);
   // (Z-X) == X  -- Z == X1
   SDOperand SH = DAG.getNode(ISD::SHL, N1.getValueType(),



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


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

2007-05-18 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

TargetLowering.cpp updated: 1.117 - 1.118
---
Log message:

same patch as the previous one, but the symmetric case


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

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


Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.117 
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.118
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.117  Fri May 18 
19:43:44 2007
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppFri May 18 19:46:51 2007
@@ -1808,7 +1808,7 @@
 if (DAG.isCommutativeBinOp(N1.getOpcode())) {
   return DAG.getSetCC(VT, N1.getOperand(0),
   DAG.getConstant(0, N1.getValueType()), Cond);
-} else {
+} else if (N1.Val-hasOneUse()) {
   assert(N1.getOpcode() == ISD::SUB  Unexpected operation!);
   // X == (Z-X)  -- X1 == Z
   SDOperand SH = DAG.getNode(ISD::SHL, N1.getValueType(), N0, 



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/part_select2.c

2007-05-18 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer:

part_select2.c updated: 1.3 - 1.4
---
Log message:

Make this test case compile again.


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

 part_select2.c |4 
 1 files changed, 4 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/part_select2.c
diff -u llvm-test/SingleSource/UnitTests/Integer/part_select2.c:1.3 
llvm-test/SingleSource/UnitTests/Integer/part_select2.c:1.4
--- llvm-test/SingleSource/UnitTests/Integer/part_select2.c:1.3 Thu May 17 
01:25:37 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select2.c Fri May 18 
19:48:24 2007
@@ -1,10 +1,6 @@
 
 #include bits.h
 
-typedef  int __attribute__ ((bitwidth(128))) int128;
-typedef  int __attribute__ ((bitwidth(8))) int8;
-// typedef unsigned int __attribute__ ((bitwidth(19))) uint19;
-
 int main()
 {
   int128 X = 0xde7ed959bcfdb200ULL;



___
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/lsr-negative-stride.ll

2007-05-18 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

lsr-negative-stride.ll added (r1.1)
---
Log message:

new testcase


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

 lsr-negative-stride.ll |   37 +
 1 files changed, 37 insertions(+)


Index: llvm/test/CodeGen/X86/lsr-negative-stride.ll
diff -c /dev/null llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.1
*** /dev/null   Fri May 18 20:21:49 2007
--- llvm/test/CodeGen/X86/lsr-negative-stride.llFri May 18 20:21:39 2007
***
*** 0 
--- 1,37 
+ ; RUN: llvm-as  %s | llc -march=x86 | not grep neg
+ ; RUN: llvm-as  %s | llc -march=x86 | not grep sub.*esp
+ ; RUN: llvm-as  %s | llc -march=x86 | not grep esi
+ 
+ define i32 @t(i32 %a, i32 %b) {
+ entry:
+   %tmp1434 = icmp eq i32 %a, %b   ; i1 [#uses=1]
+   br i1 %tmp1434, label %bb17, label %bb.outer
+ 
+ bb.outer: ; preds = %cond_false, %entry
+   %b_addr.021.0.ph = phi i32 [ %b, %entry ], [ %tmp10, %cond_false ]  
; i32 [#uses=5]
+   %a_addr.026.0.ph = phi i32 [ %a, %entry ], [ %a_addr.026.0, %cond_false 
]   ; i32 [#uses=1]
+   br label %bb
+ 
+ bb:   ; preds = %cond_true, %bb.outer
+   %indvar = phi i32 [ 0, %bb.outer ], [ %indvar.next, %cond_true ]
; i32 [#uses=2]
+   %tmp. = sub i32 0, %b_addr.021.0.ph ; i32 [#uses=1]
+   %tmp.40 = mul i32 %indvar, %tmp.; i32 [#uses=1]
+   %a_addr.026.0 = add i32 %tmp.40, %a_addr.026.0.ph   ; i32 
[#uses=6]
+   %tmp3 = icmp sgt i32 %a_addr.026.0, %b_addr.021.0.ph; i1 
[#uses=1]
+   br i1 %tmp3, label %cond_true, label %cond_false
+ 
+ cond_true:; preds = %bb
+   %tmp7 = sub i32 %a_addr.026.0, %b_addr.021.0.ph ; i32 
[#uses=2]
+   %tmp1437 = icmp eq i32 %tmp7, %b_addr.021.0.ph  ; i1 [#uses=1]
+   %indvar.next = add i32 %indvar, 1   ; i32 [#uses=1]
+   br i1 %tmp1437, label %bb17, label %bb
+ 
+ cond_false:   ; preds = %bb
+   %tmp10 = sub i32 %b_addr.021.0.ph, %a_addr.026.0; i32 
[#uses=2]
+   %tmp14 = icmp eq i32 %a_addr.026.0, %tmp10  ; i1 [#uses=1]
+   br i1 %tmp14, label %bb17, label %bb.outer
+ 
+ bb17: ; preds = %cond_false, %cond_true, %entry
+   %a_addr.026.1 = phi i32 [ %a, %entry ], [ %tmp7, %cond_true ], [ 
%a_addr.026.0, %cond_false ]   ; i32 [#uses=1]
+   ret i32 %a_addr.026.1
+ }



___
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-05-18 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

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

Handle negative strides much more optimally.  This compiles 
X86/lsr-negative-stride.ll
into:

_t:
movl 8(%esp), %ecx
movl 4(%esp), %eax
cmpl %ecx, %eax
je LBB1_3   #bb17
LBB1_1: #bb
cmpl %ecx, %eax
jg LBB1_4   #cond_true
LBB1_2: #cond_false
subl %eax, %ecx
cmpl %ecx, %eax
jne LBB1_1  #bb
LBB1_3: #bb17
ret
LBB1_4: #cond_true
subl %ecx, %eax
cmpl %ecx, %eax
jne LBB1_1  #bb
jmp LBB1_3  #bb17

instead of:

_t:
subl $4, %esp
movl %esi, (%esp)
movl 12(%esp), %ecx
movl 8(%esp), %eax
cmpl %ecx, %eax
je LBB1_4   #bb17
LBB1_1: #bb.outer
movl %ecx, %edx
negl %edx
LBB1_2: #bb
cmpl %ecx, %eax
jle LBB1_5  #cond_false
LBB1_3: #cond_true
addl %edx, %eax
cmpl %ecx, %eax
jne LBB1_2  #bb
LBB1_4: #bb17
movl (%esp), %esi
addl $4, %esp
ret
LBB1_5: #cond_false
movl %ecx, %edx
subl %eax, %edx
movl %eax, %esi
addl %esi, %esi
cmpl %ecx, %esi
je LBB1_4   #bb17
LBB1_6: #cond_false.bb.outer_crit_edge
movl %edx, %ecx
jmp LBB1_1  #bb.outer



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

 LoopStrengthReduce.cpp |   29 ++---
 1 files changed, 26 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.137 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.138
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.137 Fri May 11 
17:40:34 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Fri May 18 20:22:21 2007
@@ -987,6 +987,20 @@
   return Val.isUseOfPostIncrementedValue;
 }
 
+/// isNonConstantNegative - REturn true if the specified scev is negated, but
+/// not a constant.
+static bool isNonConstantNegative(const SCEVHandle Expr) {
+  SCEVMulExpr *Mul = dyn_castSCEVMulExpr(Expr);
+  if (!Mul) return false;
+  
+  // If there is a constant factor, it will be first.
+  SCEVConstant *SC = dyn_castSCEVConstant(Mul-getOperand(0));
+  if (!SC) return false;
+  
+  // Return true if the value is negative, this matches things like (-42 * V).
+  return SC-getValue()-getValue().isNegative();
+}
+
 /// StrengthReduceStridedIVUsers - Strength reduce all of the users of a single
 /// stride of IV.  All of the users may have different starting values, and 
this
 /// may not be the only stride (we know it is if isOnlyStride is true).
@@ -1104,15 +1118,24 @@
 // Add common base to the new Phi node.
 NewPHI-addIncoming(CommonBaseV, Preheader);
 
+// If the stride is negative, insert a sub instead of an add for the
+// increment.
+bool isNegative = isNonConstantNegative(Stride);
+SCEVHandle IncAmount = Stride;
+if (isNegative)
+  IncAmount = SCEV::getNegativeSCEV(Stride);
+
 // Insert the stride into the preheader.
-Value *StrideV = PreheaderRewriter.expandCodeFor(Stride, PreInsertPt,
+Value *StrideV = PreheaderRewriter.expandCodeFor(IncAmount, PreInsertPt,
  ReplacedTy);
 if (!isaConstantInt(StrideV)) ++NumVariable;
 
 // Emit the increment of the base value before the terminator of the loop
 // latch block, and add it to the Phi node.
-SCEVHandle IncExp = SCEVAddExpr::get(SCEVUnknown::get(NewPHI),
- SCEVUnknown::get(StrideV));
+SCEVHandle IncExp = SCEVUnknown::get(StrideV);
+if (isNegative)
+  IncExp = SCEV::getNegativeSCEV(IncExp);
+IncExp = SCEVAddExpr::get(SCEVUnknown::get(NewPHI), IncExp);
   
 IncV = Rewriter.expandCodeFor(IncExp, LatchBlock-getTerminator(),
   ReplacedTy);



___
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/lsr-negative-stride.ll

2007-05-18 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

lsr-negative-stride.ll updated: 1.1 - 1.2
---
Log message:

add source


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

 lsr-negative-stride.ll |   12 
 1 files changed, 12 insertions(+)


Index: llvm/test/CodeGen/X86/lsr-negative-stride.ll
diff -u llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.1 
llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.2
--- llvm/test/CodeGen/X86/lsr-negative-stride.ll:1.1Fri May 18 20:21:39 2007
+++ llvm/test/CodeGen/X86/lsr-negative-stride.llFri May 18 20:22:52 2007
@@ -2,6 +2,18 @@
 ; RUN: llvm-as  %s | llc -march=x86 | not grep sub.*esp
 ; RUN: llvm-as  %s | llc -march=x86 | not grep esi
 
+; This corresponds to:
+;int t(int a, int b) {
+;  while (a != b) {
+;if (a  b)
+;  a -= b;
+;else
+;  b -= a;
+;  }
+;  return a;
+;}
+
+
 define i32 @t(i32 %a, i32 %b) {
 entry:
%tmp1434 = icmp eq i32 %a, %b   ; i1 [#uses=1]



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp

2007-05-18 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

ExternalFunctions.cpp updated: 1.98 - 1.99
---
Log message:

On Linux platforms and at optimization levels -O1 and above, llvm-gcc can
turn putchar calls into _IO_putc calls which is a lower-level interface.
This patch allows these calls to be executed by lli in interpreter mode.


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

 ExternalFunctions.cpp |   17 ++---
 1 files changed, 14 insertions(+), 3 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.98 
llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.99
--- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.98 Sat Apr 
21 12:11:45 2007
+++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp  Fri May 18 
20:36:17 2007
@@ -72,13 +72,13 @@
 
   ExFunc FnPtr = FuncNames[ExtName];
   if (FnPtr == 0)
-FnPtr = 
-  (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(ExtName);
-  if (FnPtr == 0)
 FnPtr = FuncNames[lle_X_+F-getName()];
   if (FnPtr == 0)  // Try calling a generic function... if it exists...
 FnPtr = (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(
 (lle_X_+F-getName()).c_str());
+  if (FnPtr == 0)
+FnPtr = (ExFunc)(intptr_t)
+  sys::DynamicLibrary::SearchForAddressOfSymbol(F-getName());
   if (FnPtr != 0)
 Functions.insert(std::make_pair(F, FnPtr));  // Cache for later
   return FnPtr;
@@ -118,6 +118,16 @@
   return Args[0];
 }
 
+// void _IO_putc(int c, FILE* fp)
+GenericValue lle_X__IO_putc(FunctionType *FT, const vectorGenericValue 
Args){
+#ifdef __linux__
+  _IO_putc((char)Args[0].IntVal.getZExtValue(), (FILE*) Args[1].PointerVal);
+#else
+  assert(0  Can't call _IO_putc on this platform);
+#endif
+  return Args[0];
+}
+
 // void atexit(Function*)
 GenericValue lle_X_atexit(FunctionType *FT, const vectorGenericValue Args) {
   assert(Args.size() == 1);
@@ -694,6 +704,7 @@
 
 void Interpreter::initializeExternalFunctions() {
   FuncNames[lle_X_putchar]  = lle_X_putchar;
+  FuncNames[lle_X__IO_putc] = lle_X__IO_putc;
   FuncNames[lle_X_exit] = lle_X_exit;
   FuncNames[lle_X_abort]= lle_X_abort;
   FuncNames[lle_X_malloc]   = lle_X_malloc;



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