Page MenuHomePhabricator

[WebAssembly] Fix FastISel of condition in different block (PR51651)

Authored by nikic on Aug 27 2021, 1:26 PM.



If the icmp is in a different block, then the register for the icmp operand may not be initialized, as it nominally does not have cross-block uses. Add a check that the icmp is in the same block as the branch, which should be the common case.

This matches what X86 FastISel does:


Diff Detail

Event Timeline

nikic created this revision.Aug 27 2021, 1:26 PM
nikic requested review of this revision.Aug 27 2021, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2021, 1:26 PM
nikic added inline comments.Aug 27 2021, 1:27 PM

This code could principally have the same issue. However, it's also dead code, so I just dropped it entirely.

The reason it's dead is that V must have i1 type here (used either as a branch or select condition), while this checks that the type is i32.

tlively accepted this revision.Aug 27 2021, 2:02 PM

Looks good, thanks!

This revision is now accepted and ready to land.Aug 27 2021, 2:02 PM