Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2012 10:31:51 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r239390 - in vendor/llvm/dist: . autoconf include/llvm include/llvm/ADT include/llvm/Analysis include/llvm/CodeGen include/llvm/MC include/llvm/Support include/llvm/Target lib/Analysis ...
Message-ID:  <201208191031.q7JAVpir070137@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sun Aug 19 10:31:50 2012
New Revision: 239390
URL: http://svn.freebsd.org/changeset/base/239390

Log:
  Vendor import of llvm trunk r162107:
  http://llvm.org/svn/llvm-project/llvm/trunk@162107

Added:
  vendor/llvm/dist/include/llvm/MC/MCFixedLenDisassembler.h
  vendor/llvm/dist/test/CodeGen/Mips/return-vector-float4.ll
  vendor/llvm/dist/test/CodeGen/X86/2012-08-17-legalizer-crash.ll
  vendor/llvm/dist/test/CodeGen/X86/pr11334.ll
  vendor/llvm/dist/test/Transforms/GVN/edge.ll
Deleted:
  vendor/llvm/dist/test/CodeGen/X86/unreachable-stack-protector.ll
Modified:
  vendor/llvm/dist/CMakeLists.txt
  vendor/llvm/dist/Makefile
  vendor/llvm/dist/Makefile.config.in
  vendor/llvm/dist/autoconf/configure.ac
  vendor/llvm/dist/configure
  vendor/llvm/dist/include/llvm/ADT/DenseMap.h
  vendor/llvm/dist/include/llvm/ADT/VariadicFunction.h
  vendor/llvm/dist/include/llvm/Analysis/BranchProbabilityInfo.h
  vendor/llvm/dist/include/llvm/Analysis/Dominators.h
  vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h
  vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h
  vendor/llvm/dist/include/llvm/IntrinsicsHexagon.td
  vendor/llvm/dist/include/llvm/MC/MCInstrDesc.h
  vendor/llvm/dist/include/llvm/Support/AlignOf.h
  vendor/llvm/dist/include/llvm/Support/COFF.h
  vendor/llvm/dist/include/llvm/Support/Compiler.h
  vendor/llvm/dist/include/llvm/Support/FileSystem.h
  vendor/llvm/dist/include/llvm/Support/LEB128.h
  vendor/llvm/dist/include/llvm/Support/NoFolder.h
  vendor/llvm/dist/include/llvm/Target/Target.td
  vendor/llvm/dist/include/llvm/Target/TargetInstrInfo.h
  vendor/llvm/dist/lib/Analysis/BranchProbabilityInfo.cpp
  vendor/llvm/dist/lib/Analysis/MemoryBuiltins.cpp
  vendor/llvm/dist/lib/CodeGen/MachineVerifier.cpp
  vendor/llvm/dist/lib/CodeGen/PeepholeOptimizer.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  vendor/llvm/dist/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
  vendor/llvm/dist/lib/Support/APFloat.cpp
  vendor/llvm/dist/lib/Support/Unix/PathV2.inc
  vendor/llvm/dist/lib/Support/Windows/PathV2.inc
  vendor/llvm/dist/lib/Target/ARM/ARMAsmPrinter.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMBaseInstrInfo.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMBaseInstrInfo.h
  vendor/llvm/dist/lib/Target/ARM/ARMFastISel.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMISelDAGToDAG.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMInstrInfo.td
  vendor/llvm/dist/lib/Target/ARM/ARMInstrNEON.td
  vendor/llvm/dist/lib/Target/ARM/ARMInstrThumb2.td
  vendor/llvm/dist/lib/Target/ARM/ARMInstrVFP.td
  vendor/llvm/dist/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
  vendor/llvm/dist/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
  vendor/llvm/dist/lib/Target/Mips/Mips.td
  vendor/llvm/dist/lib/Target/Mips/MipsCallingConv.td
  vendor/llvm/dist/lib/Target/Mips/MipsSubtarget.h
  vendor/llvm/dist/lib/Target/PowerPC/PPCISelLowering.cpp
  vendor/llvm/dist/lib/Target/X86/X86.td
  vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist/lib/Target/X86/X86ISelLowering.h
  vendor/llvm/dist/lib/Target/X86/X86InstrFragmentsSIMD.td
  vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td
  vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCalls.cpp
  vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/CodeGenPrepare.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/GVN.cpp
  vendor/llvm/dist/lib/VMCore/Dominators.cpp
  vendor/llvm/dist/lib/VMCore/Verifier.cpp
  vendor/llvm/dist/test/Analysis/ScalarEvolution/2012-05-29-MulAddRec.ll
  vendor/llvm/dist/test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll
  vendor/llvm/dist/test/CodeGen/ARM/2011-11-29-128bitArithmetics.ll
  vendor/llvm/dist/test/CodeGen/ARM/fast-isel-call.ll
  vendor/llvm/dist/test/CodeGen/ARM/fp16.ll
  vendor/llvm/dist/test/CodeGen/ARM/select.ll
  vendor/llvm/dist/test/CodeGen/ARM/select_xform.ll
  vendor/llvm/dist/test/CodeGen/ARM/unaligned_load_store.ll
  vendor/llvm/dist/test/CodeGen/Generic/donothing.ll
  vendor/llvm/dist/test/CodeGen/Thumb2/machine-licm.ll
  vendor/llvm/dist/test/CodeGen/Thumb2/thumb2-select_xform.ll
  vendor/llvm/dist/test/CodeGen/X86/2011-08-29-InitOrder.ll
  vendor/llvm/dist/test/CodeGen/X86/fast-isel-x86.ll
  vendor/llvm/dist/test/CodeGen/X86/full-lsr.ll
  vendor/llvm/dist/test/CodeGen/X86/memcpy.ll
  vendor/llvm/dist/test/Instrumentation/AddressSanitizer/basic.ll
  vendor/llvm/dist/test/Transforms/GVN/rle.ll
  vendor/llvm/dist/test/Transforms/Inline/always-inline.ll
  vendor/llvm/dist/test/Transforms/InstCombine/memcpy.ll
  vendor/llvm/dist/test/Transforms/InstCombine/objsize.ll
  vendor/llvm/dist/test/Transforms/ObjCARC/basic.ll
  vendor/llvm/dist/test/Transforms/ObjCARC/invoke.ll
  vendor/llvm/dist/unittests/ADT/APFloatTest.cpp
  vendor/llvm/dist/unittests/Support/AlignOfTest.cpp
  vendor/llvm/dist/unittests/Support/Path.cpp
  vendor/llvm/dist/utils/TableGen/CodeGenInstruction.cpp
  vendor/llvm/dist/utils/TableGen/CodeGenInstruction.h
  vendor/llvm/dist/utils/TableGen/CodeGenRegisters.cpp
  vendor/llvm/dist/utils/TableGen/CodeGenRegisters.h
  vendor/llvm/dist/utils/TableGen/FixedLenDecoderEmitter.cpp
  vendor/llvm/dist/utils/TableGen/InstrInfoEmitter.cpp
  vendor/llvm/dist/utils/TableGen/RegisterInfoEmitter.cpp
  vendor/llvm/dist/utils/lit/lit/main.py

Modified: vendor/llvm/dist/CMakeLists.txt
==============================================================================
--- vendor/llvm/dist/CMakeLists.txt	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/CMakeLists.txt	Sun Aug 19 10:31:50 2012	(r239390)
@@ -128,10 +128,15 @@ if( LLVM_TARGETS_TO_BUILD STREQUAL "all"
   set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
 endif()
 
+set(LLVM_TARGETS_TO_BUILD
+   ${LLVM_TARGETS_TO_BUILD}
+   ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD})
+
 set(LLVM_ENUM_TARGETS "")
 foreach(c ${LLVM_TARGETS_TO_BUILD})
   list(FIND LLVM_ALL_TARGETS ${c} idx)
-  if( idx LESS 0 )
+  list(FIND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${c} idy)
+  if( idx LESS 0 AND idy LESS 0 )
     message(FATAL_ERROR "The target `${c}' does not exist.
     It should be one of\n${LLVM_ALL_TARGETS}")
   else()
@@ -139,11 +144,6 @@ foreach(c ${LLVM_TARGETS_TO_BUILD})
   endif()
 endforeach(c)
 
-set(LLVM_TARGETS_TO_BUILD
-  ${LLVM_TARGETS_TO_BUILD}
-  ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}
-  )
-
 set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
 
 include(AddLLVMDefinitions)

Modified: vendor/llvm/dist/Makefile
==============================================================================
--- vendor/llvm/dist/Makefile	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/Makefile	Sun Aug 19 10:31:50 2012	(r239390)
@@ -244,13 +244,13 @@ build-for-llvm-top:
 SVN = svn
 SVN-UPDATE-OPTIONS =
 AWK = awk
-SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}'   \
+SUB-SVN-DIRS = $(AWK) '/I|\?      / {print $$2}'   \
 		| LC_ALL=C xargs $(SVN) info 2>/dev/null \
 		| $(AWK) '/^Path:\ / {print $$2}'
 
 update:
 	$(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
-	@ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
+	@ $(SVN) status --no-ignore $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
 
 happiness: update all check-all
 

Modified: vendor/llvm/dist/Makefile.config.in
==============================================================================
--- vendor/llvm/dist/Makefile.config.in	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/Makefile.config.in	Sun Aug 19 10:31:50 2012	(r239390)
@@ -258,6 +258,11 @@ ENABLE_WERROR = @ENABLE_WERROR@
 #DEBUG_SYMBOLS = 1
 @DEBUG_SYMBOLS@
 
+# When KEEP_SYMBOLS is enabled, installed executables will never have their
+# symbols stripped.
+#KEEP_SYMBOLS = 1
+@KEEP_SYMBOLS@
+
 # The compiler flags to use for optimized builds.
 OPTIMIZE_OPTION := @OPTIMIZE_OPTION@
 

Modified: vendor/llvm/dist/autoconf/configure.ac
==============================================================================
--- vendor/llvm/dist/autoconf/configure.ac	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/autoconf/configure.ac	Sun Aug 19 10:31:50 2012	(r239390)
@@ -542,6 +542,15 @@ else
   AC_SUBST(DEBUG_SYMBOLS,[[DEBUG_SYMBOLS=1]])
 fi
 
+dnl --enable-keep-symbols : do not strip installed executables
+AC_ARG_ENABLE(keep-symbols,
+   AS_HELP_STRING(--enable-keep-symbols,[Do not strip installed executables)]),,enableval=no)
+if test ${enableval} = "no" ; then
+  AC_SUBST(KEEP_SYMBOLS,[[]])
+else
+  AC_SUBST(KEEP_SYMBOLS,[[KEEP_SYMBOLS=1]])
+fi
+
 dnl --enable-jit: check whether they want to enable the jit
 AC_ARG_ENABLE(jit,
   AS_HELP_STRING(--enable-jit,

Modified: vendor/llvm/dist/configure
==============================================================================
--- vendor/llvm/dist/configure	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/configure	Sun Aug 19 10:31:50 2012	(r239390)
@@ -693,6 +693,7 @@ ENABLE_EXPENSIVE_CHECKS
 EXPENSIVE_CHECKS
 DEBUG_RUNTIME
 DEBUG_SYMBOLS
+KEEP_SYMBOLS
 JIT
 TARGET_HAS_JIT
 ENABLE_DOCS
@@ -1408,6 +1409,7 @@ Optional Features:
                           NO)
   --enable-debug-symbols  Build compiler with debug symbols (default is NO if
                           optimization is on and YES if it's off)
+  --enable-keep-symbols   Do not strip installed executables)
   --enable-jit            Enable Just In Time Compiling (default is YES)
   --enable-docs           Build documents (default is YES)
   --enable-doxygen        Build doxygen documentation (default is NO)
@@ -5158,6 +5160,21 @@ else
 
 fi
 
+# Check whether --enable-keep-symbols was given.
+if test "${enable_keep_symbols+set}" = set; then
+  enableval=$enable_keep_symbols;
+else
+  enableval=no
+fi
+
+if test ${enableval} = "no" ; then
+  KEEP_SYMBOLS=
+
+else
+  KEEP_SYMBOLS=KEEP_SYMBOLS=1
+
+fi
+
 # Check whether --enable-jit was given.
 if test "${enable_jit+set}" = set; then
   enableval=$enable_jit;
@@ -10272,7 +10289,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10275 "configure"
+#line 10292 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -22150,12 +22167,12 @@ ENABLE_EXPENSIVE_CHECKS!$ENABLE_EXPENSIV
 EXPENSIVE_CHECKS!$EXPENSIVE_CHECKS$ac_delim
 DEBUG_RUNTIME!$DEBUG_RUNTIME$ac_delim
 DEBUG_SYMBOLS!$DEBUG_SYMBOLS$ac_delim
+KEEP_SYMBOLS!$KEEP_SYMBOLS$ac_delim
 JIT!$JIT$ac_delim
 TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim
 ENABLE_DOCS!$ENABLE_DOCS$ac_delim
 ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim
 LLVM_ENABLE_THREADS!$LLVM_ENABLE_THREADS$ac_delim
-ENABLE_PTHREADS!$ENABLE_PTHREADS$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -22197,6 +22214,7 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+ENABLE_PTHREADS!$ENABLE_PTHREADS$ac_delim
 ENABLE_PIC!$ENABLE_PIC$ac_delim
 ENABLE_SHARED!$ENABLE_SHARED$ac_delim
 ENABLE_EMBED_STDCXX!$ENABLE_EMBED_STDCXX$ac_delim
@@ -22293,7 +22311,7 @@ LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 94; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: vendor/llvm/dist/include/llvm/ADT/DenseMap.h
==============================================================================
--- vendor/llvm/dist/include/llvm/ADT/DenseMap.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/ADT/DenseMap.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -687,8 +687,7 @@ class SmallDenseMap
 
   /// A "union" of an inline bucket array and the struct representing
   /// a large bucket. This union will be discriminated by the 'Small' bit.
-  typename AlignedCharArray<BucketT[InlineBuckets], LargeRep>::union_type
-    storage;
+  AlignedCharArrayUnion<BucketT[InlineBuckets], LargeRep> storage;
 
 public:
   explicit SmallDenseMap(unsigned NumInitBuckets = 0) {
@@ -834,8 +833,7 @@ public:
         return; // Nothing to do.
 
       // First move the inline buckets into a temporary storage.
-      typename AlignedCharArray<BucketT[InlineBuckets]>::union_type
-        TmpStorage;
+      AlignedCharArrayUnion<BucketT[InlineBuckets]> TmpStorage;
       BucketT *TmpBegin = reinterpret_cast<BucketT *>(TmpStorage.buffer);
       BucketT *TmpEnd = TmpBegin;
 

Modified: vendor/llvm/dist/include/llvm/ADT/VariadicFunction.h
==============================================================================
--- vendor/llvm/dist/include/llvm/ADT/VariadicFunction.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/ADT/VariadicFunction.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -206,7 +206,7 @@ struct VariadicFunction2 {
   ResultT operator()(Param0T P0, Param1T P1, \
                      LLVM_COMMA_JOIN ## N(const ArgT &A)) const { \
     const ArgT *const Args[] = { LLVM_COMMA_JOIN ## N(&A) }; \
-    return Func(P0, P1, makeAraryRef(Args)); \
+    return Func(P0, P1, makeArrayRef(Args)); \
   }
   LLVM_DEFINE_OVERLOAD(1)
   LLVM_DEFINE_OVERLOAD(2)

Modified: vendor/llvm/dist/include/llvm/Analysis/BranchProbabilityInfo.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/BranchProbabilityInfo.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Analysis/BranchProbabilityInfo.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -122,6 +122,7 @@ private:
   bool calcLoopBranchHeuristics(BasicBlock *BB);
   bool calcZeroHeuristics(BasicBlock *BB);
   bool calcFloatingPointHeuristics(BasicBlock *BB);
+  bool calcInvokeHeuristics(BasicBlock *BB);
 };
 
 }

Modified: vendor/llvm/dist/include/llvm/Analysis/Dominators.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/Dominators.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Analysis/Dominators.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -705,7 +705,20 @@ DominatorTreeBase<NodeT>::properlyDomina
 
 EXTERN_TEMPLATE_INSTANTIATION(class DominatorTreeBase<BasicBlock>);
 
-class BasicBlockEdge;
+class BasicBlockEdge {
+  const BasicBlock *Start;
+  const BasicBlock *End;
+public:
+  BasicBlockEdge(const BasicBlock *Start_, const BasicBlock *End_) :
+    Start(Start_), End(End_) { }
+  const BasicBlock *getStart() const {
+    return Start;
+  }
+  const BasicBlock *getEnd() const {
+    return End;
+  }
+  bool isSingleEdge() const;
+};
 
 //===-------------------------------------
 /// DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to

Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h
==============================================================================
--- vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -420,6 +420,12 @@ public:
     return hasProperty(MCID::Bitcast, Type);
   }
 
+  /// isSelect - Return true if this instruction is a select instruction.
+  ///
+  bool isSelect(QueryType Type = IgnoreBundle) const {
+    return hasProperty(MCID::Select, Type);
+  }
+
   /// isNotDuplicable - Return true if this instruction cannot be safely
   /// duplicated.  For example, if the instruction has a unique labels attached
   /// to it, duplicating it would cause multiple definition errors.

Modified: vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h
==============================================================================
--- vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -146,7 +146,8 @@ public:
   inline bool isMachineOpcode() const;
   inline unsigned getMachineOpcode() const;
   inline const DebugLoc getDebugLoc() const;
-
+  inline void dump() const;
+  inline void dumpr() const;
 
   /// reachesChainWithoutSideEffects - Return true if this operand (which must
   /// be a chain) reaches the specified operand without crossing any
@@ -806,7 +807,12 @@ inline bool SDValue::hasOneUse() const {
 inline const DebugLoc SDValue::getDebugLoc() const {
   return Node->getDebugLoc();
 }
-
+inline void SDValue::dump() const {
+  return Node->dump();
+}
+inline void SDValue::dumpr() const {
+  return Node->dumpr();
+}
 // Define inline functions from the SDUse class.
 
 inline void SDUse::set(const SDValue &V) {

Modified: vendor/llvm/dist/include/llvm/IntrinsicsHexagon.td
==============================================================================
--- vendor/llvm/dist/include/llvm/IntrinsicsHexagon.td	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/IntrinsicsHexagon.td	Sun Aug 19 10:31:50 2012	(r239390)
@@ -15,7 +15,7 @@
 //
 // All Hexagon intrinsics start with "llvm.hexagon.".
 let TargetPrefix = "hexagon" in {
-  /// Hexagon_Intrinsic - Base class for all altivec intrinsics.
+  /// Hexagon_Intrinsic - Base class for all Hexagon intrinsics.
   class Hexagon_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
                               list<LLVMType> param_types,
                               list<IntrinsicProperty> properties>

Added: vendor/llvm/dist/include/llvm/MC/MCFixedLenDisassembler.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/MC/MCFixedLenDisassembler.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -0,0 +1,32 @@
+//===-- llvm/MC/MCFixedLenDisassembler.h - Decoder driver -------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Fixed length disassembler decoder state machine driver.
+//===----------------------------------------------------------------------===//
+#ifndef MCFIXEDLENDISASSEMBLER_H
+#define MCFIXEDLENDISASSEMBLER_H
+
+namespace llvm {
+
+namespace MCD {
+// Disassembler state machine opcodes.
+enum DecoderOps {
+  OPC_ExtractField = 1, // OPC_ExtractField(uint8_t Start, uint8_t Len)
+  OPC_FilterValue,      // OPC_FilterValue(uleb128 Val, uint16_t NumToSkip)
+  OPC_CheckField,       // OPC_CheckField(uint8_t Start, uint8_t Len,
+                        //                uleb128 Val, uint16_t NumToSkip)
+  OPC_CheckPredicate,   // OPC_CheckPredicate(uleb128 PIdx, uint16_t NumToSkip)
+  OPC_Decode,           // OPC_Decode(uleb128 Opcode, uleb128 DIdx)
+  OPC_SoftFail,         // OPC_SoftFail(uleb128 PMask, uleb128 NMask)
+  OPC_Fail              // OPC_Fail()
+};
+
+} // namespace MCDecode
+} // namespace llvm
+
+#endif

Modified: vendor/llvm/dist/include/llvm/MC/MCInstrDesc.h
==============================================================================
--- vendor/llvm/dist/include/llvm/MC/MCInstrDesc.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/MC/MCInstrDesc.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -107,6 +107,7 @@ namespace MCID {
     Compare,
     MoveImm,
     Bitcast,
+    Select,
     DelaySlot,
     FoldableAsLoad,
     MayLoad,
@@ -282,6 +283,12 @@ public:
     return Flags & (1 << MCID::Bitcast);
   }
 
+  /// isSelect - Return true if this is a select instruction.
+  ///
+  bool isSelect() const {
+    return Flags & (1 << MCID::Select);
+  }
+
   /// isNotDuplicable - Return true if this instruction cannot be safely
   /// duplicated.  For example, if the instruction has a unique labels attached
   /// to it, duplicating it would cause multiple definition errors.

Modified: vendor/llvm/dist/include/llvm/Support/AlignOf.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Support/AlignOf.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Support/AlignOf.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -107,8 +107,8 @@ LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
 // Any larger and MSVC complains.
 #undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
 
-/// \brief This class template exposes a typedef for type containing a suitable
-/// aligned character array to hold elements of any of up to four types.
+/// \brief This union template exposes a suitably aligned and sized character
+/// array member which can hold elements of any of up to four types.
 ///
 /// These types may be arrays, structs, or any other types. The goal is to
 /// produce a union type containing a character array which, when used, forms
@@ -116,7 +116,8 @@ LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
 /// than four types can be added at the cost of more boiler plate.
 template <typename T1,
           typename T2 = char, typename T3 = char, typename T4 = char>
-class AlignedCharArray {
+union AlignedCharArrayUnion {
+private:
   class AlignerImpl {
     T1 t1; T2 t2; T3 t3; T4 t4;
 
@@ -127,6 +128,12 @@ class AlignedCharArray {
   };
 
 public:
+  /// \brief The character array buffer for use by clients.
+  ///
+  /// No other member of this union should be referenced. The exist purely to
+  /// constrain the layout of this character array.
+  char buffer[sizeof(SizerImpl)];
+
   // Sadly, Clang and GCC both fail to align a character array properly even
   // with an explicit alignment attribute. To work around this, we union
   // the character array that will actually be used with a struct that contains
@@ -134,16 +141,10 @@ public:
   // and GCC will properly register the alignment of a struct containing an
   // aligned member, and this alignment should carry over to the character
   // array in the union.
-  union union_type {
-    // This is the only member of the union which should be used by clients:
-    char buffer[sizeof(SizerImpl)];
-
-    // This member of the union only exists to force the alignment.
-    struct {
-      typename llvm::AlignedCharArrayImpl<AlignOf<AlignerImpl>::Alignment>::type
-        nonce_inner_member;
-    } nonce_member;
-  };
+  struct {
+    typename llvm::AlignedCharArrayImpl<AlignOf<AlignerImpl>::Alignment>::type
+      nonce_inner_member;
+  } nonce_member;
 };
 
 } // end namespace llvm

Modified: vendor/llvm/dist/include/llvm/Support/COFF.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Support/COFF.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Support/COFF.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -50,7 +50,7 @@ namespace COFF {
   };
 
   enum MachineTypes {
-    MT_Invalid = -1,
+    MT_Invalid = 0xffff,
 
     IMAGE_FILE_MACHINE_UNKNOWN   = 0x0,
     IMAGE_FILE_MACHINE_AM33      = 0x13,
@@ -142,7 +142,7 @@ namespace COFF {
 
   /// Storage class tells where and what the symbol represents
   enum SymbolStorageClass {
-    SSC_Invalid = -1,
+    SSC_Invalid = 0xff,
 
     IMAGE_SYM_CLASS_END_OF_FUNCTION  = -1,  ///< Physical end of function
     IMAGE_SYM_CLASS_NULL             = 0,   ///< No symbol
@@ -220,7 +220,7 @@ namespace COFF {
   };
 
   enum SectionCharacteristics {
-    SC_Invalid = -1,
+    SC_Invalid = 0xffffffff,
 
     IMAGE_SCN_TYPE_NO_PAD            = 0x00000008,
     IMAGE_SCN_CNT_CODE               = 0x00000020,

Modified: vendor/llvm/dist/include/llvm/Support/Compiler.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Support/Compiler.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Support/Compiler.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -38,6 +38,25 @@
 #define llvm_move(value) (value)
 #endif
 
+/// LLVM_DELETED_FUNCTION - Expands to = delete if the compiler supports it.
+/// Use to mark functions as uncallable. Member functions with this should
+/// be declared private so that some behaivor is kept in C++03 mode.
+///
+/// class DontCopy {
+/// private:
+///   DontCopy(const DontCopy&) LLVM_DELETED_FUNCTION;
+///   DontCopy &operator =(const DontCopy&) LLVM_DELETED_FUNCTION;
+/// public:
+///   ...
+/// };
+#if (__has_feature(cxx_deleted_functions) \
+     || defined(__GXX_EXPERIMENTAL_CXX0X__))
+     // No version of MSVC currently supports this.
+#define LLVM_DELETED_FUNCTION = delete
+#else
+#define LLVM_DELETED_FUNCTION
+#endif
+
 /// LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked
 /// into a shared library, then the class should be private to the library and
 /// not accessible from outside it.  Can also be used to mark variables and

Modified: vendor/llvm/dist/include/llvm/Support/FileSystem.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Support/FileSystem.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Support/FileSystem.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -28,6 +28,7 @@
 #define LLVM_SUPPORT_FILE_SYSTEM_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/DataTypes.h"
@@ -576,6 +577,82 @@ error_code FindLibrary(const Twine &shor
 error_code GetMainExecutable(const char *argv0, void *MainAddr,
                              SmallVectorImpl<char> &result);
 
+/// This class represents a memory mapped file. It is based on
+/// boost::iostreams::mapped_file.
+class mapped_file_region {
+  mapped_file_region() LLVM_DELETED_FUNCTION;
+  mapped_file_region(mapped_file_region&) LLVM_DELETED_FUNCTION;
+  mapped_file_region &operator =(mapped_file_region&) LLVM_DELETED_FUNCTION;
+
+public:
+  enum mapmode {
+    readonly, //< May only access map via const_data as read only.
+    readwrite, //< May access map via data and modify it. Written to path.
+    priv //< May modify via data, but changes are lost on destruction.
+  };
+
+private:
+  /// Platform specific mapping state.
+  mapmode Mode;
+  uint64_t Size;
+  void *Mapping;
+#if LLVM_ON_WIN32
+  int FileDescriptor;
+  void *FileHandle;
+  void *FileMappingHandle;
+#endif
+
+  error_code init(int FD, uint64_t Offset);
+
+public:
+  typedef char char_type;
+
+#if LLVM_USE_RVALUE_REFERENCES
+  mapped_file_region(mapped_file_region&&);
+  mapped_file_region &operator =(mapped_file_region&&);
+#endif
+
+  /// Construct a mapped_file_region at \a path starting at \a offset of length
+  /// \a length and with access \a mode.
+  ///
+  /// \param path Path to the file to map. If it does not exist it will be
+  ///             created.
+  /// \param mode How to map the memory.
+  /// \param length Number of bytes to map in starting at \a offset. If the file
+  ///               is shorter than this, it will be extended. If \a length is
+  ///               0, the entire file will be mapped.
+  /// \param offset Byte offset from the beginning of the file where the map
+  ///               should begin. Must be a multiple of
+  ///               mapped_file_region::alignment().
+  /// \param ec This is set to errc::success if the map was constructed
+  ///           sucessfully. Otherwise it is set to a platform dependent error.
+  mapped_file_region(const Twine &path,
+                     mapmode mode,
+                     uint64_t length,
+                     uint64_t offset,
+                     error_code &ec);
+
+  /// \param fd An open file descriptor to map. mapped_file_region takes
+  ///           ownership. It must have been opended in the correct mode.
+  mapped_file_region(int fd,
+                     mapmode mode,
+                     uint64_t length,
+                     uint64_t offset,
+                     error_code &ec);
+
+  ~mapped_file_region();
+
+  mapmode flags() const;
+  uint64_t size() const;
+  char *data() const;
+
+  /// Get a const view of the data. Modifying this memory has undefined
+  /// behaivor.
+  const char *const_data() const;
+
+  /// \returns The minimum alignment offset must be.
+  static int alignment();
+};
 
 /// @brief Memory maps the contents of a file
 ///

Modified: vendor/llvm/dist/include/llvm/Support/LEB128.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Support/LEB128.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Support/LEB128.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -19,7 +19,7 @@
 
 namespace llvm {
 
-/// Utility function to encode a SLEB128 value.
+/// Utility function to encode a SLEB128 value to an output stream.
 static inline void encodeSLEB128(int64_t Value, raw_ostream &OS) {
   bool More;
   do {
@@ -34,7 +34,7 @@ static inline void encodeSLEB128(int64_t
   } while (More);
 }
 
-/// Utility function to encode a ULEB128 value.
+/// Utility function to encode a ULEB128 value to an output stream.
 static inline void encodeULEB128(uint64_t Value, raw_ostream &OS,
                                  unsigned Padding = 0) {
   do {
@@ -53,6 +53,43 @@ static inline void encodeULEB128(uint64_
   }
 }
 
+/// Utility function to encode a ULEB128 value to a buffer. Returns
+/// the length in bytes of the encoded value.
+static inline unsigned encodeULEB128(uint64_t Value, uint8_t *p,
+                                     unsigned Padding = 0) {
+  uint8_t *orig_p = p;
+  do {
+    uint8_t Byte = Value & 0x7f;
+    Value >>= 7;
+    if (Value != 0 || Padding != 0)
+      Byte |= 0x80; // Mark this byte that that more bytes will follow.
+    *p++ = Byte;
+  } while (Value != 0);
+
+  // Pad with 0x80 and emit a null byte at the end.
+  if (Padding != 0) {
+    for (; Padding != 1; --Padding)
+      *p++ = '\x80';
+    *p++ = '\x00';
+  }
+  return (unsigned)(p - orig_p);
+}
+
+
+/// Utility function to decode a ULEB128 value.
+static inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n = 0) {
+  const uint8_t *orig_p = p;
+  uint64_t Value = 0;
+  unsigned Shift = 0;
+  do {
+    Value += (*p & 0x7f) << Shift;
+    Shift += 7;
+  } while (*p++ >= 128);
+  if (n)
+    *n = (unsigned)(p - orig_p);
+  return Value;
+}
+
 }  // namespace llvm
 
 #endif  // LLVM_SYSTEM_LEB128_H

Modified: vendor/llvm/dist/include/llvm/Support/NoFolder.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Support/NoFolder.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Support/NoFolder.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -181,6 +181,12 @@ public:
                                 ArrayRef<Constant *> IdxList) const {
     return ConstantExpr::getGetElementPtr(C, IdxList);
   }
+  Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {
+    // This form of the function only exists to avoid ambiguous overload
+    // warnings about whether to convert Idx to ArrayRef<Constant *> or
+    // ArrayRef<Value *>.
+    return ConstantExpr::getGetElementPtr(C, Idx);
+  }
   Instruction *CreateGetElementPtr(Constant *C,
                                    ArrayRef<Value *> IdxList) const {
     return GetElementPtrInst::Create(C, IdxList);
@@ -190,6 +196,12 @@ public:
                                         ArrayRef<Constant *> IdxList) const {
     return ConstantExpr::getInBoundsGetElementPtr(C, IdxList);
   }
+  Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const {
+    // This form of the function only exists to avoid ambiguous overload
+    // warnings about whether to convert Idx to ArrayRef<Constant *> or
+    // ArrayRef<Value *>.
+    return ConstantExpr::getInBoundsGetElementPtr(C, Idx);
+  }
   Instruction *CreateInBoundsGetElementPtr(Constant *C,
                                            ArrayRef<Value *> IdxList) const {
     return GetElementPtrInst::CreateInBounds(C, IdxList);

Modified: vendor/llvm/dist/include/llvm/Target/Target.td
==============================================================================
--- vendor/llvm/dist/include/llvm/Target/Target.td	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Target/Target.td	Sun Aug 19 10:31:50 2012	(r239390)
@@ -28,6 +28,24 @@ class SubRegIndex<list<SubRegIndex> comp
   // ComposedOf - A list of two SubRegIndex instances, [A, B].
   // This indicates that this SubRegIndex is the result of composing A and B.
   list<SubRegIndex> ComposedOf = comps;
+
+  // CoveringSubRegIndices - A list of two or more sub-register indexes that
+  // cover this sub-register.
+  //
+  // This field should normally be left blank as TableGen can infer it.
+  //
+  // TableGen automatically detects sub-registers that straddle the registers
+  // in the SubRegs field of a Register definition. For example:
+  //
+  //   Q0    = dsub_0 -> D0, dsub_1 -> D1
+  //   Q1    = dsub_0 -> D2, dsub_1 -> D3
+  //   D1_D2 = dsub_0 -> D1, dsub_1 -> D2
+  //   QQ0   = qsub_0 -> Q0, qsub_1 -> Q1
+  //
+  // TableGen will infer that D1_D2 is a sub-register of QQ0. It will be given
+  // the synthetic index dsub_1_dsub_2 unless some SubRegIndex is defined with
+  // CoveringSubRegIndices = [dsub_1, dsub_2].
+  list<SubRegIndex> CoveringSubRegIndices = [];
 }
 
 // RegAltNameIndex - The alternate name set to use for register operands of
@@ -321,6 +339,7 @@ class Instruction {
   bit isCompare    = 0;     // Is this instruction a comparison instruction?
   bit isMoveImm    = 0;     // Is this instruction a move immediate instruction?
   bit isBitcast    = 0;     // Is this instruction a bitcast instruction?
+  bit isSelect     = 0;     // Is this instruction a select instruction?
   bit isBarrier    = 0;     // Can control flow fall through this instruction?
   bit isCall       = 0;     // Is this instruction a call instruction?
   bit canFoldAsLoad = 0;    // Can this be folded as a simple memory operand?

Modified: vendor/llvm/dist/include/llvm/Target/TargetInstrInfo.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Target/TargetInstrInfo.h	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/include/llvm/Target/TargetInstrInfo.h	Sun Aug 19 10:31:50 2012	(r239390)
@@ -413,6 +413,51 @@ public:
     llvm_unreachable("Target didn't implement TargetInstrInfo::insertSelect!");
   }
 
+  /// analyzeSelect - Analyze the given select instruction, returning true if
+  /// it cannot be understood. It is assumed that MI->isSelect() is true.
+  ///
+  /// When successful, return the controlling condition and the operands that
+  /// determine the true and false result values.
+  ///
+  ///   Result = SELECT Cond, TrueOp, FalseOp
+  ///
+  /// Some targets can optimize select instructions, for example by predicating
+  /// the instruction defining one of the operands. Such targets should set
+  /// Optimizable.
+  ///
+  /// @param         MI Select instruction to analyze.
+  /// @param Cond    Condition controlling the select.
+  /// @param TrueOp  Operand number of the value selected when Cond is true.
+  /// @param FalseOp Operand number of the value selected when Cond is false.
+  /// @param Optimizable Returned as true if MI is optimizable.
+  /// @returns False on success.
+  virtual bool analyzeSelect(const MachineInstr *MI,
+                             SmallVectorImpl<MachineOperand> &Cond,
+                             unsigned &TrueOp, unsigned &FalseOp,
+                             bool &Optimizable) const {
+    assert(MI && MI->isSelect() && "MI must be a select instruction");
+    return true;
+  }
+
+  /// optimizeSelect - Given a select instruction that was understood by
+  /// analyzeSelect and returned Optimizable = true, attempt to optimize MI by
+  /// merging it with one of its operands. Returns NULL on failure.
+  ///
+  /// When successful, returns the new select instruction. The client is
+  /// responsible for deleting MI.
+  ///
+  /// If both sides of the select can be optimized, PreferFalse is used to pick
+  /// a side.
+  ///
+  /// @param MI          Optimizable select instruction.
+  /// @param PreferFalse Try to optimize FalseOp instead of TrueOp.
+  /// @returns Optimized instruction or NULL.
+  virtual MachineInstr *optimizeSelect(MachineInstr *MI,
+                                       bool PreferFalse = false) const {
+    // This function must be implemented if Optimizable is ever set.
+    llvm_unreachable("Target must implement TargetInstrInfo::optimizeSelect!");
+  }
+
   /// copyPhysReg - Emit instructions to copy a pair of physical registers.
   virtual void copyPhysReg(MachineBasicBlock &MBB,
                            MachineBasicBlock::iterator MI, DebugLoc DL,

Modified: vendor/llvm/dist/lib/Analysis/BranchProbabilityInfo.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/BranchProbabilityInfo.cpp	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/lib/Analysis/BranchProbabilityInfo.cpp	Sun Aug 19 10:31:50 2012	(r239390)
@@ -1,4 +1,4 @@
-//===-- BranchProbabilityInfo.cpp - Branch Probability Analysis -*- C++ -*-===//
+//===-- BranchProbabilityInfo.cpp - Branch Probability Analysis -----------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -78,6 +78,19 @@ static const uint32_t ZH_NONTAKEN_WEIGHT
 static const uint32_t FPH_TAKEN_WEIGHT = 20;
 static const uint32_t FPH_NONTAKEN_WEIGHT = 12;
 
+/// \brief Invoke-terminating normal branch taken weight
+///
+/// This is the weight for branching to the normal destination of an invoke
+/// instruction. We expect this to happen most of the time. Set the weight to an
+/// absurdly high value so that nested loops subsume it.
+static const uint32_t IH_TAKEN_WEIGHT = 1024 * 1024 - 1;
+
+/// \brief Invoke-terminating normal branch not-taken weight.
+///
+/// This is the weight for branching to the unwind destination of an invoke
+/// instruction. This is essentially never taken.
+static const uint32_t IH_NONTAKEN_WEIGHT = 1;
+
 // Standard weight value. Used when none of the heuristics set weight for
 // the edge.
 static const uint32_t NORMAL_WEIGHT = 16;
@@ -371,6 +384,19 @@ bool BranchProbabilityInfo::calcFloating
   return true;
 }
 
+bool BranchProbabilityInfo::calcInvokeHeuristics(BasicBlock *BB) {
+  InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator());
+  if (!II)
+    return false;
+
+  BasicBlock *Normal = II->getNormalDest();
+  BasicBlock *Unwind = II->getUnwindDest();
+
+  setEdgeWeight(BB, Normal, IH_TAKEN_WEIGHT);
+  setEdgeWeight(BB, Unwind, IH_NONTAKEN_WEIGHT);
+  return true;
+}
+
 void BranchProbabilityInfo::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<LoopInfo>();
   AU.setPreservesAll();
@@ -397,7 +423,9 @@ bool BranchProbabilityInfo::runOnFunctio
       continue;
     if (calcZeroHeuristics(*I))
       continue;
-    calcFloatingPointHeuristics(*I);
+    if (calcFloatingPointHeuristics(*I))
+      continue;
+    calcInvokeHeuristics(*I);
   }
 
   PostDominatedByUnreachable.clear();

Modified: vendor/llvm/dist/lib/Analysis/MemoryBuiltins.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/MemoryBuiltins.cpp	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/lib/Analysis/MemoryBuiltins.cpp	Sun Aug 19 10:31:50 2012	(r239390)
@@ -473,6 +473,10 @@ ObjectSizeOffsetVisitor::visitExtractVal
 }
 
 SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) {
+  // Ignore self-referencing GEPs, they can occur in unreachable code.
+  if (&GEP == GEP.getPointerOperand())
+    return unknown();
+
   SizeOffsetType PtrData = compute(GEP.getPointerOperand());
   if (!bothKnown(PtrData) || !GEP.hasAllConstantIndices())
     return unknown();

Modified: vendor/llvm/dist/lib/CodeGen/MachineVerifier.cpp
==============================================================================
--- vendor/llvm/dist/lib/CodeGen/MachineVerifier.cpp	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/lib/CodeGen/MachineVerifier.cpp	Sun Aug 19 10:31:50 2012	(r239390)
@@ -681,10 +681,10 @@ void
 MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
   const MachineInstr *MI = MO->getParent();
   const MCInstrDesc &MCID = MI->getDesc();
-  const MCOperandInfo &MCOI = MCID.OpInfo[MONum];
 
   // The first MCID.NumDefs operands must be explicit register defines
   if (MONum < MCID.getNumDefs()) {
+    const MCOperandInfo &MCOI = MCID.OpInfo[MONum];
     if (!MO->isReg())
       report("Explicit definition must be a register", MO, MONum);
     else if (!MO->isDef() && !MCOI.isOptionalDef())
@@ -692,6 +692,7 @@ MachineVerifier::visitMachineOperand(con
     else if (MO->isImplicit())
       report("Explicit definition marked as implicit", MO, MONum);
   } else if (MONum < MCID.getNumOperands()) {
+    const MCOperandInfo &MCOI = MCID.OpInfo[MONum];
     // Don't check if it's the last operand in a variadic instruction. See,
     // e.g., LDM_RET in the arm back end.
     if (MO->isReg() &&

Modified: vendor/llvm/dist/lib/CodeGen/PeepholeOptimizer.cpp
==============================================================================
--- vendor/llvm/dist/lib/CodeGen/PeepholeOptimizer.cpp	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/lib/CodeGen/PeepholeOptimizer.cpp	Sun Aug 19 10:31:50 2012	(r239390)
@@ -79,6 +79,7 @@ STATISTIC(NumBitcasts,   "Number of bitc
 STATISTIC(NumCmps,       "Number of compares eliminated");
 STATISTIC(NumImmFold,    "Number of move immediate folded");
 STATISTIC(NumLoadFold,   "Number of loads folded");
+STATISTIC(NumSelects,    "Number of selects optimized");
 
 namespace {
   class PeepholeOptimizer : public MachineFunctionPass {
@@ -109,6 +110,7 @@ namespace {
     bool optimizeCmpInstr(MachineInstr *MI, MachineBasicBlock *MBB);
     bool optimizeExtInstr(MachineInstr *MI, MachineBasicBlock *MBB,
                           SmallPtrSet<MachineInstr*, 8> &LocalMIs);
+    bool optimizeSelect(MachineInstr *MI);
     bool isMoveImmediate(MachineInstr *MI,
                          SmallSet<unsigned, 4> &ImmDefRegs,
                          DenseMap<unsigned, MachineInstr*> &ImmDefMIs);
@@ -386,6 +388,23 @@ bool PeepholeOptimizer::optimizeCmpInstr
   return false;
 }
 
+/// Optimize a select instruction.
+bool PeepholeOptimizer::optimizeSelect(MachineInstr *MI) {
+  unsigned TrueOp = 0;
+  unsigned FalseOp = 0;
+  bool Optimizable = false;
+  SmallVector<MachineOperand, 4> Cond;
+  if (TII->analyzeSelect(MI, Cond, TrueOp, FalseOp, Optimizable))
+    return false;
+  if (!Optimizable)
+    return false;
+  if (!TII->optimizeSelect(MI))
+    return false;
+  MI->eraseFromParent();
+  ++NumSelects;
+  return true;
+}
+
 /// isLoadFoldable - Check whether MI is a candidate for folding into a later
 /// instruction. We only fold loads to virtual registers and the virtual
 /// register defined has a single use.
@@ -477,11 +496,11 @@ bool PeepholeOptimizer::runOnMachineFunc
     ImmDefMIs.clear();
     FoldAsLoadDefReg = 0;
 
-    bool First = true;
-    MachineBasicBlock::iterator PMII;
     for (MachineBasicBlock::iterator
            MII = I->begin(), MIE = I->end(); MII != MIE; ) {
       MachineInstr *MI = &*MII;
+      // We may be erasing MI below, increment MII now.
+      ++MII;
       LocalMIs.insert(MI);
 
       // If there exists an instruction which belongs to the following
@@ -490,28 +509,18 @@ bool PeepholeOptimizer::runOnMachineFunc
           MI->isKill() || MI->isInlineAsm() || MI->isDebugValue() ||
           MI->hasUnmodeledSideEffects()) {
         FoldAsLoadDefReg = 0;
-        ++MII;
         continue;
       }
       if (MI->mayStore() || MI->isCall())
         FoldAsLoadDefReg = 0;
 
-      if (MI->isBitcast()) {
-        if (optimizeBitcastInstr(MI, MBB)) {
-          // MI is deleted.
-          LocalMIs.erase(MI);
-          Changed = true;
-          MII = First ? I->begin() : llvm::next(PMII);
-          continue;
-        }
-      } else if (MI->isCompare()) {
-        if (optimizeCmpInstr(MI, MBB)) {
-          // MI is deleted.
-          LocalMIs.erase(MI);
-          Changed = true;
-          MII = First ? I->begin() : llvm::next(PMII);
-          continue;
-        }
+      if ((MI->isBitcast() && optimizeBitcastInstr(MI, MBB)) ||
+          (MI->isCompare() && optimizeCmpInstr(MI, MBB)) ||
+          (MI->isSelect() && optimizeSelect(MI))) {
+        // MI is deleted.
+        LocalMIs.erase(MI);
+        Changed = true;
+        continue;
       }
 
       if (isMoveImmediate(MI, ImmDefRegs, ImmDefMIs)) {
@@ -542,14 +551,9 @@ bool PeepholeOptimizer::runOnMachineFunc
 
           // MI is replaced with FoldMI.
           Changed = true;
-          PMII = FoldMI;
-          MII = llvm::next(PMII);
           continue;
         }
       }
-      First = false;
-      PMII = MII;
-      ++MII;
     }
   }
 

Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/TargetLowering.cpp
==============================================================================
--- vendor/llvm/dist/lib/CodeGen/SelectionDAG/TargetLowering.cpp	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/TargetLowering.cpp	Sun Aug 19 10:31:50 2012	(r239390)
@@ -2303,7 +2303,7 @@ TargetLowering::SimplifySetCC(EVT VT, SD
         N0.getOpcode() == ISD::AND)
       if (ConstantSDNode *AndRHS =
                   dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
-        EVT ShiftTy = DCI.isBeforeLegalize() ?
+        EVT ShiftTy = DCI.isBeforeLegalizeOps() ?
           getPointerTy() : getShiftAmountTy(N0.getValueType());
         if (Cond == ISD::SETNE && C1 == 0) {// (X & 8) != 0  -->  (X & 8) >> 3
           // Perform the xform if the AND RHS is a single bit.
@@ -2333,7 +2333,7 @@ TargetLowering::SimplifySetCC(EVT VT, SD
           const APInt &AndRHSC = AndRHS->getAPIntValue();
           if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
             unsigned ShiftBits = AndRHSC.countTrailingZeros();
-            EVT ShiftTy = DCI.isBeforeLegalize() ?
+            EVT ShiftTy = DCI.isBeforeLegalizeOps() ?
               getPointerTy() : getShiftAmountTy(N0.getValueType());
             EVT CmpTy = N0.getValueType();
             SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0.getOperand(0),
@@ -2361,7 +2361,7 @@ TargetLowering::SimplifySetCC(EVT VT, SD
         }
         NewC = NewC.lshr(ShiftBits);
         if (ShiftBits && isLegalICmpImmediate(NewC.getSExtValue())) {
-          EVT ShiftTy = DCI.isBeforeLegalize() ?
+          EVT ShiftTy = DCI.isBeforeLegalizeOps() ?
             getPointerTy() : getShiftAmountTy(N0.getValueType());
           EVT CmpTy = N0.getValueType();
           SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0,

Modified: vendor/llvm/dist/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
==============================================================================
--- vendor/llvm/dist/lib/ExecutionEngine/JIT/JITMemoryManager.cpp	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/lib/ExecutionEngine/JIT/JITMemoryManager.cpp	Sun Aug 19 10:31:50 2012	(r239390)
@@ -461,6 +461,9 @@ namespace {
     /// allocateCodeSection - Allocate memory for a code section.
     uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
                                  unsigned SectionID) {
+      // Grow the required block size to account for the block header
+      Size += sizeof(*CurBlock);
+
       // FIXME: Alignement handling.
       FreeRangeHeader* candidateBlock = FreeMemoryList;
       FreeRangeHeader* head = FreeMemoryList;

Modified: vendor/llvm/dist/lib/Support/APFloat.cpp
==============================================================================
--- vendor/llvm/dist/lib/Support/APFloat.cpp	Sun Aug 19 09:59:41 2012	(r239389)
+++ vendor/llvm/dist/lib/Support/APFloat.cpp	Sun Aug 19 10:31:50 2012	(r239390)
@@ -1770,23 +1770,41 @@ APFloat::opStatus APFloat::roundToIntegr
   opStatus fs;
   assertArithmeticOK(*semantics);
 
+  // If the exponent is large enough, we know that this value is already
+  // integral, and the arithmetic below would potentially cause it to saturate
+  // to +/-Inf.  Bail out early instead.
+  if (exponent+1 >= (int)semanticsPrecision(*semantics))
+    return opOK;
+
   // The algorithm here is quite simple: we add 2^(p-1), where p is the
   // precision of our format, and then subtract it back off again.  The choice
   // of rounding modes for the addition/subtraction determines the rounding mode
   // for our integral rounding as well.
-  APInt IntegerConstant(NextPowerOf2(semanticsPrecision(*semantics)),
-                        1 << (semanticsPrecision(*semantics)-1));
+  // NOTE: When the input value is negative, we do subtraction followed by
+  // addition instead.
+  APInt IntegerConstant(NextPowerOf2(semanticsPrecision(*semantics)), 1);
+  IntegerConstant <<= semanticsPrecision(*semantics)-1;
   APFloat MagicConstant(*semantics);
   fs = MagicConstant.convertFromAPInt(IntegerConstant, false,
                                       rmNearestTiesToEven);
+  MagicConstant.copySign(*this);
+
   if (fs != opOK)
     return fs;
 
+  // Preserve the input sign so that we can handle 0.0/-0.0 cases correctly.
+  bool inputSign = isNegative();

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208191031.q7JAVpir070137>