[mono/mono] 09a0c58b: [jit] Fix sgen support in LLVM. Use the new LLVM 'invariant.load' metadata instead of our 'mono.noalias' metadata.

"Zoltan Varga ([email protected])" <[email protected]> Fri, 8 Nov 2013 04:13:55 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014235ea9575-f89ef6d7-e3d2-4f10-add0-f5c45d5f631d-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/623b9d0dcf66...09a0c58b7a6e

   Commit: 09a0c58b7a6e5c5f46732a3c1c90a7c95170e52b
   Author: Zoltan Varga <[email protected]> (vargaz)
     Date: 2013-11-08 04:12:41 GMT
      URL: https://github.com/mono/mono/commit/09a0c58b7a6e5c5f46732a3c1c90a7c95170e52b

[jit] Fix sgen support in LLVM. Use the new LLVM 'invariant.load' metadata instead of our 'mono.noalias' metadata.

Changed paths:
  M mono/mini/method-to-ir.c
  M mono/mini/mini-llvm.c

Modified: mono/mini/method-to-ir.c
===================================================================
@@ -2901,7 +2901,7 @@
 	has_card_table_wb = TRUE;
 #endif
 
-	if (has_card_table_wb && !cfg->compile_aot && card_table && nursery_shift_bits > 0) {
+	if (has_card_table_wb && !cfg->compile_aot && card_table && nursery_shift_bits > 0 && !COMPILE_LLVM (cfg)) {
 		MonoInst *wbarrier;
 
 		MONO_INST_NEW (cfg, wbarrier, OP_CARD_TABLE_WBARRIER);

Modified: mono/mini/mini-llvm.c
===================================================================
@@ -1274,12 +1274,26 @@
 {
 	LLVMValueRef md_arg;
 	int md_kind;
-	
+
 	md_kind = LLVMGetMDKindID (flag_name, strlen (flag_name));
 	md_arg = LLVMMDString ("mono", 4);
 	LLVMSetMetadata (v, md_kind, LLVMMDNode (&md_arg, 1));
 }
 
+static void
+set_invariant_load_flag (LLVMValueRef v)
+{
+	LLVMValueRef md_arg;
+	int md_kind;
+	const char *flag_name;
+
+	// FIXME: Cache this
+	flag_name = "invariant.load";
+	md_kind = LLVMGetMDKindID (flag_name, strlen (flag_name));
+	md_arg = LLVMMDString ("<index>", strlen ("<index>"));
+	LLVMSetMetadata (v, md_kind, LLVMMDNode (&md_arg, 1));
+}
+
 /*
  * emit_call:
  *
@@ -2685,7 +2699,8 @@
 		case OP_AND_IMM:
 		case OP_MUL_IMM:
 		case OP_SHL_IMM:
-		case OP_SHR_IMM: {
+		case OP_SHR_IMM:
+		case OP_SHR_UN_IMM: {
 			LLVMValueRef imm;
 
 			if (spec [MONO_INST_SRC1] == 'l') {
@@ -2761,6 +2776,7 @@
 				values [ins->dreg] = LLVMBuildLShr (builder, lhs, imm, dname);
 				break;
 			case OP_LSHR_UN_IMM:
+			case OP_SHR_UN_IMM:
 				values [ins->dreg] = LLVMBuildLShr (builder, lhs, imm, dname);
 				break;
 			default:
@@ -2977,7 +2993,7 @@
 				 * These will signal LLVM that these loads do not alias any stores, and
 				 * they can't fail, allowing them to be hoisted out of loops.
 				 */
-				set_metadata_flag (values [ins->dreg], "mono.noalias");
+				set_invariant_load_flag (values [ins->dreg]);
 				set_metadata_flag (values [ins->dreg], "mono.nofail.load");
 			}
 


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches