<div dir="ltr">Some of formatting issues are from previous patches. All the problems mentioned are now fixed.<div><br></div><div>David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 18, 2015 at 1:01 PM, Justin Bogner via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Betul Buyukkurt via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
> Author: betulb<br>
> Date: Wed Nov 18 12:14:55 2015<br>
> New Revision: 253484<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253484&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253484&view=rev</a><br>
> Log:<br>
> [PGO] Value profiling support<br>
><br>
> This change introduces an instrumentation intrinsic instruction for<br>
> value profiling purposes, the lowering of the instrumentation intrinsic<br>
> and raw reader updates. The raw profile data files for llvm-profdata<br>
> testing are updated.<br>
><br>
><br>
> Modified:<br>
>     llvm/trunk/docs/LangRef.rst<br>
>     llvm/trunk/include/llvm/IR/IntrinsicInst.h<br>
>     llvm/trunk/include/llvm/IR/Intrinsics.td<br>
>     llvm/trunk/include/llvm/ProfileData/InstrProf.h<br>
>     llvm/trunk/include/llvm/ProfileData/InstrProfData.inc<br>
>     llvm/trunk/include/llvm/ProfileData/InstrProfReader.h<br>
>     llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>
>     llvm/trunk/lib/ProfileData/InstrProfReader.cpp<br>
>     llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
>     llvm/trunk/test/Instrumentation/InstrProfiling/PR23499.ll<br>
>     llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll<br>
>     llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll<br>
>     llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll<br>
>     llvm/trunk/test/tools/llvm-profdata/Inputs/c-general.profraw<br>
>     llvm/trunk/test/tools/llvm-profdata/c-general.test<br>
>     llvm/trunk/test/tools/llvm-profdata/raw-32-bits-be.test<br>
>     llvm/trunk/test/tools/llvm-profdata/raw-32-bits-le.test<br>
>     llvm/trunk/test/tools/llvm-profdata/raw-64-bits-be.test<br>
>     llvm/trunk/test/tools/llvm-profdata/raw-64-bits-le.test<br>
>     llvm/trunk/test/tools/llvm-profdata/raw-two-profiles.test<br>
><br>
> Modified: llvm/trunk/docs/LangRef.rst<br>
> URL:<br>
> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/docs/LangRef.rst (original)<br>
> +++ llvm/trunk/docs/LangRef.rst Wed Nov 18 12:14:55 2015<br>
> @@ -9514,6 +9514,55 @@ structures and the code to increment the<br>
>  format that can be written out by a compiler runtime and consumed via<br>
>  the ``llvm-profdata`` tool.<br>
><br>
> +'``llvm.instrprof_value_profile``' Intrinsic<br>
> +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
> +<br>
> +Syntax:<br>
> +"""""""<br>
> +<br>
> +::<br>
> +<br>
> +      declare void @llvm.instrprof_value_profile(i8* <name>, i64 <hash>,<br>
> +                                                 i64 <value>, i32 <value_kind>,<br>
> +                                                 i32 <index>)<br>
> +<br>
> +Overview:<br>
> +"""""""""<br>
> +<br>
> +The '``llvm.instrprof_value_profile``' intrinsic can be emitted by a<br>
> +frontend for use with instrumentation based profiling. This will be<br>
> +lowered by the ``-instrprof`` pass to find out the target values,<br>
> +instrumented expressions take in a program at runtime.<br>
> +<br>
> +Arguments:<br>
> +""""""""""<br>
> +<br>
> +The first argument is a pointer to a global variable containing the<br>
> +name of the entity being instrumented. ``name`` should generally be the<br>
> +(mangled) function name for a set of counters.<br>
> +<br>
> +The second argument is a hash value that can be used by the consumer<br>
> +of the profile data to detect changes to the instrumented source. It<br>
> +is an error if ``hash`` differs between two instances of<br>
> +``llvm.instrprof_*`` that refer to the same name.<br>
> +<br>
> +The third argument is the value of the expression being profiled. The profiled<br>
> +expression's value should be representable as an unsigned 64-bit value. The<br>
> +fourth argument represents the kind of value profiling that is being done. The<br>
> +supported value profiling kinds are enumerated through the<br>
> +``InstrProfValueKind`` type declared in the<br>
> +``<include/llvm/ProfileData/InstrProf.h>`` header file. The last argument is the<br>
> +index of the instrumented expression within ``name``. It should be >= 0.<br>
> +<br>
> +Semantics:<br>
> +""""""""""<br>
> +<br>
> +This intrinsic represents the point where a call to a runtime routine<br>
> +should be inserted for value profiling of target expressions. ``-instrprof``<br>
> +pass will generate the appropriate data structures and replace the<br>
> +``llvm.instrprof_value_profile`` intrinsic with the call to the profile<br>
> +runtime library with proper arguments.<br>
> +<br>
>  Standard C Library Intrinsics<br>
>  -----------------------------<br>
><br>
><br>
> Modified: llvm/trunk/include/llvm/IR/IntrinsicInst.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/IR/IntrinsicInst.h (original)<br>
> +++ llvm/trunk/include/llvm/IR/IntrinsicInst.h Wed Nov 18 12:14:55 2015<br>
> @@ -372,6 +372,39 @@ namespace llvm {<br>
>        return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));<br>
>      }<br>
>    };<br>
> -}<br>
> +<br>
> +  /// This represents the llvm.instrprof_value_profile intrinsic.<br>
> +  class InstrProfValueProfileInst : public IntrinsicInst {<br>
> +  public:<br>
> +    static inline bool classof(const IntrinsicInst *I) {<br>
> +      return I->getIntrinsicID() == Intrinsic::instrprof_value_profile;<br>
> +    }<br>
> +    static inline bool classof(const Value *V) {<br>
> +      return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));<br>
> +    }<br>
> +<br>
> +    GlobalVariable *getName() const {<br>
> +      return cast<GlobalVariable>(<br>
> +          const_cast<Value *>(getArgOperand(0))->stripPointerCasts());<br>
> +    }<br>
> +<br>
> +    ConstantInt *getHash() const {<br>
> +      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(1)));<br>
> +    }<br>
> +<br>
> +    Value *getTargetValue() const {<br>
> +      return cast<Value>(const_cast<Value *>(getArgOperand(2)));<br>
> +    }<br>
> +<br>
> +    ConstantInt *getValueKind() const {<br>
> +      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));<br>
> +    }<br>
> +<br>
> +    // Returns the value site index.<br>
> +    ConstantInt *getIndex() const {<br>
> +      return cast<ConstantInt>(const_cast<Value *>(getArgOperand(4)));<br>
> +    }<br>
> +  };<br>
> +} // namespace llvm<br>
><br>
>  #endif<br>
><br>
> Modified: llvm/trunk/include/llvm/IR/Intrinsics.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Intrinsics.td?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Intrinsics.td?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/IR/Intrinsics.td (original)<br>
> +++ llvm/trunk/include/llvm/IR/Intrinsics.td Wed Nov 18 12:14:55 2015<br>
> @@ -319,7 +319,15 @@ def int_instrprof_increment : Intrinsic<<br>
>                                          [llvm_ptr_ty, llvm_i64_ty,<br>
>                                           llvm_i32_ty, llvm_i32_ty],<br>
>                                          []>;<br>
> -<br>
> +<br>
> +// A call to profile runtime for value profiling of target expressions<br>
> +// through instrumentation based profiling.<br>
> +def int_instrprof_value_profile : Intrinsic<[],<br>
> +                                            [llvm_ptr_ty, llvm_i64_ty,<br>
> +                                             llvm_i64_ty, llvm_i32_ty,<br>
> +                                             llvm_i32_ty],<br>
> +                                            []>;<br>
> +<br>
>  //===------------------- Standard C Library Intrinsics --------------------===//<br>
>  //<br>
><br>
><br>
> Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)<br>
> +++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Wed Nov 18 12:14:55 2015<br>
> @@ -265,7 +265,7 @@ struct InstrProfRecord {<br>
>    inline void addValueData(uint32_t ValueKind, uint32_t Site,<br>
>                             InstrProfValueData *VData, uint32_t N,<br>
>                             ValueMapType *HashKeys);<br>
> -  /// Merge Value Profile ddata from Src record to this record for ValueKind.<br>
> +  /// Merge Value Profile data from Src record to this record for ValueKind.<br>
>    inline instrprof_error mergeValueProfData(uint32_t ValueKind,<br>
>                                              InstrProfRecord &Src);<br>
><br>
> @@ -273,6 +273,12 @@ struct InstrProfRecord {<br>
>    /// the writer instance.<br>
>    inline void updateStrings(InstrProfStringTable *StrTab);<br>
><br>
> +  /// Clear value data entries<br>
> +  inline void clearValueData() {<br>
> +    for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)<br>
> +      getValueSitesForKind(Kind).clear();<br>
> +  }<br>
> +<br>
>  private:<br>
>    std::vector<InstrProfValueSiteRecord> IndirectCallSites;<br>
>    const std::vector<InstrProfValueSiteRecord> &<br>
> @@ -292,6 +298,7 @@ private:<br>
>          const_cast<const InstrProfRecord *>(this)<br>
>              ->getValueSitesForKind(ValueKind));<br>
>    }<br>
> +<br>
>    // Map indirect call target name hash to name string.<br>
>    uint64_t remapValue(uint64_t Value, uint32_t ValueKind,<br>
>                        ValueMapType *HashKeys) {<br>
> @@ -303,9 +310,8 @@ private:<br>
>            std::lower_bound(HashKeys->begin(), HashKeys->end(), Value,<br>
>                             [](const std::pair<uint64_t, const char *> &LHS,<br>
>                                uint64_t RHS) { return LHS.first < RHS; });<br>
> -      assert(Result != HashKeys->end() &&<br>
> -             "Hash does not match any known keys\n");<br>
> -      Value = (uint64_t)Result->second;<br>
> +      if (Result != HashKeys->end())<br>
> +        Value = (uint64_t)Result->second;<br>
>        break;<br>
>      }<br>
>      }<br>
> @@ -464,7 +470,7 @@ struct ValueProfData {<br>
>    // The number of value profile kinds that has value profile data.<br>
>    // In this implementation, a value profile kind is considered to<br>
>    // have profile data if the number of value profile sites for the<br>
> -  // kind is not zero. More aggressively, the implemnetation can<br>
> +  // kind is not zero. More aggressively, the implementation can<br>
>    // choose to check the actual data value: if none of the value sites<br>
>    // has any profiled values, the kind can be skipped.<br>
>    uint32_t NumValueKinds;<br>
> @@ -545,7 +551,7 @@ struct Header {<br>
><br>
>  namespace RawInstrProf {<br>
><br>
> -const uint64_t Version = 1;<br>
> +const uint64_t Version = 2;<br>
><br>
>  // Magic number to detect file format and endianness.<br>
>  // Use 255 at one end, since no UTF-8 file can use that character.  Avoid 0,<br>
> @@ -577,7 +583,7 @@ inline uint64_t getMagic<uint32_t>() {<br>
>  // compiler-rt/lib/profile/InstrProfiling.h.<br>
>  // It should also match the synthesized type in<br>
>  // Transforms/Instrumentation/InstrProfiling.cpp:getOrCreateRegionCounters.<br>
> -template <class IntPtrT> struct ProfileData {<br>
> +template <class IntPtrT> struct LLVM_ALIGNAS(8) ProfileData {<br>
>    #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) Type Name;<br>
>    #include "llvm/ProfileData/InstrProfData.inc"<br>
>  };<br>
> @@ -594,6 +600,9 @@ struct Header {<br>
>    const uint64_t NamesSize;<br>
>    const uint64_t CountersDelta;<br>
>    const uint64_t NamesDelta;<br>
> +  const uint64_t ValueKindLast;<br>
> +  const uint64_t ValueDataSize;<br>
> +  const uint64_t ValueDataDelta;<br>
>  };<br>
><br>
>  }  // end namespace RawInstrProf<br>
><br>
> Modified: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (original)<br>
> +++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Wed Nov 18 12:14:55 2015<br>
> @@ -56,6 +56,12 @@ INSTR_PROF_DATA(const IntPtrT, llvm::Typ<br>
>  INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt64PtrTy(Ctx), CounterPtr, \<br>
>                  ConstantExpr::getBitCast(CounterPtr, \<br>
>                  llvm::Type::getInt64PtrTy(Ctx)))<br>
> +INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), FunctionPointer, \<br>
> +                FunctionAddr)<br>
> +INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \<br>
> +                ConstantPointerNull::get(Int8PtrTy))<br>
> +INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last+1], \<br>
> +                ConstantArray::get(Int16ArrayTy, Int16ArrayVals))<br>
>  // INSTR_PROF_DATA_END<br>
><br>
>  #ifdef INSTR_PROF_DATA<br>
><br>
> Modified: llvm/trunk/include/llvm/ProfileData/InstrProfReader.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfReader.h?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfReader.h?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/ProfileData/InstrProfReader.h (original)<br>
> +++ llvm/trunk/include/llvm/ProfileData/InstrProfReader.h Wed Nov 18 12:14:55 2015<br>
> @@ -20,10 +20,12 @@<br>
>  #include "llvm/ProfileData/InstrProf.h"<br>
>  #include "llvm/Support/EndianStream.h"<br>
>  #include "llvm/Support/ErrorOr.h"<br>
> +#include "llvm/Support/raw_ostream.h"<br>
>  #include "llvm/Support/LineIterator.h"<br>
>  #include "llvm/Support/MemoryBuffer.h"<br>
>  #include "llvm/Support/OnDiskHashTable.h"<br>
>  #include <iterator><br>
> +#include <map><br>
<br>
</div></div>Is <map> used? I think this include's left over from an earlier<br>
iteration.<br>
<div><div class="h5"><br>
><br>
>  namespace llvm {<br>
><br>
> @@ -132,15 +134,21 @@ class RawInstrProfReader : public InstrP<br>
>  private:<br>
>    /// The profile data file contents.<br>
>    std::unique_ptr<MemoryBuffer> DataBuffer;<br>
> -<br>
>    bool ShouldSwapBytes;<br>
>    uint64_t CountersDelta;<br>
>    uint64_t NamesDelta;<br>
> +  uint64_t ValueDataDelta;<br>
>    const RawInstrProf::ProfileData<IntPtrT> *Data;<br>
>    const RawInstrProf::ProfileData<IntPtrT> *DataEnd;<br>
>    const uint64_t *CountersStart;<br>
>    const char *NamesStart;<br>
> +  const uint8_t *ValueDataStart;<br>
>    const char *ProfileEnd;<br>
> +  uint32_t ValueKindLast;<br>
> +<br>
> +  // String table for holding a unique copy of all the strings in the profile.<br>
> +  InstrProfStringTable StringTable;<br>
> +  InstrProfRecord::ValueMapType FunctionPtrToNameMap;<br>
><br>
>    RawInstrProfReader(const RawInstrProfReader &) = delete;<br>
>    RawInstrProfReader &operator=(const RawInstrProfReader &) = delete;<br>
> @@ -159,10 +167,13 @@ private:<br>
>    IntT swap(IntT Int) const {<br>
>      return ShouldSwapBytes ? sys::getSwappedBytes(Int) : Int;<br>
>    }<br>
> -<br>
> +  inline uint8_t getNumPaddingBytes(uint64_t SizeInBytes) {<br>
> +    return 7 & (sizeof(uint64_t) - SizeInBytes % sizeof(uint64_t));<br>
> +  }<br>
>    std::error_code readName(InstrProfRecord &Record);<br>
>    std::error_code readFuncHash(InstrProfRecord &Record);<br>
>    std::error_code readRawCounts(InstrProfRecord &Record);<br>
> +  std::error_code readValueData(InstrProfRecord &Record);<br>
>    bool atEnd() const { return Data == DataEnd; }<br>
>    void advanceData() { Data++; }<br>
><br>
> @@ -174,6 +185,15 @@ private:<br>
>      ptrdiff_t Offset = (swap(NamePtr) - NamesDelta) / sizeof(char);<br>
>      return NamesStart + Offset;<br>
>    }<br>
> +  const uint8_t *getValueDataCounts(IntPtrT ValueCountsPtr) const {<br>
> +    ptrdiff_t Offset = (swap(ValueCountsPtr) - ValueDataDelta) / sizeof(uint8_t);<br>
> +    return ValueDataStart + Offset;<br>
> +  }<br>
> +  // This accepts an already byte-swapped ValueDataPtr argument.<br>
> +  const InstrProfValueData *getValueData(IntPtrT ValueDataPtr) const {<br>
> +    ptrdiff_t Offset = (ValueDataPtr - ValueDataDelta) / sizeof(uint8_t);<br>
> +    return reinterpret_cast<const InstrProfValueData*>(ValueDataStart + Offset);<br>
<br>
</div></div>Some of the formatting looks a bit off, here and in a few places<br>
elsewhere in the patch. Did you remember to use clang-format?<br>
<div><div class="h5"><br>
> +  }<br>
>  };<br>
><br>
>  typedef RawInstrProfReader<uint32_t> RawInstrProfReader32;<br>
> @@ -303,6 +323,7 @@ private:<br>
>    /// Fill Counts with the profile data for the given function name.<br>
>    std::error_code getFunctionCounts(StringRef FuncName, uint64_t FuncHash,<br>
>                                      std::vector<uint64_t> &Counts);<br>
> +<br>
>    /// Return the maximum of all known function counts.<br>
>    uint64_t getMaximumFunctionCount() { return MaxFunctionCount; }<br>
><br>
><br>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Nov 18 12:14:55 2015<br>
> @@ -5211,7 +5211,8 @@ SelectionDAGBuilder::visitIntrinsicCall(<br>
>    }<br>
>    case Intrinsic::instrprof_increment:<br>
>      llvm_unreachable("instrprof failed to lower an increment");<br>
> -<br>
> +  case Intrinsic::instrprof_value_profile:<br>
> +    llvm_unreachable("instrprof failed to lower a value profiling call");<br>
>    case Intrinsic::localescape: {<br>
>      MachineFunction &MF = DAG.getMachineFunction();<br>
>      const TargetInstrInfo *TII = DAG.getSubtarget().getInstrInfo();<br>
><br>
> Modified: llvm/trunk/lib/ProfileData/InstrProfReader.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfReader.cpp?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfReader.cpp?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/ProfileData/InstrProfReader.cpp (original)<br>
> +++ llvm/trunk/lib/ProfileData/InstrProfReader.cpp Wed Nov 18 12:14:55 2015<br>
> @@ -206,15 +206,21 @@ std::error_code RawInstrProfReader<IntPt<br>
><br>
>    CountersDelta = swap(Header.CountersDelta);<br>
>    NamesDelta = swap(Header.NamesDelta);<br>
> +  ValueDataDelta = swap(Header.ValueDataDelta);<br>
>    auto DataSize = swap(Header.DataSize);<br>
>    auto CountersSize = swap(Header.CountersSize);<br>
>    auto NamesSize = swap(Header.NamesSize);<br>
> +  auto ValueDataSize = swap(Header.ValueDataSize);<br>
> +  ValueKindLast = swap(Header.ValueKindLast);<br>
> +<br>
> +  auto DataSizeInBytes = DataSize * sizeof(RawInstrProf::ProfileData<IntPtrT>);<br>
> +  auto PaddingSize = getNumPaddingBytes(NamesSize);<br>
><br>
>    ptrdiff_t DataOffset = sizeof(RawInstrProf::Header);<br>
> -  ptrdiff_t CountersOffset =<br>
> -      DataOffset + sizeof(RawInstrProf::ProfileData<IntPtrT>) * DataSize;<br>
> +  ptrdiff_t CountersOffset = DataOffset + DataSizeInBytes;<br>
>    ptrdiff_t NamesOffset = CountersOffset + sizeof(uint64_t) * CountersSize;<br>
> -  size_t ProfileSize = NamesOffset + sizeof(char) * NamesSize;<br>
> +  ptrdiff_t ValueDataOffset = NamesOffset + NamesSize + PaddingSize;<br>
> +  size_t ProfileSize = ValueDataOffset + ValueDataSize;<br>
><br>
>    auto *Start = reinterpret_cast<const char *>(&Header);<br>
>    if (Start + ProfileSize > DataBuffer->getBufferEnd())<br>
> @@ -225,8 +231,23 @@ std::error_code RawInstrProfReader<IntPt<br>
>    DataEnd = Data + DataSize;<br>
>    CountersStart = reinterpret_cast<const uint64_t *>(Start + CountersOffset);<br>
>    NamesStart = Start + NamesOffset;<br>
> +  ValueDataStart = reinterpret_cast<const uint8_t*>(Start + ValueDataOffset);<br>
>    ProfileEnd = Start + ProfileSize;<br>
><br>
> +  FunctionPtrToNameMap.clear();<br>
> +  for (const RawInstrProf::ProfileData<IntPtrT> *I = Data; I != DataEnd; ++I) {<br>
> +    const IntPtrT FPtr = swap(I->FunctionPointer);<br>
> +    if (!FPtr)<br>
> +      continue;<br>
> +    StringRef FunctionName(getName(I->NamePtr), swap(I->NameSize));<br>
> +    const char* NameEntryPtr = StringTable.insertString(FunctionName);<br>
> +    FunctionPtrToNameMap.push_back(std::pair<const IntPtrT, const char*><br>
> +                                   (FPtr, NameEntryPtr));<br>
> +  }<br>
> +  std::sort(FunctionPtrToNameMap.begin(), FunctionPtrToNameMap.end(), less_first());<br>
> +  FunctionPtrToNameMap.erase(std::unique(FunctionPtrToNameMap.begin(),<br>
> +                                         FunctionPtrToNameMap.end()),<br>
> +                                         FunctionPtrToNameMap.end());<br>
>    return success();<br>
>  }<br>
><br>
> @@ -234,9 +255,8 @@ template <class IntPtrT><br>
>  std::error_code RawInstrProfReader<IntPtrT>::readName(InstrProfRecord &Record) {<br>
>    Record.Name = StringRef(getName(Data->NamePtr), swap(Data->NameSize));<br>
>    if (Record.Name.data() < NamesStart ||<br>
> -      Record.Name.data() + Record.Name.size() > DataBuffer->getBufferEnd())<br>
> +      Record.Name.data() + Record.Name.size() > (char*)ValueDataStart)<br>
<br>
</div></div>We generally prefer C++ conversions to C-style casts, so I would expect<br>
reinterpret_cast here.<br>
<span class=""><br>
>      return error(instrprof_error::malformed);<br>
> -<br>
>    return success();<br>
>  }<br>
><br>
> @@ -275,8 +295,54 @@ std::error_code RawInstrProfReader<IntPt<br>
>  }<br>
><br>
>  template <class IntPtrT><br>
> -std::error_code<br>
> -RawInstrProfReader<IntPtrT>::readNextRecord(InstrProfRecord &Record) {<br>
> +std::error_code RawInstrProfReader<IntPtrT>::readValueData(<br>
> +    InstrProfRecord &Record) {<br>
> +<br>
> +  Record.clearValueData();<br>
> +  if (!Data->Values || (ValueDataDelta == 0))<br>
> +    return success();<br>
> +<br>
> +  // Read value data.<br>
> +  uint64_t NumVSites = 0;<br>
> +  for (uint32_t Kind = IPVK_First; Kind <= ValueKindLast; ++Kind)<br>
> +    NumVSites += swap(Data->NumValueSites[Kind]);<br>
> +  NumVSites += getNumPaddingBytes(NumVSites);<br>
> +<br>
> +  auto VDataCounts = makeArrayRef(getValueDataCounts(Data->Values), NumVSites);<br>
> +  // Check bounds.<br>
> +  if (VDataCounts.data() < ValueDataStart ||<br>
> +      VDataCounts.data() + VDataCounts.size() > (const uint8_t *)ProfileEnd)<br>
<br>
</span>Similarly here.<br>
<div class="HOEnZb"><div class="h5"><br>
> +    return error(instrprof_error::malformed);<br>
> +<br>
> +  const InstrProfValueData *VDataPtr =<br>
> +      getValueData(swap(Data->Values) + NumVSites);<br>
> +  for (uint32_t Kind = IPVK_First; Kind <= ValueKindLast; ++Kind) {<br>
> +    NumVSites = swap(Data->NumValueSites[Kind]);<br>
> +    Record.reserveSites(Kind, NumVSites);<br>
> +    for (uint32_t VSite = 0; VSite < NumVSites; ++VSite) {<br>
> +<br>
> +      uint32_t VDataCount = VDataCounts[VSite];<br>
> +      if ((const char *)(VDataPtr + VDataCount) > ProfileEnd)<br>
> +        return error(instrprof_error::malformed);<br>
> +<br>
> +      std::vector<InstrProfValueData> CurrentValues;<br>
> +      CurrentValues.reserve(VDataCount);<br>
> +      for (uint32_t VIndex = 0; VIndex < VDataCount; ++VIndex) {<br>
> +        uint64_t TargetValue = swap(VDataPtr->Value);<br>
> +        uint64_t Count = swap(VDataPtr->Count);<br>
> +        CurrentValues.push_back({TargetValue, Count});<br>
> +        ++VDataPtr;<br>
> +      }<br>
> +      Record.addValueData(Kind, VSite, CurrentValues.data(),<br>
> +                          VDataCount, &FunctionPtrToNameMap);<br>
> +    }<br>
> +  }<br>
> +  return success();<br>
> +}<br>
> +<br>
> +template <class IntPtrT><br>
> +std::error_code RawInstrProfReader<IntPtrT>::readNextRecord(<br>
> +    InstrProfRecord &Record) {<br>
>    if (atEnd())<br>
>      if (std::error_code EC = readNextHeader(ProfileEnd))<br>
>        return EC;<br>
> @@ -293,6 +359,9 @@ RawInstrProfReader<IntPtrT>::readNextRec<br>
>    if (std::error_code EC = readRawCounts(Record))<br>
>      return EC;<br>
><br>
> +  // Read value data and set Record.<br>
> +  if (std::error_code EC = readValueData(Record)) return EC;<br>
> +<br>
>    // Iterate.<br>
>    advanceData();<br>
>    return success();<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Wed Nov 18 12:14:55 2015<br>
> @@ -7,19 +7,18 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
>  //<br>
> -// This pass lowers instrprof_increment intrinsics emitted by a frontend for<br>
> -// profiling. It also builds the data structures and initialization code needed<br>
> -// for updating execution counts and emitting the profile at runtime.<br>
> +// This pass lowers instrprof_* intrinsics emitted by a frontend for profiling.<br>
> +// It also builds the data structures and initialization code needed for<br>
> +// updating execution counts and emitting the profile at runtime.<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> -#include "llvm/ProfileData/InstrProf.h"<br>
> -#include "llvm/Transforms/Instrumentation.h"<br>
> -<br>
>  #include "llvm/ADT/Triple.h"<br>
>  #include "llvm/IR/IRBuilder.h"<br>
>  #include "llvm/IR/IntrinsicInst.h"<br>
>  #include "llvm/IR/Module.h"<br>
> +#include "llvm/ProfileData/InstrProf.h"<br>
> +#include "llvm/Transforms/Instrumentation.h"<br>
>  #include "llvm/Transforms/Utils/ModuleUtils.h"<br>
><br>
>  using namespace llvm;<br>
> @@ -50,7 +49,15 @@ public:<br>
>  private:<br>
>    InstrProfOptions Options;<br>
>    Module *M;<br>
> -  DenseMap<GlobalVariable *, GlobalVariable *> RegionCounters;<br>
> +  typedef struct PerFunctionProfileData {<br>
> +    uint32_t NumValueSites[IPVK_Last+1];<br>
> +    GlobalVariable* RegionCounters;<br>
> +    GlobalVariable* DataVar;<br>
> +    PerFunctionProfileData() : RegionCounters(nullptr), DataVar(nullptr) {<br>
> +      memset(NumValueSites, 0, sizeof(uint32_t) * (IPVK_Last+1));<br>
> +    }<br>
> +  } PerFunctionProfileData;<br>
> +  DenseMap<GlobalVariable *, PerFunctionProfileData> ProfileDataMap;<br>
>    std::vector<Value *> UsedVars;<br>
><br>
>    bool isMachO() const {<br>
> @@ -77,6 +84,12 @@ private:<br>
>      return getInstrProfCoverageSectionName(isMachO());<br>
>    }<br>
><br>
> +  /// Count the number of instrumented value sites for the function.<br>
> +  void computeNumValueSiteCounts(InstrProfValueProfileInst *Ins);<br>
> +<br>
> +  /// Replace instrprof_value_profile with a call to runtime library.<br>
> +  void lowerValueProfileInst(InstrProfValueProfileInst *Ins);<br>
> +<br>
>    /// Replace instrprof_increment with an increment of the appropriate value.<br>
>    void lowerIncrement(InstrProfIncrementInst *Inc);<br>
><br>
> @@ -118,21 +131,37 @@ bool InstrProfiling::runOnModule(Module<br>
>    bool MadeChange = false;<br>
><br>
>    this->M = &M;<br>
> -  RegionCounters.clear();<br>
> +  ProfileDataMap.clear();<br>
>    UsedVars.clear();<br>
><br>
> +  // We did not know how many value sites there would be inside<br>
> +  // the instrumented function. This is counting the number of instrumented<br>
> +  // target value sites to enter it as field in the profile data variable.<br>
>    for (Function &F : M)<br>
>      for (BasicBlock &BB : F)<br>
>        for (auto I = BB.begin(), E = BB.end(); I != E;)<br>
> -        if (auto *Inc = dyn_cast<InstrProfIncrementInst>(I++)) {<br>
> +        if (auto *Ind = dyn_cast<InstrProfValueProfileInst>(I++))<br>
> +          computeNumValueSiteCounts(Ind);<br>
> +<br>
> +  for (Function &F : M)<br>
> +    for (BasicBlock &BB : F)<br>
> +      for (auto I = BB.begin(), E = BB.end(); I != E;) {<br>
> +        auto Instr = I++;<br>
> +        if (auto *Inc = dyn_cast<InstrProfIncrementInst>(Instr)) {<br>
>            lowerIncrement(Inc);<br>
>            MadeChange = true;<br>
> +        } else if (auto *Ind = dyn_cast<InstrProfValueProfileInst>(Instr)) {<br>
> +          lowerValueProfileInst(Ind);<br>
> +          MadeChange = true;<br>
>          }<br>
> +      }<br>
> +<br>
>    if (GlobalVariable *Coverage =<br>
>            M.getNamedGlobal(getCoverageMappingVarName())) {<br>
>      lowerCoverageData(Coverage);<br>
>      MadeChange = true;<br>
>    }<br>
> +<br>
>    if (!MadeChange)<br>
>      return false;<br>
><br>
> @@ -143,6 +172,54 @@ bool InstrProfiling::runOnModule(Module<br>
>    return true;<br>
>  }<br>
><br>
> +static Constant *getOrInsertValueProfilingCall(Module &M) {<br>
> +  auto *VoidTy = Type::getVoidTy(M.getContext());<br>
> +  auto *VoidPtrTy = Type::getInt8PtrTy(M.getContext());<br>
> +  auto *Int32Ty = Type::getInt32Ty(M.getContext());<br>
> +  auto *Int64Ty = Type::getInt64Ty(M.getContext());<br>
> +  Type *ArgTypes[] = {Int64Ty, VoidPtrTy, Int32Ty};<br>
> +  auto *ValueProfilingCallTy =<br>
> +      FunctionType::get(VoidTy, makeArrayRef(ArgTypes), false);<br>
> +  return M.getOrInsertFunction("__llvm_profile_instrument_target",<br>
> +                               ValueProfilingCallTy);<br>
> +}<br>
> +<br>
> +void InstrProfiling::computeNumValueSiteCounts(InstrProfValueProfileInst *Ind) {<br>
> +<br>
> +  GlobalVariable *Name = Ind->getName();<br>
> +  uint64_t ValueKind = Ind->getValueKind()->getZExtValue();<br>
> +  uint64_t Index = Ind->getIndex()->getZExtValue();<br>
> +  auto It = ProfileDataMap.find(Name);<br>
> +  if (It == ProfileDataMap.end()) {<br>
> +    PerFunctionProfileData PD;<br>
> +    PD.NumValueSites[ValueKind] = Index + 1;<br>
> +    ProfileDataMap[Name] = PD;<br>
> +  } else if (It->second.NumValueSites[ValueKind] <= Index)<br>
> +    It->second.NumValueSites[ValueKind] = Index + 1;<br>
> +}<br>
> +<br>
> +void InstrProfiling::lowerValueProfileInst(InstrProfValueProfileInst *Ind) {<br>
> +<br>
> +  GlobalVariable *Name = Ind->getName();<br>
> +  auto It = ProfileDataMap.find(Name);<br>
> +  assert(It != ProfileDataMap.end() && It->second.DataVar &&<br>
> +    "value profiling detected in function with no counter incerement");<br>
> +<br>
> +  GlobalVariable *DataVar = It->second.DataVar;<br>
> +  uint64_t ValueKind = Ind->getValueKind()->getZExtValue();<br>
> +  uint64_t Index = Ind->getIndex()->getZExtValue();<br>
> +  for (uint32_t Kind = IPVK_First; Kind < ValueKind; ++Kind)<br>
> +    Index += It->second.NumValueSites[Kind];<br>
> +<br>
> +  IRBuilder<> Builder(Ind);<br>
> +  Value* Args[3] = {Ind->getTargetValue(),<br>
> +      Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),<br>
> +      Builder.getInt32(Index)};<br>
> +  Ind->replaceAllUsesWith(<br>
> +      Builder.CreateCall(getOrInsertValueProfilingCall(*M), Args));<br>
> +  Ind->eraseFromParent();<br>
> +}<br>
> +<br>
>  void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) {<br>
>    GlobalVariable *Counters = getOrCreateRegionCounters(Inc);<br>
><br>
> @@ -174,9 +251,10 @@ void InstrProfiling::lowerCoverageData(G<br>
>      GlobalVariable *Name = cast<GlobalVariable>(V);<br>
><br>
>      // If we have region counters for this name, we've already handled it.<br>
> -    auto It = RegionCounters.find(Name);<br>
> -    if (It != RegionCounters.end())<br>
> -      continue;<br>
> +    auto It = ProfileDataMap.find(Name);<br>
> +    if (It != ProfileDataMap.end())<br>
> +      if (It->second.RegionCounters)<br>
> +        continue;<br>
><br>
>      // Move the name variable to the right section.<br>
>      Name->setSection(getNameSection());<br>
> @@ -191,12 +269,25 @@ static std::string getVarName(InstrProfI<br>
>    return (Prefix + Name).str();<br>
>  }<br>
><br>
> +static inline bool shouldRecordFunctionAddr(Function *F) {<br>
> +  // Check the linkage<br>
> +  if (!F->hasLinkOnceLinkage() && !F->hasLocalLinkage() &&<br>
> +      !F->hasAvailableExternallyLinkage())<br>
> +    return true;<br>
> +  // Check uses of this function for other than direct calls or invokes to it.<br>
> +  return F->hasAddressTaken();<br>
> +}<br>
> +<br>
>  GlobalVariable *<br>
>  InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) {<br>
>    GlobalVariable *NamePtr = Inc->getName();<br>
> -  auto It = RegionCounters.find(NamePtr);<br>
> -  if (It != RegionCounters.end())<br>
> -    return It->second;<br>
> +  auto It = ProfileDataMap.find(NamePtr);<br>
> +  PerFunctionProfileData PD;<br>
> +  if (It != ProfileDataMap.end()) {<br>
> +    if (It->second.RegionCounters)<br>
> +      return It->second.RegionCounters;<br>
> +    PD = It->second;<br>
> +  }<br>
><br>
>    // Move the name variable to the right section. Place them in a COMDAT group<br>
>    // if the associated function is a COMDAT. This will make sure that<br>
> @@ -225,22 +316,29 @@ InstrProfiling::getOrCreateRegionCounter<br>
>    CounterPtr->setAlignment(8);<br>
>    CounterPtr->setComdat(ProfileVarsComdat);<br>
><br>
> -  RegionCounters[Inc->getName()] = CounterPtr;<br>
> -<br>
>    // Create data variable.<br>
> -<br>
> +  auto *Int8PtrTy = Type::getInt8PtrTy(Ctx);<br>
> +  auto *Int16Ty = Type::getInt16Ty(Ctx);<br>
> +  auto *Int16ArrayTy = ArrayType::get(Int16Ty, IPVK_Last+1);<br>
>    Type *DataTypes[] = {<br>
>      #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) LLVMType,<br>
>      #include "llvm/ProfileData/InstrProfData.inc"<br>
>    };<br>
>    auto *DataTy = StructType::get(Ctx, makeArrayRef(DataTypes));<br>
><br>
> +  Constant *FunctionAddr = shouldRecordFunctionAddr(Fn) ?<br>
> +                           ConstantExpr::getBitCast(Fn, Int8PtrTy) :<br>
> +                           ConstantPointerNull::get(Int8PtrTy);<br>
> +<br>
> +  Constant *Int16ArrayVals[IPVK_Last+1];<br>
> +  for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)<br>
> +    Int16ArrayVals[Kind] = ConstantInt::get(Int16Ty, PD.NumValueSites[Kind]);<br>
> +<br>
>    Constant *DataVals[] = {<br>
>      #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) Init,<br>
>      #include "llvm/ProfileData/InstrProfData.inc"<br>
>    };<br>
> -<br>
> -  auto *Data = new GlobalVariable(*M, DataTy, true, NamePtr->getLinkage(),<br>
> +  auto *Data = new GlobalVariable(*M, DataTy, false, NamePtr->getLinkage(),<br>
>                                    ConstantStruct::get(DataTy, DataVals),<br>
>                                    getVarName(Inc, getInstrProfDataVarPrefix()));<br>
>    Data->setVisibility(NamePtr->getVisibility());<br>
> @@ -248,6 +346,10 @@ InstrProfiling::getOrCreateRegionCounter<br>
>    Data->setAlignment(8);<br>
>    Data->setComdat(ProfileVarsComdat);<br>
><br>
> +  PD.RegionCounters = CounterPtr;<br>
> +  PD.DataVar = Data;<br>
> +  ProfileDataMap[NamePtr] = PD;<br>
> +<br>
>    // Mark the data variable as used so that it isn't stripped out.<br>
>    UsedVars.push_back(Data);<br>
><br>
> @@ -341,7 +443,6 @@ void InstrProfiling::emitUses() {<br>
>    LLVMUsed =<br>
>        new GlobalVariable(*M, ATy, false, GlobalValue::AppendingLinkage,<br>
>                           ConstantArray::get(ATy, MergedVars), "llvm.used");<br>
> -<br>
>    LLVMUsed->setSection("llvm.metadata");<br>
>  }<br>
><br>
><br>
> Modified: llvm/trunk/test/Instrumentation/InstrProfiling/PR23499.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/PR23499.ll?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/PR23499.ll?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/InstrProfiling/PR23499.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/InstrProfiling/PR23499.ll Wed Nov 18 12:14:55 2015<br>
> @@ -10,7 +10,7 @@ $_Z3barIvEvv = comdat any<br>
><br>
>  ; CHECK: @__llvm_profile_name__Z3barIvEvv = linkonce_odr hidden constant [11 x i8] c"_Z3barIvEvv", section "{{.*}}__llvm_prf_names", comdat($__llvm_profile_vars__Z3barIvEvv), align 1<br>
>  ; CHECK: @__llvm_profile_counters__Z3barIvEvv = linkonce_odr hidden global [1 x i64] zeroinitializer, section "{{.*}}__llvm_prf_cnts", comdat($__llvm_profile_vars__Z3barIvEvv), align 8<br>
> -; CHECK: @__llvm_profile_data__Z3barIvEvv = linkonce_odr hidden constant { i32, i32, i64, i8*, i64* } { i32 11, i32 1, i64 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name__Z3barIvEvv, i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_profile_counters__Z3barIvEvv, i32 0, i32 0) }, section "{{.*}}__llvm_prf_data", comdat($__llvm_profile_vars__Z3barIvEvv), align 8<br>
> +; CHECK: @__llvm_profile_data__Z3barIvEvv = linkonce_odr hidden global { i32, i32, i64, i8*, i64*, i8*, i8*, [1 x i16] } { i32 11, i32 1, i64 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name__Z3barIvEvv, i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_profile_counters__Z3barIvEvv, i32 0, i32 0), i8* null, i8* null, [1 x i16] zeroinitializer }, section "{{.*}}__llvm_prf_data", comdat($__llvm_profile_vars__Z3barIvEvv), align 8<br>
><br>
>  declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #1<br>
><br>
><br>
> Modified: llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll Wed Nov 18 12:14:55 2015<br>
> @@ -9,28 +9,28 @@<br>
>  @__llvm_profile_name_foo_inline = linkonce_odr hidden constant [10 x i8] c"foo_inline"<br>
><br>
>  ; COMMON: @__llvm_profile_counters_foo = hidden global<br>
> -; COMMON: @__llvm_profile_data_foo = hidden constant<br>
> +; COMMON: @__llvm_profile_data_foo = hidden global<br>
>  define void @foo() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64 0, i32 1, i32 0)<br>
>    ret void<br>
>  }<br>
><br>
>  ; COMMON: @__llvm_profile_counters_foo_weak = weak hidden global<br>
> -; COMMON: @__llvm_profile_data_foo_weak = weak hidden constant<br>
> +; COMMON: @__llvm_profile_data_foo_weak = weak hidden global<br>
>  define weak void @foo_weak() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__llvm_profile_name_foo_weak, i32 0, i32 0), i64 0, i32 1, i32 0)<br>
>    ret void<br>
>  }<br>
><br>
>  ; COMMON: @"__llvm_profile_counters_linkage.ll:foo_internal" = internal global<br>
> -; COMMON: @"__llvm_profile_data_linkage.ll:foo_internal" = internal constant<br>
> +; COMMON: @"__llvm_profile_data_linkage.ll:foo_internal" = internal global<br>
>  define internal void @foo_internal() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @"__llvm_profile_name_linkage.ll:foo_internal", i32 0, i32 0), i64 0, i32 1, i32 0)<br>
>    ret void<br>
>  }<br>
><br>
>  ; COMMON: @__llvm_profile_counters_foo_inline = linkonce_odr hidden global<br>
> -; COMMON: @__llvm_profile_data_foo_inline = linkonce_odr hidden constant<br>
> +; COMMON: @__llvm_profile_data_foo_inline = linkonce_odr hidden global<br>
>  define linkonce_odr void @foo_inline() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__llvm_profile_name_foo_inline, i32 0, i32 0), i64 0, i32 1, i32 0)<br>
>    ret void<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/InstrProfiling/platform.ll Wed Nov 18 12:14:55 2015<br>
> @@ -12,10 +12,11 @@<br>
>  ; MACHO: @__llvm_profile_counters_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8<br>
>  ; ELF: @__llvm_profile_counters_foo = hidden global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8<br>
><br>
> -; MACHO: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
> -; LINUX: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8<br>
> -; FREEBSD: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8<br>
> -; SOLARIS: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8<br>
> +; MACHO: @__llvm_profile_data_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
> +; LINUX: @__llvm_profile_data_foo = hidden {{.*}}, section "__llvm_prf_data", align 8<br>
> +; FREEBSD: @__llvm_profile_data_foo = hidden {{.*}}, section "__llvm_prf_data", align 8<br>
> +; SOLARIS: @__llvm_profile_data_foo = hidden {{.*}}, section "__llvm_prf_data", align 8<br>
> +<br>
>  define void @foo() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64 0, i32 1, i32 0)<br>
>    ret void<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll Wed Nov 18 12:14:55 2015<br>
> @@ -10,21 +10,21 @@ target triple = "x86_64-apple-macosx10.1<br>
>  ; CHECK: @baz_prof_name = hidden constant [3 x i8] c"baz", section "__DATA,__llvm_prf_names", align 1<br>
><br>
>  ; CHECK: @__llvm_profile_counters_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8<br>
> -; CHECK: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
> +; CHECK: @__llvm_profile_data_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
>  define void @foo() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64 0, i32 1, i32 0)<br>
>    ret void<br>
>  }<br>
><br>
>  ; CHECK: @__llvm_profile_counters_bar = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8<br>
> -; CHECK: @__llvm_profile_data_bar = hidden constant {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
> +; CHECK: @__llvm_profile_data_bar = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
>  define void @bar() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__llvm_profile_name_bar, i32 0, i32 0), i64 0, i32 1, i32 0)<br>
>    ret void<br>
>  }<br>
><br>
>  ; CHECK: @__llvm_profile_counters_baz = hidden global [3 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8<br>
> -; CHECK: @__llvm_profile_data_baz = hidden constant {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
> +; CHECK: @__llvm_profile_data_baz = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
>  define void @baz() {<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @baz_prof_name, i32 0, i32 0), i64 0, i32 3, i32 0)<br>
>    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @baz_prof_name, i32 0, i32 0), i64 0, i32 3, i32 1)<br>
><br>
> Modified: llvm/trunk/test/tools/llvm-profdata/Inputs/c-general.profraw<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/Inputs/c-general.profraw?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/Inputs/c-general.profraw?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> Binary files llvm/trunk/test/tools/llvm-profdata/Inputs/c-general.profraw (original) and llvm/trunk/test/tools/llvm-profdata/Inputs/c-general.profraw Wed Nov 18 12:14:55 2015 differ<br>
><br>
> Modified: llvm/trunk/test/tools/llvm-profdata/c-general.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/c-general.test?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/c-general.test?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/tools/llvm-profdata/c-general.test (original)<br>
> +++ llvm/trunk/test/tools/llvm-profdata/c-general.test Wed Nov 18 12:14:55 2015<br>
> @@ -6,7 +6,7 @@ REGENERATE: $ SRC=path/to/llvm<br>
>  REGENERATE: $ CFE=$SRC/tools/clang<br>
>  REGENERATE: $ TESTDIR=$SRC/test/tools/llvm-profdata<br>
>  REGENERATE: $ CFE_TESTDIR=$CFE/test/Profile<br>
> -REGENERATE: $ clang -o a.out -fprofile-instr-generate $CFE_TESTDIR/test/Profile/c-general.c<br>
> +REGENERATE: $ clang -o a.out -fprofile-instr-generate $CFE_TESTDIR/c-general.c<br>
>  REGENERATE: $ LLVM_PROFILE_FILE=$TESTDIR/Inputs/c-general.profraw ./a.out<br>
><br>
>  RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - | FileCheck %s -check-prefix=CHECK<br>
> @@ -14,11 +14,11 @@ RUN: llvm-profdata show %p/Inputs/c-gene<br>
><br>
>  SWITCHES-LABEL: Counters:<br>
>  SWITCHES-NEXT:   switches:<br>
> -SWITCHES-NEXT:     Hash: 0x0000000000000013<br>
> +SWITCHES-NEXT:     Hash: 0x2618e4f23f2e8daa<br>
>  SWITCHES-NEXT:     Counters: 19<br>
>  SWITCHES-NEXT:     Function count: 1<br>
>  SWITCHES-LABEL: Functions shown: 1<br>
><br>
> -CHECK-LABEL: Total functions: 11<br>
> +CHECK-LABEL: Total functions: 12<br>
>  CHECK-NEXT: Maximum function count: 1<br>
>  CHECK-NEXT: Maximum internal block count: 100<br>
><br>
> Modified: llvm/trunk/test/tools/llvm-profdata/raw-32-bits-be.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-32-bits-be.test?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-32-bits-be.test?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/tools/llvm-profdata/raw-32-bits-be.test (original)<br>
> +++ llvm/trunk/test/tools/llvm-profdata/raw-32-bits-be.test Wed Nov 18 12:14:55 2015<br>
> @@ -1,27 +1,36 @@<br>
>  RUN: printf '\377lprofR\201' > %t<br>
> -RUN: printf '\0\0\0\0\0\0\0\1' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\2' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\2' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\3' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\6' >> %t<br>
>  RUN: printf '\0\0\0\0\1\0\0\0' >> %t<br>
>  RUN: printf '\0\0\0\0\2\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\0\0\0\3' >> %t<br>
>  RUN: printf '\0\0\0\1' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\1' >> %t<br>
>  RUN: printf '\2\0\0\0' >> %t<br>
>  RUN: printf '\1\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\0\0\0\3' >> %t<br>
>  RUN: printf '\0\0\0\2' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\2' >> %t<br>
>  RUN: printf '\2\0\0\03' >> %t<br>
>  RUN: printf '\1\0\0\10' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\0\0\0\0\0\0\0\023' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\067' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\101' >> %t<br>
> -RUN: printf 'foobar' >> %t<br>
> +RUN: printf 'foobar\0\0' >> %t<br>
><br>
>  RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s<br>
><br>
><br>
> Modified: llvm/trunk/test/tools/llvm-profdata/raw-32-bits-le.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-32-bits-le.test?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-32-bits-le.test?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/tools/llvm-profdata/raw-32-bits-le.test (original)<br>
> +++ llvm/trunk/test/tools/llvm-profdata/raw-32-bits-le.test Wed Nov 18 12:14:55 2015<br>
> @@ -1,27 +1,36 @@<br>
>  RUN: printf '\201Rforpl\377' > %t<br>
> -RUN: printf '\1\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\2\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\2\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\3\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\6\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\0\0\0\1\0\0\0\0' >> %t<br>
>  RUN: printf '\0\0\0\2\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\3\0\0\0' >> %t<br>
>  RUN: printf '\1\0\0\0' >> %t<br>
>  RUN: printf '\1\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\0\0\0\2' >> %t<br>
>  RUN: printf '\0\0\0\1' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\3\0\0\0' >> %t<br>
>  RUN: printf '\2\0\0\0' >> %t<br>
>  RUN: printf '\02\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\03\0\0\2' >> %t<br>
>  RUN: printf '\10\0\0\1' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\023\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\067\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\101\0\0\0\0\0\0\0' >> %t<br>
> -RUN: printf 'foobar' >> %t<br>
> +RUN: printf 'foobar\0\0' >> %t<br>
><br>
>  RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s<br>
><br>
><br>
> Modified: llvm/trunk/test/tools/llvm-profdata/raw-64-bits-be.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-64-bits-be.test?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-64-bits-be.test?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/tools/llvm-profdata/raw-64-bits-be.test (original)<br>
> +++ llvm/trunk/test/tools/llvm-profdata/raw-64-bits-be.test Wed Nov 18 12:14:55 2015<br>
> @@ -1,27 +1,36 @@<br>
>  RUN: printf '\377lprofr\201' > %t<br>
> -RUN: printf '\0\0\0\0\0\0\0\1' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\2' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\2' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\3' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\6' >> %t<br>
>  RUN: printf '\0\0\0\1\0\4\0\0' >> %t<br>
>  RUN: printf '\0\0\0\2\0\4\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\0\0\0\3' >> %t<br>
>  RUN: printf '\0\0\0\1' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\1' >> %t<br>
>  RUN: printf '\0\0\0\2\0\4\0\0' >> %t<br>
>  RUN: printf '\0\0\0\1\0\4\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\0\0\0\3' >> %t<br>
>  RUN: printf '\0\0\0\2' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\02' >> %t<br>
>  RUN: printf '\0\0\0\2\0\4\0\03' >> %t<br>
>  RUN: printf '\0\0\0\1\0\4\0\10' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\0\0\0\0\0\0\0\023' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\067' >> %t<br>
>  RUN: printf '\0\0\0\0\0\0\0\101' >> %t<br>
> -RUN: printf 'foobar' >> %t<br>
> +RUN: printf 'foobar\0\0' >> %t<br>
><br>
>  RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s<br>
><br>
><br>
> Modified: llvm/trunk/test/tools/llvm-profdata/raw-64-bits-le.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-64-bits-le.test?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-64-bits-le.test?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/tools/llvm-profdata/raw-64-bits-le.test (original)<br>
> +++ llvm/trunk/test/tools/llvm-profdata/raw-64-bits-le.test Wed Nov 18 12:14:55 2015<br>
> @@ -1,27 +1,36 @@<br>
>  RUN: printf '\201rforpl\377' > %t<br>
> -RUN: printf '\1\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\2\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\2\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\3\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\6\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\0\0\4\0\1\0\0\0' >> %t<br>
>  RUN: printf '\0\0\4\0\2\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\3\0\0\0' >> %t<br>
>  RUN: printf '\1\0\0\0' >> %t<br>
>  RUN: printf '\1\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\0\0\4\0\2\0\0\0' >> %t<br>
>  RUN: printf '\0\0\4\0\1\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\03\0\0\0' >> %t<br>
>  RUN: printf '\02\0\0\0' >> %t<br>
>  RUN: printf '\02\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\03\0\4\0\2\0\0\0' >> %t<br>
>  RUN: printf '\10\0\4\0\1\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t<br>
><br>
>  RUN: printf '\023\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\067\0\0\0\0\0\0\0' >> %t<br>
>  RUN: printf '\101\0\0\0\0\0\0\0' >> %t<br>
> -RUN: printf 'foobar' >> %t<br>
> +RUN: printf 'foobar\0\0' >> %t<br>
><br>
>  RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s<br>
><br>
><br>
> Modified: llvm/trunk/test/tools/llvm-profdata/raw-two-profiles.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-two-profiles.test?rev=253484&r1=253483&r2=253484&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/raw-two-profiles.test?rev=253484&r1=253483&r2=253484&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/tools/llvm-profdata/raw-two-profiles.test (original)<br>
> +++ llvm/trunk/test/tools/llvm-profdata/raw-two-profiles.test Wed Nov 18 12:14:55 2015<br>
> @@ -1,48 +1,51 @@<br>
>  RUN: printf '\201rforpl\377' > %t-foo.profraw<br>
> -RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
> +RUN: printf '\2\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\3\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
><br>
>  RUN: printf '\3\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\1\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw<br>
>  RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
><br>
>  RUN: printf '\023\0\0\0\0\0\0\0' >> %t-foo.profraw<br>
> -RUN: printf 'foo' >> %t-foo.profraw<br>
> +RUN: printf 'foo\0\0\0\0\0' >> %t-foo.profraw<br>
><br>
>  RUN: printf '\201rforpl\377' > %t-bar.profraw<br>
> -RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
> +RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\3\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
><br>
>  RUN: printf '\3\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\2\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
> +RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
><br>
>  RUN: printf '\067\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
>  RUN: printf '\101\0\0\0\0\0\0\0' >> %t-bar.profraw<br>
> -RUN: printf 'bar' >> %t-bar.profraw<br>
> -<br>
> -Versions of the profiles that are padded to eight byte alignment.<br>
> -RUN: cat %t-foo.profraw > %t-foo-padded.profraw<br>
> -RUN: printf '\0\0\0\0\0' >> %t-foo-padded.profraw<br>
> -RUN: cat %t-bar.profraw > %t-bar-padded.profraw<br>
> -RUN: printf '\0\0\0\0\0' >> %t-bar-padded.profraw<br>
> -<br>
> -RUN: cat %t-foo-padded.profraw %t-bar.profraw > %t-pad-between.profraw<br>
> -RUN: cat %t-foo-padded.profraw %t-bar-padded.profraw > %t-pad.profraw<br>
> +RUN: printf 'bar\0\0\0\0\0' >> %t-bar.profraw<br>
><br>
> -RUN: llvm-profdata show %t-pad-between.profraw -all-functions -counts | FileCheck %s<br>
> +RUN: cat %t-foo.profraw %t-bar.profraw > %t-pad.profraw<br>
>  RUN: llvm-profdata show %t-pad.profraw -all-functions -counts | FileCheck %s<br>
><br>
>  CHECK: Counters:<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>