summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2019-07-10 22:53:52 +0000
committerVitaly Buka <vitalybuka@google.com>2019-07-10 22:53:52 +0000
commitd03bd1db59496079dfecf9e3d2bd79b6b6c7659b (patch)
treeb1cf7f5ccfe694ab353e9179faace626a51f4460 /clang/lib/CodeGen
parente72676657f3e2f3e29125efc8c12bcb477cda445 (diff)
downloadbcm5719-llvm-d03bd1db59496079dfecf9e3d2bd79b6b6c7659b.tar.gz
bcm5719-llvm-d03bd1db59496079dfecf9e3d2bd79b6b6c7659b.zip
NFC: Pass DataLayout into isBytewiseValue
Summary: We will need to handle IntToPtr which I will submit in a separate patch as it's not going to be NFC. Reviewers: eugenis, pcc Reviewed By: eugenis Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63940 llvm-svn: 365709
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 0afd4816143..739b2d858cb 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -967,11 +967,12 @@ static bool shouldUseBZeroPlusStoresToInitialize(llvm::Constant *Init,
/// FIXME We could be more clever, as we are for bzero above, and generate
/// memset followed by stores. It's unclear that's worth the effort.
static llvm::Value *shouldUseMemSetToInitialize(llvm::Constant *Init,
- uint64_t GlobalSize) {
+ uint64_t GlobalSize,
+ const llvm::DataLayout &DL) {
uint64_t SizeLimit = 32;
if (GlobalSize <= SizeLimit)
return nullptr;
- return llvm::isBytewiseValue(Init);
+ return llvm::isBytewiseValue(Init, DL);
}
/// Decide whether we want to split a constant structure or array store into a
@@ -1177,7 +1178,8 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
}
// If the initializer is a repeated byte pattern, use memset.
- llvm::Value *Pattern = shouldUseMemSetToInitialize(constant, ConstantSize);
+ llvm::Value *Pattern =
+ shouldUseMemSetToInitialize(constant, ConstantSize, CGM.getDataLayout());
if (Pattern) {
uint64_t Value = 0x00;
if (!isa<llvm::UndefValue>(Pattern)) {
OpenPOWER on IntegriCloud