Skip to content
  1. Feb 05, 2012
  2. Feb 01, 2012
    • Stepan Dyatkovskiy's avatar
      SwitchInst refactoring. · 513aaa56
      Stepan Dyatkovskiy authored
      The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.
      
      What was done:
      
      1. Changed semantics of index inside the getCaseValue method:
      getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
      2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
      3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
      4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
      4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
      4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.
      
      Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.
      llvm-svn: 149481
      513aaa56
  3. Jan 31, 2012
  4. Jan 30, 2012
  5. Dec 01, 2011
  6. Oct 15, 2011
  7. Oct 14, 2011
  8. Oct 07, 2011
    • Duncan Sands's avatar
      Teach GVN to also propagate switch cases. For example, in this code · c52af464
      Duncan Sands authored
        switch (n) {
          case 27:
            do_something(x);
          ...
        }
      the call do_something(x) will be replaced with do_something(27).  In
      gcc-as-one-big-file this results in the removal of about 500 lines of
      bitcode (about 0.02%), so has about 1/10 of the effect of propagating
      branch conditions.
      
      llvm-svn: 141360
      c52af464
  9. Oct 05, 2011
    • Duncan Sands's avatar
      GVN does simple propagation of conditions: when it sees a conditional · f4f47ccd
      Duncan Sands authored
      branch "br i1 %x, label %if_true, label %if_false" then it replaces
      "%x" with "true" in places only reachable via the %if_true arm, and
      with "false" in places only reachable via the %if_false arm.  Except
      that actually it doesn't: if value numbering shows that %y is equal
      to %x then, yes, %y will be turned into true/false in this way, but
      any occurrences of %x itself are not transformed.  Fix this.  What's
      more, it's often the case that %x is an equality comparison such as
      "%x = icmp eq %A, 0", in which case every occurrence of %A that is
      only reachable via the %if_true arm can be replaced with 0.  Implement
      this and a few other variations on this theme.  This reduces the number
      of lines of LLVM IR in "GCC as one big file" by 0.2%.  It has a bigger
      impact on Ada code, typically reducing the number of lines of bitcode
      by around 0.4% by removing repeated compiler generated checks.  Passes
      the LLVM nightly testsuite and the Ada ACATS testsuite.
      
      llvm-svn: 141177
      f4f47ccd
    • Duncan Sands's avatar
      Generalize GVN's conditional propagation logic slightly: · e90dd058
      Duncan Sands authored
      it's OK for the false/true destination to have multiple
      predecessors as long as the extra ones are dominated by
      the branch destination.
      
      llvm-svn: 141176
      e90dd058
  10. Sep 27, 2011
  11. Sep 02, 2011
  12. Aug 18, 2011
  13. Aug 17, 2011
    • Bill Wendling's avatar
      Disable PRE for landing pads. · 8bbcbede
      Bill Wendling authored
      PRE needs the landing pads to have their critical edges split. Doing this for a
      landing pad is non-trivial. Abandon the attempt to perform PRE when we come
      across a landing pad. (Reviewed by Owen!)
      
      llvm-svn: 137876
      8bbcbede
  14. Jul 21, 2011
  15. Jul 18, 2011
  16. Jul 09, 2011
  17. Jul 08, 2011
  18. Jun 20, 2011
    • Jay Foad's avatar
      Make better use of the PHINode API. · 372ad64b
      Jay Foad authored
      Change various bits of code to make better use of the existing PHINode
      API, to insulate them from forthcoming changes in how PHINodes store
      their operands.
      
      llvm-svn: 133434
      372ad64b
  19. Jun 15, 2011
  20. May 22, 2011
  21. May 17, 2011
  22. May 05, 2011
  23. Apr 28, 2011
  24. Apr 26, 2011
    • Chris Lattner's avatar
      Improve the bail-out predicate to really only kick in when phi · eb045f9c
      Chris Lattner authored
      translation fails.  We were bailing out in some cases that would
      cause us to miss GVN'ing some non-local cases away.
      
      llvm-svn: 130206
      eb045f9c
    • Chris Lattner's avatar
      Enhance MemDep: When alias analysis returns a partial alias result, · 6f83d06f
      Chris Lattner authored
      return it as a clobber.  This allows GVN to do smart things.
      
      Enhance GVN to be smart about the case when a small load is clobbered
      by a larger overlapping load.  In this case, forward the value.  This
      allows us to compile stuff like this:
      
      int test(void *P) {
        int tmp = *(unsigned int*)P;
        return tmp+*((unsigned char*)P+1);
      }
      
      into:
      
      _test:                                  ## @test
      	movl	(%rdi), %ecx
      	movzbl	%ch, %eax
      	addl	%ecx, %eax
      	ret
      
      which has one load.  We already handled the case where the smaller
      load was from a must-aliased base pointer.
      
      llvm-svn: 130180
      6f83d06f
  25. Mar 30, 2011
  26. Jan 24, 2011
    • Dan Gohman's avatar
      Give GetUnderlyingObject a TargetData, to keep it in sync · 0f124e19
      Dan Gohman authored
      with BasicAA's DecomposeGEPExpression, which recently began
      using a TargetData. This fixes PR8968, though the testcase
      is awkward to reduce.
      
      Also, update several off GetUnderlyingObject's users
      which happen to have a TargetData handy to pass it in.
      
      llvm-svn: 124134
      0f124e19
  27. Jan 11, 2011
Loading