authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-26 19:53:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-26 19:53:36-07:00
logb0995cb9f9540a6d463dcc2722cb3b8918a61e8e
tree851e5f39cdfd916c395e405d29ddad056c29d5df
parentcc26cb9b2366723a8149e9f79e8252936cb69b73

stage2: correct logic for analyzeIsNull


1 files changed, 2 insertions(+), 1 deletions(-)

src-self-hosted/Module.zig+2-1
...@@ -2572,7 +2572,8 @@ pub fn analyzeIsNull(...@@ -2572,7 +2572,8 @@ pub fn analyzeIsNull(
2572) InnerError!*Inst {2572) InnerError!*Inst {
2573 if (operand.value()) |opt_val| {2573 if (operand.value()) |opt_val| {
2574 const is_null = opt_val.isNull();2574 const is_null = opt_val.isNull();
2575 return self.constBool(scope, src, invert_logic);2575 const bool_value = if (invert_logic) !is_null else is_null;
2576 return self.constBool(scope, src, bool_value);
2576 }2577 }
2577 const b = try self.requireRuntimeBlock(scope, src);2578 const b = try self.requireRuntimeBlock(scope, src);
2578 const inst_tag: Inst.Tag = if (invert_logic) .isnonnull else .isnull;2579 const inst_tag: Inst.Tag = if (invert_logic) .isnonnull else .isnull;