[PATCH] D27051: [X86] Add NumRegisterParameters Module Flag

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 12:52:16 PST 2017


niravd added inline comments.


================
Comment at: lib/CodeGen/CodeGenModule.cpp:421
+  // Record mregparm value.
+  getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters",
+                            CodeGenOpts.NumRegisterParameters);
----------------
rnk wrote:
> I'd like this to be conditional on NumRegisterParameters being non-zero, so that it doesn't pollute the vast majority of modules that don't use -mregparm. I think you will get the right LTO diagnostic behavior if you use llvm::Module::Require instead of Error here.
My understanding is that Require only checks the post-linking values, so we'd not error when linking regparm 0 with regparm N. 

That said, it'd be easy enough to restrict emitting the module flag to target that actually depend on it, i.e. X86-32. That would get us 90% of the way.


https://reviews.llvm.org/D27051





More information about the llvm-commits mailing list