[PATCH] D27051: [X86] Add Regparm Subtarget Attributes

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 09:06:40 PST 2017


niravd updated this revision to Diff 85928.
niravd added a comment.
Herald added subscribers: rengolin, aemerson.

Change to llvm module flag


https://reviews.llvm.org/D27051

Files:
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGen/pr3997.c
  test/CodeGenCUDA/flush-denormals.cu
  test/CodeGenCXX/strict-vtable-pointers.cpp
  test/Headers/altivec-header.c


Index: test/Headers/altivec-header.c
===================================================================
--- test/Headers/altivec-header.c
+++ test/Headers/altivec-header.c
@@ -9,4 +9,4 @@
 
 // CHECK: target triple = "powerpc64-
 // CHECK-NEXT: {{^$}}
-// CHECK-NEXT: llvm.ident
+// CHECK-NEXT: {{llvm\..*}}
Index: test/CodeGenCXX/strict-vtable-pointers.cpp
===================================================================
--- test/CodeGenCXX/strict-vtable-pointers.cpp
+++ test/CodeGenCXX/strict-vtable-pointers.cpp
@@ -211,9 +211,8 @@
 // CHECK-DTORS-LABEL: {{^}}}
 
 
-// CHECK-LINK-REQ: !llvm.module.flags = !{![[FIRST:.*]], ![[SEC:.*]]{{.*}}}
+// CHECK-LINK-REQ: !llvm.module.flags = !{!0, ![[FIRST:.*]], ![[SEC:.*]]{{.*}}}
 
 // CHECK-LINK-REQ: ![[FIRST]] = !{i32 1, !"StrictVTablePointers", i32 1}
 // CHECK-LINK-REQ: ![[SEC]] = !{i32 3, !"StrictVTablePointersRequirement", ![[META:.*]]}
 // CHECK-LINK-REQ: ![[META]] = !{!"StrictVTablePointers", i32 1}
-
Index: test/CodeGenCUDA/flush-denormals.cu
===================================================================
--- test/CodeGenCUDA/flush-denormals.cu
+++ test/CodeGenCUDA/flush-denormals.cu
@@ -18,8 +18,8 @@
 // FTZ: attributes #0 = {{.*}} "nvptx-f32ftz"="true"
 // NOFTZ-NOT: attributes #0 = {{.*}} "nvptx-f32ftz"
 
-// FTZ:!llvm.module.flags = !{[[MODFLAG:![0-9]+]]}
+// FTZ:!llvm.module.flags = !{!0, [[MODFLAG:![0-9]+]]}
 // FTZ:[[MODFLAG]] = !{i32 4, !"nvvm-reflect-ftz", i32 1}
 
-// NOFTZ:!llvm.module.flags = !{[[MODFLAG:![0-9]+]]}
+// NOFTZ:!llvm.module.flags = !{!0, [[MODFLAG:![0-9]+]]}
 // NOFTZ:[[MODFLAG]] = !{i32 4, !"nvvm-reflect-ftz", i32 0}
Index: test/CodeGen/pr3997.c
===================================================================
--- /dev/null
+++ test/CodeGen/pr3997.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -triple i386-unknown-linux-gnu -mregparm 3 -emit-llvm -o - | FileCheck %s
+
+void *memcpy(void *dest, const void *src, unsigned int n);
+
+void use_builtin_memcpy(void *dest, const void *src, unsigned int n) {
+  __builtin_memcpy(dest, src, n);
+}
+
+void use_memcpy(void *dest, const void *src, unsigned int n) {
+  memcpy(dest, src, n);
+}
+
+//CHECK: !{i32 1, !"NumRegisterParameters", i32 3}
Index: lib/CodeGen/MicrosoftCXXABI.cpp
===================================================================
--- lib/CodeGen/MicrosoftCXXABI.cpp
+++ lib/CodeGen/MicrosoftCXXABI.cpp
@@ -732,7 +732,7 @@
         CGM.CreateRuntimeFunction(FTy, "_CxxThrowException"));
     // _CxxThrowException is stdcall on 32-bit x86 platforms.
     if (CGM.getTarget().getTriple().getArch() == llvm::Triple::x86)
-      Fn->setCallingConv(llvm::CallingConv::X86_StdCall);
+      Fn->setCallingConv(llvm::CallingConv::X86_LibStdCall);
     return Fn;
   }
 
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -416,6 +416,11 @@
       (Context.getLangOpts().Modules || !LinkerOptionsMetadata.empty())) {
     EmitModuleLinkOptions();
   }
+
+  // Record mregparm value.
+  getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters",
+                            CodeGenOpts.NumRegisterParameters);
+
   if (CodeGenOpts.DwarfVersion) {
     // We actually want the latest version when there are conflicts.
     // We can change from Warning to Latest if such mode is supported.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27051.85928.patch
Type: text/x-patch
Size: 3394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170126/55c9513e/attachment-0001.bin>


More information about the llvm-commits mailing list