summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/VMCore/Constants.cpp')
-rw-r--r--llvm/lib/VMCore/Constants.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp
index 5151105e05d..1976832294d 100644
--- a/llvm/lib/VMCore/Constants.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud