diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2009-10-29 11:27:06 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2009-10-29 11:27:06 +0000 |
commit | c6eb131a83eb35d0c896170652563449648a32c3 (patch) | |
tree | f523865ee816ab38fd4f23fd78b0751ba05680bc /lib/CodeGen | |
parent | 4fff4b3fdf49272a26b7cb7bd564a521e938805b (diff) |
make clang emit undefs for padding of structs and unions instead of zeros. this enables constant compaction optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index dc0aa9e7c4..9145d92128 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -228,7 +228,7 @@ class VISIBILITY_HIDDEN ConstStructBuilder { if (NumBytes > 1) Ty = llvm::ArrayType::get(Ty, NumBytes); - llvm::Constant *C = llvm::Constant::getNullValue(Ty); + llvm::Constant *C = llvm::UndefValue::get(Ty); Elements.push_back(C); assert(getAlignment(C) == 1 && "Padding must have 1 byte alignment!"); @@ -266,7 +266,7 @@ class VISIBILITY_HIDDEN ConstStructBuilder { if (NumBytes > 1) Ty = llvm::ArrayType::get(Ty, NumBytes); - llvm::Constant *Padding = llvm::Constant::getNullValue(Ty); + llvm::Constant *Padding = llvm::UndefValue::get(Ty); PackedElements.push_back(Padding); ElementOffsetInBytes += getSizeInBytes(Padding); } @@ -496,7 +496,7 @@ public: if (NumPadBytes > 1) Ty = llvm::ArrayType::get(Ty, NumPadBytes); - Elts.push_back(llvm::Constant::getNullValue(Ty)); + Elts.push_back(llvm::UndefValue::get(Ty)); Types.push_back(Ty); } |