diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-19 19:35:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-19 19:35:49 +0000 |
commit | 41bfbb0a8776674c486682cbf2aa80f15abfef68 (patch) | |
tree | dac0ce40b8e7de6eb9cca6196fca47833cb4ddb8 /lib/Analysis/ValueTracking.cpp | |
parent | 3a393728a62122d7009d8e2cbe52a221874e576a (diff) |
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
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | lib/Analysis/ValueTracking.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 32d2c88721..1060bc5349 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -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. |