]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #74533 - nikic:issue-74425, r=eddyb
authorbors <bors@rust-lang.org>
Sat, 8 Aug 2020 13:33:53 +0000 (13:33 +0000)
committerbors <bors@rust-lang.org>
Sat, 8 Aug 2020 13:33:53 +0000 (13:33 +0000)
Emit == null instead of <= null for niche check

When the niche maximum is zero, emit a "== zero" check instead of a "<= zero" check. In particular, this avoids the awkward case of "<= null". While LLVM does canonicalize this to "== null", this apparently doesn't happen for constant expressions, leading to the issue in #74425. While that can be addressed on the LLVM side, it still seems prudent to emit sensible IR here, because this will allow null checks to be optimized earlier in the pipeline.

Fixes #74425.


Trivial merge