Skip to content
  • 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
Loading