Browse Source

Add extra check for ZeroInit instruction

gingerBill 5 years ago
parent
commit
b288613307
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/ir.cpp

+ 2 - 1
src/ir.cpp

@@ -3008,7 +3008,8 @@ void ir_emit_zero_init(irProcedure *p, irValue *address, Ast *expr) {
 		args[1] = ir_const_int(type_size_of(t));
 		args[1] = ir_const_int(type_size_of(t));
 		AstPackage *pkg_runtime = get_core_package(p->module->info, str_lit("runtime"));
 		AstPackage *pkg_runtime = get_core_package(p->module->info, str_lit("runtime"));
 		if (p->entity != nullptr) {
 		if (p->entity != nullptr) {
-			if (p->entity->pkg != pkg_runtime && p->entity->token.string != "mem_zero") {
+			String name = p->entity->token.string;
+			if (p->entity->pkg != pkg_runtime && !(name == "mem_zero" || name == "memset")) {
 				ir_emit_comment(p, str_lit("ZeroInit"));
 				ir_emit_comment(p, str_lit("ZeroInit"));
 				irValue *v = ir_emit_package_call(p, "runtime", "mem_zero", args, expr);
 				irValue *v = ir_emit_package_call(p, "runtime", "mem_zero", args, expr);
 				return;
 				return;