Skip to content
  1. Apr 22, 2016
  2. Apr 21, 2016
    • Andrew Kaylor's avatar
      Initial implementation of optimization bisect support. · f0f27929
      Andrew Kaylor authored
      This patch implements a optimization bisect feature, which will allow optimizations to be selectively disabled at compile time in order to track down test failures that are caused by incorrect optimizations.
      
      The bisection is enabled using a new command line option (-opt-bisect-limit).  Individual passes that may be skipped call the OptBisect object (via an LLVMContext) to see if they should be skipped based on the bisect limit.  A finer level of control (disabling individual transformations) can be managed through an addition OptBisect method, but this is not yet used.
      
      The skip checking in this implementation is based on (and replaces) the skipOptnoneFunction check.  Where that check was being called, a new call has been inserted in its place which checks the bisect limit and the optnone attribute.  A new function call has been added for module and SCC passes that behaves in a similar way.
      
      Differential Revision: http://reviews.llvm.org/D19172
      
      llvm-svn: 267022
      f0f27929
    • Mehdi Amini's avatar
      ThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing · bda3c97c
      Mehdi Amini authored
      Summary:
      The function importer already decided what symbols need to be pulled
      in. Also these magically added ones will not be in the export list
      for the source module, which can confuse the internalizer for
      instance.
      
      Reviewers: tejohnson, rafael
      
      Subscribers: joker.eph, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D19096
      
      From: Mehdi Amini <mehdi.amini@apple.com>
      llvm-svn: 266948
      bda3c97c
    • Dehao Chen's avatar
      Refine instruction weight annotation algorithm for sample profiler. · a8bae823
      Dehao Chen authored
      Summary:
      This patch refined the instruction weight anootation algorithm:
      1. Do not use dbg_value intrinsics for annotation.
      2. Annotate cold calls if the call is inlined in profile, but not inlined before preparation. This indicates that the annotation preparation step found no sample for the inlined callsite, thus the call should be very cold.
      
      Reviewers: dnovillo, davidxl
      
      Subscribers: mgrang, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D19286
      
      llvm-svn: 266936
      a8bae823
  3. Apr 20, 2016
  4. Apr 19, 2016
  5. Apr 18, 2016
  6. Apr 16, 2016
  7. Apr 15, 2016
    • Adrian Prantl's avatar
      [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. · 75819aed
      Adrian Prantl authored
      Currently each Function points to a DISubprogram and DISubprogram has a
      scope field. For member functions the scope is a DICompositeType. DIScopes
      point to the DICompileUnit to facilitate type uniquing.
      
      Distinct DISubprograms (with isDefinition: true) are not part of the type
      hierarchy and cannot be uniqued. This change removes the subprograms
      list from DICompileUnit and instead adds a pointer to the owning compile
      unit to distinct DISubprograms. This would make it easy for ThinLTO to
      strip unneeded DISubprograms and their transitively referenced debug info.
      
      Motivation
      ----------
      
      Materializing DISubprograms is currently the most expensive operation when
      doing a ThinLTO build of clang.
      
      We want the DISubprogram to be stored in a separate Bitcode block (or the
      same block as the function body) so we can avoid having to expensively
      deserialize all DISubprograms together with the global metadata. If a
      function has been inlined into another subprogram we need to store a
      reference the block containing the inlined subprogram.
      
      Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script
      that updates LLVM IR testcases to the new format.
      
      http://reviews.llvm.org/D19034
      <rdar://problem/25256815>
      
      llvm-svn: 266446
      75819aed
    • Justin Lebar's avatar
      [PM] Add a SpeculativeExecution pass for targets with divergent branches. · cf63b64f
      Justin Lebar authored
      Summary:
      This IR pass is helpful for GPUs, and other targets with divergent
      branches.  It's a nop on targets without divergent branches.
      
      Reviewers: chandlerc
      
      Subscribers: llvm-commits, jingyue, rnk, joker.eph, tra
      
      Differential Revision: http://reviews.llvm.org/D18626
      
      llvm-svn: 266399
      cf63b64f
  8. Apr 13, 2016
  9. Apr 12, 2016
    • Mehdi Amini's avatar
      Add a pass to name anonymous/nameless function · d5faa267
      Mehdi Amini authored
      Summary:
      For correct handling of alias to nameless
      function, we need to be able to refer them through a GUID in the summary.
      Here we name them using a hash of the non-private global names in the module.
      
      Reviewers: tejohnson
      
      Subscribers: joker.eph, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D18883
      
      From: Mehdi Amini <mehdi.amini@apple.com>
      llvm-svn: 266132
      d5faa267
    • JF Bastien's avatar
      NFC: MergeFunctions return early · f90029bb
      JF Bastien authored
      Same effect, easier to read.
      
      llvm-svn: 266128
      f90029bb
    • Teresa Johnson's avatar
      [ThinLTO] Only compute imports for current module in FunctionImport pass · c86af334
      Teresa Johnson authored
      Summary:
      The function import pass was computing all the imports for all the
      modules in the index, and only using the imports for the current module.
      Change this to instead compute only for the given module. This means
      that the exports list can't be populated, but they weren't being used
      anyway.
      
      Longer term, the linker can collect all the imports and export lists
      and serialize them out for consumption by the distributed backend
      processes which use this pass.
      
      Reviewers: joker.eph
      
      Subscribers: llvm-commits, joker.eph
      
      Differential Revision: http://reviews.llvm.org/D18945
      
      llvm-svn: 266125
      c86af334
    • JF Bastien's avatar
      NFC: MergeFunctions update more comments · 1bb32ac4
      JF Bastien authored
      They are wordy. Some words were wrong.
      
      llvm-svn: 266124
      1bb32ac4
    • JF Bastien's avatar
      MergeFunctions: test alloca better · 4f43cfd2
      JF Bastien authored
      r237193 fix handling of alloca size / align in MergeFunctions, but only tested one and didn't follow FunctionComparator::cmpOperations's usual comparison pattern. It also didn't update Instruction.cpp:haveSameSpecialState which I'll do separately.
      
      llvm-svn: 266022
      4f43cfd2
  10. Apr 11, 2016
    • Teresa Johnson's avatar
      [ThinLTO] Move summary computation from BitcodeWriter to new pass · 2d5487cf
      Teresa Johnson authored
      Summary:
      This is the first step in also serializing the index out to LLVM
      assembly.
      
      The per-module summary written to bitcode is moved out of the bitcode
      writer and to a new analysis pass (ModuleSummaryIndexWrapperPass).
      The pass itself uses a new builder class to compute index, and the
      builder class is used directly in places where we don't have a pass
      manager (e.g. llvm-as).
      
      Because we are computing summaries outside of the bitcode writer, we no
      longer can use value ids created by the bitcode writer's
      ValueEnumerator. This required changing the reference graph edge type
      to use a new ValueInfo class holding a union between a GUID (combined
      index) and Value* (permodule index). The Value* are converted to the
      appropriate value ID during bitcode writing.
      
      Also, this enables removal of the BitWriter library's dependence on the
      Analysis library that was previously required for the summary computation.
      
      Reviewers: joker.eph
      
      Subscribers: joker.eph, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D18763
      
      llvm-svn: 265941
      2d5487cf
  11. Apr 10, 2016
  12. Apr 08, 2016
    • Sanjoy Das's avatar
      Don't IPO over functions that can be de-refined · 5ce32728
      Sanjoy Das authored
      Summary:
      Fixes PR26774.
      
      If you're aware of the issue, feel free to skip the "Motivation"
      section and jump directly to "This patch".
      
      Motivation:
      
      I define "refinement" as discarding behaviors from a program that the
      optimizer has license to discard.  So transforming:
      
      ```
      void f(unsigned x) {
        unsigned t = 5 / x;
        (void)t;
      }
      ```
      
      to
      
      ```
      void f(unsigned x) { }
      ```
      
      is refinement, since the behavior went from "if x == 0 then undefined
      else nothing" to "nothing" (the optimizer has license to discard
      undefined behavior).
      
      Refinement is a fundamental aspect of many mid-level optimizations done
      by LLVM.  For instance, transforming `x == (x + 1)` to `false` also
      involves refinement since the expression's value went from "if x is
      `undef` then { `true` or `false` } else { `false` }" to "`false`" (by
      definition, the optimizer has license to fold `undef` to any non-`undef`
      value).
      
      Unfortunately, refinement implies that the optimizer cannot assume
      that the implementation of a function it can see has all of the
      behavior an unoptimized or a differently optimized version of the same
      function can have.  This is a problem for functions with comdat
      linkage, where a function can be replaced by an unoptimized or a
      differently optimized version of the same source level function.
      
      For instance, FunctionAttrs cannot assume a comdat function is
      actually `readnone` even if it does not have any loads or stores in
      it; since there may have been loads and stores in the "original
      function" that were refined out in the currently visible variant, and
      at the link step the linker may in fact choose an implementation with
      a load or a store.  As an example, consider a function that does two
      atomic loads from the same memory location, and writes to memory only
      if the two values are not equal.  The optimizer is allowed to refine
      this function by first CSE'ing the two loads, and the folding the
      comparision to always report that the two values are equal.  Such a
      refined variant will look like it is `readonly`.  However, the
      unoptimized version of the function can still write to memory (since
      the two loads //can// result in different values), and selecting the
      unoptimized version at link time will retroactively invalidate
      transforms we may have done under the assumption that the function
      does not write to memory.
      
      Note: this is not just a problem with atomics or with linking
      differently optimized object files.  See PR26774 for more realistic
      examples that involved neither.
      
      This patch:
      
      This change introduces a new set of linkage types, predicated as
      `GlobalValue::mayBeDerefined` that returns true if the linkage type
      allows a function to be replaced by a differently optimized variant at
      link time.  It then changes a set of IPO passes to bail out if they see
      such a function.
      
      Reviewers: chandlerc, hfinkel, dexonsmith, joker.eph, rnk
      
      Subscribers: mcrosier, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D18634
      
      llvm-svn: 265762
      5ce32728
  13. Apr 06, 2016
    • JF Bastien's avatar
      NFC: make AtomicOrdering an enum class · 800f87a8
      JF Bastien authored
      Summary:
      In the context of http://wg21.link/lwg2445 C++ uses the concept of
      'stronger' ordering but doesn't define it properly. This should be fixed
      in C++17 barring a small question that's still open.
      
      The code currently plays fast and loose with the AtomicOrdering
      enum. Using an enum class is one step towards tightening things. I later
      also want to tighten related enums, such as clang's
      AtomicOrderingKind (which should be shared with LLVM as a 'C++ ABI'
      enum).
      
      This change touches a few lines of code which can be improved later, I'd
      like to keep it as NFC for now as it's already quite complex. I have
      related changes for clang.
      
      As a follow-up I'll add:
        bool operator<(AtomicOrdering, AtomicOrdering) = delete;
        bool operator>(AtomicOrdering, AtomicOrdering) = delete;
        bool operator<=(AtomicOrdering, AtomicOrdering) = delete;
        bool operator>=(AtomicOrdering, AtomicOrdering) = delete;
      This is separate so that clang and LLVM changes don't need to be in sync.
      
      Reviewers: jyknight, reames
      
      Subscribers: jyknight, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D18775
      
      llvm-svn: 265602
      800f87a8
  14. Apr 05, 2016
  15. Apr 04, 2016
  16. Apr 02, 2016
  17. Apr 01, 2016
Loading