Skip to content
  1. May 16, 2013
  2. May 15, 2013
    • Bill Wendling's avatar
      Use proper syntax. · 598123ed
      Bill Wendling authored
      llvm-svn: 181930
      598123ed
    • Hal Finkel's avatar
      Implement PPC counter loops as a late IR-level pass · 25c1992b
      Hal Finkel authored
      The old PPCCTRLoops pass, like the Hexagon pass version from which it was
      derived, could only handle some simple loops in canonical form. We cannot
      directly adapt the new Hexagon hardware loops pass, however, because the
      Hexagon pass contains a fundamental assumption that non-constant-trip-count
      loops will contain a guard, and this is not always true (the result being that
      incorrect negative counts can be generated). With this commit, we replace the
      pass with a late IR-level pass which makes use of SE to calculate the
      backedge-taken counts and safely generate the loop-count expressions (including
      any necessary max() parts). This IR level pass inserts custom intrinsics that
      are lowered into the desired decrement-and-branch instructions.
      
      The most fragile part of this new implementation is that interfering uses of
      the counter register must be detected on the IR level (and, on PPC, this also
      includes any indirect branches in addition to function calls). Also, to make
      all of this work, we need a variant of the mtctr instruction that is marked
      as having side effects. Without this, machine-code level CSE, DCE, etc.
      illegally transform the resulting code. Hopefully, this can be improved
      in the future.
      
      This new pass is smaller than the original (and much smaller than the new
      Hexagon hardware loops pass), and can handle many additional cases correctly.
      In addition, the preheader-creation code has been copied from LoopSimplify, and
      after we decide on where it belongs, this code will be refactored so that it
      can be explicitly shared (making this implementation even smaller).
      
      The new test-case files ctrloop-{le,lt,ne}.ll have been adapted from tests for
      the new Hexagon pass. There are a few classes of loops that this pass does not
      transform (noted by FIXMEs in the files), but these deficiencies can be
      addressed within the SE infrastructure (thus helping many other passes as well).
      
      llvm-svn: 181927
      25c1992b
    • Hal Finkel's avatar
      Fix legalization of SETCC with promoted integer intrinsics · 1f6a7f53
      Hal Finkel authored
      If the input operands to SETCC are promoted, we need to make sure that we
      either use the promoted form of both operands (or neither); a mixture is not
      allowed. This can happen, for example, if a target has a custom promoted
      i1-returning intrinsic (where i1 is not a legal type). In this case, we need to
      use the promoted form of both operands.
      
      This change only augments the behavior of the existing logic in the case where
      the input types (which may or may not have already been legalized) disagree,
      and should not affect existing target code because this case would otherwise
      cause an assert in the SETCC operand promotion code.
      
      This will be covered by (essentially all of the) tests for the new PPCCTRLoops
      infrastructure.
      
      llvm-svn: 181926
      1f6a7f53
Loading