Skip to content
  1. Oct 24, 2011
    • Chandler Carruth's avatar
      Sink an otherwise unused variable's initializer into the asserts that · 30b63c64
      Chandler Carruth authored
      used it. Fixes an unused variable warning from GCC on release builds.
      
      llvm-svn: 142799
      30b63c64
    • Benjamin Kramer's avatar
      Implement comparison operators for BranchProbability in a way that can't overflow INT64_MAX. · 812da491
      Benjamin Kramer authored
      Add a test case for the edge case that triggers this. Thanks to Chandler for bringing this to my attention.
      
      llvm-svn: 142794
      812da491
    • Chandler Carruth's avatar
      Remove return heuristics from the static branch probabilities, and · 7111f456
      Chandler Carruth authored
      introduce no-return or unreachable heuristics.
      
      The return heuristics from the Ball and Larus paper don't work well in
      practice as they pessimize early return paths. The only good hitrate
      return heuristics are those for:
       - NULL return
       - Constant return
       - negative integer return
      
      Only the last of these three can possibly require significant code for
      the returning block, and even the last is fairly rare and usually also
      a constant. As a consequence, even for the cold return paths, there is
      little code on that return path, and so little code density to be gained
      by sinking it. The places where sinking these blocks is valuable (inner
      loops) will already be weighted appropriately as the edge is a loop-exit
      branch.
      
      All of this aside, early returns are nearly as common as all three of
      these return categories, and should actually be predicted as taken!
      Rather than muddy the waters of the static predictions, just remain
      silent on returns and let the CFG itself dictate any layout or other
      issues.
      
      However, the return heuristic was flagging one very important case:
      unreachable. Unfortunately it still gave a 1/4 chance of the
      branch-to-unreachable occuring. It also didn't do a rigorous job of
      finding those blocks which post-dominate an unreachable block.
      
      This patch builds a more powerful analysis that should flag all branches
      to blocks known to then reach unreachable. It also has better worst-case
      runtime complexity by not looping through successors for each block. The
      previous code would perform an N^2 walk in the event of a single entry
      block branching to N successors with a switch where each successor falls
      through to the next and they finally fall through to a return.
      
      Test case added for noreturn heuristics. Also doxygen comments improved
      along the way.
      
      llvm-svn: 142793
      7111f456
    • NAKAMURA Takumi's avatar
      Revert "Test commit" · d1175cf7
      NAKAMURA Takumi authored
      llvm-svn: 142792
      d1175cf7
    • NAKAMURA Takumi's avatar
      Test commit · 6ff417a1
      NAKAMURA Takumi authored
      llvm-svn: 142791
      6ff417a1
    • Nick Lewycky's avatar
      Reapply r142781 with fix. Original message: · 9be7f277
      Nick Lewycky authored
        Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
        loop header when computing the trip count.
      
        With this, we now constant evaluate:
          struct ListNode { const struct ListNode *next; int i; };
          static const struct ListNode node1 = {0, 1};
          static const struct ListNode node2 = {&node1, 2};
          static const struct ListNode node3 = {&node2, 3};
          int test() {
            int sum = 0;
            for (const struct ListNode *n = &node3; n != 0; n = n->next)
              sum += n->i;
            return sum;
          }
      
      llvm-svn: 142790
      9be7f277
    • Chandler Carruth's avatar
      Doxygen-ify the comments on the public interface for BPI. Also, move the · f5394bcf
      Chandler Carruth authored
      two more subtle routines to the bottom and expand on their cautionary
      comments a bit. No functionality or actual interface change here.
      
      llvm-svn: 142789
      f5394bcf
    • Nick Lewycky's avatar
      PHI nodes not in the loop header aren't part of the loop iteration initial · 8e904dee
      Nick Lewycky authored
      state. Furthermore, they might not have two operands. This fixes the underlying
      issue behind the crashes introduced in r142781.
      
      llvm-svn: 142788
      8e904dee
    • Nick Lewycky's avatar
      A dead malloc, a free(NULL) and a free(undef) are all trivially dead · dd1d3df5
      Nick Lewycky authored
      instructions.
      
      This doesn't introduce any optimizations we weren't doing before (except
      potentially due to pass ordering issues), now passes will eliminate them sooner
      as part of their own cleanups.
      
      llvm-svn: 142787
      dd1d3df5
    • Nick Lewycky's avatar
      Speculatively revert r142781. Bots are showing · 9d28c26d
      Nick Lewycky authored
        Assertion `i_nocapture < OperandTraits<PHINode>::operands(this) && "getOperand() out of range!"' failed.
      coming out of indvars.
      
      llvm-svn: 142786
      9d28c26d
    • NAKAMURA Takumi's avatar
    • Chandler Carruth's avatar
      Simplify the design of BranchProbabilityInfo by collapsing it into · 7a0094a6
      Chandler Carruth authored
      a single class. Previously it was split between two classes, one
      internal and one external. The concern seemed to center around exposing
      the weights used, but those can remain confined to the implementation
      file.
      
      Having a single class to maintain the state and analyses in use will
      also simplify several of the enhancements I want to make to our static
      heuristics.
      
      llvm-svn: 142783
      7a0094a6
    • Nick Lewycky's avatar
      Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the · 1700007e
      Nick Lewycky authored
      loop header when computing the trip count.
      
      With this, we now constant evaluate:
        struct ListNode { const struct ListNode *next; int i; };
        static const struct ListNode node1 = {0, 1};
        static const struct ListNode node2 = {&node1, 2};
        static const struct ListNode node3 = {&node2, 3};
        int test() {
          int sum = 0;
          for (const struct ListNode *n = &node3; n != 0; n = n->next)
            sum += n->i;
          return sum;
        }
      
      llvm-svn: 142781
      1700007e
    • Chandler Carruth's avatar
      Tidy up a loop to be more idiomatic for LLVM's codebase, and remove some · 24cee10f
      Chandler Carruth authored
      extraneous whitespace. Trying to clean-up this pass as much as I can
      before I start making functional changes.
      
      llvm-svn: 142780
      24cee10f
    • Craig Topper's avatar
      Add X86 SARX, SHRX, and SHLX instructions. · b05d9e9b
      Craig Topper authored
      llvm-svn: 142779
      b05d9e9b
  2. Oct 23, 2011
  3. Oct 22, 2011
  4. Oct 21, 2011
Loading