From 41bfbb0a8776674c486682cbf2aa80f15abfef68 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 19 Feb 2011 19:35:49 +0000 Subject: 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 --- lib/Analysis/ValueTracking.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/Analysis/ValueTracking.cpp') 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(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. -- cgit v1.2.3