Skip to content
  1. Mar 03, 2014
  2. Mar 02, 2014
  3. Feb 28, 2014
    • Lang Hames's avatar
      Jumped the gun with r202551 and broke some bots that weren't yet C++11ified. · c083578a
      Lang Hames authored
      Reverting until the C++11 switch is complete.
      
      llvm-svn: 202554
      c083578a
    • Lang Hames's avatar
      New PBQP solver, and updates to the PBQP graph. · 525a2123
      Lang Hames authored
      The previous PBQP solver was very robust but consumed a lot of memory,
      performed a lot of redundant computation, and contained some unnecessarily tight
      coupling that prevented experimentation with novel solution techniques. This new
      solver is an attempt to address these shortcomings.
      
      Important/interesting changes:
      
      1) The domain-independent PBQP solver class, HeuristicSolverImpl, is gone.
      It is replaced by a register allocation specific solver, PBQP::RegAlloc::Solver
      (see RegAllocSolver.h).
      
      The optimal reduction rules and the backpropagation algorithm have been extracted
      into stand-alone functions (see ReductionRules.h), which can be used to build
      domain specific PBQP solvers. This provides many more opportunities for
      domain-specific knowledge to inform the PBQP solvers' decisions. In theory this
      should allow us to generate better solutions. In practice, we can at least test
      out ideas now.
      
      As a side benefit, I believe the new solver is more readable than the old one.
      
      2) The solver type is now a template parameter of the PBQP graph.
      
      This allows the graph to notify the solver of any modifications made (e.g. by
      domain independent rules) without the overhead of a virtual call. It also allows
      the solver to supply policy information to the graph (see below).
      
      3) Significantly reduced memory overhead.
      
      Memory management policy is now an explicit property of the PBQP graph (via
      the CostAllocator typedef on the graph's solver template argument). Because PBQP
      graphs for register allocation tend to contain many redundant instances of
      single values (E.g. the value representing an interference constraint between
      GPRs), the new RASolver class uses a uniquing scheme. This massively reduces
      memory consumption for large register allocation problems. For example, looking
      at the largest interference graph in each of the SPEC2006 benchmarks (the
      largest graph will always set the memory consumption high-water mark for PBQP),
      the average memory reduction for the PBQP costs was 400x. That's times, not
      percent. The highest was 1400x. Yikes. So - this is fixed.
      
      "PBQP: No longer feasting upon every last byte of your RAM".
      
      Minor details:
      
      - Fully C++11'd. Never copy-construct another vector/matrix!
      
      - Cute tricks with cost metadata: Metadata that is derived solely from cost
      matrices/vectors is attached directly to the cost instances themselves. That way
      if you unique the costs you never have to recompute the metadata. 400x less
      memory means 400x less cost metadata (re)computation.
      
      Special thanks to Arnaud de Grandmaison, who has been the source of much
      encouragement, and of many very useful test cases.
      
      This new solver forms the basis for future work, of which there's plenty to do.
      I will be adding TODO notes shortly.
      
      - Lang.
      
      llvm-svn: 202551
      525a2123
  4. Feb 24, 2014
    • Rafael Espindola's avatar
      Replace the F_Binary flag with a F_Text one. · 90c7f1cc
      Rafael Espindola authored
      After this I will set the default back to F_None. The advantage is that
      before this patch forgetting to set F_Binary would corrupt a file on windows.
      Forgetting to set F_Text produces one that cannot be read in notepad, which
      is a better failure mode :-)
      
      llvm-svn: 202052
      90c7f1cc
    • Rafael Espindola's avatar
      Don't make F_None the default. · 7dbcdd08
      Rafael Espindola authored
      This will make it easier to switch the default to being binary files.
      
      llvm-svn: 202042
      7dbcdd08
  5. Dec 14, 2013
    • Michael Gottesman's avatar
      [block-freq] Refactor LiveInterals::getSpillWeight to use the new... · 9f49d744
      Michael Gottesman authored
      [block-freq] Refactor LiveInterals::getSpillWeight to use the new MachineBlockFrequencyInfo methods.
      
      This is slightly more interesting than the previous batch of changes.
      Specifically:
      
      1. We refactor getSpillWeight to take a MachineBlockFrequencyInfo (MBFI)
      object. This enables us to completely encapsulate the actual manner we
      use the MachineBlockFrequencyInfo to get our spill weights. This yields
      cleaner code since one does not need to fetch the actual block frequency
      before getting the spill weight if all one wants it the spill weight. It
      also gives us access to entry frequency which we need for our
      computation.
      
      2. Instead of having getSpillWeight take a MachineBasicBlock (as one
      might think) to look up the block frequency via the MBFI object, we
      instead take in a MachineInstr object. The reason for this is that the
      method is supposed to return the spill weight for an instruction
      according to the comments around the function.
      
      llvm-svn: 197296
      9f49d744
  6. Nov 11, 2013
  7. Nov 10, 2013
    • Arnaud A. de Grandmaison's avatar
      CalculateSpillWeights does not need to be a pass · 760c1e0b
      Arnaud A. de Grandmaison authored
      Based on discussions with Lang Hames and Jakob Stoklund Olesen at the hacker's lab, and in the light of upcoming work on the PBQP register allocator, it was though that CalcSpillWeights does not need to be a pass. This change will enable to customize / tune the spill weight computation depending on the allocator.
      
      Update the documentation style while there.
      
      No functionnal change.
      
      llvm-svn: 194356
      760c1e0b
  8. Nov 09, 2013
    • Lang Hames's avatar
      Re-apply r194300 with fixes for warnings. · fb82630a
      Lang Hames authored
      llvm-svn: 194311
      fb82630a
    • Nick Lewycky's avatar
      Revert r194300 which broke the build. · 59886d00
      Nick Lewycky authored
      llvm-svn: 194308
      59886d00
    • Lang Hames's avatar
      Rewrite the PBQP graph data structure. · 1662b832
      Lang Hames authored
      The new graph structure replaces the node and edge linked lists with vectors.
      Free lists (well, free vectors) are used for fast insertion/deletion.
      
      The ultimate aim is to make PBQP graphs cheap to clone. The motivation is that
      the PBQP solver destructively consumes input graphs while computing a solution,
      forcing the graph to be fully reconstructed for each round of PBQP. This
      imposes a high cost on large functions, which often require several rounds of
      solving/spilling to find a final register allocation. If we can cheaply clone
      the PBQP graph and incrementally update it between rounds then hopefully we can
      reduce this cost. Further, once we begin pooling matrix/vector values (future
      work), we can cache some PBQP solver metadata and share it between cloned
      graphs, allowing the PBQP solver to re-use some of the computation done in
      earlier rounds.
      
      For now this is just a data structure update. The allocator and solver still
      use the graph the same way as before, fully reconstructing it between each
      round. I expect no material change from this update, although it may change
      the iteration order of the nodes, causing ties in the solver to break in
      different directions, and this could perturb the generated allocations
      (hopefully in a completely benign way).
      
      Thanks very much to Arnaud Allard de Grandmaison for encouraging me to get back
      to work on this, and for a lot of discussion and many useful PBQP test cases.
      
      llvm-svn: 194300
      1662b832
  9. Nov 08, 2013
  10. Aug 15, 2013
    • Mark Lacey's avatar
      Track new virtual registers by register number. · f9ea8854
      Mark Lacey authored
      Track new virtual registers by register number, rather than by the live
      interval created for them. This is the first step in separating the
      creation of new virtual registers and new live intervals.  Eventually
      live intervals will be created and populated on demand after the virtual
      registers have been created and used in instructions.
      
      llvm-svn: 188434
      f9ea8854
  11. Jul 01, 2013
  12. Jun 17, 2013
    • Benjamin Kramer's avatar
      Switch spill weights from a basic loop depth estimation to BlockFrequencyInfo. · e2a1d89e
      Benjamin Kramer authored
      The main advantages here are way better heuristics, taking into account not
      just loop depth but also __builtin_expect and other static heuristics and will
      eventually learn how to use profile info. Most of the work in this patch is
      pushing the MachineBlockFrequencyInfo analysis into the right places.
      
      This is good for a 5% speedup on zlib's deflate (x86_64), there were some very
      unfortunate spilling decisions in its hottest loop in longest_match(). Other
      benchmarks I tried were mostly neutral.
      
      This changes register allocation in subtle ways, update the tests for it.
      2012-02-20-MachineCPBug.ll was deleted as it's very fragile and the instruction
      it looked for was gone already (but the FileCheck pattern picked up unrelated
      stuff).
      
      llvm-svn: 184105
      e2a1d89e
  13. Apr 15, 2013
  14. Apr 12, 2013
  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 04, 2012
  17. 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
  18. Nov 28, 2012
  19. Nov 27, 2012
  20. Oct 29, 2012
  21. Oct 16, 2012
  22. Oct 15, 2012
  23. Oct 10, 2012
  24. Oct 04, 2012
  25. Sep 05, 2012
  26. Aug 22, 2012
  27. Jun 22, 2012
  28. Jun 21, 2012
  29. Jun 20, 2012
  30. Jun 09, 2012
    • Jakob Stoklund Olesen's avatar
      Also compute MBB live-in lists in the new rewriter pass. · be336295
      Jakob Stoklund Olesen authored
      This deduplicates some code from the optimizing register allocators, and
      it means that it is now possible to change the register allocators'
      solutions simply by editing the VirtRegMap between the register
      allocator pass and the rewriter.
      
      llvm-svn: 158249
      be336295
    • Jakob Stoklund Olesen's avatar
      Reintroduce VirtRegRewriter. · 1224312f
      Jakob Stoklund Olesen authored
      OK, not really. We don't want to reintroduce the old rewriter hacks.
      
      This patch extracts virtual register rewriting as a separate pass that
      runs after the register allocator. This is possible now that
      CodeGen/Passes.cpp can configure the full optimizing register allocator
      pipeline.
      
      The rewriter pass uses register assignments in VirtRegMap to rewrite
      virtual registers to physical registers, and it inserts kill flags based
      on live intervals.
      
      These finalization steps are the same for the optimizing register
      allocators: RABasic, RAGreedy, and PBQP.
      
      llvm-svn: 158244
      1224312f
Loading