Skip to content
  1. May 03, 2016
  2. Apr 23, 2016
  3. Apr 22, 2016
  4. 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
  5. 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
  6. Jun 23, 2015
  7. Jun 19, 2015
  8. Apr 25, 2014
  9. Apr 22, 2014
    • Chandler Carruth's avatar
      [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE · 964daaaf
      Chandler Carruth authored
      definition below all of the header #include lines, lib/Transforms/...
      edition.
      
      This one is tricky for two reasons. We again have a couple of passes
      that define something else before the includes as well. I've sunk their
      name macros with the DEBUG_TYPE.
      
      Also, InstCombine contains headers that need DEBUG_TYPE, so now those
      headers #define and #undef DEBUG_TYPE around their code, leaving them
      well formed modular headers. Fixing these headers was a large motivation
      for all of these changes, as "leaky" macros of this form are hard on the
      modules implementation.
      
      llvm-svn: 206844
      964daaaf
  10. Mar 09, 2014
    • Chandler Carruth's avatar
      [C++11] Add range based accessors for the Use-Def chain of a Value. · cdf47884
      Chandler Carruth authored
      This requires a number of steps.
      1) Move value_use_iterator into the Value class as an implementation
         detail
      2) Change it to actually be a *Use* iterator rather than a *User*
         iterator.
      3) Add an adaptor which is a User iterator that always looks through the
         Use to the User.
      4) Wrap these in Value::use_iterator and Value::user_iterator typedefs.
      5) Add the range adaptors as Value::uses() and Value::users().
      6) Update *all* of the callers to correctly distinguish between whether
         they wanted a use_iterator (and to explicitly dig out the User when
         needed), or a user_iterator which makes the Use itself totally
         opaque.
      
      Because #6 requires churning essentially everything that walked the
      Use-Def chains, I went ahead and added all of the range adaptors and
      switched them to range-based loops where appropriate. Also because the
      renaming requires at least churning every line of code, it didn't make
      any sense to split these up into multiple commits -- all of which would
      touch all of the same lies of code.
      
      The result is still not quite optimal. The Value::use_iterator is a nice
      regular iterator, but Value::user_iterator is an iterator over User*s
      rather than over the User objects themselves. As a consequence, it fits
      a bit awkwardly into the range-based world and it has the weird
      extra-dereferencing 'operator->' that so many of our iterators have.
      I think this could be fixed by providing something which transforms
      a range of T&s into a range of T*s, but that *can* be separated into
      another patch, and it isn't yet 100% clear whether this is the right
      move.
      
      However, this change gets us most of the benefit and cleans up
      a substantial amount of code around Use and User. =]
      
      llvm-svn: 203364
      cdf47884
  11. Mar 05, 2014
  12. Mar 04, 2014
  13. Jan 28, 2014
  14. Dec 05, 2013
    • Alp Toker's avatar
      Correct word hyphenations · f907b891
      Alp Toker authored
      This patch tries to avoid unrelated changes other than fixing a few
      hyphen-related ambiguities and contractions in nearby lines.
      
      llvm-svn: 196471
      f907b891
  15. Jan 02, 2013
    • Chandler Carruth's avatar
      Move all of the header files which are involved in modelling the LLVM IR · 9fb823bb
      Chandler Carruth authored
      into their new header subdirectory: include/llvm/IR. This matches the
      directory structure of lib, and begins to correct a long standing point
      of file layout clutter in LLVM.
      
      There are still more header files to move here, but I wanted to handle
      them in separate commits to make tracking what files make sense at each
      layer easier.
      
      The only really questionable files here are the target intrinsic
      tablegen files. But that's a battle I'd rather not fight today.
      
      I've updated both CMake and Makefile build systems (I think, and my
      tests think, but I may have missed something).
      
      I've also re-sorted the includes throughout the project. I'll be
      committing updates to Clang, DragonEgg, and Polly momentarily.
      
      llvm-svn: 171366
      9fb823bb
  16. Dec 03, 2012
    • Chandler Carruth's avatar
      Use the new script to sort the includes of every file under lib. · ed0881b2
      Chandler Carruth authored
      Sooooo many of these had incorrect or strange main module includes.
      I have manually inspected all of these, and fixed the main module
      include to be the nearest plausible thing I could find. If you own or
      care about any of these source files, I encourage you to take some time
      and check that these edits were sensible. I can't have broken anything
      (I strictly added headers, and reordered them, never removed), but they
      may not be the headers you'd really like to identify as containing the
      API being implemented.
      
      Many forward declarations and missing includes were added to a header
      files to allow them to parse cleanly when included first. The main
      module rule does in fact have its merits. =]
      
      llvm-svn: 169131
      ed0881b2
  17. Jul 18, 2011
  18. Apr 04, 2011
  19. Oct 19, 2010
    • Owen Anderson's avatar
      Get rid of static constructors for pass registration. Instead, every pass... · 6c18d1aa
      Owen Anderson authored
      Get rid of static constructors for pass registration.  Instead, every pass exposes an initializeMyPassFunction(), which
      must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
      the pass's dependencies.
      
      Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
      CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
      before parsing commandline arguments.
      
      I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
      with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
      registration/creation, please send the testcase to me directly.
      
      llvm-svn: 116820
      6c18d1aa
  20. Oct 08, 2010
  21. Aug 06, 2010
  22. Jul 29, 2010
  23. Jul 22, 2010
  24. Jul 12, 2010
  25. Nov 23, 2009
  26. Nov 01, 2009
  27. Oct 25, 2009
  28. Sep 24, 2009
  29. Aug 13, 2009
  30. Jul 31, 2009
  31. Jul 22, 2009
  32. Jul 16, 2009
  33. Jul 07, 2009
  34. Jul 06, 2009
  35. Jun 06, 2009
  36. Jan 22, 2009
Loading