summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-19 19:35:49 +0000
committerChris Lattner <sabre@nondot.org>2011-02-19 19:35:49 +0000
commitacf6b0776a624f1ef0400b131d1623cae24b3409 (patch)
tree732fdc9d8de0c449e6c84dd18a1b5654e9c1e096 /llvm/lib/Analysis
parent0f4a64011ebf9b4de29515ebc5b205eb1b20a560 (diff)
downloadbcm5719-llvm-acf6b0776a624f1ef0400b131d1623cae24b3409.tar.gz
bcm5719-llvm-acf6b0776a624f1ef0400b131d1623cae24b3409.zip
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')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 32d2c887211..1060bc5349e 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.
OpenPOWER on IntegriCloud