aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
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);