[PATCH] D64386: CodeGen: Use memset in initializers for non-zeros
Vitaly Buka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 8 22:08:38 PDT 2019
vitalybuka created this revision.
vitalybuka added reviewers: eugenis, pcc, jfb.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D64386
Files:
clang/lib/CodeGen/CGDecl.cpp
clang/test/CodeGen/init-memset.c
Index: clang/test/CodeGen/init-memset.c
===================================================================
--- clang/test/CodeGen/init-memset.c
+++ clang/test/CodeGen/init-memset.c
@@ -26,7 +26,7 @@
void test_all_a() {
// CHECK-LABEL: define void @test_all_a()
char a[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
- // CHECK: call void @llvm.memcpy.{{.*}}
+ // CHECK: call void @llvm.memset.{{.*}}
use(a);
}
@@ -41,6 +41,7 @@
void test_most_a() {
// CHECK-LABEL: define void @test_most_a()
char a[] = "aaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
- // CHECK: call void @llvm.memcpy.{{.*}}
+ // CHECK: call void @llvm.memset.{{.*}}
+ // CHECK: store i8 122
use(a);
}
Index: clang/lib/CodeGen/CGDecl.cpp
===================================================================
--- clang/lib/CodeGen/CGDecl.cpp
+++ clang/lib/CodeGen/CGDecl.cpp
@@ -973,11 +973,6 @@
if (GlobalSize <= SizeLimit)
return nullptr;
- // TODO: Remove. It's here just to keep behavior.
- if (MFB.Other && MFB.Value &&
- MFB.Value != llvm::ConstantInt::get(CGM.Int8Ty, 0))
- return nullptr;
-
if (!MFB.Value) {
// We don't know most frequent byte, we may still completely initialize it
// with small number of stores.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64386.208596.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190709/77c9d0ae/attachment-0001.bin>
More information about the cfe-commits
mailing list