Skip to content

Commit c19d263

Browse files
committed
Merge remote-tracking branch 'llvm/release_40' into flang_release_40
2 parents 1210030 + 3c8961b commit c19d263

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/CodeGen/CodeGenModule.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
159159
// CoverageMappingModuleGen object.
160160
if (CodeGenOpts.CoverageMapping)
161161
CoverageMapping.reset(new CoverageMappingModuleGen(*this, *CoverageInfo));
162+
163+
// Record mregparm value now so it is visible through rest of codegen.
164+
if (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86)
165+
getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters",
166+
CodeGenOpts.NumRegisterParameters);
167+
162168
}
163169

164170
CodeGenModule::~CodeGenModule() {}
@@ -416,6 +422,7 @@ void CodeGenModule::Release() {
416422
(Context.getLangOpts().Modules || !LinkerOptionsMetadata.empty())) {
417423
EmitModuleLinkOptions();
418424
}
425+
419426
if (CodeGenOpts.DwarfVersion) {
420427
// We actually want the latest version when there are conflicts.
421428
// We can change from Warning to Latest if such mode is supported.

test/CodeGen/pr3997.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 %s -triple i386-unknown-linux-gnu -mregparm 3 -emit-llvm -o - | FileCheck %s
2+
3+
void *memcpy(void *dest, const void *src, unsigned int n);
4+
5+
void use_builtin_memcpy(void *dest, const void *src, unsigned int n) {
6+
__builtin_memcpy(dest, src, n);
7+
}
8+
9+
void use_memcpy(void *dest, const void *src, unsigned int n) {
10+
memcpy(dest, src, n);
11+
}
12+
13+
//CHECK: !{i32 1, !"NumRegisterParameters", i32 3}

test/Headers/altivec-header.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99

1010
// CHECK: target triple = "powerpc64-
1111
// CHECK-NEXT: {{^$}}
12-
// CHECK-NEXT: llvm.ident
12+
// CHECK-NEXT: {{llvm\..*}}

0 commit comments

Comments
 (0)