Stores of null pointers should turn into memset, we weren't recognizing

them as splat values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126041 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2011-02-19 19:35:49 +00:00
parent 3a393728a6
commit 41bfbb0a87
2 changed files with 27 additions and 0 deletions

View File

@ -1163,6 +1163,11 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) {
Value *llvm::isBytewiseValue(Value *V) {
// All byte-wide stores are splatable, even of arbitrary variables.
if (V->getType()->isIntegerTy(8)) return V;
// Handle 'null' ConstantArrayZero etc.
if (Constant *C = dyn_cast<Constant>(V))
if (C->isNullValue())
return Constant::getNullValue(Type::getInt8Ty(V->getContext()));
// Constant float and double values can be handled as integer values if the
// corresponding integer value is "byteable". An important case is 0.0.