Skip to content

Commit 388fca7

Browse files
committed
Avoid emitting OP_NOT_NULL opcodes in non-llvm mode, they are not used, and they keep their inputs alive.
1 parent 1329353 commit 388fca7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mono/mono/mini/ir-emit.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ static int ccount = 0;
886886
cfg->flags |= MONO_CFG_HAS_CHECK_THIS; \
887887
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, (reg), 0); \
888888
MONO_EMIT_NEW_COND_EXC (cfg, EQ, "NullReferenceException"); \
889-
MONO_EMIT_NEW_UNALU (cfg, OP_NOT_NULL, -1, reg); \
889+
if (COMPILE_LLVM (cfg)) MONO_EMIT_NEW_UNALU (cfg, OP_NOT_NULL, -1, reg); \
890890
} while (0)
891891

892892
/* Emit an explicit null check which doesn't depend on SIGSEGV signal handling */
@@ -897,7 +897,7 @@ static int ccount = 0;
897897
} else { \
898898
MONO_EMIT_NEW_IMPLICIT_EXCEPTION_LOAD_STORE (cfg); \
899899
} \
900-
MONO_EMIT_NEW_UNALU (cfg, OP_NOT_NULL, -1, reg); \
900+
if (COMPILE_LLVM (cfg)) MONO_EMIT_NEW_UNALU (cfg, OP_NOT_NULL, -1, reg); \
901901
} while (0)
902902

903903
#define MONO_EMIT_NEW_CHECK_THIS(cfg, sreg) do { \
@@ -907,7 +907,7 @@ static int ccount = 0;
907907
} else { \
908908
MONO_EMIT_NEW_UNALU (cfg, OP_CHECK_THIS, -1, sreg); \
909909
MONO_EMIT_NEW_IMPLICIT_EXCEPTION_LOAD_STORE (cfg); \
910-
MONO_EMIT_NEW_UNALU (cfg, OP_NOT_NULL, -1, sreg); \
910+
if (COMPILE_LLVM (cfg)) MONO_EMIT_NEW_UNALU (cfg, OP_NOT_NULL, -1, sreg); \
911911
} \
912912
} while (0)
913913

0 commit comments

Comments
 (0)