Skip to content
  1. Sep 24, 2012
    • Chandler Carruth's avatar
      Address one of the original FIXMEs for the new SROA pass by implementing · 92924fd2
      Chandler Carruth authored
      integer promotion analogous to vector promotion. When there is an
      integer alloca being accessed both as its integer type and as a narrower
      integer type, promote the narrower access to "insert" and "extract" the
      smaller integer from the larger one, and make the integer alloca
      a candidate for promotion.
      
      In the new formulation, we don't care about target legal integer or use
      thresholds to control things. Instead, we only perform this promotion to
      an integer type which the frontend has already emitted a load or store
      for. This bounds the scope and prevents optimization passes from
      coalescing larger and larger entities into a single integer.
      
      llvm-svn: 164479
      92924fd2
  2. Sep 23, 2012
    • Chandler Carruth's avatar
      Switch to a signed representation for the dynamic offsets while walking · e7a1ba5e
      Chandler Carruth authored
      across the uses of the alloca. It's entirely possible for negative
      numbers to come up here, and in some rare cases simply doing the 2's
      complement arithmetic isn't the correct decision. Notably, we can't zext
      the index of the GEP. The definition of GEP is that these offsets are
      sign extended or truncated to the size of the pointer, and then wrapping
      2's complement arithmetic used.
      
      This patch fixes an issue that comes up with *no* input from the
      buildbots or bootstrap afaict. The only place where it manifested,
      disturbingly, is Clang's own regression test suite. A reduced and
      targeted collection of tests are added to cope with this. Note that I've
      tried to pin down the potential cases of overflow, but may have missed
      some cases. I've tried to add a few cases to test this, but its hard
      because LLVM has quite limited support for >64bit constructs.
      
      llvm-svn: 164475
      e7a1ba5e
  3. Sep 22, 2012
    • Chandler Carruth's avatar
      Fix a case where the new SROA pass failed to zap dead operands to · 225d4bdb
      Chandler Carruth authored
      selects with a constant condition. This resulted in the operands
      remaining live through the SROA rewriter. Most of the time, this just
      caused some dead allocas to persist and get zapped by later passes, but
      in one case found by Joerg, it caused a crash when we tried to *promote*
      the alloca despite it having this dead use. We already have the
      mechanisms in place to handle this, just wire select up to them.
      
      llvm-svn: 164427
      225d4bdb
  4. Sep 21, 2012
  5. Sep 19, 2012
  6. Sep 18, 2012
  7. Sep 17, 2012
  8. Sep 16, 2012
    • Chandler Carruth's avatar
      Refactor the SROA visitors for partitioning an alloca and building · 9712117a
      Chandler Carruth authored
      partition use lists a bit. No functionality changed.
      
      These visitors are actually visiting a tuple of a Use and an offset into
      the alloca. However, we use the InstVisitor to handle the dispatch over
      the users, and so the Use and Offset are stored in class member
      variables and set just before each call to visit(). This is fairly
      awkward and makes the functions a bit harder to read, but its the only
      real option we have until InstVisitor can be rewritten to use variadic
      templates.
      
      However, this pattern shouldn't be followed on the helper member
      functions where there is no interface constraint from the visitor. We
      already were passing the instruction as a normal parameter rather than
      use the Use to get at it, start passing the offset as well. This will
      become more important in subsequent patches as the offset will in some
      cases change while visiting a single instruction.
      
      llvm-svn: 164003
      9712117a
  9. Sep 15, 2012
    • Craig Topper's avatar
      Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments. · a60c0f11
      Craig Topper authored
      llvm-svn: 163974
      a60c0f11
    • Benjamin Kramer's avatar
      Disable new sroa now that all buildbots have tested it. · ed11e35e
      Benjamin Kramer authored
      What we have so far:
      - Some clang test failures (these were known already)
      
      - Perf results are mixed, some big regressions
        http://llvm.org/perf/db_default/v4/nts/3844
        http://llvm.org/perf/db_default/v4/nts/3845
      
        bullet suffers a lot. matmul is interesting: slower scalar code, faster with -vectorize.
      
      - Some dragonegg selfhost bots crash in SROA during selfhost now
        http://lab.llvm.org:8011/builders/dragonegg-x86_64-linux-gcc-4.6-self-host-checks/builds/1632
        http://lab.llvm.org:8011/builders/dragonegg-x86_64-linux-gcc-4.5-self-host/builds/1891
      
      llvm-svn: 163968
      ed11e35e
    • Chandler Carruth's avatar
      Port the SSAUpdater-based promotion logic from the old SROA pass to the · 70b44c5c
      Chandler Carruth authored
      new one, and add support for running the new pass in that mode and in
      that slot of the pass manager. With this the new pass can completely
      replace the old one within the pipeline.
      
      The strategy for enabling or disabling the SSAUpdater logic is to do it
      by making the requirement of the domtree analysis optional. By default,
      it is required and we get the standard mem2reg approach. This is usually
      the desired strategy when run in stand-alone situations. Within the
      CGSCC pass manager, we disable requiring of the domtree analysis and
      consequentially trigger fallback to the SSAUpdater promotion.
      
      In theory this would allow the pass to re-use a domtree if one happened
      to be available even when run in a mode that doesn't require it. In
      practice, it lets us have a single pass rather than two which was
      simpler for me to wrap my head around.
      
      There is a hidden flag to force the use of the SSAUpdater code path for
      the purpose of testing. The primary testing strategy is just to run the
      existing tests through that path. One notable difference is that it has
      custom code to handle lifetime markers, and one of the tests has been
      enhanced to exercise that code.
      
      This has survived a bootstrap and the test suite without serious
      correctness issues, however my run of the test suite produced *very*
      alarming performance numbers. I don't entirely understand or trust them
      though, so more investigation is on-going.
      
      To aid my understanding of the performance impact of the new SROA now
      that it runs throughout the optimization pipeline, I'm enabling it by
      default in this commit, and will disable it again once the LNT bots have
      picked up one iteration with it. I want to get those bots (which are
      much more stable) to evaluate the impact of the change before I jump to
      any conclusions.
      
      NOTE: Several Clang tests will fail because they run -O3 and check the
      result's order of output. They'll go back to passing once I disable it
      again.
      
      llvm-svn: 163965
      70b44c5c
    • Manman Ren's avatar
      PGO: preserve branch-weight metadata when simplifying two branches with a common · bfb9d435
      Manman Ren authored
      destination.
      
      Updated previous implementation to fix a case not covered:
      // PBI: br i1 %x, TrueDest, BB
      // BI:  br i1 %y, TrueDest, FalseDest
      The other case was handled correctly.
      // PBI: br i1 %x, BB, FalseDest
      // BI:  br i1 %y, TrueDest, FalseDest
      
      Also tried to use 64-bit arithmetic instead of APInt with scale to simplify the
      computation. Let me know if you have other opinions about this.
      
      llvm-svn: 163954
      bfb9d435
    • Bill Wendling's avatar
      Remove comment. · 8d26bc38
      Bill Wendling authored
      llvm-svn: 163945
      8d26bc38
  10. Sep 14, 2012
Loading