[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner clattner at apple.com
Tue Feb 27 14:20:48 PST 2007


On Feb 27, 2007, at 12:51 PM, Reid Spencer wrote:
> Can't we just change this part of ConstantInt:
>
>  /// getTrue/getFalse - Return the singleton true/false values.
>   static inline ConstantInt *getTrue() {
>     if (TheTrueVal) return TheTrueVal;
>     return CreateTrueFalseVals(true);
>   }
>   static inline ConstantInt *getFalse() {
>     if (TheFalseVal) return TheFalseVal;
>     return CreateTrueFalseVals(false);
>   }
>
> into:
>  /// getTrue/getFalse - Return the singleton true/false values.
>   static inline ConstantInt *getTrue() {
>     return get(Type::Int1Ty, 1);
>   }
>   static inline ConstantInt *getFalse() {
>     return get(Type::Int1Ty, 0);
>   }
>
> and get rid of all the special handling of true/false values? Or  
> have we
> provided this simply as an optimization on frequently obtained integer
> values?

Yes we could.  I would like to do that, but we should do (compile  
time) timings to see if it is a significant perf hit.

-Chris



More information about the llvm-commits mailing list