[PATCH] Pass -mglobal-merge as a module flag metadata.

Akira Hatanaka ahatanak at gmail.com
Sun Mar 1 13:57:14 PST 2015


Just one question:

Should it be an error if two files compiled with -mglobal-merge and -mno-global-merge are linked? With this patch applied, the merged IR (foo3.ll) gets "Enable Global Merge"="true" in such case.

$ clang foo1.c -o foo1.ll -mglobal-merge ...
$ clang foo2.c -o foo2.ll -mno-global-merge ...
$ lvm-link foo1.ll foo2.ll -o foo3.ll


================
Comment at: lib/CodeGen/CodeGenModule.cpp:3617
@@ +3616,3 @@
+    getModule().addModuleFlag(llvm::Module::Error, "Enable Global Merge",
+                              llvm::MDString::get("true"));
+}
----------------
Do you need to pass LLVMContext here? I saw a build error when I applied this patch.

http://reviews.llvm.org/D7968

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list