Skip to content
  1. Mar 18, 2010
  2. Mar 12, 2010
  3. Mar 10, 2010
  4. Feb 23, 2010
    • Dan Gohman's avatar
      Remove the code which constant-folded ptrtoint(inttoptr(x)+c) to · 8a0eb36d
      Dan Gohman authored
      getelementptr. Despite only doing so in the case where x is a known
      array object and c can be converted to an index within range, this
      could still be invalid if c is actually the address of an object
      allocated outside of LLVM. Also, SCEVExpander, the original motivation
      for this code, has since been improved to avoid inttoptr+ptroint in
      more cases.
      
      llvm-svn: 96950
      8a0eb36d
  5. Feb 22, 2010
  6. Feb 17, 2010
  7. Feb 16, 2010
  8. Feb 15, 2010
  9. Feb 08, 2010
  10. Feb 01, 2010
    • Dan Gohman's avatar
      Generalize target-independent folding rules for sizeof to handle more · e5e1b7b0
      Dan Gohman authored
      cases, and implement target-independent folding rules for alignof and
      offsetof. Also, reassociate reassociative operators when it leads to
      more folding.
      
      Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
      arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
      to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.
      
      Make the target-dependent folder promote GEP array indices to
      pointer-sized integers, to make implicit casting explicit and exposed
      to subsequent folding.
      
      And add a bunch of testcases for this new functionality, and a bunch
      of related existing functionality.
      
      llvm-svn: 94987
      e5e1b7b0
  11. Jan 08, 2010
  12. Jan 02, 2010
  13. Dec 04, 2009
  14. Dec 03, 2009
  15. Nov 29, 2009
  16. Nov 23, 2009
  17. Nov 10, 2009
  18. Nov 06, 2009
  19. Oct 25, 2009
    • Chris Lattner's avatar
      Teach FoldBitCast to be able to handle bitcasts from (e.g.) i128 -> <4 x float>. · d8e8fb4d
      Chris Lattner authored
      This allows us to simplify this:
      union vec2d {
          double e[2];
          double v __attribute__((vector_size(16)));
      };
      typedef union vec2d vec2d;
      
      static vec2d a={{1,2}}, b={{3,4}};
          
      vec2d foo () {
          return (vec2d){ .v = a.v + b.v * (vec2d){{5,5}}.v };
      }
      
      down to:
      
      define %0 @foo() nounwind ssp {
      entry:
        %mrv5 = insertvalue %0 undef, double 1.600000e+01, 0 ; <%0> [#uses=1]
        %mrv6 = insertvalue %0 %mrv5, double 2.200000e+01, 1 ; <%0> [#uses=1]
        ret %0 %mrv6
      }
      
      instead of:
      
      define %0 @foo() nounwind ssp {
      entry:
        %mrv5 = insertvalue %0 undef, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 0), 0 ; <%0> [#uses=1]
        %mrv6 = insertvalue %0 %mrv5, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 1), 1 ; <%0> [#uses=1]
        ret %0 %mrv6
      }
      
      llvm-svn: 85040
      d8e8fb4d
    • Chris Lattner's avatar
      move FoldBitCast earlier in the file, and use it instead of · 9d051246
      Chris Lattner authored
      ConstantExpr::getBitCast in various places.
      
      llvm-svn: 85039
      9d051246
    • Chris Lattner's avatar
      refactor FoldBitCast to reduce nesting and to always return a constantexpr · c5fd5ad4
      Chris Lattner authored
      instead of returning null on failure.  No functionality change.
      
      llvm-svn: 85038
      c5fd5ad4
  20. Oct 24, 2009
  21. Oct 23, 2009
    • Chris Lattner's avatar
      teach libanalysis to simplify vector loads with bitcast sources. This · ccf1e847
      Chris Lattner authored
      implements something out of Target/README.txt producing:
      
      _foo:                                                       ## @foo
      	movl	4(%esp), %eax
      	movapd	LCPI1_0, %xmm0
      	movapd	%xmm0, (%eax)
      	ret	$4
      
      instead of:
      
      _foo:                                                       ## @foo
      	movl	4(%esp), %eax
      	movapd	_b, %xmm0
      	mulpd	LCPI1_0, %xmm0
      	addpd	_a, %xmm0
      	movapd	%xmm0, (%eax)
      	ret	$4
      
      llvm-svn: 84942
      ccf1e847
    • Chris Lattner's avatar
      enhance FoldReinterpretLoadFromConstPtr to handle loads of up to 32 · 59f94c01
      Chris Lattner authored
      bytes (i256).
      
      llvm-svn: 84941
      59f94c01
    • Chris Lattner's avatar
      teach libanalysis to fold int and fp loads from almost arbitrary · ed00b80b
      Chris Lattner authored
      non-type-safe constant initializers.  This sort of thing happens
      quite a bit for 4-byte loads out of string constants, unions, 
      bitfields, and an interesting endianness check from sqlite, which
      is something like this:
      
      const int sqlite3one = 1;
      # define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)
      # define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
      # define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
      
      all of these macros now constant fold away.
      
      This implements PR3152 and is based on a patch started by Eli, but heavily
      modified and extended.
      
      llvm-svn: 84936
      ed00b80b
  22. Oct 22, 2009
  23. Oct 06, 2009
  24. Oct 05, 2009
  25. Sep 16, 2009
  26. Sep 11, 2009
  27. Sep 04, 2009
    • Dan Gohman's avatar
      Revert 80959. It isn't sufficient to solve the full problem. And it · e4ca02da
      Dan Gohman authored
      introduced regressions in the Ocaml bindings tests.
      
      llvm-svn: 80969
      e4ca02da
    • Dan Gohman's avatar
      Remove the API for creating ConstantExprs with the nsw, nuw, inbounds, · 2a53b30f
      Dan Gohman authored
      and exact flags. Because ConstantExprs are uniqued, creating an
      expression with this flag causes all expressions with the same operands
      to have the same flag, which may not be safe. Add, sub, mul, and sdiv
      ConstantExprs are usually folded anyway, so the main interesting flag
      here is inbounds, and the constant folder already knows how to set the
      inbounds flag automatically in most cases, so there isn't an urgent need
      for the API support.
      
      This can be reconsidered in the future, but for now just removing these
      API bits eliminates a source of potential trouble with little downside.
      
      llvm-svn: 80959
      2a53b30f
Loading