Skip to content
  1. Nov 13, 2012
    • Meador Inge's avatar
      instcombine: Migrate math library call simplifications · 193e035b
      Meador Inge authored
      This patch migrates the math library call simplifications from the
      simplify-libcalls pass into the instcombine library call simplifier.
      
      I have typically migrated just one simplifier at a time, but the math
      simplifiers are interdependent because:
      
         1. CosOpt, PowOpt, and Exp2Opt all depend on UnaryDoubleFPOpt.
         2. CosOpt, PowOpt, Exp2Opt, and UnaryDoubleFPOpt all depend on
            the option -enable-double-float-shrink.
      
      These two factors made migrating each of these simplifiers individually
      more of a pain than it would be worth.  So, I migrated them all together.
      
      llvm-svn: 167815
      193e035b
  2. Nov 12, 2012
    • Meador Inge's avatar
      Normalize memcmp constant folding results. · b3e91f6a
      Meador Inge authored
      The library call simplifier folds memcmp calls with all constant arguments
      to a constant.  For example:
      
        memcmp("foo", "foo", 3) ->  0
        memcmp("hel", "foo", 3) ->  1
        memcmp("foo", "hel", 3) -> -1
      
      The folding is implemented in terms of the system memcmp that LLVM gets
      linked with.  It currently just blindly uses the value returned from
      the system memcmp as the folded constant.
      
      This patch normalizes the values returned from the system memcmp to
      (-1, 0, 1) so that we get consistent results across multiple platforms.
      The test cases were adjusted accordingly.
      
      llvm-svn: 167726
      b3e91f6a
  3. Nov 11, 2012
    • Meador Inge's avatar
      instcombine: Migrate memset optimizations · d4825780
      Meador Inge authored
      This patch migrates the memset optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167689
      d4825780
    • Meador Inge's avatar
      instcombine: Migrate memmove optimizations · 9cf328b5
      Meador Inge authored
      This patch migrates the memmove optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167687
      9cf328b5
    • Meador Inge's avatar
      instcombine: Migrate memcpy optimizations · dd9234a1
      Meador Inge authored
      This patch migrates the memcpy optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167686
      dd9234a1
    • Meador Inge's avatar
      instcombine: Migrate memcmp optimizations · 4d2827c1
      Meador Inge authored
      This patch migrates the memcmp optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167683
      4d2827c1
    • Meador Inge's avatar
      instcombine: Migrate strstr optimizations · 56edbc93
      Meador Inge authored
      This patch migrates the strstr optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167682
      56edbc93
    • Meador Inge's avatar
      Add method for replacing instructions to LibCallSimplifier · 76fc1a47
      Meador Inge authored
      In some cases the library call simplifier may need to replace instructions
      other than the library call being simplified.  In those cases it may be
      necessary for clients of the simplifier to override how the replacements
      are actually done.  As such, a new overrideable method for replacing
      instructions was added to LibCallSimplifier.
      
      A new subclass of LibCallSimplifier is also defined which overrides
      the instruction replacement method.  This is because the instruction
      combiner defines its own replacement method which updates the worklist
      when instructions are replaced.
      
      llvm-svn: 167681
      76fc1a47
  4. Nov 10, 2012
  5. Nov 08, 2012
  6. Nov 01, 2012
    • Chandler Carruth's avatar
      Revert the series of commits starting with r166578 which introduced the · 7ec5085e
      Chandler Carruth authored
      getIntPtrType support for multiple address spaces via a pointer type,
      and also introduced a crasher bug in the constant folder reported in
      PR14233.
      
      These commits also contained several problems that should really be
      addressed before they are re-committed. I have avoided reverting various
      cleanups to the DataLayout APIs that are reasonable to have moving
      forward in order to reduce the amount of churn, and minimize the number
      of commits that were reverted. I've also manually updated merge
      conflicts and manually arranged for the getIntPtrType function to stay
      in DataLayout and to be defined in a plausible way after this revert.
      
      Thanks to Duncan for working through this exact strategy with me, and
      Nick Lewycky for tracking down the really annoying crasher this
      triggered. (Test case to follow in its own commit.)
      
      After discussing with Duncan extensively, and based on a note from
      Micah, I'm going to continue to back out some more of the more
      problematic patches in this series in order to ensure we go into the
      LLVM 3.2 branch with a reasonable story here. I'll send a note to
      llvmdev explaining what's going on and why.
      
      Summary of reverted revisions:
      
      r166634: Fix a compiler warning with an unused variable.
      r166607: Add some cleanup to the DataLayout changes requested by
               Chandler.
      r166596: Revert "Back out r166591, not sure why this made it through
               since I cancelled the command. Bleh, sorry about this!
      r166591: Delete a directory that wasn't supposed to be checked in yet.
      r166578: Add in support for getIntPtrType to get the pointer type based
               on the address space.
      llvm-svn: 167221
      7ec5085e
  7. Oct 31, 2012
    • Meador Inge's avatar
      instcombine: Migrate strto* optimizations · 05a625a0
      Meador Inge authored
      This patch migrates the strto* optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167119
      05a625a0
    • Meador Inge's avatar
      instcombine: Migrate strpbrk optimizations · 6f8e0112
      Meador Inge authored
      This patch migrates the strpbrk optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167105
      6f8e0112
    • Meador Inge's avatar
      instcombine: Migrate strlen optimizations · d589ac62
      Meador Inge authored
      This patch migrates the strlen optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167103
      d589ac62
    • Meador Inge's avatar
      instcombine: Migrate strncpy optimizations · 067294b3
      Meador Inge authored
      This patch migrates the strncpy optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.
      
      llvm-svn: 167102
      067294b3
    • Meador Inge's avatar
      instcombine: Migrate stpcpy optimizations · 9a6a1905
      Meador Inge authored
      This patch migrates the stpcpy optimizations from the simplify-libcalls
      pass into the instcombine library call simplifier.  Note that the
      __stpcpy_chk simplifications were migrated in a previous commit.
      
      llvm-svn: 167083
      9a6a1905
    • Meador Inge's avatar
      instcombine: Split out the __stpcpy_chk simplifications from StrCpyChkOpt · cdb2ca54
      Meador Inge authored
      r166198 migrated the strcpy optimization to instcombine.  The strcpy
      simplifier that was migrated from Transforms/Scalar/SimplifyLibCalls.cpp
      was also doing some __strcpy_chk simplifications.  Those fortified
      simplifications were migrated as well, but introduced a bug in the
      __stpcpy_chk simplifier in the process.  This happened because the
      __strcpy_chk and __stpcpy_chk simplifiers were both mapped to StrCpyChkOpt
      which was updated with simplifications that worked for __strcpy_chk, but
      not __stpcpy_chk.
      
      This patch fixes the problem by adding proper test coverage and creating a
      new simplifier for __stpcpy_chk (instead of sharing one with __strcpy_chk).
      
      llvm-svn: 167082
      cdb2ca54
  8. Oct 24, 2012
  9. Oct 18, 2012
    • Meador Inge's avatar
      2332615f
    • Meador Inge's avatar
      instcombine: Migrate strcpy optimizations · 000dbccf
      Meador Inge authored
      This patch migrates the strcpy optimizations from the simplify-libcalls pass
      into the instcombine library call simplifier.  Note also that StrCpyChkOpt
      has been updated with a few simplifications that were being done in the
      simplify-libcalls version of StrCpyOpt, but not in the migrated implementation
      of StrCpyOpt.  There is no reason to overload StrCpyOpt with fortified and
      regular simplifications in the new model since there is already a dedicated
      simplifier for __strcpy_chk.
      
      llvm-svn: 166198
      000dbccf
  10. Oct 15, 2012
  11. Oct 13, 2012
Loading