Skip to content

SimplifyCFG of empty WinEH cleanup pads doesn't handle lifetime.end correctly #43674

Open
@andykaylor

Description

@andykaylor
Bugzilla Link 44329
Version trunk
OS Windows NT
Attachments Reproducer for SSA problem
CC @efriedma-quic,@rnk

Extended Description

The SimplifyCFG utility doesn't correctly handle lifetime.end intrinsics when deleting empty WinEH cleanup pads. There are at least two issues.

  1. The lifetime.end intrinsic is simply deleted with the empty cleanup pad. This leaves a path through the control graph in which a pointer appears to be alive longer than it should.

  2. If the lifetime.end is the only user of a PHI node in the cleanup pad we will attempt to sink the PHI node into the cleanup pad's successor, which might not be dominated by the cleanup pad. If the PHI node had non-PHI users outside the cleanup pad this would be safe, but when the only user of the PHI node is a lifetime.end marker inside the cleanup pad it causes an SSA violation.

The attached IR file reproduces the second problem. The first problem can be seen in the existing (as of 12/17/2019) SimplifyCFG/empty-cleanuppad.ll test (in f9).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions