summaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-24 14:17:05 +0000
committerChris Lattner <sabre@nondot.org>2012-01-24 14:17:05 +0000
commit29cc6cb4d1aa22f0a27edf4e5b363071a83a65d8 (patch)
tree75dfab2a48716105544899e8ebb3f6f34687019d /lib/VMCore/Constants.cpp
parent32100602432657b188db603ca3ab50b487938027 (diff)
downloadllvm-29cc6cb4d1aa22f0a27edf4e5b363071a83a65d8.tar.gz
llvm-29cc6cb4d1aa22f0a27edf4e5b363071a83a65d8.tar.bz2
llvm-29cc6cb4d1aa22f0a27edf4e5b363071a83a65d8.tar.xz
C++, CBE, and TLOF support for ConstantDataSequential
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 5151105e05..1976832294 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -2048,7 +2048,8 @@ static bool isAllZeros(StringRef Arr) {
/// we *want* an underlying "char*" to avoid TBAA type punning violations.
Constant *ConstantDataSequential::getImpl(StringRef Elements, Type *Ty) {
assert(isElementTypeCompatible(cast<SequentialType>(Ty)->getElementType()));
- // If the elements are all zero, return a CAZ, which is more dense.
+ // If the elements are all zero or there are no elements, return a CAZ, which
+ // is more dense and canonical.
if (isAllZeros(Elements))
return ConstantAggregateZero::get(Ty);