Skip to content
  1. Jan 29, 2019
    • Bjorn Pettersson's avatar
      [IPCP] Don't crash due to arg count/type mismatch between caller/callee · d014d576
      Bjorn Pettersson authored
      Summary:
      This patch avoids an assert in IPConstantPropagation when
      there is a argument count/type mismatch between the caller and
      the callee.
      
      While this is actually UB on C-level (clang emits a warning),
      the IR verifier seems to accept it. I'm not sure what other
      frontends/languages might think about this, so simply bailing out
      to avoid hitting an assert (in CallSiteBase<>::getArgOperand or
      Value::doRAUW) seems like a simple solution.
      
      The problem is exposed by the fact that AbstractCallSites will look
      through a bitcast at the callee position of a call/invoke.
      
      Reviewers: jdoerfert, reames, efriedma
      
      Reviewed By: jdoerfert, efriedma
      
      Subscribers: eli.friedman, efriedma, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D57052
      
      llvm-svn: 352469
      d014d576
  2. Jan 19, 2019
    • Chandler Carruth's avatar
      Update the file headers across all of the LLVM projects in the monorepo · 2946cd70
      Chandler Carruth authored
      to reflect the new license.
      
      We understand that people may be surprised that we're moving the header
      entirely to discuss the new license. We checked this carefully with the
      Foundation's lawyer and we believe this is the correct approach.
      
      Essentially, all code in the project is now made available by the LLVM
      project under our new license, so you will see that the license headers
      include that license only. Some of our contributors have contributed
      code under our old license, and accordingly, we have retained a copy of
      our old license notice in the top-level files in each project and
      repository.
      
      llvm-svn: 351636
      2946cd70
    • Johannes Doerfert's avatar
      Enable IPConstantPropagation to work with abstract call sites · 36872b5d
      Johannes Doerfert authored
      This modification of the currently unused inter-procedural constant
      propagation pass (IPConstantPropagation) shows how abstract call sites
      enable optimization of callback calls alongside direct and indirect
      calls. Through minimal changes, mostly dealing with the partial mapping
      of callbacks, inter-procedural constant propagation was enabled for
      callbacks, e.g., OpenMP runtime calls or pthreads_create.
      
      Differential Revision: https://reviews.llvm.org/D56447
      
      llvm-svn: 351628
      36872b5d
  3. Jul 30, 2018
  4. Jun 06, 2017
    • Chandler Carruth's avatar
      Sort the remaining #include lines in include/... and lib/.... · 6bda14b3
      Chandler Carruth authored
      I did this a long time ago with a janky python script, but now
      clang-format has built-in support for this. I fed clang-format every
      line with a #include and let it re-sort things according to the precise
      LLVM rules for include ordering baked into clang-format these days.
      
      I've reverted a number of files where the results of sorting includes
      isn't healthy. Either places where we have legacy code relying on
      particular include ordering (where possible, I'll fix these separately)
      or where we have particular formatting around #include lines that
      I didn't want to disturb in this patch.
      
      This patch is *entirely* mechanical. If you get merge conflicts or
      anything, just ignore the changes in this patch and run clang-format
      over your #include lines in the files.
      
      Sorry for any noise here, but it is important to keep these things
      stable. I was seeing an increasing number of patches with irrelevant
      re-ordering of #include lines because clang-format was used. This patch
      at least isolates that churn, makes it easy to skip when resolving
      conflicts, and gets us to a clean baseline (again).
      
      llvm-svn: 304787
      6bda14b3
  5. Feb 04, 2017
  6. Jun 26, 2016
  7. May 03, 2016
  8. Apr 23, 2016
  9. Apr 22, 2016
  10. 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
  11. 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
  12. Jun 23, 2015
  13. Jun 19, 2015
  14. Apr 25, 2014
  15. 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
  16. 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
  17. Mar 05, 2014
  18. Mar 04, 2014
  19. Jan 28, 2014
  20. 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
  21. 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
  22. 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
  23. Jul 18, 2011
  24. Apr 04, 2011
  25. 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
  26. Oct 08, 2010
  27. Aug 06, 2010
  28. Jul 29, 2010
  29. Jul 22, 2010
  30. Jul 12, 2010
  31. Nov 23, 2009
  32. Nov 01, 2009
  33. Oct 25, 2009
  34. Sep 24, 2009
  35. Aug 13, 2009
Loading