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 | acf6b0776a624f1ef0400b131d1623cae24b3409 (patch) | |
| tree | 732fdc9d8de0c449e6c84dd18a1b5654e9c1e096 /llvm/lib/Analysis/ValueTracking.cpp | |
| parent | 0f4a64011ebf9b4de29515ebc5b205eb1b20a560 (diff) | |
| download | llvm-acf6b0776a624f1ef0400b131d1623cae24b3409.zip llvm-acf6b0776a624f1ef0400b131d1623cae24b3409.tar.gz llvm-acf6b0776a624f1ef0400b131d1623cae24b3409.tar.bz2 | |
Stores of null pointers should turn into memset, we weren't recognizing
them as splat values.
llvm-svn: 126041
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 32d2c88..1060bc5 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/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. |
